, . ( php $var [] = 'foo'.) , , .
var arr;
(arr = arr || []).push('foo');
:
var obj = {};
(obj.arr = obj.arr || []).push('foo');
|| returns the left side if true, and the right side to the left. By the time of execution .push () arr is an array - if it was not already.
source
share