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
| { | |
| "name": "JavaScript Store", | |
| "short_name": "JavaScript Store", | |
| "lang": "en-US", | |
| "start_url": "/", | |
| "display": "fullscreen", | |
| "orientation": "portrait", | |
| "theme_color": "#f2e058", | |
| "icons": [ | |
| { |
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 propDefaults(defaults) { | |
| const handler = { | |
| get (obj, prop) { | |
| return Reflect.get(obj, prop) || defaults[prop]; | |
| } | |
| }; | |
| return new Proxy({}, handler); | |
| } | |
| const palette = propDefaults({color: "yellow"}); |
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 promise = new Promise((resolve, reject) => { | |
| //invoke async operation, then | |
| if (/* success */) { | |
| resolve("response received! Success!"); | |
| } else { | |
| reject(Error("Something failed")); | |
| } | |
| }); | |
| promise.then(function(result) { |
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
| displayFeatures() { | |
| this._features.forEach((feature, index) => console.info(`${this._language} feature ${index} ${feature}`)) | |
| } |
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 s = “Hello”; | |
| let sIterator = s[Symbol.iterator](); | |
| console.info( sIterator.next().value ) //H | |
| console.info( sIterator.next().value ) //e | |
| console.info( sIterator.next().value ) //l |
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 store = { | |
| _language: “JavaScript”, | |
| _features: [], | |
| displayFeatures() { | |
| this._features.forEach((feature, index) =>console.info(this._language + feature + index+ “ ”+ feature)) | |
| } | |
| } |
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 Person { //instance method | |
| speak() { | |
| console.log(‘speak’); | |
| } | |
| } | |
| class Person { //static method | |
| static isHuman() {} | |
| } | |
| class Person { //initialize instances | |
| constructor(arguments) {} |