diff --git a/exercises/110-objects.js b/exercises/110-objects.js index c26afbe..2368b84 100644 --- a/exercises/110-objects.js +++ b/exercises/110-objects.js @@ -140,3 +140,45 @@ function dotNotation () { // Return the name of the bootcampInstructor Object using dot notation } + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// With all that you have learned about syntax in the arrays and objects exercises, +// it is time to type out a more complex Object to help cement the ideas. +// In the following exercise, declare and assign the variable described. +// Return the final Object (named applicationState) +function hardMode () { + // ~create an object with variable name~ + // bootcampInstructor + // ~which contains the following data~ + // name =>'Susan' , + // favoriteColor =>'green' , + // favoriteFoods =>Array('chicken pot pie', 'salmon', 'pho') + const bootcampInstructor = { + name: 'Susan', + favoriteColor: 'green', + favoriteFoods: [ + 'chicken pot pie', + 'salmon', + 'pho' + ] + } + + // ~create an object with variable name~ + // applicationState + // ~which contains the following data~ + // currentPage =>'homepage' , + // previousPage =>'dashboard' , + // loggedIn =>true , + // user =>Object( + // id=>245 , displayName=>'Frank' + // ) , + // preferences =>Object( + // colorScheme=>'retro', + // listPadding=>'comfortable', + // blockedUsers=>Array('baldar' , 'krel_z' , 'zachman') + // ) + + + // return applicationState + +} diff --git a/test/test.js b/test/test.js index f77f44c..1fe7b01 100644 --- a/test/test.js +++ b/test/test.js @@ -631,6 +631,30 @@ function check110 () { // TODO: make sure they returned the reference, not "Susan". // TODO: make sure they used dot notation. }) + + checkForFunction(filename, module, 'hardMode') + it('"hardMode" function implementation', function () { + const application_state = { + currentPage:'homepage', + previousPage:'dashboard', + loggedIn:true, + user: { + id:245, + displayName:'Frank' + }, + preferences: { + colorScheme:'retro', + listPadding:'comfortable', + blockedUsers: [ + 'baldar', + 'krel_z', + 'zachman' + ] + } + } + assert.deepStrictEqual(module.hardMode(), application_state, 'hardMode() should return the Object \'applicationState\' as described in the comments') + // TODO: make sure they made the variable applicationState. + }) } // -----------------------------------------------------------------------------