Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const logVisibleLightWaves = () => {
- let lightWaves = 'Moonlight';
- let region = 'The Arctic';
- // Add if statement here:
- if (region === 'The Arctic'){
- let lightWaves = 'Northern Lights'; //let keyword is used, so it will not overwrite the value Moonlight
- console.log(lightWaves) //prints Northern Lights
- }
- console.log(lightWaves); //prints Moonlight
- };
- logVisibleLightWaves(); //call the function above
- console.log(lightWaves); //However if want to print the variable that is local (block scope) for both values, then it will prompt error as it cannot be accessed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement