i'm a relatively newbie in javascript and i have to perform a task I have an immutable map:
Map({
isNamed: true,
isMarried: "",
isMan: false
})
Now i have to loop through this Map and if a value is "" i must replace it with with false so my final Map is this:
isNamed: true,
isMarried: false,
isMan: false
})
I've used the forEach method like this:
const prepareData = cardData.forEach((value, key, map = {}) => {
if (value === '') {
map[key] = false;
} else {
map[key] = value;
}
return map;
});
but the output is 0. What am i missing?