Encapsulation in javascript - method 2/3