Combining Data Types
Lesson Objectives
Combine objects, arrays, and functions
Combine objects, arrays, and functions more than one level deep
Combine objects, arrays, and functions
0
You can create a property for an object that is an array
const foo = {
someArray:[1,2,3]
};
foo.someArray[0]; //11
You can create a property for an object that is an object
const foo = {
someObject: {
someProperty: 'oh hai!'
}
};
foo.someObject.someProperty; //oh hai!2
You can create a property for an object that is a function (method)
3
You can store an object in an array
4
You can store an array in an array
5
You can store a function in an array
6
You can loop over an array in an object
7
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
8
You can create a function that returns an object. Just add the . after the () since the return value of the function is an object
9
You can create a function that returns an array. Just add [index] after the () since the return value of the function is an array
10
You can create a function that returns an object that has an array
11
You can create a function that returns an object that has an object
12
You can create a function that returns an object that has a method
13
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
14
You can create an object that has a method that returns an object
15
You can create an object that has a method that returns an object that has an array
16
You can create an object that has a method that returns an object that has an object
17
You can create an object that has a method that returns an object that has another method
18
You can create an object that has a method that returns a function
19
You can create an array that has a function that returns an object
20
You can create an array that has a function that returns an object that has an array
21
You can create an array that has a function that returns an object that has an object
22
You can create an array that has a function that returns an object that has a method
23
You can create an array that has a function that returns a function
Adapted from SEI-MAE
Last updated
Was this helpful?