This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// VIDEO REMAINING INTERNAL HELPER METHODS | |
// QUESTIONS AND OBSERVATIONS | |
//QUESTION 1: why object[key] == null and not object[key] === undefined ? Why its compare it with null instead of undefined. Because if an object property is missing obj['prop'] it will return undefined not null. | |
// QUESTION 2: object[key] = defs[key]; if defaultObject has an array as property with couple of values instead of primitive values then it will copy to the new return object that array by reference and if you change a value to one it will change to all. | |
var defaultCar = { | |
color: ['grey', 'red'], | |
wheels: 4, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var libs = {}; | |
function librarySystem(libName, depArr, cb){ | |
if (arguments.length > 1 && depArr.length >= 1){ | |
var storArr = []; | |
for(var i = 0; i < depArr.length; i++){ | |
storArr.push(libs[depArr[i]]); | |
} | |
libs[libName] = cb.apply(this, storArr); | |
} else { | |
libs[libName] = cb(); |