Skip to content
RED SAG Skills
hard20 pts · first answer countshash-mapjavascript

Adding to a Map during forEach

What happens here?

const m = new Map([[1, "a"]])
m.forEach((v, k) => {
  if (k < 5) m.set(k + 1, v)
})
console.log(m.size)
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions