jQuery cache variable naming when multiple word
I know that it is good to name like this:
var $number = $('#number');
But if there are more than one word like this:
$('#number_of_ship');
Which one do you think is better $number_of_ship
or $numberOfShip
?
It's bad idea to name the id or class in Camel Case because it's case insensitive, so I don't want to name the开发者_StackOverflow id like #numberOfShip
, but I use Camel Case in JavaScript code.
It could be trivial thing, but it bothers me every time.
Expressive names are so important. Readability, Maintainability. Use Camel casing. Its the way to go. If it bothers you try to get used to it. See the benefits.
精彩评论