0

I have a JQuery which is retunring an array of LockedProjects [] which is decalred as global variable.

var LockedProjects = [];

I wanted to display the values of this array LockedProjects in another JQuery I m accesing this array of values in an alert box to display and separating them with comma. Before displaying that I am checking the length of it.

if(LockedProjects.length>0)
alert(LockedProjecrs.join(,));

'if' condition is passed But It is not displaying any values. Can any one help on this?

1

2 Answers 2

1

join() expects string, you've given it a comma. Also, 'LockedProjects' is spelt incorrectly. I believe it should be:

alert(LockedProjects.join(","));
Sign up to request clarification or add additional context in comments.

2 Comments

I am using like this only. I kept within double quotes still it did nt work
Can you re-produce the issue? Perhaps on jsfiddle.net? See this
0

The default separator for join is , so you could simply do

LockedProjects.join()

The separator is converted to a string if necessary. If omitted, the array elements are separated with a comma.

Comments

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.