Take a look at this code snippet:
setTimeout(() => {console.log("b")})
["c"].forEach((x) => console.log(x))
This throws the following error:
Uncaught TypeError: Cannot read properties of undefined (reading
‘forEach’)
This however gets resolved after I put a semicolon after the first line. Why is this happening? Can someone explain what is happening behind the scenes here?