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?
eval
, it's not safe (yeah,eval
is horrible, but it's part of the standard and you don't throw away standard compilance for an optimization) and it doesn't help the slightest bit in reducing traffic - you'd still send the full file. – delnan Mar 13 '12 at 14:09