Created
January 8, 2019 18:17
-
-
Save veritstudio/be69620193ee92973fb5d2f9f31d7f53 to your computer and use it in GitHub Desktop.
Strict mode and eval
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function strictPrice() { | |
"use strict"; | |
var price = 200; | |
eval('var price = 100'); | |
console.log(price); // prints 200 | |
} | |
function nonStrictPrice() { | |
var price = 200; | |
eval('var price = 100'); | |
console.log(price); //prints 100 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment