当前位置:网站首页>JS learning notes - data types
JS learning notes - data types
2022-07-02 16:01:00 【Dumb monkey】
The data type of the variable determines how bits representing these values are stored in the memory of the computer .JavaScript yes A weakly typed or dynamic language . It means You don't have to declare the type of variable in advance , While the program is running , The type will be automatically determined .
When the code is running , The data type of a variable is defined by JS Engine basis = The data type of the variable value on the right , After running , Variables determine the data type .
Basic data type

JavaScript The maximum and minimum of the values in
alert(Number.MAX_VALUE) ; / / 1. 7976931348 623157e+308
alert(Number.MIN_VALUE) ; / / 5e-324Three special values of digital type
alert(Infinity) ;
// Infinity
alert(-Infinity) ; // - Infinity
alert (NaN) ;
// NaN
Infinity , For infinity , Greater than any number
-Infinity , For infinitesimal , Less than any number
NaN , Not a number , Represents a non numerical value
isNaN()
isNaN() Used to determine whether a variable is a non numeric type , And return a value , If it's a number , The return is false . If it's not a number , The return is true.
String escape character

String length detection
A string is made up of several characters , The number of these characters is the length of the string . Through strings length attribute You can get the length of the entire string .
String splicing
You can use... Between multiple strings + Splicing , The splicing method is character string + Any kind of = The new string after splicing
Any type added to the string will be converted into a string before splicing , And then splice it into a new string
Add the values , The characters are connected
prompt The value taken is word Haptic
typeof Determine the variable data type
console.1og(typeof str);
Data type conversion
What is data type conversion : Is to convert a variable of one data type into another data type .
Convert to string

Convert to digital 
Convert to Boolean

Representational space 、 Negative values are converted to false , Such as "、0、NaN、null、 undefined, The rest of the values are converted to true
边栏推荐
猜你喜欢

XPT2046 四线电阻式触摸屏

Aike AI frontier promotion (7.2)

Add user-defined formula (time sharing t+0) to mobile app access as an example

Review materials for the special topic of analog electronics with all essence: basic amplification circuit knowledge points

隐藏在 Nebula Graph 背后的星辰大海

如何实现十亿级离线 CSV 导入 Nebula Graph

How to import a billion level offline CSV into Nepal graph

Aiko ai Frontier promotion (7.2)

Nebula Graph & 数仓血缘关系数据的存储与读写

idea jar包冲突排查
随机推荐
The sea of stars hidden behind the nebula graph
Idea jar package conflict troubleshooting
Aike AI frontier promotion (7.2)
解决BASE64Encoder报错的问题
Various entanglements between qvariant and Jason -- QT
(5) Flink's table API and SQL update mode and Kafka connector case
Compress words (kmp/ string hash, double hash)
Group by的用法
Strings and arrays
Processing gzip: stdin: not in gzip format: child returned status 1tar: error is not recoverable: exitin
注册成为harmonyos开发者并安装DevEco Studio 3.0 Beta2 for HarmonyOS
Construction and business practice of Zhongke brain knowledge map platform
Figure database | Nepal graph v3.1.0 performance report
Review materials for the special topic of analog electronics with all essence: basic amplification circuit knowledge points
隐藏在 Nebula Graph 背后的星辰大海
Introduction to database system Chapter 1 short answer questions - how was the final exam?
HMS core machine learning service helps zaful users to shop conveniently
idea 公共方法抽取快捷键
Aiko ai Frontier promotion (7.2)
[development environment] install Visual Studio Ultimate 2013 development environment (download software | install software | run software)