문제

CSS uses hyphens to separate words:

.class_name{background-color:#000;}

Javascript uses lowerUpper formatting:

document.getElementById("my_div").style.backgroundColor

But what is the lowerUpper formatting syntax called?

I read it somewhere, in the context of "remember to _ the style property because javascript doesn't use hyphens".

Thanks

도움이 되었습니까?

해결책

It's called CamelCase. Take a look at wikipedia for more information: http://en.wikipedia.org/wiki/CamelCase

다른 팁

I follow Douglas Crockford's code conventions for javascript. I also use his JSLint tool to validate following those conventions.

JSLint can be too radical and restrictive for many developers, then JSHint can be better choice.

There is also the Online Javascript Beautifier which seems to use all the Douglas Crockford conventions to format the code. It does not address the naming of variables and functions though.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top