You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jenny has written a function that returns a greeting for a user. However, she's in love with Johnny, and would like to greet him slightly different. She added a special case to her function, but she made a mistake.
Can you help her?
*/
// First Attempt - Feb 2019
function greet(name){
if(name == "Johnny") return "Hello, my love!";
else
return "Hello, " + name + "!";
}
// Second Attempt - Feb 2020
function greet(name){
return name === 'Johnny' ? 'Hello, my love!' : `Hello, ${name}!`