[Solved] got blank output in javascript


You are getting a js error, and that’s probably the reason for the blank page.

you are trying to call the function ‘b’ on the object ‘person’ which doesn’t exsit.

console.log(somebody.person.b().name);

‘b’ always returns null, this line will never work

You need something like:

var person = {
    firstName: "John",
    lastName : "Doe",
    id       : 5566,
    b : function(/* parameters */)
    {
        // do something
        // return something
    }

};

Also:

var somebody = new person();

‘person’ is not a function, so you can’t call ‘new’ on it.

2

solved got blank output in javascript