I've created an object using object literal notation and in it I have a couple of methods that I've logged to the console to make sure they are working. Each method shows in my console. But right after each method is logged, 'undefined' is returned and I cannot figure out why.
I have searched questions related to object literal notation but have not seen anything that pertains to this specific issue.
I've even gone through the MDN for working with objects. Something tells me it's probably a simple mistake. Does anyone have any suggestions?
Here is the code I'm using:
var car = {
name: 'Magic',
make: 'Nissan',
model: 'Sentra',
mileage: 79000,
year: 2002,
owned: true,
start: function() {
console.log('Car is turned on!');
},
off: function() {
console.log('This car has not been turned on. Do you have the key?');
}
};
console.log(car);
console.log(car.start());
console.log(car.off());