If you're coming from a class-keyword language like Java or C++, then this might help you.
In JavaScript a function can be used as a constructor for an object, as you did here:
var Npc = function() {
this.name='Hello world';
}
var data = new Npc();
By way of loose analogy to a class-keyword language, the "name" property is an instance variable defined in a "class" called Npc. So the expression data.name is perfectly logical.
In JavaScript a function is also an object, which is how you used it here:
Npc.attr='my new attribute';
Again by way of loose analogy to a class-keyword language, Npc.attr is like a static class member. So attr is a member of Npc and not a member of any instance of Npc.