当前位置:网站首页>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 .
边栏推荐
- 看抖音直播Beyond演唱会有感
- 图解网络:TCP三次握手背后的原理,为啥两次握手不可以?
- 从 1.5 开始搭建一个微服务框架——调用链追踪 traceId
- Cloud guide DNS, knowledge popularization and classroom notes
- Keepalive component cache does not take effect
- Four dimensional matrix, flip (including mirror image), rotation, world coordinates and local coordinates
- synchronized 和 ReentrantLock
- Spark DF增加一列
- 《强化学习周刊》第52期:Depth-CUPRL、DistSPECTRL & Double Deep Q-Network
- 【文件IO的简单实现】
猜你喜欢
[groovy] compile time metaprogramming (compile time method injection | method injection using buildfromspec, buildfromstring, buildfromcode)
Installation and use of esxi
Four dimensional matrix, flip (including mirror image), rotation, world coordinates and local coordinates
毕设-基于SSM高校学生社团管理系统
Spark AQE
1791. Find the central node of the star diagram / 1790 Can two strings be equal by performing string exchange only once
[groovy] XML serialization (use markupbuilder to generate XML data | set XML tag content | set XML tag attributes)
KDD 2022 | EEG AI helps diagnose epilepsy
图解网络:TCP三次握手背后的原理,为啥两次握手不可以?
Ubantu check cudnn and CUDA versions
随机推荐
JVM_ 15_ Concepts related to garbage collection
面试必刷算法TOP101之回溯篇 TOP34
视频直播源码,实现本地存储搜索历史记录
如何制作自己的机器人
程序员成长第九篇:真实项目中的注意事项
MCU realizes OTA online upgrade process through UART
Installation and use of esxi
The growth path of test / development programmers, the problem of thinking about the overall situation
Obstacle detection
After 95, the CV engineer posted the payroll and made up this. It's really fragrant
cf:C. The Third Problem【关于排列这件事】
程序员搞开源,读什么书最合适?
cf:D. Insert a Progression【关于数组中的插入 + 绝对值的性质 + 贪心一头一尾最值】
Spark获取DataFrame中列的方式--col,$,column,apply
Finding the nearest common ancestor of binary tree by recursion
KDD 2022 | EEG AI helps diagnose epilepsy
激动人心,2022开放原子全球开源峰会报名火热开启
[day 30] given an integer n, find the sum of its factors
Differences between standard library functions and operators
Distributed base theory