What is the best-practice casing style for javascript? Why?

前端 未结 6 1918
梦毁少年i
梦毁少年i 2020-12-09 09:19

One aspect of javascript that it\'s hard to find information on is casing practices. By casing practices, I mean what casing style (ie. camel-case, pascal-case, etc) should

6条回答
  •  [愿得一人]
    2020-12-09 09:48

    I prefer camelCase for everything except for constructors. The reason (and I believe this is why Mr. Crockford suggested this as well) is because in other languages, such as Java, the convention is capitalize your classes, which is what constructors are used for.

    That is my $0.02.

提交回复
热议问题