10 Matching Annotations
  1. Sep 2016
    1. var myNamespace = (function () {   var myPrivateVar, myPrivateMethod;   // A private counter variable  myPrivateVar = 0;   // A private function which logs any arguments  myPrivateMethod = function( foo ) {      console.log( foo );  };   return {     // A public variable    myPublicVar: "foo",     // A public function utilizing privates    myPublicFunction: function( bar ) {       // Increment our private counter      myPrivateVar++;       // Call our private method using bar      myPrivateMethod( bar );     }  }; })();

      Module Template

    2. Literals

      Als Literal (lateinisch littera ‚Buchstabe‘) bezeichnet man in Programmiersprachen eine Zeichenfolge, die zur direkten Darstellung der Werte von Basistypen (z. B. Ganzzahlen, Gleitkommazahlen, Zeichenketten) definiert bzw. zulässig ist.

    3. Car.prototype.toString = function () {  return this.model + " has done " + this.miles + " miles";};

      moving the toString() function out of the constructor! Why? otherwise its redefined every time the constructor is called see above!