If you use var, you are declaring a local variable. If you execute MYAPP || {}, you usually try to set the default value for a global variable or for a variable declared earlier.
What should be the area MYAPP? If it’s global, then something like
MYAPP = window.MYAPP || {};
window. stops him from complaining that it is undefined
, ,
MYAPP = MYAPP || {};
, , then
var MYAPP = {};
, script (.. ), . script ( javascript ) , .
script ( javascript), IIFE ( ). .
(function() {
var MYAPP = {};
})();