icon picker
FullStack JavaScript Code Challenges

4/27/22 Write an ‘if’ statement

Create a conditional statement that tests if the isAdmin variable is true. If it’s true, set the value of the message variable to “Welcome Admin”.
const isAdmin = true;const isStudent = false;let message;
if ( isAdmin ) { message = "Welcome admin";}

4/27/22 Add an ‘else if’ clause

const isAdmin = false;const isStudent = true;let message;
if ( isAdmin ) { message = 'Welcome admin';} else if ( isStudent ) { message = 'Welcome student';}

4/27/22 Add a Final ‘else’ clause

const isAdmin = false;const isStudent = false;let message;
if ( isAdmin ) { message = 'Welcome admin';} else if ( isStudent ) { message = 'Welcome student';} else { message = 'Access denied';}

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.