Justyna
Justyna

Reputation: 29

Why do I receive an 'undefined' in addition to my correct output in JavaScript? I would like to get rid off "undefined"

I have a huge object that is defined as

var success;

Then I access this object properties as follows:

var title = success.categories.cms.results[0].title;
console.log(title);
var company1 = success.categories.cms.results[0].company[0];
console.log(company1);

and so on. I can tell that the way I access object properties is correct because I get back the correct values in the console. But I have no idea why I also receive 'undefined' value after the correct value.

Any help would be very appreciated.

Upvotes: 0

Views: 35

Answers (1)

NightmareZ
NightmareZ

Reputation: 41

coz function console.log() returns undefined value

Upvotes: 1

Related Questions