Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a 'large' object to exercise #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions exercises/110-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

}
24 changes: 24 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
})
}

// -----------------------------------------------------------------------------
Expand Down