Toggle Booleans into a New Array
Given an array of boolean values called
flags
, use forEach
to create a new array called toggled
that contains the opposite boolean value for each element (i.e., true
becomes false
and vice versa). Do not modify the original flags
array.Premium
JavaScript
Console