-
-
Save codecademydev/f750a35781c633ac4f0601f4073cf8af to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vegetables = ['Cabbage', 'Turnip', 'Radish', 'Carrot']; | |
var numbers = [1, 34, 100, 67, 120, 200, 9]; | |
let array = numbers.filter((number, index ) => { | |
return index > 1; | |
}); | |
let layeredArray = [[1,2], [2,4], [4,6],[6,8], [3,7]]; | |
let newArray = layeredArray.reduce( (acc, curVal, idx) => { | |
return acc + curVal; | |
}); | |
//output [1, 22, 44, 66, 8] | |
console.log(newArray); | |
let cars = ['Honda', 'Acura', 'Nissan', 'Hyundai', 'Audi', 'BMW', 'Benz']; | |
let germanCars = ['Audi', 'BMW', 'Benz']; | |
/*function something (car) { | |
console.log(`These are car brands ${car} `); | |
} */ | |
//cars.forEach(something); | |
let newArray1 = cars.filter( car => !germanCars.includes(car)); | |
console.log(newArray1); | |
//console.log(44+2+2+4+6+8); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment