Encapsulation in javascript - method 1a/3