This forum is now read-only. Please use our new forums! Go to forums
Just... all of three really.
I only even made it to 3.5 because someone else answered a question that I asked earlier. I really dislike Amjad Masad. He teaches in a much less understandable way than the others. Anyway, I can’t figure out what to do or even really what I am being asked to do. Also, in his own code that he has prepared for the user he uses this “if ( n === lost[i]),” but I have no idea what that means. Never used brackets in code before. He just introduces a lot of content without…. well, introducing it first. Am I just stupid? Can someone explain this lesson to me?
Answer 502343732ad04100020116c3
Regarding “introducing content…”, I think there used to be another course before this one that explained arrays and bracket notation, but they moved things around to try and give things a more gradual start (evidence is in hint for 3.5 - it’s a course dealing with arrays that isn’t available through the normal track).
Since this wasn’t really covered, I’m going to post the code for you. You should learn what you need to know in upcoming courses.
var lost = [4, 8, 15, 16, 23, 42];
var count = lost.length;
var isLost = function (n) {
for (i = 0; i < count; i++) {
if ( n === lost[i]) {
return true;
}
}
return false;
};
if ( isLost(12) ) {
console.log('12 is a lost number');
}
if ( isLost(16) ) {
console.log('16 is a lost number');
}
If you want an explanation for anything, just leave a comment. I’ll be reporting this course to Codecademy admin, so hopefully they’ll rework things a bit.
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
4 comments
How do you report courses to admins? That might be useful if I come across something like this in the future. The best I could do was dislike it. I really don’t understand this course much at all. Hopefully I won’t need to know it so much in future ones…
How do you make a code box like that? Anyway, in your for loop’s if statement, you say if ( n === lost[i]) But how does it know what n is? Or does that have something to do with the brackets? Maybe I should just wait for there to be a new lesson on this stuff.
I’m a forum moderator, so I have some special privileges when it comes to reporting issues. If there’s a glaring problem, you should send a descriptive email to [email protected]. Formatting instructions are available through the “show formatting instructions” link below the “add a question” and “add an answer” textboxes. Formatting does not work in comments. n is the parameter for the function (look at the top of the function definition and you’ll see “function(n)”). Its value is provided when you call the function (at the bottom of the code, it’s called twice. Once with 12, once with 16).
Oh ok. I feel slightly incompetent now. Oh well. Thanks a million.