Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
45
rated 0 times [  46] [ 1]  / answers: 1 / hits: 20002  / 15 Years ago, tue, may 19, 2009, 12:00:00

In JSLint, it warns that



var x = new Array();


(That's not a real variable name) should be



var result = [];


What is wrong with the 1st syntax? What's the reasoning behind the suggestion?


More From » jslint

 Answers
36

Crockford doesn't like new. Therefore, JSLint expects you to avoid it when possible. And creating a new array object is possible without using new....


[#99500] Friday, May 15, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kalistaz

Total Points: 0
Total Questions: 100
Total Answers: 106

Location: Bermuda
Member since Thu, Apr 20, 2023
1 Year ago
;