Why is undefined not writable in JavaScript? Why is undefined not writable in JavaScript? javascript javascript

Why is undefined not writable in JavaScript?


A removed comment by Amy gives the solution. You are creating a variable named undefined, and it doesn't work if you do your snippets in the global scope:

var undefined = 'hello';var test = undefined;console.log(typeof test);