Skip to main content
1-Visitor
January 6, 2014
Solved

how do i combine arrays in javascript

  • January 6, 2014
  • 1 reply
  • 1148 views

ids = new Array()

.

.

ids.concat(bean.getRelatedIssues("relationship");

does not work

    Best answer by LLawton

    The concat function doesn't modify its operand, you have to assign the results of concat to a variable.

    You can do a direct assignment:

    var ids = bean.getRelatedIssues("relationship");

    Or if you must add to an array:

    ids = ids.concat( bean.getRelatedIssues("relationship") );

    1 reply

    LLawton16-PearlAnswer
    16-Pearl
    January 6, 2014

    The concat function doesn't modify its operand, you have to assign the results of concat to a variable.

    You can do a direct assignment:

    var ids = bean.getRelatedIssues("relationship");

    Or if you must add to an array:

    ids = ids.concat( bean.getRelatedIssues("relationship") );