What does undefined mean in javascript?

little bottle
Release: 2019-05-10 11:55:32
Original
24143 people have browsed it

JavaScript is a literal scripting language. It is a dynamically typed, weakly typed, prototype-based language with built-in support for types. Its interpreter is called the JavaScript engine, which is part of the browser and is widely used in client-side scripting languages. It was first used on HTML web pages to add dynamic functions to HTML web pages. It has many special definitions that you may not be very clear about. Today I will talk to you about a special data type undefined in JavaScript.

What does undefined mean in javascript?

undefined represents an undeclared variable, or a variable that has been declared but not assigned a value, or an object property that does not exist. When the function does not return a value, undefined is returned by default. .

These are several typical uses of undefined. To determine whether a variable is undefined, use the typeof function. The typeof function mainly returns a string, mainly as follows: "number", " string", "boolean", "object", "function", "undefined".

Note that this special undefined value is different from null.

Usage example:

if (typeof(obj) == "undefined") { /*逻辑*/ }
Copy after login

The above is the detailed content of What does undefined mean in javascript?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!