p

Size: a a a
p
p
const subtractTwo = (num) => num - 2;
const map = (arr, callback) => {
let output = [];
for (let x in arr) {
output.push(subtractTwo(arr[x]));
}
return output;
}
console.log(typeof subtractTwo); // should log: 'function'
console.log(typeof map); // should log: 'function'
console.log(map([3,4,5], subtractTwo)); // should log: [ 1, 2, 3 ]
p
DE
DE
const subtractTwo = (num) => num - 2;
const map = (arr, callback) => {
let output = [];
for (let x in arr) {
output.push(subtractTwo(arr[x]));
}
return output;
}
console.log(typeof subtractTwo); // should log: 'function'
console.log(typeof map); // should log: 'function'
console.log(map([3,4,5], subtractTwo)); // should log: [ 1, 2, 3 ]
const subtractTwo = (num) => num - 2;
const map = (arr, callback) => {
let output = [];
for (const x of arr) {
output.push(callback(x));
}
return output;
}
console.log(typeof subtractTwo); // should log: 'function'
console.log(typeof map); // should log: 'function'
console.log(map([3,4,5], subtractTwo)); // should log: [ 1, 2, 3 ]
П
DE
const subtractTwo = (num) => num - 2;
const map = (arr, callback) => {
let output = [];
for (let x in arr) {
output.push(subtractTwo(arr[x]));
}
return output;
}
console.log(typeof subtractTwo); // should log: 'function'
console.log(typeof map); // should log: 'function'
console.log(map([3,4,5], subtractTwo)); // should log: [ 1, 2, 3 ]
const subtractTwo = (num) => num - 2;
const map = (arr, callback) => arr.map(callback)
console.log(typeof subtractTwo); // should log: 'function'
console.log(typeof map); // should log: 'function'
console.log(map([3,4,5], subtractTwo)); // should log: [ 1, 2, 3 ]
p
const subtractTwo = (num) => num - 2;
const map = (arr, callback) => {
let output = [];
for (const x of arr) {
output.push(callback(x));
}
return output;
}
console.log(typeof subtractTwo); // should log: 'function'
console.log(typeof map); // should log: 'function'
console.log(map([3,4,5], subtractTwo)); // should log: [ 1, 2, 3 ]
DE
DE
П
p
const subtractTwo = (num) => num - 2;
const map = (arr, callback) => arr.map(callback)
console.log(typeof subtractTwo); // should log: 'function'
console.log(typeof map); // should log: 'function'
console.log(map([3,4,5], subtractTwo)); // should log: [ 1, 2, 3 ]
G
DE
G
p