Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialpabloaguilera
4,196 PointsIs the var " NotInList" correct?
Hello
another student wrote this code(I asked this question to him in a comment, but never got an answer, I guess he hasn't seen it yet) ( challenge 3 from js objecst video):
I'm kinda confused with this variable " notInList". Did he mean to say " onTheList" instead?
I changed that variale to - "onTheList" and that makes more sense to me. For example:
on line 54, if I type the name "Andrew", that is obviously not on the list,(The list of students that he made).
so (!onTheList) = not on the list. I might be wrong, a clarification is greatly appreciated.
thanks.
pabloaguilera
4,196 PointsJosh Olson
I think the code is not running because that's just part of the code. The whole thing is in this link:
https://teamtreehouse.com/community/finally-got-extra-credit-code-done-here-it-is
They are 2 javascript files. students.js and student_report.js.
take care
1 Answer
mkmk
15,897 PointsIt appears your intuition is correct, the name notInList is misleading the way it is used.
Made clear in the last bit of code where it prints the message that the search term is not in the list if ! notIntList is true -- which would be not-notInList or INLIST! And also when the variable is assigned to true, when the name is found in the first if block of the for statement.
Good catch.
pabloaguilera
4,196 PointsThanks mkmk, that's what I thought.
jobbol
Full Stack JavaScript Techdegree Student 17,885 Pointsjobbol
Full Stack JavaScript Techdegree Student 17,885 PointsI can't run this code. Can you send the text itself instead of an image of it?
See this link for help on formatting. https://teamtreehouse.com/community/posting-code-to-the-forum