I am learning ES6, so please carry me.
Below is the code that works fine if I press the start button once, but on the second hit it starts showing a TypeError: redeclaration of let myArr .
Let me know about this weird (maybe not) behavior.
let myArr = [34,45,67,2,67,1,5,90]; let evenArr = []; let oddArr = []; myArr.forEach(x => { if (x % 2 === 0) { evenArr.push(x); } else { oddArr.push(x); } }); console.log(evenArr); console.log(oddArr);
Error -

source share