当前位置:网站首页>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-324
Three 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
边栏推荐
- 全方位解读服务网格(Service Mesh)的背景和概念
- Pyobject to char* (string)
- Idea jar package conflict troubleshooting
- (5) Flink's table API and SQL update mode and Kafka connector case
- How to use percona tool to add fields to MySQL table after interruption
- 注册成为harmonyos开发者并安装DevEco Studio 3.0 Beta2 for HarmonyOS
- Boot transaction usage
- Pyinstaller's method of packaging pictures attached to exe
- [idea] recommend an idea translation plug-in: translation "suggestions collection"
- Tree binary search tree
猜你喜欢
Review materials for the special topic of analog electronics with all essence: basic amplification circuit knowledge points
Application of visualization technology in Nebula graph
Dimension table and fact table in data warehouse
[development environment] install Visual Studio Ultimate 2013 development environment (download software | install software | run software)
通过两级网关设计来路由服务网格流量
Experiment collection of University "Fundamentals of circuit analysis". Experiment 6 - observation and measurement of typical signals
Recommended practice sharing of Zhilian recruitment based on Nebula graph
原神2.6服务端下载以及搭建安装教程
Idea jar package conflict troubleshooting
《大学“电路分析基础”课程实验合集.实验六》丨典型信号的观察与测量
随机推荐
制作p12证书[通俗易懂]
SQL FOREIGN KEY
Song of cactus - throwing stones to ask the way (3)
SQL修改语句
SQLServer查询哪些索引利用率低
Review materials for the special topic of analog electronics with all essence: basic amplification circuit knowledge points
Introduction to dynamic planning I, BFS of queue (70.121.279.200)
Storage, reading and writing of blood relationship data of Nepal Graph & Data Warehouse
奥比中光 astra: Could not open “2bc5/[email protected]/6“: Failed to set USB interface
mysql 计算经纬度范围内的数据
Strings and arrays
Boot 中bean配置覆盖
[2. Basics of Delphi grammar] 3 Object Pascal constants and variables
原神2.6服务端下载以及搭建安装教程
解决** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the defau
Recommended practice sharing of Zhilian recruitment based on Nebula graph
Dimension table and fact table in data warehouse
[solution] educational codeforces round 82
愛可可AI前沿推介(7.2)
Idea public method extraction shortcut key