Wednesday, March 11, 2015

Quick Assignment Shortcut in JS

This is an old trick, but a good one. I showed a seasoned developer this one yesterday so I figured it's worth sharing here.




    var ns = ns || {};



another variant is




 
    var a = a || b;




a working sample.


JS Bin

No comments:

Post a Comment