Why are we using both “words” and “word” in step 1 with the `words.some()` method call?


#1

Question

Why are we using both “words” and “word” in step 1 with the words.some() method call?

Answer

In Step 1, “words” refers to the words array we have on line 1. “word” is what the name of the parameter is in that function. The parameter represents the current word we are looping through. You can name your parameter anything, as long as you keep it consistent throughout your function. For instance, instead of “word” we could name our parameter “vocabulary” or “chicken.” It’s good to be descriptive with parameters names, though, so that you or anybody else can understand the code later on.