当前位置:网站首页>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 .
边栏推荐
- Novice entry depth learning | 3-6: optimizer optimizers
- Introduction of motor
- Natural language processing (NLP) - third party Library (Toolkit):allenlp [library for building various NLP models; based on pytorch]
- [day 30] given an integer n, find the sum of its factors
- SAP Spartacus home 页面读取 product 数据的请求的 population 逻辑
- Idea远程提交spark任务到yarn集群
- Fibonacci number
- RAID disk redundancy queue
- View class diagram in idea
- Spark DF增加一列
猜你喜欢

看抖音直播Beyond演唱会有感

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

95后CV工程师晒出工资单,狠补了这个,真香...

Ubantu check cudnn and CUDA versions

VSphere implements virtual machine migration

For a deadline, the IT fellow graduated from Tsinghua suddenly died on the toilet

2020.2.13

Meta AI西雅图研究负责人Luke Zettlemoyer | 万亿参数后,大模型会持续增长吗?

Free chat robot API

Study diary: February 13, 2022
随机推荐
C language programming (Chapter 6 functions)
esxi的安装和使用
Cve-2017-11882 reappearance
MySQL storage engine
golang mqtt/stomp/nats/amqp
毕设-基于SSM高校学生社团管理系统
[groovy] JSON serialization (jsonbuilder builder | generates JSON string with root node name | generates JSON string without root node name)
Gartner released the prediction of eight major network security trends from 2022 to 2023. Zero trust is the starting point and regulations cover a wider range
Starting from 1.5, build a micro Service Framework - call chain tracking traceid
STM32 key chattering elimination - entry state machine thinking
Meta AI西雅图研究负责人Luke Zettlemoyer | 万亿参数后,大模型会持续增长吗?
Building core knowledge points
logstash清除sincedb_path上传记录,重传日志数据
直播系统代码,自定义软键盘样式:字母、数字、标点三种切换
How to use the flutter framework to develop and run small programs
Gartner发布2022-2023年八大网络安全趋势预测,零信任是起点,法规覆盖更广
激动人心,2022开放原子全球开源峰会报名火热开启
Zhuhai laboratory ventilation system construction and installation instructions
Synchronized and reentrantlock
Live video source code, realize local storage of search history