Home Web Front-end JS Tutorial Javascript Study Notes 1 Data Type_Basic Knowledge

Javascript Study Notes 1 Data Type_Basic Knowledge

May 16, 2016 pm 06:36 PM
javascript type of data

There is only one form of code type and that is function.

undefined: Undefined, we can also call it non-existent, typeof(undefined)=undefined.

null: Empty. Undefined means it does not exist, and null means it exists, but is absent. typeof(null)=object, but null is not object. This is the magical and unique thing about null.

boolean: true or false.

Number: NaN and Infinity are two special numbers. NaN represents a number that cannot be expressed numerically, while Infinity represents an infinite number. On the contrary, -Infinify represents negative infinity. There are two special things here: NaN!=NaN, Infinity/Infinity=NaN. In the Number type, there is a very useful method: ToString(), which can accept a number from 2 to 36, and then convert our Number into the corresponding base number.

String: String. There is no concept of characters in Javascript. String is the smallest unit to represent text. In strings, there are two functions, charAt(index) and charCodeAt(index), which return the character corresponding to the index and the character Unicode encoding respectively. In our daily life, we may often use subscripts to access, such as s[10], but this is not an ECMAScript standard and should be avoided as much as possible.

All types of Javascript are built based on these five simple types. There are countless complex relationships between these five types. Undefined, null, 0, "" are false when converted to boolean, and except for these four, all are true. But among these five, except for undefined==null, the others are not equal.

Here we have another incompatibility with strongly typed languages, such as 123=="123". So how can we differentiate between types? At this time: all equal to: === comes into use.

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the best data type for gender fields in MySQL? What is the best data type for gender fields in MySQL? Mar 15, 2024 am 10:24 AM

In MySQL, the most suitable data type for gender fields is the ENUM enumeration type. The ENUM enumeration type is a data type that allows the definition of a set of possible values. The gender field is suitable for using the ENUM type because gender usually only has two values, namely male and female. Next, I will use specific code examples to show how to create a gender field in MySQL and use the ENUM enumeration type to store gender information. The following are the steps: First, create a table named users in MySQL, including

What data type should be used for gender field in MySQL database? What data type should be used for gender field in MySQL database? Mar 14, 2024 pm 01:21 PM

In a MySQL database, gender fields can usually be stored using the ENUM type. ENUM is an enumeration type that allows us to select one as the value of a field from a set of predefined values. ENUM is a good choice when representing a fixed and limited option like gender. Let's look at a specific code example: Suppose we have a table called "users" that contains user information, including gender. Now we want to create a field for gender, we can design the table structure like this: CRE

Mind map of Python syntax: in-depth understanding of code structure Mind map of Python syntax: in-depth understanding of code structure Feb 21, 2024 am 09:00 AM

Python is widely used in a wide range of fields with its simple and easy-to-read syntax. It is crucial to master the basic structure of Python syntax, both to improve programming efficiency and to gain a deep understanding of how the code works. To this end, this article provides a comprehensive mind map detailing various aspects of Python syntax. Variables and Data Types Variables are containers used to store data in Python. The mind map shows common Python data types, including integers, floating point numbers, strings, Boolean values, and lists. Each data type has its own characteristics and operation methods. Operators Operators are used to perform various operations on data types. The mind map covers the different operator types in Python, such as arithmetic operators, ratio

Simple JavaScript Tutorial: How to Get HTTP Status Code Simple JavaScript Tutorial: How to Get HTTP Status Code Jan 05, 2024 pm 06:08 PM

JavaScript tutorial: How to get HTTP status code, specific code examples are required. Preface: In web development, data interaction with the server is often involved. When communicating with the server, we often need to obtain the returned HTTP status code to determine whether the operation is successful, and perform corresponding processing based on different status codes. This article will teach you how to use JavaScript to obtain HTTP status codes and provide some practical code examples. Using XMLHttpRequest

What is the best data type choice for gender field in MySQL? What is the best data type choice for gender field in MySQL? Mar 14, 2024 pm 01:24 PM

When designing database tables, choosing the appropriate data type is very important for performance optimization and data storage efficiency. In the MySQL database, there is really no so-called best choice for the data type to store the gender field, because the gender field generally only has two values: male or female. But for efficiency and space saving, we can choose a suitable data type to store the gender field. In MySQL, the most commonly used data type to store gender fields is the enumeration type. An enumeration type is a data type that can limit the value of a field to a limited set.

Python entry to proficiency: from zero basics to project development Python entry to proficiency: from zero basics to project development Feb 20, 2024 am 11:42 AM

1. Introduction to Python Python is a general-purpose programming language that is easy to learn and powerful. It was created by Guido van Rossum in 1991. Python's design philosophy emphasizes code readability and provides developers with rich libraries and tools to help them build various applications quickly and efficiently. 2. Python basic syntax The basic syntax of Python is similar to other programming languages, including variables, data types, operators, control flow statements, etc. Variables are used to store data. Data types define the data types that variables can store. Operators are used to perform various operations on data. Control flow statements are used to control the execution flow of the program. 3.Python data types in Python

Detailed explanation of how to use Boolean type in MySQL Detailed explanation of how to use Boolean type in MySQL Mar 15, 2024 am 11:45 AM

Detailed explanation of how to use Boolean types in MySQL MySQL is a commonly used relational database management system. In practical applications, it is often necessary to use Boolean types to represent logical true and false values. There are two representation methods of Boolean type in MySQL: TINYINT(1) and BOOL. This article will introduce in detail the use of Boolean types in MySQL, including the definition, assignment, query and modification of Boolean types, and explain it with specific code examples. 1. The Boolean type is defined in MySQL and can be

Introduction to basic syntax and data types of C language Introduction to basic syntax and data types of C language Mar 18, 2024 pm 04:03 PM

C language is a widely used computer programming language that is efficient, flexible and powerful. To be proficient in programming in C language, you first need to understand its basic syntax and data types. This article will introduce the basic syntax and data types of C language and give examples. 1. Basic syntax 1.1 Comments In C language, comments can be used to explain the code to facilitate understanding and maintenance. Comments can be divided into single-line comments and multi-line comments. //This is a single-line comment/*This is a multi-line comment*/1.2 Keyword C language

See all articles