This file contains 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
//ES2015 | |
function makeRequest(url, timeout = 2000, callback = function(){}) { | |
//do something | |
} |
This file contains 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
//ES2015 | |
let product = "Sencha"; | |
let myText = `${product} provides the industry's most comprehensive collection of high-performance, customizable UI widgets. | |
These "widgets" include HTML5 grids, trees, lists, forms, menus, toolbars, panels, windows, and much more. | |
If you don't find a widget you are looking for, hundreds of user extensions are available from the Sencha community.`; |
This file contains 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
//ES2015 | |
function myTag(arrLiterals){ | |
return arrLiterals[0].toUpperCase(); | |
} | |
let message = myTag`hello world!`; //HELLO WORLD! | |
This file contains 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
//ES6 arrow functions | |
var calculate = (x,y) => { | |
return x + y; | |
} | |
var sayHello = (name) => { | |
return "Hello " + name; | |
} | |
//or: |
This file contains 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
//ES2015 | |
var x = (x,x) => x; | |
//SyntaxError: duplicate argument names not allowed in this context |
This file contains 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
//ES2015 | |
var foo = (x,y) => arguments[0]; | |
foo("lee","2") //ReferenceError: arguments is not defined [Learn More] |
This file contains 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
//ES2015 | |
function VideoGame(){ | |
this.title = "Uncharted"; | |
this.version = 3; | |
setInterval(() => { | |
console.log(this.title + " " + this.version++); // |this| properly refers to the VideoGame object | |
}, 5000); | |
} |
This file contains 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
//ES5 | |
var myobject = { | |
name: "Sencha", | |
logo: { | |
small: { | |
png: 'http://path/to/small.png', | |
jpg: 'http://path/to/small.jpg' | |
}, | |
large: { | |
png: 'http://path/to/large.png', |
This file contains 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 myarray = ["Ext JS", "GXT", "Sencha Test"]; | |
var [myvar1, myvar2, myvar3] = myarray; | |
console.log(myvar1) //Ext JS | |
console.log(myvar2) //GXT | |
console.log(myvar3) //Sencha Test |
This file contains 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
//ES2015 | |
function getVideoGame(title, version, platform) { | |
return { | |
title, | |
version, | |
platform | |
}; | |
} | |
getVideoGame("Uncharted", "4", "PS4") |