What is this javascript documentation style called?

南楼画角 提交于 2019-12-06 01:24:17

The page in question has been rewritten since to use object.property instead, but I remember that Object#property style, though I don't think it's ever had a name.

The problem it's trying to solve is that properties/methods can be available on constructors like Array.isArray(), as well as on instances, like ['foo','bar'].join(' '). The question is how to denote the latter. There were some competing denotations, such as

  • array.join(), which is what the socket.io docs are using now
  • Array.prototype.join (technically correct, but arguably even more confusing than Array#join to anyone who doesn't know how prototypes work in JS)
  • Array#join(), invented to be clearly different from Array.join syntax, and to avoid confusion with any existing JavaScript syntax.

The Object#prototype syntax was somewhat popular ten years ago, but didn't win in the end, so now it's just confusing when you encounter it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!