Posted By

nerdfiles on 10/22/09


Tagged

javascript


Versions (?)

GLOBAL VARS AND OR


 / Published in: JavaScript
 

  1. var pity = this.pity || {}
  2.  
  3. function doSomething (a) {
  4. a = a || ‘defaultValue’;
  5. }
  6.  
  7. function doSomething (a) {
  8. a = (a !== undefined ? a : ‘defaultValue’);
  9. }

Report this snippet  

You need to login to post a comment.