[Solved] how to search for the value with a certain index in an array and modify its value?


For a oneliner, you could use map from Array.prototype:

secondArray = secondArray.map((element, index) => firstArray.includes(index) ? "blank" : element )

Please note the map function returns a new array, instead of modifying the original one.

Edit: removed redundant return and curly-braces around the arrow function body

1

solved how to search for the value with a certain index in an array and modify its value?