-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpread-Operator.js
More file actions
50 lines (32 loc) · 848 Bytes
/
Spread-Operator.js
File metadata and controls
50 lines (32 loc) · 848 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// combaining Arrays
/*
let shoppingCart =[345, 375, 485, 158];
let newItems = [95, 256];
shoppingCart.push(...newItems);
console.log(shoppingCart); // [ 345, 375, 485, 158, 95, 256 ]
*/
// Copying Arrays
/*
const shoppingCart = [ 345, 375, 485, 158];
const updateCart = shoppingCart.slice();
updateCart.push(100);
console.log(updateCart); // [ 345, 375, 485, 158, 100]
console.log(shoppingCart); // [ 345, 375, 485, 158]
*/
/*
const orderTotals = [1, 5, 1, 10, 2, 3];
console.log(Math.max(...orderTotals));
// [1, 5, 1, 10, 2, 3]
// ...[1, 5, 1, 10, 2, 3]
// 1, 5, 1, 10, 2, 3
*/
// ..Deconstruction
const { adventure, cities, ...teams } = {
adventure: 'Trip',
cities: 'Guadalajara',
teamMates_1: 'Carlos',
teamMates_2: 'Gregorio'
}
console.log(adventure);
console.log(cities);
console.log(teams);