[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Errors/No_non-null_object [Back]  [Original]

TypeError: "x" is not a non-null object( : "x" ) - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

TypeError: "x" is not a non-null object( : "x" )

TypeError:    {x} (Edge)
TypeError: "x"     (Firefox)
TypeError:     : "x" (Chrome)
TypeError:  ,     (Chrome)

In this article

TypeError

?

- . null . .

, Object.create() Object.defineProperty() Object.defineProperties() , . (, ), :

js
Object.defineProperty({}, "key", 1);
// TypeError: 1 is not a non-null object

Object.defineProperty({}, "key", null);
// TypeError: null is not a non-null object

:

js
Object.defineProperty({}, "key", { value: "foo", writable: false });

WeakMap and WeakSet . .

js
var ws = new WeakSet();
ws.add("foo");
// TypeError: "foo" is not a non-null object

:

js
ws.add({ foo: "bar" });
ws.add(window);


Web Proxy Viewer  |  New URL  |  Original Page