Javascript naming conventions

Posted by ManuPK on Programmers See other posts from Programmers or by ManuPK
Published on 2012-03-13T13:58:22Z Indexed on 2012/03/27 17:42 UTC
Read the original article Hit count: 297

Filed under:

I am from Java background and am new to JavaScript. I have noticed many JavaScript methods using single character parameter names, such as in the following example.

doSomething(a,b,c)

I don't like it, but a fellow JavaScript developer convinced me that this is done to reduce the file size, noting that JavaScript files have to be transferred to the browser.

Then I found myself talking to another developer. He showed me the way that Firefox will truncate variable names to load the page faster. Is this a standard practice for web browsers?

What are the best-practice naming conversions that should be followed when programming in JavaScript? Does identifier length matter, and if so, to what extent?

© Programmers or respective owner

Related posts about conventions