当前位置:网站首页>Interesting - questions about undefined
Interesting - questions about undefined
2022-07-06 18:01:00 【free loop 】
about
undefined
This thing , Many of them are used in ordinary development , But we really understand ?
today , Strange knowledge points appear
as everyone knows ,undefined
It's undefined , This is often written in projects :
// Commonly used in initialization
let str = undefined
No problem ! But the great God in the big factory ( Deep well ice ) Will study some magical problems ! Formulate some specifications , To define undefined It has to be written like this .
// It is used like this in big factories
var str=void 0
This is the result
effect : This is to eliminate some hidden dangers
for example :
// If we write like this, there will be a problem
function log(){
var undefined=1// because undefined Not a keyword , It can be defined as
var a=undefined// Declare one more variable a, Its value is undefined
console.log(a)// What to print ???
}
there
undefined
Not in global variablesundefined
, But this declared variableundefined
, So there will be problems with such an assignment , Print the1
.
summary : Although it could be js At the beginning of belt design , The legacy of the bug, But we still need to be meticulous and rigorous in our business .
边栏推荐
猜你喜欢
STM32按键状态机2——状态简化与增加长按功能
Kivy tutorial: support Chinese in Kivy to build cross platform applications (tutorial includes source code)
Summary of Android interview questions of Dachang in 2022 (II) (including answers)
STM32 key state machine 2 - state simplification and long press function addition
Spark accumulator and broadcast variables and beginners of sparksql
Jerry's access to additional information on the dial [article]
Smart street lamp based on stm32+ Huawei cloud IOT design
SAP UI5 框架的 manifest.json
中移动、蚂蚁、顺丰、兴盛优选技术专家,带你了解架构稳定性保障
Basic configuration and use of spark
随机推荐
高精度运算
Today in history: the mother of Google was born; Two Turing Award pioneers born on the same day
Codeforces Round #803 (Div. 2)
Stealing others' vulnerability reports and selling them into sidelines, and the vulnerability reward platform gives rise to "insiders"
Getting started with pytest ----- test case rules
RB157-ASEMI整流桥RB157
Pytest learning ----- detailed explanation of the request for interface automation test
Jerry's setting currently uses the dial. Switch the dial through this function [chapter]
How to output special symbols in shell
MSF horizontal MSF port forwarding + routing table +socks5+proxychains
Solution qui ne peut pas être retournée après la mise à jour du navigateur Web flutter
FMT开源自驾仪 | FMT中间件:一种高实时的分布式日志模块Mlog
VR全景婚礼,帮助新人记录浪漫且美好的场景
Mysqlimport imports data files into the database
Nodejs developer roadmap 2022 zero foundation Learning Guide
The difference between parallelism and concurrency
J'aimerais dire quelques mots de plus sur ce problème de communication...
8位MCU跑RTOS有没有意义?
李书福为何要亲自挂帅造手机?
Manifest of SAP ui5 framework json