Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let tool = ''; //since is empty string, it will take the default value of 'pen' as tool is falsy.
- // Use short circuit evaluation to assign writingUtensil variable below:
- let writingUtensil = tool || 'pen';
- console.log(`The ${writingUtensil} is mightier than the sword.`);
- /*
- The variable writingUtensil will be assigned the actual value of tool if is truthy,
- while it will be assigned the value of 'pen' if tool is falsy.
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement