Record Collection lesson

Thanks for clarfying.
I think the word “variable” confusing me.
I know to declare variables either let/const
but ID is a parameter we talked about it in this post i’ll try to see if there is an answer here.

Unless the explanation that id stands for something that is a property which is another variable… definitely confusing.

my other question is after I have finished my else ifs, don’t I need to wrap the return around else? I tried it and it fails.

else {
 return records;
}

From the instructions. I know there is a lot, but if you aren’t fully reading the instructions, that would explain why you are struggling so much.

No, I am reading the instructions, I can even see I wrote the correct code the reason it failed is because of value!==0

“Have you tried console logging what each argument is?”
I thought you got value is an empty string from console.log so that is why it made me really confused.

Anyway thank you for your help, I appreciate you taking your time answering my questions.

Also I see “your function must always return”
I assume that is why else on return fails to complete the exercise.

Parameter is a variable name defined by you (function writer) to contain any value given by User for the function to run. The value given by User is called argument.

With return. Most of the time you’ll have to return, because IRL we’re running a function to get the value it returned to be used somewhere else, e.g.:

let x = thisFunction()
we are expecting x to have a value whatever returned from invoking the function.

If you’re running a loop (e.g. to find every vowel in a string), you want the return at the end of the function (most of the time, because once it hits return, the function will stop and not run any line after the return). But if you want the function to stop right away after a (if else) condition is met, “That’s it! I’m done!” (e.g. find the first vowel in a string), you want to return in each if else statement, and sometimes we have to do both (when a function has a loop with if else statement). You’ll get this later on.

Anyway, great! You got this.

1 Like