-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathes6.js
More file actions
35 lines (28 loc) · 722 Bytes
/
es6.js
File metadata and controls
35 lines (28 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const numbers = [2, 45, 65, 43, 2, 1, 9];
const student = {
name: 'jerin',
id: 38,
age: 23,
}
// template string
const about = `My name is ${student.name}`;
console.log(about);
// 2 arrow function
const getFiftyFive = () => 55;
const addSixtyFive = num => num + 65;
const isEven = x => x % 2 === 0;
const addThree = (x, y, z) => x + y + z;
const doMath = (num1, num2) => {
const sum = num1 + num2;
return sum;
}
// spread Operator
const newNumbers = [...numbers];
// Create a new array from an older array and add an element
const currentNumbers = [...numbers, 55];
numbers.push(99);
numbers.push(99);
numbers.push(99);
console.log(numbers);
console.log(newNumbers);
console.log(currentNumbers);