FrontendInterviews.dev

644. Array.fill Shared References

Easy•

Predict the output.

const arr = Array(2).fill({ x: 0 })
arr[0].x = 9
console.log(arr[1].x)

What is printed in the console?

Select an option and submit your answer.
Next Problem