Basic JavaScript - Profile Lookup

I don’t understand how this code works. Am I following the lesson wrong? To be honest, I’ll watch the video instead of attempting the code, so maybe I should start doing that first. I’ll probably go through the lessons a second time to see if I get it.

But that aside, I don’t understand this first part of the answer:

for (var i = 0; i < contacts.length; i++)

I get the next couple of lines of code, but I really don’t understand how this first line works and it’s kind of frustrating.

Watching someone else solve the problem doesn’t really help you learn how to solve problems in code, unfortunately.

It looks like you are looking at a bad solution - its using var which is outdated.

Lets back up and understand the problem first.

Back to the lesson “For Loop”.

Search the lesson " Iterate with JavaScript For Loops" in JavaScript lesson.
If you understand that class, you should understand the line you mentioned.

Hope to hearing good news from you.

Yeah, I think you are right. I think I’ve been kind of screwing myself. I just going to do the course over again and really think on what each piece of code means until I get it myself.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.