Hello, I am having a trouble with creating an object in Javascript.
I found something strange that when I used console in Chrome:
function person(){this.Name = "John";}
var a = new person()
Result: undefined
But if I do this
b = new person()
Result: Person {Name: "John"}
Is there any difference between using var
keyword or not using it, when creating an object in javascript?