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 bark() { | |
| console.log("Woof!"); | |
| } | |
| bark.animal = "dog"; |
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
| let greeting; | |
| greetign = {}; // Typo! | |
| console.log(greetign); |
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
| class Chameleon { | |
| static colorChange(newColor) { | |
| this.newColor = newColor; | |
| return this.newColor; | |
| } | |
| constructor({ newColor = "green" } = {}) { | |
| this.newColor = newColor; | |
| } | |
| } |
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
| let a = 3; | |
| let b = new Number(3); | |
| let c = 3; | |
| console.log(a == b); | |
| console.log(a === b); | |
| console.log(b === c); |
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
| let c = { greeting: "Hey!" }; | |
| let d; | |
| d = c; | |
| c.greeting = "Hello"; | |
| console.log(d.greeting); |
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 bird = { | |
| size: "small" | |
| }; | |
| const mouse = { | |
| name: "Mickey", | |
| small: true | |
| }; |
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
| +true; | |
| !"Lydia"; |
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 shape = { | |
| radius: 10, | |
| diameter() { | |
| return this.radius * 2; | |
| }, | |
| perimeter: () => 2 * Math.PI * this.radius | |
| }; | |
| console.log(shape.diameter()); | |
| console.log(shape.perimeter()); |
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
| for (var i = 0; i < 3; i++) { | |
| setTimeout(() => console.log(i), 1); | |
| } | |
| for (let i = 0; i < 3; i++) { | |
| setTimeout(() => console.log(i), 1); | |
| } |
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 sayHi() { | |
| console.log(name); | |
| console.log(age); | |
| var name = "Lydia"; | |
| let age = 21; | |
| } | |
| sayHi(); |