-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBank list Day 1
More file actions
82 lines (59 loc) · 1.92 KB
/
Copy pathBank list Day 1
File metadata and controls
82 lines (59 loc) · 1.92 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// const movements = [200, 450, -400, 3000, -650, -130, 70, 1300];
/////////////////////////////////////////////////
// let arr = ['a', 'b', 'c', 'd', 'e'];
// console.log(arr.slice(2));
// console.log(arr);
// console.log(arr.slice(2, 4));
// console.log(arr.slice(-2));
// console.log(arr.slice(1, -1));
// console.log(...arr);
// //splice method
// // console.log(arr.splice(2));
// console.log(arr);
// //remove the last element
// arr.splice(-1);
// console.log(arr);
// arr.splice(1, 2);
// console.log(arr);
// //reverse the array
// arr = ['a', 'b', 'c', 'd', 'e'];
// const arr2 = ['j', 'i', 'h', 'g', 'f'];
// console.log(arr2.reverse());
// console.log(arr2);
// //concat method
// const letters = arr.concat(arr2);
// console.log(letters);
// console.log(...arr, ...arr2);
// //join method
// console.log(letters.join('-'));
// //loop array
// const movements = [200, 450, -400, 3000, -650, -130, 70, 1300];
// // for (const movement of movements) {
// for (const [i, movement] of movements.entries()) {
// if (movement > 0) {
// console.log(`Movement ${i} : You deposied ${movement}`);
// } else {
// console.log(`Movement ${i} :You deposited ${Math.abs(movement)}`);
// }
// }
// console.log('-----------------FOR EACH LOOP-------------------------');
// movements.forEach(function (movement, index, arr) {
// if (movement > 0) {
// console.log(`Movement ${index} :You deposied ${movement}`);
// } else {
// console.log(`Movement ${index} :You deposited ${Math.abs(movement)}`);
// }
// });
const currencies = new Map([
['USD', 'United States dollar'],
['EUR', 'Euro'],
['GBP', 'Pound sterling'],
]);
currencies.forEach(function (value, key, map) {
console.log(`${key} :${value}`);
});
const currenciesUnique = new Set(['USD', 'EURO', 'GBP', 'USD', 'EURO', 'GBP']);
console.log(currenciesUnique);
currenciesUnique.forEach(function (value, _, map) {
console.log(`${value} :${value}`);
});