-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs.html
More file actions
94 lines (72 loc) · 1.9 KB
/
js.html
File metadata and controls
94 lines (72 loc) · 1.9 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
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<title>Axios</title>
</head>
<body>
</body>
<script>
// const people = [
// { name: "John", age: 30 },
// { name: "Alice", age: 25 },
// { name: "Bob", age: 35 },
// ];
// function change(tab,condition){
// return tab.filter(function(obj){
// return condition(obj) ;
// })
// }
// const sup= change(people,function(p){
// return p.age >= 30;
// })
// const inf = change(people,function(p){
// return p.age < 30;
// })
// console.log(sup)
// console.log(inf)
// function sumNumbers(numbers) {
// return numbers.reduce(
// (accumulator, currentNumber) => {
// return accumulator * currentNumber;
// }, 1);
// }
// const numbers = [1, 2, 3, 4, 5];
// const sum = sumNumbers(numbers);
// console.log(sum);
//*1
let livres = [
{
id:10,
titre:'POO',
auteur:'RAMI',
prix:300
},
{
id:11,
titre:'JS ES6',
auteur:'FAMI',
prix:230
},
{
id:12,
titre:'ALgo',
auteur:'KARIMI',
prix:330
},
{
id:13,
titre:'HTML',
auteur:'RAMI',
prix:340
}
]
const titres = livres.map(livre => livres.titre)
const titresRami = livres.filter(livre => livre.auteur == "RAMI").map(livre => livres.titre)
const livreId12 = livres.find(livre => livre.id == 12)
const totalPrix = livres.reduce((som,obj)=> som+obj.prix,0)
const mesLivres = [...livres] // copie
</script>
</html>