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
| // Do celu =>! (if you know what I mean) | |
| Adder.prototype.addToArray = function (arr) { | |
| return arr.map(x => x + this.value); | |
| } |
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 Adder = (val) => { | |
| this.val = val; | |
| } | |
| const addTwo = new Adder(2); // TypeError: Adder is not a constructor |
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 algoSmart = { | |
| likes: 52, | |
| getLikes: () => console.log(this.likes), | |
| setLikes: function(value) { | |
| this.likes = value; | |
| }, | |
| }; | |
| algoSmart.getLikes(); // undefined | |
| algoSmart.setLikes(100000); |
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
| .on { | |
| background-color: #0288d1; | |
| } |
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 myPreciousSecret = `I <3 AlgoSmart`; | |
| console.log(myPreciousSecret); // "I <3 AlgoSmart" | |
| console.log(typeof myPreciousSecret); // "string" | |
| console.log(myPreciousSecret.length); // 14 |
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
| // Pre-ES6. | |
| var myFavouriteMeal = "Pizza"; | |
| console.log('I love ' + myFavouriteMeal + '!'); // "I love Pizza!" | |
| // ES6. | |
| const myFavouriteMeal = "Pizza"; | |
| console.log(`I love ${myFavouriteMeal}!`); // "I love Pizza!" |
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
| console.log(`2 + 2 = ${2+2}`); // "2 + 2 = 4" | |
| console.log(`2 + 2 = ${add(2, 2)}`); // "2 + 2 = 4" | |
| console.log(`Is Marcin 23 years old? ${true || false}`;`) // "Is Marcin 23 years old? 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
| var message = [ | |
| 'Du偶o linijek, ', | |
| 'du偶o problem贸w.' | |
| ].join('\n'); | |
| var message = 'Du偶o linijek, \n' + | |
| 'du偶o problem贸w.'; |