It may be worth your time to press the “reset” button on the top row of the keyboard to get back to the starer code.
There are a few things in the code you posted that you would want to change:
var positive = pickRandom(positive)
- This is creating a new variable called
positive and assign it a value of
pickRandom(positive). This won’t work because
pickRandom() only works if you give it an array or a number, and
positive is not either of those. In fact,
positive doesn’t have any value yet.
After that line, your code will not finish because it can’t get past
pickRandom(positive). You won’t have to use an identifier all on its own, like
answer; You won’t see any change in your code if you include this or not, so it’s not worth having in there at all.
var answer = pickRandom(answer)
- This has the same problem that the
positive declaration had. You’re creating a variable using the variable. This is like trying to define a word using the same word – “An elephant is an animal that is an elephant”, "The variable
answer stores a random item from
answer", but what exactly is
['yes', 'no', 'outlook positive']
- This array is alright except it isn’t being stored in a variable or used in a function, so it won’t affect the output of your code. This array should be placed inside of a
pickRandom() call and the result should be assigned to a variable. The starter code already includes this format.
If you reset your code, you’ll only need to add a 3rd string to the starting array, which you’ve already been able to do.