How to inline combine arrays in JavaScript? -
given 2 arrays, how to pass combination of both function, preferably inline syntax?
var current = [1.01, 3.01, 2.42, 4.31]; var preview = [0.89, 3.15]; /* * pass both combined function, fictional syntax. * display(current + preview); */
what mean inline syntax create temporary array gets passed. don't want 1 of arrays modified.
you can use concat
create new array containing values both:
display(current.concat(preview));
Comments
Post a Comment