These are chat archives for Colt/WDB-CodeTalk

31st
Aug 2016
Pluts
@plutspluts_twitter
Aug 31 2016 03:19
Hi! Im new to the boot camp. Nice to meet all of you!
I had a bit of a background in programming bt that was 8 yrs ago.
sammyj
@sjnichols89_twitter
Aug 31 2016 04:41
Hey errr body just signed up a few hours ago most of my exp is based in networking love technology but wanna go in a different direction
Hemanshu
@hemanshum
Aug 31 2016 05:16
Hello @plutspluts_twitter @sjnichols89_twitter I am also new to bootcamp, Join Yesterday
Sayan Samanta
@githubsayansamanta
Aug 31 2016 05:46
hello everyonevar logo = document.querySelector("#hplogo");
setInterval(function(){
logo.width+=5;
}, 100)
itried to animate google logo with chrome console but thats not working can any one help me my code below..
var logo = document.querySelector("#hplogo");
setInterval(function(){
logo.width+=5;
}, 100)
Pluts
@plutspluts_twitter
Aug 31 2016 13:11
@hemanshum Nice to meet you!
sammyj
@sjnichols89_twitter
Aug 31 2016 14:21
@hemanshum Hey glad your here you too @plutspluts_twitter I think we're going to have some fun through this process
Pluts
@plutspluts_twitter
Aug 31 2016 14:29
@hemanshum I also look forward to it. Cheers!
parthindia47
@parthindia47
Aug 31 2016 16:01
Hi frnds... completed HTML portion today
planning to complete CSS and javascript tommorow
so far it is good
Hemanshu
@hemanshum
Aug 31 2016 17:09
@parthindia47 Hello and Congrats!! Keep it up!!
Karan Kumar
@karan13kk
Aug 31 2016 19:18
hii guys need help on something
i have a competition on this weekend .... the theme is sexual harassment...anyidea on this.....
anyidea will be good so please anyone
Kelsey B
@kelseybcoding
Aug 31 2016 19:20
@karan13kk you are participating in a sexual harassment competition??? That makes no sense.
Karan Kumar
@karan13kk
Aug 31 2016 19:21
sry i meant against
i m really i wasnt clear enough >.<
@kelseybcoding
Krista Handel
@meloncatty
Aug 31 2016 19:31
hey gang, I'm having a small issue with the Todo list in lecture 116
I'm wondering why the text on the page never loads and all I get is the popup box right away
the prompt is the only thing that loads and I can't even open the console to check what's going on
Boomer
@boomer1204
Aug 31 2016 19:33
@meloncatty can you share your code please with something like jsbin or codepen??
Krista Handel
@meloncatty
Aug 31 2016 19:33
ahh nevermind, I just quit the app then restarted it
Boomer
@boomer1204
Aug 31 2016 19:33
heheh
Krista Handel
@meloncatty
Aug 31 2016 19:33
haha
Krista Handel
@meloncatty
Aug 31 2016 22:43
if it's taking me more than an hour to figure out a simple algorithm should i just look at the solution?
Boomer
@boomer1204
Aug 31 2016 22:43
ask for help
Krista Handel
@meloncatty
Aug 31 2016 22:43
i'm doing the simplist problem in the world :\
trying to print an array, descending
Boomer
@boomer1204
Aug 31 2016 22:43
ok
Krista Handel
@meloncatty
Aug 31 2016 22:44
and i'm trying to start by finding the last index of the array?
Neil Smith
@knifejuggler
Aug 31 2016 22:45
think about how many items are in the array vs their indexes
Krista Handel
@meloncatty
Aug 31 2016 22:45
is that a bad place to start
so the length of the array?
Boomer
@boomer1204
Aug 31 2016 22:46
how would find that out ^^
Neil Smith
@knifejuggler
Aug 31 2016 22:46
if an array starts at zero, and has 10 items, what would the last index be
Krista Handel
@meloncatty
Aug 31 2016 22:46
last index is 9?
or wait
10
Neil Smith
@knifejuggler
Aug 31 2016 22:47
and the length is 10, so...
Krista Handel
@meloncatty
Aug 31 2016 22:47
array.length
Neil Smith
@knifejuggler
Aug 31 2016 22:47
last index would be 9
Krista Handel
@meloncatty
Aug 31 2016 22:47
oh okay i read that wrong
i thought the array started at 0, not the index
so length is 10, index is 9
Neil Smith
@knifejuggler
Aug 31 2016 22:48
yup, so how would you loop backwards through an array?
Krista Handel
@meloncatty
Aug 31 2016 22:49
you would start at the end of it
Neil Smith
@knifejuggler
Aug 31 2016 22:49
what kind of loop would you use?
Krista Handel
@meloncatty
Aug 31 2016 22:49
for loop
Neil Smith
@knifejuggler
Aug 31 2016 22:50
and can you do that backwards?
Krista Handel
@meloncatty
Aug 31 2016 22:51
well... maybe not? because i'm having the hardest time figuring that out
Neil Smith
@knifejuggler
Aug 31 2016 22:51
how do you increment the index with a for loop?
Krista Handel
@meloncatty
Aug 31 2016 22:51
i++
but I know I can do i--
Neil Smith
@knifejuggler
Aug 31 2016 22:51
how do you start a for loop?
Krista Handel
@meloncatty
Aug 31 2016 22:52
i=0
Neil Smith
@knifejuggler
Aug 31 2016 22:52
and do you have to start with a zero?
Krista Handel
@meloncatty
Aug 31 2016 22:52
could I do something like this then
var last = array[array.length - 1];
for (i = last; ... ; i--){

}
Neil Smith
@knifejuggler
Aug 31 2016 22:53
you wouldn't use the brackets, just what's inside them
Krista Handel
@meloncatty
Aug 31 2016 22:53
???
what do you mean
Neil Smith
@knifejuggler
Aug 31 2016 22:53
var last = array.length-1;
Krista Handel
@meloncatty
Aug 31 2016 22:54
oh
Neil Smith
@knifejuggler
Aug 31 2016 22:54
otherwise you are assigning the last item in the array to 'last'
Krista Handel
@meloncatty
Aug 31 2016 22:54
the part I can't figure out now is what to do for the condition of the for loop
Neil Smith
@knifejuggler
Aug 31 2016 22:55
when do you want to stop looping?
at what index?
Krista Handel
@meloncatty
Aug 31 2016 22:55
array[0]
so while i > array[0]?
Neil Smith
@knifejuggler
Aug 31 2016 22:56
so, if you normally do i < array.length what would i need to be for it to stop?
Krista Handel
@meloncatty
Aug 31 2016 22:56
array[0]?
Neil Smith
@knifejuggler
Aug 31 2016 22:57
ignore the array bit, cos that's using the content of the array
Boomer
@boomer1204
Aug 31 2016 22:57
This message was deleted
@knifejuggler
Neil Smith
@knifejuggler
Aug 31 2016 22:59
when you are incrementing/decrementing the index (i), you don't use array[x], just the x
Krista Handel
@meloncatty
Aug 31 2016 22:59
hmmm, so while i > 0?
Neil Smith
@knifejuggler
Aug 31 2016 23:00
almost! that will stop before doing the 0th item in the array. You need to also do it when i IS 0
Krista Handel
@meloncatty
Aug 31 2016 23:00
i>=0
Neil Smith
@knifejuggler
Aug 31 2016 23:00
perfect
so your final code will be...?
Krista Handel
@meloncatty
Aug 31 2016 23:01
1 sec
i got it :D
Neil Smith
@knifejuggler
Aug 31 2016 23:02
:)
Krista Handel
@meloncatty
Aug 31 2016 23:02
function printReverse(array){
    var last = array.length-1;
    for(i = last; i >= 0; i--){
        console.log(array[i]);
    }
}
Neil Smith
@knifejuggler
Aug 31 2016 23:02
Great!
Krista Handel
@meloncatty
Aug 31 2016 23:02
thank you so much!
Neil Smith
@knifejuggler
Aug 31 2016 23:03
no problem at all :)
Boomer
@boomer1204
Aug 31 2016 23:18
@meloncatty awesome job!!
Now that's awesome and you did the right thing by doing it yourself but don't forget once you get proficient there are a bunch of built-in stuff with javascript as well
Krista Handel
@meloncatty
Aug 31 2016 23:24
thanks @boomer1204
what do you mean by that? is there some sort of built in function that does what I just did but in a simpler form?
Boomer
@boomer1204
Aug 31 2016 23:25
yep
Krista Handel
@meloncatty
Aug 31 2016 23:25
ahh, shoot
i did a bit of googling but didn't see anything for that
Boomer
@boomer1204
Aug 31 2016 23:25
there is .sort() and .reverse() that you can call on arrays. Again you went the right way because you still want/need to understand how/why it's doing cuz those built-in things wont always work exactly how you want everytime
Krista Handel
@meloncatty
Aug 31 2016 23:29
i see. i guess i'm used to drawing things out myself because i did some problems like this for FCC
only problem is those took me days to tackle -_-
i felt like i wasted a lot of time doing that though
Boomer
@boomer1204
Aug 31 2016 23:30
@meloncatty no you definitely want to go that route first