1

I just wanted to get all the values from the loop in a single array variable details which is declared outside the loop. But, I didn't get it wot work. How do I do this?

var details = [];
for(i=0;i<taskArray.length;i++){
    details = taskArray[i].concat("-",stateArray[i]);
}
0

2 Answers 2

0

just do details.push(taskArray[i])

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

Comments

0

Just simple you can make use array push method, you can push items one by one, as like as below:

function cancatTaskState(taskArray,stateArray){
    var details = [];
    for(i=0;i<taskArray.length;i++){
        details.push(taskArray[i].concat("-",stateArray[i]));
    } 
    return details;
}

2 Comments

Thank you so much.. it works :) any idea about "org.mozilla.javascript.NativeArray@e4e213" error ? when i pass the result through web service,it shows like this.
Welcome priya...:)am not sure about java, how to pass value in web services. But this link has solution for that: stackoverflow.com/questions/1433382/…

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.