fork download
  1. var Person = (function() {
  2. var _salary = Symbol(); //prywatna wlasnosc
  3.  
  4. var Person = function (name) {
  5. this.name = name; //publiczna wlasnosc
  6. this[_salary] = NaN; //wlasnosc indeksowana symbolem - to nie to samo co this["_salary"]!
  7. };
  8.  
  9. Person.prototype.getSalary = function() {
  10. return this[_salary];
  11. };
  12.  
  13. Person.prototype.setSalary = function(salary) {
  14. this[_salary] = salary;
  15. };
  16.  
  17. return Person;
  18. }());
Runtime error #stdin #stdout #stderr 0.4s 381888KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
js: uncaught JavaScript runtime exception: ReferenceError: "Symbol" is not defined.