Home > Web Front-end > JS Tutorial > Determine whether the input is empty and obtain the JS code of the input type_javascript skills

Determine whether the input is empty and obtain the JS code of the input type_javascript skills

WBOY
Release: 2016-05-16 17:18:12
Original
684 people have browsed it

Use typeof algorithm

The operand of typeof is undefined, and the returned value is "undefined".

The following defines x as the operand:

There are five situations;

The operand is a number, typeof(x) returns "number";

String typeof(x) returns "string";

Boolean value typeof(x) returns "boolean";

Object, array, null: typeof(x) returns "object";

The function typeof(x) returns "function".

For example:

Copy code The code is as follows:


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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template