当前位置:网站首页>Some features of ECMAScript
Some features of ECMAScript
2022-07-06 00:58:00 【sunday2018】
ECMAScript Some characteristics of
Strict mode (strict mode)
ES5 introduce . In strict mode JS The parsing and execution of will be different , Solve some ES3 Uncertain behavior in , Unsafe operation will also report errors .
Usage mode
Add the following code at the top
// Switch JS The engine is in strict mode
"use strict";
Specifies that the function executes in strict mode
function test() {
"use strict";
// ...
}
data type
ES Yes 6 Type of data :
undefined, null, boolean, number, string, object
typeof
typeof Can be used to detect the data type of variables , The returned string is
// 'undefined' Undefined
// 'boolean'
// 'string'
// 'number'
// 'object' Object or null
// 'function'

Undefined type
Undefined Variables of type have only one value , namely undefined
Use var Declare variables , But the variable is not initialized , The value of this variable is undefined.
Null type
Null Type has only one value ,null.
If the defined variable is prepared to hold the object , It is recommended to initialize the variable to null.
Object type
Object similar Java Medium Object object , Every Object Instances of types will have Object Properties and methods in classes .
- constructor, Save the function that creates the current object
- hasOwnProperty(propertyName), Check whether the given property exists in the current object instance
- isPropertypeOf(object), Check whether the incoming object is the prototype of the current object
- propertyIsEnumerable(propertyName), Check whether the attribute can be used for-in enumeration
- toLocalString()
- toString()
- valueOf()
function
No overloading , Function with the same name , The function defined later will overwrite the function defined earlier .
边栏推荐
- ADS-NPU芯片架构设计的五大挑战
- Leetcode 44 Wildcard matching (2022.02.13)
- 图解网络:TCP三次握手背后的原理,为啥两次握手不可以?
- How to extract MP3 audio from MP4 video files?
- [groovy] JSON string deserialization (use jsonslurper to deserialize JSON strings | construct related classes according to the map set)
- 【文件IO的简单实现】
- Spark SQL null value, Nan judgment and processing
- After Luke zettlemoyer, head of meta AI Seattle research | trillion parameters, will the large model continue to grow?
- 详细页返回列表保留原来滚动条所在位置
- 朝招金安全吗 会不会亏损本金
猜你喜欢

KDD 2022 | 脑电AI助力癫痫疾病诊断

Arduino六足机器人

Four commonly used techniques for anti aliasing

Common API classes and exception systems

How to extract MP3 audio from MP4 video files?

测试/开发程序员的成长路线,全局思考问题的问题......

View class diagram in idea

Intensive learning weekly, issue 52: depth cuprl, distspectrl & double deep q-network

Spark AQE

282. Stone consolidation (interval DP)
随机推荐
Obstacle detection
Cloud guide DNS, knowledge popularization and classroom notes
关于#数据库#的问题:(5)查询库存表中每本书的条码、位置和借阅的读者编号
Spark DF增加一列
Curlpost PHP
Convert binary search tree into cumulative tree (reverse middle order traversal)
NLP generation model 2017: Why are those in transformer
FFT 学习笔记(自认为详细)
Finding the nearest common ancestor of binary search tree by recursion
【第30天】给定一个整数 n ,求它的因数之和
[groovy] XML serialization (use markupbuilder to generate XML data | create sub tags under tag closures | use markupbuilderhelper to add XML comments)
Comment faire votre propre robot
[simple implementation of file IO]
Common API classes and exception systems
Spark SQL null value, Nan judgment and processing
Leetcode Fibonacci sequence
Programmer growth Chapter 9: precautions in real projects
Overview of Zhuhai purification laboratory construction details
Dynamic programming -- linear DP
esxi的安装和使用