[Javascript] Replace undefined with void 0

Why? Mainly due to undefinedis not a keyword, therefore you are able to create a variable called undefinedand assign it any value

let undefined = 10

 

Also undefinedis a global property in windowobject

'undefined' in window // true

 

Therefore there is recommendation that use void 0to repensent undefined

posted @ 2024-11-24 19:23  Zhentiw  阅读(10)  评论(0)    收藏  举报