So I created a variable car and then assigned it to a function and added the arguments model, year. Then created an object within the function with reference to the arguments.
Then Created the "closure" inner function yourCar() and returned the outer functions object "Properties" within it. followed by returning the inner function yourCar() within the outer function to be available on a global scope.
So to my understanding I thought the inner function has access to all of the variables and functions to the outer function. Thus I called yourCar(model, year); to get the object variables.
But keep getting the error message : "yourCar is not defined"... I am using scratchpad on mozilla fox to test and debug. Can anyone help with this, so I can understand it a bit better!
var car = function(model, year){
var Properties = {
model: nissan,
year: 2004
}
function yourCar() {
return Properties;
}
return yourCar();
}
yourCar(model, year);