pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Errors/Unexpected_type

type="font/woff2" crossorigen="anonymous" fetchpriority="low" />

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) "y"

Message

    TypeError: "x" is (not) "y"

    Examples:
    TypeError: "x" is undefined
    TypeError: "x" is null
    TypeError: "undefined" is not an object
    TypeError: "x" is not an object or null
    TypeError: "x" is not a symbol

Error type

TypeError.

What went wrong?

그것은 정확하지 않은 형태이다. 그것은 가끔undefinednull 값을 발생한다.

또한, Object.create() 또는 Symbol.keyFor()와 같은 메서드는 반드시 제공되어야하는 특별한 형태를 요구한다.

Examples

Invalid cases

js
// undefined and null cases on which the substring method won't work
var foo = undefined;
foo.substring(1); // TypeError: foo is undefined

var foo = null;
foo.substring(1); // TypeError: foo is null

// Certain methods might require a specific type
var foo = {};
Symbol.keyFor(foo); // TypeError: foo is not a symbol

var foo = "bar";
Object.create(foo); // TypeError: "foo" is not an object or null

Fixing the issue

undefined 나 null 값을 가진 null 포인터를 고치기 위해서 아래 예제와 같이 typeof 연산자를 사용할 수 있다.

js
if (typeof foo !== "undefined") {
  // Now we know that foo is defined, we are good to go.
}

같이 보기

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy