Javascript expando objects

后端 未结 4 1841
醉梦人生
醉梦人生 2020-12-02 12:50

What are expando objects in javascripts?

For what purpose we need this ? Any complete example will be appreciated

I found 1 article here Javascript: The red

4条回答
  •  醉话见心
    2020-12-02 13:44

    An article written in 2007 that uses document.all (as the only way to access elements)? That's a big red flag.

    It is just dressing up "You can add properties to an object" with some buzzwords.

    We need to be able to do this because otherwise we wouldn't be able to store data, and that would make JavaScript a pretty useless language.

    (Everything is an array? No it isn't. And it iterates over an object without a hasOwnProperty wrapper. That isn't safe. Just keep away from the article, it is worse than useless)

提交回复
热议问题