Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const numbers = [102, 101, 1.5, 1, 2, 3, 22, 77, 4, 5, 6, 7];
- const prices1 = [10, 20, 30, 40, 40, 60];
- const prices2 = [70, 80, 90, 100];
- const names = ["Rene", "Tom", "Claire", "Ralph", "Ben"];
- const colors = ["Red", "Green", "Blue", "Yellow", "Red", "Green Red"];
- //.map()
- //array.map(function(currentValue, index, arr), thisValue)
- //.forEach()
- //array.forEach(function(currentValue, index, arr), thisValue)
- //.reduce()
- //array.reduce(function(total, currentValue, currentIndex, arr), initialValue)
- //.filter()
- //array.filter(function(currentValue, index, arr), thisValue)
- //.reverse()
- //array.reverse()
- //.concat()
- //array1.concat(array2, array3, ..., arrayX)
- //.join()
- //array.join(separator)
- //.push()
- //array.push(item1, item2, ..., itemX)
- //.pop()
- //array.pop()
- //.slice()
- //array.slice(start, end)
- //.splice()
- //array.splice(index, howmany, item1, ....., itemX)
- //.sort()
- //array.sort(compareFunction)
- const cars = [
- {
- name: "Mercedes",
- color: "Grey",
- age: 2,
- price: 90000
- },
- {
- name: "Opel",
- color: "Green",
- age: 1,
- price: 40000
- },
- {
- name: "VW",
- color: "Yellow",
- age: 15,
- price: 30000
- },
- {
- name: "Audi",
- color: "Blue",
- age: 3,
- price: 60000
- },
- {
- name: "Citroen",
- color: "Pink",
- age: 11,
- price: 40000
- },
- {
- name: "Jaguar",
- color: "Orange",
- age: 5,
- price: 80000
- },
- {
- name: "Ferrari",
- color: "Red",
- age: 6,
- price: 500000
- }
- ];
- //1. 20% discount on vehicles older than 10 years
- //2. Sort by price
- //3. Repaint pink cars to red
- //4. Total value of all cars
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement