Array map function doesn't change elements
Solution 1:
JavaScript Array map() Method
*)creates a new array with the results of calling a function for every array element and it calls the provided function once for each element in an array, in order.
Note: map() Method does not execute the function for array elements without values and it does not change the original array.
more details
Solution 2:
Array map function is working fine. The map() method creates a new array with the results of calling a provided function on every element in this array. map() does not mutate the array on which it is called.
var array = [true, false]
var new_array = array.map(function(item) {
return false;
});
console.log(array)
console.log(new_array)
Solution 3:
If your mapping is simple, you can do:
var array = [true, false];
array = array.map(_ => false);
console.log(array);
// [false, false]