-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_4.js
More file actions
32 lines (28 loc) · 1.39 KB
/
script_4.js
File metadata and controls
32 lines (28 loc) · 1.39 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
const entrepreneurs = [
{ first: 'Steve', last: 'Jobs', year: 1955 },
{ first: 'Oprah', last: 'Winfrey', year: 1954 },
{ first: 'Bill', last: 'Gates', year: 1955 },
{ first: 'Sheryl', last: 'Sandberg', year: 1969 },
{ first: 'Mark', last: 'Zuckerberg', year: 1984 },
{ first: 'Beyonce', last: 'Knowles', year: 1981 },
{ first: 'Jeff', last: 'Bezos', year: 1964 },
{ first: 'Diane', last: 'Hendricks', year: 1947 },
{ first: 'Elon', last: 'Musk', year: 1971 },
{ first: 'Marissa', last: 'Mayer', year: 1975 },
{ first: 'Walt', last: 'Disney', year: 1901 },
{ first: 'Larry', last: 'Page', year: 1973 },
{ first: 'Jack', last: 'Dorsey', year: 1976 },
{ first: 'Evan', last: 'Spiegel', year: 1990 },
{ first: 'Brian', last: 'Chesky', year: 1981 },
{ first: 'Travis', last: 'Kalanick', year: 1976 },
{ first: 'Marc', last: 'Andreessen', year: 1971 },
{ first: 'Peter', last: 'Thiel', year: 1967 }
];
let test1 = entrepreneurs.filter(array => array.year >= 1970 && array.year < 1980);
console.log(test1);
let test2 = entrepreneurs.map(array => `${array.first} ${array.last}`);
console.log(test2);
let test3 = entrepreneurs.map(array => "L'inventeur " + array.first + " " + array.last + " aurait " + (2024 - array.year) + "ans aujourd'hui.");
console.log(test3);
entrepreneurs.sort((a, b) => a.last.localeCompare(b.last));
console.log(entrepreneurs);