can anyone explain how this below works?
var MYAPP = {};
MYAPP.namespace = function(name){
var parts = name.split('.');
var current = MYAPP;
for (var i in parts) {
if (!current[parts[i]]) {
current[parts[i]] = {};
}
// shouldn't this line override the MYAPP object with all it's properties?
current = current[parts[i]];
}
}
currentthat points toMYAPP. It doesn't overwrite the valueMYAPP