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
| erik.weight = 185 | |
| erik.weight //=> 185 |
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
| const erik = { weight: '155lbs', height: '6 4'}; |
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
| const key = 'baby’s first constant'; | |
| key = 'changed!'; //=> Uncaught TypeError: Assignment to constant variable.......... |
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
| } // Defining our block | |
| let secret = ‘skedaddle’ | |
| let secret = ‘password’ | |
| //=> Uncaught SyntaxError: Identifier ‘secret’ has already been defined. | |
| { |
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
| if(age > 12) { | |
| let dogYears = age * 7 | |
| console.log(‘You are ${dogYears} dog years old!’) | |
| } | |
| //=> dogYears not available here |
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
| if(age > 12) { | |
| const dogYears = age * 7 | |
| console.log(‘You are ${dogYears} dog years old!’) | |
| } | |
| //=> dogYears not available here |
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 setWidth() { | |
| var width = 100; | |
| console.log(width); | |
| } | |
| /// width not available here |
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
| var width = 100; | |
| console.log (width); //=> 100 | |
| var width = 200 | |
| console.log (width); //=> 200 |
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
| var width = 100; | |
| console.log (width); //=> 100 |
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 Person(firstname, lastname) { | |
| this.firstname = firstname | |
| this.lastname = lastname | |
| } | |
| var john = new Person(‘john’, ‘doe’); | |
| var sally = new Person(‘sally’, ‘white’); | |
| //=> Person { Firstname: “John”, Lastname: “Doe” } | |
| //=> Person { Firstname: “Sally”, Lastname: “White” } |