Posted By

sekihin on 04/27/09


Tagged

javascript argument


Versions (?)

Optional Parameters and Default Arguments


 / Published in: JavaScript
 

URL: http://www.startupcto.com/front-end-tech/javascript/optional-parameters-default-arguments

  1. function testFunction(a,b,c) {
  2. // this says 'if the type of a is undefined, set it to '', otherwise set it
  3. // to a (e.g. itself)'
  4. a = (typeof(a) == undefined) ? '' : a;
  5. b = (typeof(b) == undefined) ? '' : b;
  6. c = (typeof(b) == undefined) ? '' : c;
  7. }

Report this snippet  

You need to login to post a comment.