These are chat archives for FreeCodeCamp/Help

5th
Jan 2015
Ian Yeager
@iyeager2004
Jan 05 2015 05:41
function LongestWord(sen) { 
  var wordArray = sen.split(" ");
  var longestWord = "";

  wordArray.forEach(word) {
    if(word.length > longestWord.length) {
      longestWord = word;
    }
  }

  return word; 

}
Any idea why this doesn't work? Keep getting an extra } error. Can't find it.
Ryan Malm
@Rybar
Jan 05 2015 05:45
forEach isn't structured correctly. need to make an function expression for your callback.
Ian Yeager
@iyeager2004
Jan 05 2015 05:48
function LongestWord(sen) { 
  var wordArray = sen.split(" ");
  var longestWord = "";

  wordArray.forEach(function (word) {
    if(word.length > longestWord.length) {
      longestWord = word;
    }
  });

  return word; 

}
Changed to this. Now it says word is undefined. Guess I can't figure out how to iterate over an array from the documentation for forEach.
Ryan Malm
@Rybar
Jan 05 2015 05:53
not sure forEach is the best solution for this; I think you just want to sort and then return the first or last value, depending on your sort function
This message was deleted
This message was deleted
Ian Yeager
@iyeager2004
Jan 05 2015 05:54
Need to revamp anyway, looks like it failed test cases that used symbols and not letters. Splitting on the space is wrong, need to regex the word I guess.
Ryan Malm
@Rybar
Jan 05 2015 05:56
ah i see.. yeah, I just moved on. same incorrect test case
Ian Yeager
@iyeager2004
Jan 05 2015 05:57
function LongestWord(sen) { 
  var wordArray = sen.split(" ");
  wordArray.sort;

  return wordArray[0]; 

}
But yeah, that's much nicer.
Will split work on a regex expression?
Ryan Malm
@Rybar
Jan 05 2015 05:58
you'll have to check regex's methods; I think there's a way to get an array of matches back
.sort without a callback won't work I dont think; you need to sort the array by length
I'd still split by space, and then regex out anything non-letter in the sort callback.
```
function LongestWord(sen) { 
  var words = sen.split(" ").sort(function(a,b){
    return b.replace(/[^a-z]/gi,"").length - a.replace(/[^a-z]/gi,"").length;
  });
  return words.shift();
}
Ian Yeager
@iyeager2004
Jan 05 2015 06:10
What are the a and b var's in sort?
Ryan Malm
@Rybar
Jan 05 2015 06:19
sibling elements in the array. you could just as easily name then wordA and wordB, as long as the sort callback gets two arguments.
Cinnamon
@CinnamonB
Jan 05 2015 14:03

I need help, trying to understand what I'm either missing or inputting wrong

function add(firstName,lastName,email,phoneNumber) {
    contacts[contacts.length] = {
        firstName: firstName,
        lastName: lastName,
        email: email,
        phoneNumber: phoneNumber

        add(firstName,lastName,email,phoneNumber);
    };
}

The error I keep getting was something with syntax, not sure

Nathan
@terakilobyte
Jan 05 2015 14:04
your call to add is within the contacts object for starters
Dominic Jones
@towwiow
Jan 05 2015 14:05
yeah, a curly bracket is missing it looks like.
Nathan
@terakilobyte
Jan 05 2015 14:05
if that were to succeed you’d enter an infinite recursive function and quickly crash your browser or node
Charles Watson
@sircharleswatson
Jan 05 2015 14:05
^
Cinnamon
@CinnamonB
Jan 05 2015 14:06
Ok, it's placed outside of the contacts object, but still an error
Nathan
@terakilobyte
Jan 05 2015 14:07
what’s the error and new code?
:)
Charles Watson
@sircharleswatson
Jan 05 2015 14:07
the contacts[contacts.length] is an error
contacts.length is read-only
Justin Rogers
@yaskyj
Jan 05 2015 14:08
Are you creating this function for the Contacts object?
Cinnamon
@CinnamonB
Jan 05 2015 14:13
Yes
Adding it to the Contacts Array
Just seems bit confusing
Charles Watson
@sircharleswatson
Jan 05 2015 14:13
@CinnamonB Read what I said above
Cinnamon
@CinnamonB
Jan 05 2015 14:14
Ok, so would it be best if I remove that entirely?
And create an object to place the contact info within?
Justin Rogers
@yaskyj
Jan 05 2015 14:16
function add(firstName, lastName, email, phoneNumber) {
    contacts[contacts.length] = {
        firstName: firstName,
        lastName: lastName,
        phoneNumber: phoneNumber,
        email: email
    }; 
}
Charles Watson
@sircharleswatson
Jan 05 2015 14:16
you could do
contacts.push({
        firstName: firstName,
        lastName: lastName,
        email: email,
        phoneNumber: phoneNumber
})
Adam Hollett
@admhlt
Jan 05 2015 14:17
Yeah, I think .push is what's needed here.
Cinnamon
@CinnamonB
Jan 05 2015 14:17
.push is new
Charles Watson
@sircharleswatson
Jan 05 2015 14:17
push is a way to add something to an array
Adam Hollett
@admhlt
Jan 05 2015 14:18
.push adds the pushed data to the end of an array.
In a new position -- it doesn't overwrite anything.
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:18
although if codecademy hasn’t introduced that to you, it might not work as a solution
Cinnamon
@CinnamonB
Jan 05 2015 14:19
^ it definitely doesn't
Charles Watson
@sircharleswatson
Jan 05 2015 14:19
@CinnamonB can you post a link to the section you're on?
Justin Rogers
@yaskyj
Jan 05 2015 14:20
@CinnamonB After you take out the call to the add function inside of it, it works properly?
Charles Watson
@sircharleswatson
Jan 05 2015 14:22
@CinnamonB I see. so you are supposed to use contacts[contacts.length]
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:22
I think the call to your add function should be A) outside of the add function itself, as stated earlier but also B) should be propagated with sample data and not the parameter names themselves
try throwing some fake info in to call it
Charles Watson
@sircharleswatson
Jan 05 2015 14:23
^
that too lol
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:24
add(“Cinnamon”, “B”, “abc@email.com”, “(555)555-5555”);
list();
Cinnamon
@CinnamonB
Jan 05 2015 14:25
OMG
That worked.
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:25
woohoo
Cinnamon
@CinnamonB
Jan 05 2015 14:25
Thanks guys
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:25
np
Cinnamon
@CinnamonB
Jan 05 2015 14:26
Codecademy has its moments where it leaves you frustrated figuring the code out for hours.
Charles Watson
@sircharleswatson
Jan 05 2015 14:26
Ya. there are better ways to learn JS for sure
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:27
it’s a good intro, I had fun with their JS track
but I could see how it would be frustrating for someone who knows an alternative way to solve a problem, and it wont accept that answer
Jimmy Bryant II
@JimBry
Jan 05 2015 14:27
Codecademy is good for getting started though even if its frustrating
I'm 100% new to JS so it takes me awhile to get the hang of things, as I would assume for any other beginner
towwiow @towwiow hasn't gotten to the codecademy challenges yet.
Cinnamon
@CinnamonB
Jan 05 2015 14:31
It is. I was frustrated with that last night that I didn't touch it again until this morning. Now a mental break is needed lmaoo
You're in for it @towwiow
towwiow @towwiow runs back to html and css.
Dominic Jones
@towwiow
Jan 05 2015 14:31
lol
Jimmy Bryant II
@JimBry
Jan 05 2015 14:32
haha yeah @towwiow good luck :smile:
Cinnamon
@CinnamonB
Jan 05 2015 14:32
:laughing:
Dominic Jones
@towwiow
Jan 05 2015 14:32
thanks.
Just feel like the most difficult part is understanding the logic the computer is talking
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:32
nah man you’re going to have a lot of fun with JS
Dominic Jones
@towwiow
Jan 05 2015 14:32
just understanding the language makes talking to it so much easier, but takes time
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:33
it’s very powerful, and they ease you into it
Dominic Jones
@towwiow
Jan 05 2015 14:33
@figitalboy - JQuery helps you build your DOT COMMMM lol
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:33
hahaha you didnt
Dominic Jones
@towwiow
Jan 05 2015 14:33
lmaooo since you said something, it actually stuck.
Cinnamon
@CinnamonB
Jan 05 2015 14:33
JS is a thrill for sure, when you get to code it they way you want, vs having to do it exactly a certain way (Codecademy)
Jimmy Bryant II
@JimBry
Jan 05 2015 14:33
I plan on doing Elequent JS & You Don't Know JS after I'm finished with the codecademy JS track
Dominic Jones
@towwiow
Jan 05 2015 14:33
I was good until you sabotaged me.
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:34
I’ve heard nothing but good things about eloquent. I plan on working through that myself at some point
@towwiow Dude i’m so sorry
Dominic Jones
@towwiow
Jan 05 2015 14:34
@figitalboy all good :)
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:34
I actually like that song. I’m long done with the try jQuery track, but sometimes i’ll search that song out on youtube just for a laugh
Jimmy Bryant II
@JimBry
Jan 05 2015 14:34
Patience is key I'm taking my time
Dominic Jones
@towwiow
Jan 05 2015 14:34
lol yeah.
I'm writing my blog post right now. I'm declaring war on my lack of focus.
my singular declaration for the year.
towwiow @towwiow tosses out the idea of new years resolutions.
Dominic Jones
@towwiow
Jan 05 2015 14:37
@JimBry thanks bro
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:37
“lack of focus” … links to fast co
see you in a few hours!
lol
Jimmy Bryant II
@JimBry
Jan 05 2015 14:38
ahahaha
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:38
they have some great articles though
I actually prefer their youtube videos on minimalism
Jimmy Bryant II
@JimBry
Jan 05 2015 14:42
I'll check that out zen and minimalism is right up my alley haha I'm 81% done with Codecademy JS track woo! :smile:
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:43
awesome! did you build your cash register or not yet?
Jimmy Bryant II
@JimBry
Jan 05 2015 14:44
I just started on that after this I'll be complete
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 14:48
I had a lot of fun with that one
gl!
Serhii Borovskyi
@serhiicss
Jan 05 2015 14:52
Hello. Does anyone know SASS pretty good?
Ben Stoltz
@benstoltz
Jan 05 2015 14:52
So so @serhiicss, what’s up?
Serhii Borovskyi
@serhiicss
Jan 05 2015 14:54
I am trying to import a partial sass file into main sass file, but it gets overridden by css rules of the main file
Dominic Jones
@towwiow
Jan 05 2015 14:54
back - had to do work at work .. pft
Serhii Borovskyi
@serhiicss
Jan 05 2015 14:55
i hope that makes sense
Ben Stoltz
@benstoltz
Jan 05 2015 14:55
It does
Dominic Jones
@towwiow
Jan 05 2015 14:55
@JimBry & @figitalboy - I use a readability extension to cut out all the flack and just focus on the reading. Something I learned while going through my Super Learner course.
Serhii Borovskyi
@serhiicss
Jan 05 2015 14:55
basically I want to create a partial sass for media queries
lets say a for a smartphone screens
Ben Stoltz
@benstoltz
Jan 05 2015 14:55
Right you have your media queries abstracted out into another stylesheet
What are you using for compiling sass to css?
Serhii Borovskyi
@serhiicss
Jan 05 2015 14:56
compass
Ben Stoltz
@benstoltz
Jan 05 2015 14:56
and you’re compiling and then the styles in the immport are overwritten??
import*
Serhii Borovskyi
@serhiicss
Jan 05 2015 14:57
yes, but only if the styles are defined in main sass file
if footer for example set to color red in main sass
it wont chnage if it is set to green in import sass
Ben Stoltz
@benstoltz
Jan 05 2015 14:58
you have your import file beginning with _?
Serhii Borovskyi
@serhiicss
Jan 05 2015 14:58
yes
So If I understand correctly, the main sass file imports a partial sass, but then further down overrides it
How to avoid that?
Jimmy Bryant II
@JimBry
Jan 05 2015 15:01
@towwiow that's cool I've never heard of that extension before now
Ben Stoltz
@benstoltz
Jan 05 2015 15:01
/ponders
When it’s being compiled where are the imported styles going in the stylesheet?
Dominic Jones
@towwiow
Jan 05 2015 15:06
@JimBry - yeah, it's called Readability - goto an article, click the red couch and say either read now or read later. it cleans it up and takes you to the new page where you just get the text links and photos within the article
Serhii Borovskyi
@serhiicss
Jan 05 2015 15:06
@benstoltz top of the stylesheet
Ben Stoltz
@benstoltz
Jan 05 2015 15:09
Have you tried moving the @import statement down the stylesheet? (I don’t think it will work but it’s worth a shot if you haven’t tried)
Another option
You could just move all your styles out into import files and just control the order they are coming in….
Serhii Borovskyi
@serhiicss
Jan 05 2015 15:12
2nd option is probably what I was thinking about
@benstoltz Thank you!
Ben Stoltz
@benstoltz
Jan 05 2015 15:13
@serhiicss No problem :)
Maxim Orlov
@Maximization
Jan 05 2015 17:01
anyone has an idea why this doesn't work?
function reverseArrayInPlace(arr) {
  for (var i = 0; i < arr.length; i++) {
    arr.unshift(arr.pop()); 
  }
  return arr;
}
oh silly me..
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 17:02
missing a )
Maxim Orlov
@Maximization
Jan 05 2015 17:04
nah, this just rotates the string to the starting point again
Charles Watson
@sircharleswatson
Jan 05 2015 17:04
I dont see a missing )
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 17:05
LOL
soooo, window wasn’t wide enough and cut off some of the code
and apparently the markup code stuff isn’t responsive
Charles Watson
@sircharleswatson
Jan 05 2015 17:06
lol :P
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 17:07
I thought it was just really messy code as far as line breaks
Ben Stoltz
@benstoltz
Jan 05 2015 17:08
@Maximization So Unshift adds the last element to the beginning of the array.
So what you’re doing is first moving the last item to the front, then the second to last to the front, and so on.
Meaning you’ll end up with the same array as you had before.
If my understanding of it is accurate
Maxim Orlov
@Maximization
Jan 05 2015 17:10
yes that's exactly what happens
Charles Watson
@sircharleswatson
Jan 05 2015 17:10
The unshift() method adds one or more elements to the beginning of an array and returns the new length of the array.
Maxim Orlov
@Maximization
Jan 05 2015 17:10
need to find a different strategy to reverse an array in place
seahik
@seahik
Jan 05 2015 17:11
when they say in place, that means not creating a new array, correct?
Ben Stoltz
@benstoltz
Jan 05 2015 17:11
Correct
Maxim Orlov
@Maximization
Jan 05 2015 17:11
yes
Ben Stoltz
@benstoltz
Jan 05 2015 17:11
You’re modding
seahik
@seahik
Jan 05 2015 17:12
is using a temp variable considered still in place?
Ben Stoltz
@benstoltz
Jan 05 2015 17:12
@seahik If you want to see what it is doing, add a console.log(arr) after the unshift line and then call the function with an array passed in
Charles Watson
@sircharleswatson
Jan 05 2015 17:12
@Maximization you could do array.reverse() :P
Maxim Orlov
@Maximization
Jan 05 2015 17:14
it's an excersise in Eloquent JS, not allowed to use it
but I've found this solution
function reverseArrayInPlace(arr) {
  var copy = arr.slice();
  for (var i = 0; i < arr.length; i++) {
    arr[i] = copy[(copy.length - 1) - i];
  }
  return arr;
}
seahik
@seahik
Jan 05 2015 17:15
@benstoltz ive got that hated site w3 open testing shift..heh
Charles Watson
@sircharleswatson
Jan 05 2015 17:15
@seahik You should use the MDN instead of w3schools
Ben Stoltz
@benstoltz
Jan 05 2015 17:15
Oh I dislike w3schools...
+1 for MDN
seahik
@seahik
Jan 05 2015 17:16
i know i know....but its so simple and i like the testing page
you can test in the javascript console
on any webpage
seahik
@seahik
Jan 05 2015 17:17
@Maximization do you understand that solution? i'm a bit fuzzy on it
@sircharleswatson ok thanks, I do bring up MDN most of the time as well...I'm learning to not speak of W3...lol
Maxim Orlov
@Maximization
Jan 05 2015 17:19
@seahik this solution works but it's kind of cheating since I'm copying the array and then use a loop to set the first value equal to the last value from the copied array and so on
Charles Watson
@sircharleswatson
Jan 05 2015 17:19
haha. good ;) you will get shamed in pretty much any developer community for saying those cursed words :P Just trying to save you :) haha
Ben Stoltz
@benstoltz
Jan 05 2015 17:19
@Maximization Are you wanting to produce a new array that’s a reverse of the original or just reverse the original?
Maxim Orlov
@Maximization
Jan 05 2015 17:19
I'm working on a better solution
Maxim Orlov
@Maximization
Jan 05 2015 17:20
in place, so reverse the original @benstoltz
it's an exercise so I don't want to get straight to answer yet :P, but I've almost got it!
Ben Stoltz
@benstoltz
Jan 05 2015 17:21
hehehe, fair enough. Anyway array.reverse(); is apparently very innefficient
Maxim Orlov
@Maximization
Jan 05 2015 17:22
There it is!
function reverseArrayInPlace(arr) {
  for (var i = 0; i < arr.length / 2; i++) {
    var temp = arr[i];
    arr[i] = arr[(arr.length - 1) - i];
    arr[(arr.length - 1) - i] = temp;
  }
  return arr;
}
seahik
@seahik
Jan 05 2015 17:22
its interesting to read discussion on efficiency on stack overflow
Charles Watson
@sircharleswatson
Jan 05 2015 17:23
@seahik by "very inneficeint" they are talking milliseconds. so I wouldn't worry too much about using it.
Ben Stoltz
@benstoltz
Jan 05 2015 17:23
@sircharleswatson It depends. If you’re working with huge arrays it will add up.
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 17:24
^
seahik
@seahik
Jan 05 2015 17:24
@sircharleswatson sometimes i notice further discussions efficiencies change over the years
like something that used to be inefficient has gotten better
Charles Watson
@sircharleswatson
Jan 05 2015 17:24
@benstoltz 90% of people aren't working with arrays big enough to cause them troubles with the efficiency of reverse.
Ben Stoltz
@benstoltz
Jan 05 2015 17:25
That’s true @sircharleswatson.
seahik
@seahik
Jan 05 2015 17:25
is it easy to test code?
im assuming there are tools
would be interesting to see
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 17:25
you dont want to develop bad habits that let you be part of the % that do have troubles should you need to work with large datasets
Charles Watson
@sircharleswatson
Jan 05 2015 17:27
I would argue that if you're working with datasets that big, you will already know a better way to do it than using reverse()
:P
seahik
@seahik
Jan 05 2015 17:28
@Maximization how far are you into Eloquent JS?
Ben Stoltz
@benstoltz
Jan 05 2015 17:28
Another resource to take a gander at…..if you really want to improve the readability of your code…..is: http://underscorejs.org
seahik
@seahik
Jan 05 2015 17:29
I'm in middle of ch 4
all about the weresquirrel :P
Maxim Orlov
@Maximization
Jan 05 2015 17:30
@seahik 5h chapter now
haha weresquirrel, what a story
Ben Stoltz
@benstoltz
Jan 05 2015 17:31
I read through the old version of Eloquent JS, I really should look at the new version
seahik
@seahik
Jan 05 2015 17:32
did you like it the first time?
Ben Stoltz
@benstoltz
Jan 05 2015 17:32
It was great.
Maxim Orlov
@Maximization
Jan 05 2015 17:32
I like it when programming problems have stories attached to them, it makes you feel more connected to the solution you're coding, like we talked about codeabbey, it does that very good
Ben Stoltz
@benstoltz
Jan 05 2015 17:32
But I also love Professional Javascript for Web developers which apparently many people here dislike. :P
seahik
@seahik
Jan 05 2015 17:33
huh interesting i hadnt heard it was disliked
Charles Watson
@sircharleswatson
Jan 05 2015 17:33
@benstoltz I read about half of PJSfWD but it was pretty dry. Good. but dry. never finished it
His HTML/CSS book is quite good as well
seahik
@seahik
Jan 05 2015 17:35
@Maximization yes codeabbey was perfect for me...little bitesized interesting info about the problem
i need to see what books my library has
thanks a lot for the recommendations
Ben Stoltz
@benstoltz
Jan 05 2015 17:36
NP
Ben Stoltz
@benstoltz
Jan 05 2015 17:44
Another nifty site with awesome videos is: https://frontendmasters.com/courses/
seahik
@seahik
Jan 05 2015 17:44
its looks like it's fee based?
Ben Stoltz
@benstoltz
Jan 05 2015 17:45
Yes, and it’s a bit more advanced then the others.
seahik
@seahik
Jan 05 2015 17:46
its kind of strange to advertise as front-end masters, but the website doesnt look that great (at least on my browser?)
Maxim Orlov
@Maximization
Jan 05 2015 17:46
the rest of the site looks fine, just the courses part looks awful
Ben Stoltz
@benstoltz
Jan 05 2015 17:47
The content they supply > the appearance.
appearance is important, but /shrugs
seahik
@seahik
Jan 05 2015 17:47
ah ok, cool...will definitely consider it
actually there is something to be said for minimilism
Ben Stoltz
@benstoltz
Jan 05 2015 17:48
anyway I’m off for lunch, peace
seahik
@seahik
Jan 05 2015 17:48
like i think people would protest if reddit changed
ok see ya!
Michael D. Johnson
@CodeNonprofit
Jan 05 2015 17:49
remember digg? redesign killed the website
that’s how I found reddit to begin with, like 5ish years ago? maybe 6
seahik
@seahik
Jan 05 2015 17:49
ah interesting...(ive heard of digg but not really familiar with it)
yeah and when you think about Google....wasn't Google's simpe search page that contributed to its popularity way back. Simple is nice.
Darryl Dixon - Piece Digital
@piecedigital
Jan 05 2015 17:51
Kind of funny how they it's called front end masters but somebody forgot the CSS, apparently.
seahik
@seahik
Jan 05 2015 17:51
yeah lol its a touch ironic
Deam
@deamme
Jan 05 2015 20:12
Someone that can help me with meteor HTTP package..
?
How do I only get the data?
I got it. Just like this: result.data
Cool
Love meteor btw ^_^
Charles Watson
@sircharleswatson
Jan 05 2015 20:18
@deamme What got you into meteor?
Deam
@deamme
Jan 05 2015 20:31
@sircharleswatson Yes. Just trying experimenting :smile:
Charles Watson
@sircharleswatson
Jan 05 2015 20:32
@deamme Awesome. I too love meteor. :)
Deam
@deamme
Jan 05 2015 20:32
@sircharleswatson Oh.. Actually one of my family members talked about it, and then I thought why not go through it more deeply because I've seen it mentioned a lot.
Read your message wrong from before haha
Charles Watson
@sircharleswatson
Jan 05 2015 20:34
Awesome. Meteor is great. i've been very distracted by it for the past month :P
seahik
@seahik
Jan 05 2015 20:50
can anyone by chance see a mistake in this code....it's such a simple exercise, but it's not working.
function range(start, end) {
  var myArr = [];

  for (var i=start; i<=end; i++) {
    myArr.push(i);
    };
  return myArr;
}

function sum(myArr) {
  var sum = 0;
  for (var i=0; i <  myArr.length; i++) {
    sum += myArr[i];
  }; 
  return sum;
}

document.write(range(1,10));
document.write(sum(range(1,10)));
Charles Watson
@sircharleswatson
Jan 05 2015 20:52
@seahik What is the error you are getting
seahik
@seahik
Jan 05 2015 20:53
hey...im on codepen. no error message. the range function works but not the sum
Charles Watson
@sircharleswatson
Jan 05 2015 20:53
@seahik on your range function you need to put **var** i = start
seahik
@seahik
Jan 05 2015 20:54
hmm i fixed that but still only range function works
Charles Watson
@sircharleswatson
Jan 05 2015 20:54
ok, one sec
seahik
@seahik
Jan 05 2015 20:55
oh wait nvm mind...its working now!
Charles Watson
@sircharleswatson
Jan 05 2015 20:56
i was just about to say
lol
your code worked in the console :P
seahik
@seahik
Jan 05 2015 20:56
thanks! it's strange sometimes you can get away with not putting var in the for loop for declaring i
Charles Watson
@sircharleswatson
Jan 05 2015 20:57
you should always use it. :) just keep that in the back of your head
seahik
@seahik
Jan 05 2015 20:57
is it because I was trying to use "i" in 2 different functions, i wonder
Charles Watson
@sircharleswatson
Jan 05 2015 20:57
you'll know when you don't need it
seahik
@seahik
Jan 05 2015 20:58
ok thanks again! i new it was something silly. i hate when something doesn't work and then you start doubting the wrong elements of the code
Charles Watson
@sircharleswatson
Jan 05 2015 20:59
ya. it sucks when you have a spelling error that you dont notice for hours. then you realize it and kick yourself :P
seahik
@seahik
Jan 05 2015 21:00
after tearing apart and rebuilding everything else :S