2

i want to use javascript array globly using netbeans ide.. i declare the array like this.layer=new Array(); and var layer=new Array(); but the problem is that when i use the array in function the drop down menu of Array functions is not shown as netbeans shows.

1 Answer 1

1

Type analysis for a fully-dynamic language like JavaScript is tricky and there's no guarantee an IDE will be able to resolve it. Autocompletion is very much a best-guess feature. I wouldn't expect tracking properties like this.layer to work as, unless it enforces one particular style of object creation there is no way for an IDE to know what this is.

I would suggest in general using the array literal syntax [] in preference to new Array in almost every case. Don't know if that'll help Netbeans though.

Sign up to request clarification or add additional context in comments.

1 Comment

[] instead of new Array is highly recommended for JavaScript.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.