Encapsulation in javascript - method 1b/3