ECMAScript6 Handson
ECMAScript6 Handson
ECMAScript6 Handson
#######Block of Variables:#######
#######Block of Variables:#######
#######Parameters :#######
m
}
er as
module.exports = {sum}
co
eH w
#######Parameters :#######
o.
#######Destructuring Content######rs e
ou urc
const states = [['Tamilnadu'], ['Punjab', 'Haryana']]
module.exports = {states}
aC s
v i y re
#######Destructuring Content######
#######Arrow Function##############
Write an arrow function which takes your name as input and prints "Hello
your_name" to console.
ed d
ar stu
#######Arrow Function##############
Th
#######Template Literals###########
let a = 1; let b = 2;
Achieve the following output using template literals.
"The sum of 1 and 2 is 3"
#######Template Literals###########
#############Class#################
This study source was downloaded by 100000832806195 from CourseHero.com on 10-07-2021 22:51:38 GMT -05:00
https://www.coursehero.com/file/75470599/ECMAScript6-handsontxt/
class Car{
constructor(name, distance){
this.name = name;
this.distance = distance;
}
carDistance() {
return (this.name +' had travelled for ' +this.distance+' miles')
}
}
let Car1 = new Car('Audi', 100);
const msg = Car1.carDistance();
module.exports = {msg}
#############Class#################
############Symbols################
m
er as
Create an object Employee with properties:
co
--name as "rajesh" --phone as 9800000000, --symbol "email" as
eH w
"[email protected]".
After creating the object, display:
o.
--All the keys of object "employee" --Only private keys (symbols) --Only public
rs e
keys (non sumbol)
ou urc
let email = Symbol();
let Employee = {
name:"rajesh",
o
phone:9800000000,
aC s
[email] : "[email protected]"
v i y re
};
############Symbols################
sh is
Th
This study source was downloaded by 100000832806195 from CourseHero.com on 10-07-2021 22:51:38 GMT -05:00
https://www.coursehero.com/file/75470599/ECMAScript6-handsontxt/
Powered by TCPDF (www.tcpdf.org)