So I'm trying to get through this "javascript for absolute beginners book."
One of the first programs is to determine if a ice cream is in a top 10 list... An array.
So the code is
A few questions.
Can a variable have a value and a function or it it merely a function?
In the for loop, why does it end with "I--" instead of I++?
And finally, during the if loop, does the rankflavor equate to a number or a text based comparison. I'm confused as to how rankflavor compares to flavor.
Any help would be greatly appreciated.
One of the first programs is to determine if a ice cream is in a top 10 list... An array.
So the code is
Code:
Var rankflavor=function(flavor) {
For var i= rankflavor.len; i--;) {
If (rankflavor[i]===flavor) {
Return flavor + "is number " + (I +1) + ".";
}
}
Return flavor + "is not among my top 10."}
A few questions.
Can a variable have a value and a function or it it merely a function?
In the for loop, why does it end with "I--" instead of I++?
And finally, during the if loop, does the rankflavor equate to a number or a text based comparison. I'm confused as to how rankflavor compares to flavor.
Any help would be greatly appreciated.
Last edited by a moderator: