javascript iterate array of variables and reassign value to each variable

Posted by Shanison on Stack Overflow See other posts from Stack Overflow or by Shanison
Published on 2010-06-17T09:56:48Z Indexed on 2010/06/17 10:03 UTC
Read the original article Hit count: 148

Filed under:
|

Hi how should i iterate array of variables and reassign value to each variable. E.g in jQuery

function test(param1, param2) {

  $.each([param1, param2], function (i, v) {
     //check if all the input params have value, else assign the default value to it
     if (!v) 
         v = default_value; //this is wrong, can't use v, which is value
  }

}

How should I get the variable and assign new value in the loop?

Thank you very much!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery