The map() method creates a new array populated with the results of calling
a provided function on every element in the calling array.
const array1 = [1, 4, 9, 16];
// pass a function to map
const map1 = array1.map(x => x * 2);
console.log(map1);
// expected output: Array [2, 8, 18, 32]
// Map objects are collections of key-value pairs.
// A key in the Map may only occur once, it is unique in the Map 's collection
let map = new Map()
let keyArray = 'Array'
map.set(keyArray, [1, 2, 3, 4, 5])
map.get(keyArray) // 1, 2, 3, 4, 5
function square(arr) {
const newArr = arr.map(x => x * x );
return newArr ;
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
//// Write a function that takes an array of objects (courses) and returns object of 2 new arrays // first one is containing the names of all of the courses in the data set. // second one is containing the names of all the students
const getInfo = (arr) => {
let coursesName = [];
let studentsName = [];
// write your code here
return { coursesName, studentsName };
};
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)