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
"use strict"; | |
class Avenger{ | |
constructor(){ | |
this.who = 'tony'; | |
} | |
says(){ | |
setTimeout(()=>{ | |
console.log(this.who+' says Rock and roll'); | |
},1); |
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
"use strict"; | |
//es5 code | |
var avengers = ['tony','steve','bruce','thor'].filter(function(aven){ | |
return aven != 'thor' | |
}); | |
console.log(avengers); | |
//same in es6 | |
let avengers = ['tony','steve','bruce','thor'].filter((aven)=> aven != 'thor' ); | |
console.log(avengers); |
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
class Student extends Person{ | |
constructor(){ | |
/** | |
* to make sure everthing initiated in parent class | |
*/ | |
super(); | |
} | |
} | |
let p = new Student(); |
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
"use strict"; | |
class Person{ | |
/** | |
* initiate anythin you want here | |
*/ | |
constructor(){ | |
this._name = 'aravind'; | |
this._age = '25'; | |
} | |
/** |
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
"use strict"; | |
const PI = 3.41; | |
PI = 2.3; |
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
"use strict"; | |
let lang = "php"; | |
for(;true;){ | |
let lang = "js"; | |
console.log(lang); //expect js | |
break; | |
} | |
console.log(lang); //expect php |
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 lang = "php"; | |
for(;true;){ | |
var lang = "js"; | |
console.log(lang); //expect js | |
break; | |
} | |
console.log(lang); //expect php |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta content="IE=edge" http-equiv="X-UA-Compatible"> | |
<meta content="width=device-width, initial-scale=1" name="viewport"> | |
<title>Es6 tutorial</title> | |
<script src="./jspm_packages/system.js" type="text/javascript"></script> | |
<script src="./config.js" type="text/javascript"></script> | |
</head> |
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
{ | |
"name": "es6-tutorial", | |
"version": "1.0.0", | |
"description": "es6 features ", | |
"main": "app.js", | |
"scripts": { | |
"start":"jspm-server", | |
"test": "karma test" | |
}, | |
"jspm": { |
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
{ | |
"name": "fake-name", | |
"version": "1.0.0", | |
"description": "A Node.js library to create fake data for you.", | |
"main": "fake-name.js", | |
"bin":{ | |
"faker":"fake-name.js" | |
}, | |
"scripts": { | |
"test": "mocha test" |