Function(method) name syntax for javascript objects


Do we have to write javascript methods(functions) with dot notations? If i remember correctly, normal functions(not methods) didn't need any notations.

This exercise..

It can be seen that bob.setAge method has dot notation, so the task is to call the method with a different parameter(i.e 20). so I wrote this..

// here is bob again, with his usual properties
var bob = new Object(); = "Bob Smith";
bob.age = 30;
// this time we have added a method, setAge
bobsetAge = function (newAge){
  bob.age = newAge;
// here we set bob's age to 40
// bob's feeling old.  Use our method to set bob's age to 20

and it didn't pass.


nevermind, i found the answer.


The problem was