function guestChallenge() {
// code goes here
var num = 0;
for (var i = 1; i< 1001; i++) {
if (i.toSring(10).match(/7/));
else num+=i;
}
return num;
}
Edit: I really should have added more context! The challenge was:Using the JavaScript language, have the function guestChallenge() add up all of the numbers from 1 to 1000. But everytime a number that contains a 7 is reached, don't add that number to the others (ie. exclude 7, 17, 370, etc). Do not put any code outside of the function and use the return keyword to return your answer from within the function.
And my program didn't generate any output at all, which leads me to believe I made a syntax error as opposed to just a logic error.
Edit again: Yes. I just had to fix my typing error ("toSring"), and then it passed. Thanks, guys!