A few points: Your code works, what's the problem? It's a widely-accepted convention to give instantiatable functions (class-like functions like your 'person' function) names that start with a Capital Letter. Whereas instances normally have lower-case names. It's only a convention, but everyone does it so I'd suggest you do it too "this" is the current context. Complicated subject, I recommend reading this explanation