Javascript : Prototype method