@@ -5,38 +5,59 @@ const makeCat = (name, age) => {
55 // add an age property to the object with the value set to the age argument
66 // add a method called meow that returns the string 'Meow!'
77 // return the object
8+ const cat = {
9+ name,
10+ age,
11+ meow ( ) {
12+ return 'Meow!' ;
13+ }
14+ } ;
15+ return cat ;
816} ;
917
1018const addProperty = ( object , property ) => {
1119 // add the property to the object with a value of null
1220 // return the object
1321 // note: the property name is NOT 'property'. The name is the value of the argument called property (a string)
22+ object [ property ] = null ;
23+ return object ;
1424} ;
1525
1626const invokeMethod = ( object , method ) => {
1727 // method is a string that contains the name of a method on the object
1828 // invoke this method
1929 // nothing needs to be returned
30+ object [ method ] ( ) ;
2031} ;
2132
2233const multiplyMysteryNumberByFive = ( mysteryNumberObject ) => {
2334 // mysteryNumberObject has a property called mysteryNumber
2435 // multiply the mysteryNumber property by 5 and return the product
36+ return mysteryNumberObject . mysteryNumber * 5 ;
2537} ;
2638
2739const deleteProperty = ( object , property ) => {
2840 // remove the property from the object
2941 // return the object
42+ delete object [ property ] ;
43+ return object ;
3044} ;
3145
3246const newUser = ( name , email , password ) => {
3347 // create a new object with properties matching the arguments passed in.
3448 // return the new object
49+ const person = {
50+ name,
51+ email,
52+ password
53+ } ;
54+ return person ;
3555} ;
3656
3757const hasEmail = ( user ) => {
3858 // return true if the user has a value for the property 'email'
3959 // otherwise return false
60+
4061} ;
4162
4263const hasProperty = ( object , property ) => {
0 commit comments