I recently started programming in javascript, and I had a problem related to the sequence of code execution.
var grid2 = [[]]
var oldgrid2 = grid2.slice()
console.log(oldgrid2)
grid2[0][0] = 'test'
the point is that the console outputs the status after changing the array, which is on the 4th line, although the output in the console is on the 3rd line.
when i switch to sequential code execution mode(ctrl + / + f8) then my code executes correctly and the initial state is entered into the console. please tell me what could be the problem.