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 people = [{ | |
| "id": 1, | |
| "first_name": "Katleen", | |
| "last_name": "Josefs", | |
| "email": "[email protected]", | |
| "gender": "Female", | |
| "ip_address": "68.36.229.0" | |
| }, { | |
| "id": 2, | |
| "first_name": "Cletus", |
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
| //define colors | |
| var c = { | |
| db: "#036", //darkblue | |
| bk: "#000", //black | |
| rd: "#F00", //red | |
| tn: "#FC9", //tan | |
| lp: "#F9F", //lightpink | |
| dp: "#F39", //darkpink | |
| og: "#F90", //orange |
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 myString = "This string has many spaces"; | |
| console.log(myString.replace(/ /,"")); | |
| //"Thisstring has many spaces" | |
| console.log(myString.replace(/ /g,"")); | |
| //"Thisstringhasmanyspaces" |
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 chris1 = { | |
| name: 'Chris', | |
| location: 'Belfast' | |
| } | |
| const chris2 = { | |
| name: 'Chris', | |
| location: 'Belfast' | |
| } |
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 chris1 = { | |
| name: 'Chris', | |
| location: 'Belfast' | |
| } | |
| const chris2 = { | |
| name: 'Chris', | |
| location: 'Belfast' | |
| } |
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 < 5; i++) { | |
| setTimeout(console.log.bind(this, i), 1000); | |
| } |
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 < 5; i++) { | |
| setTimeout(function () { | |
| console.log(i); | |
| }, 1000); | |
| } |
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
| onClick: () => { | |
| console.log(Window.event); | |
| } | |
| //Bad | |
| onClick: (event) => { | |
| console.log(event); | |
| } | |
| //Good |
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
| this.foo = 'foo'; | |
| document.querySelector('.my-div').onclick = () => { | |
| console.log(this.foo) | |
| } |
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
| this.foo = 'foo'; | |
| document.querySelector('.my-div').onclick = function() { | |
| console.log(this.foo) | |
| } | |
| //Logs undefined | |
| document.querySelector('.my-div').onclick = function() { | |
| console.log(this.foo) | |
| }.bind(thid); |