Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View JensThanx's full-sized avatar

Jens JensThanx

  • Germany
View GitHub Profile
@JensThanx
JensThanx / privateFields.js
Created November 13, 2015 15:16
private fields, getter/setter in JS
function MyClass( paramA ){
propertyR = "this property is read-only";
this.getPropertyR = function(){
return propertyR;
};
function privateMethod() {
return "privateMethod() is a private method";
}
@JensThanx
JensThanx / privatePublic.js
Last active November 13, 2015 15:15
private fields and methods in JS
function MyClass( paramA ) {
// public member
this.member = paramA;
// private member, only accessible from the inside
value1 = 3;
// very private member, only accessible from private and priviliged actors
var value2 = 6;