Hello,
I just took the javascript conditionals quiz and one answer has me confused. Can someone please explain how none of the answers are correct? I realize my mistake in my selection, but I think the last selection is correct. Also, how am I supposed to select the correct answer if none of the answers are correct?
I do not have a screen shot, but I copied the text.
type or paste code here
How would you properly refactor this code block using the ternary operator?
if (walkSignal === 'Walk') {
console.log('You may walk!');
} else {
console.log('Do not walk!');
}
Incorrect:
walkSignal === 'Walk' : console.log('You may walk!') : console.log('Do not walk!');
Incorrect:
walkSignal === 'Walk' ? ('You may walk!') : ('Do not walk!');
(Selected)Incorrect:
walkSignal ? console.log('You may walk!') : console.log('Do not walk!');
Incorrect:
walkSignal === 'Walk' ? console.log('You may walk!') : console.log('Do not walk!');
Any help would be appreciated!
Mel