亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - Why is there no real empty object in js?
世界只因有你
世界只因有你 2017-05-19 10:24:47
0
4
647

In js, use the object literal method to create an object, var obj={}; Since the Object constructor is not called, why is it still an instance? Shouldn't such an object be an empty object? Why is its prototype Object.prototype?

世界只因有你
世界只因有你

reply all(4)
我想大聲告訴你

var obj = {}; is just a shorthand, equivalent to var obj = Object.create({});

Object.create(null); may be an empty object.

淡淡煙草味
  1. You have to ask about thisBrendan Eich.

  2. I think you should first tell me what you define as 空對(duì)象.

  3. According to your title description, I guess what you mean by 空對(duì)象應(yīng)該是指最原始的那個(gè)對(duì)象原型吧?這個(gè)東西是有的,它是null should refer to the original object prototype, right? This thing exists, it is null, and it is the end of the prototype chain of all objects.

我想大聲告訴你

js has empty objects

Object.create(null);

Practice is the only criterion for verifying truth

大家講道理

Conceptually speaking, Object is defined as the root object of all objects and is the most basic unit (reference) of the concept of "object-oriented". If it is removed, the entire concept will collapse;
Can you imagine matter without molecules/atoms?

No matter you create it with new or use literals, the compiler will automatically recognize the ancestor of the object

Yeah, null exception, this thing itself is a special case. js treats it as an object at the beginning, and then the so-called "empty object" phenomenon will appear in the subsequent Object.create(null). If it is defined at the beginning is a special value, then there is no such thing as Object.create(null). So in my understanding, this "empty object" is self-consistent and connected in definition, and should not be classified as "object-oriented" In this concept.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template