Lesson Objectives
Combine objects, arrays, and functions
Combine objects, arrays, and functions more than one level deep
Combine objects, arrays, and functions
You can create a property for an object that is an array
Copy const foo = {
someArray : [ 1 , 2 , 3 ]
};
foo . someArray [ 0 ] ; // 1 You can create a property for an object that is an object
Copy const foo = {
someObject : {
someProperty : ' oh hai! '
}
};
foo . someObject . someProperty ; // oh hai! You can create a property for an object that is a function (method)
You can store an object in an array
You can store an array in an array
You can store a function in an array
You can loop over an array in an object
You can loop over an array in an array. Just add an additional [index ] after the first [index ]
Combine objects, arrays, and functions more than one level deep
You can create a function that returns an object. Just add the . after the () since the return value of the function is an object
You can create a function that returns an array. Just add [index] after the () since the return value of the function is an array
You can create a function that returns an object that has an array
You can create a function that returns an object that has an object
You can create a function that returns an object that has a method
You can create a function that returns a function. Just add the () after the first () since the return value of the first function is another function
You can create an object that has a method that returns an object
You can create an object that has a method that returns an object that has an array
You can create an object that has a method that returns an object that has an object
You can create an object that has a method that returns an object that has another method
You can create an object that has a method that returns a function
You can create an array that has a function that returns an object
You can create an array that has a function that returns an object that has an array
You can create an array that has a function that returns an object that has an object
You can create an array that has a function that returns an object that has a method
You can create an array that has a function that returns a function
Adapted from SEI-MAE arrow-up-right