I seen there is a variable declaration now days popular,
the declaration is :
var object = object || {};
var array = array || [];
var number = number || 20
Such like this. i assume that, it is using the catching data’s. but this is the only one useage of this? or is there any further advancement with this? else we need to declar the variables always this way? any one can explain me?
You do that so if the variable is already set, it takes its current value, otherwise a default value. Empty object, empty array, or 20, in the examples you provided. This way your code doesn’t break if you try to use a variable that doesn’t exist.