+ 1

Struggling on JavaScript Control Flow Problem (Updated)

Instructions: Uncomment the if statement and modify the condition in line 4 so the code outputs 'Four score and seven years ago!' if name is set to 'Abraham Lincoln'. ________ 1. 2. var name; 3. var message = 'Hi, ' + name; 4. //if ( ) { 5. // message = 'Four score and seven years ago!'; 6. //} 7. console.log(message); 8. *Requirements: - name should be set to Abraham Lincoln. - message should be Four score and seven years ago! - Please do not modify line 3. - Make sure to uncomment the if statement.

9th Jun 2018, 5:15 AM
Ghost
Ghost - avatar
3 odpowiedzi
+ 3
maybe something like if(name = "Abraham Lincoln") that should execute the if block and assign the string abraham lincoln to name or if that doesn‘t work try if(name = "Abraham Lincoln" || true) or if(name="Abraham Lincoln",true) utilizing the comma operator
9th Jun 2018, 7:38 AM
Max
Max - avatar
0
if (name === "Abraham Lincoln")
9th Jun 2018, 5:50 AM
CHMD
CHMD - avatar
0
I've tried plugging in the codes above but still can't get passed this exercise for multiple hours.
9th Jun 2018, 7:04 AM
Ghost
Ghost - avatar