rnewsome's public fiddles
-
LsKZv
No-Library (pure JS), HTML, CSS, JavaScript
-
Stop Watch - Counts Down (7 days out)
No-Library (pure JS), HTML, CSS, JavaScript
-
Basic Calculator example
No-Library (pure JS), HTML, CSS, JavaScript
-
Simple Object Example
Mootools 1.4.5, HTML, CSS, JavaScript
-
OOP - Base/Prototype Approach
jQuery 1.7.2, HTML, CSS, JavaScript
-
OOP - Hybrid Approach with Inheritance
jQuery 1.7.2, HTML, CSS, JavaScript
-
OOP - Hybrid Approach
An example of how we can leverage lexical scoping to obtain encapsulation of private "shared" variables when using the prototype inheritance model. Prototype methods though can not gain access to private variables declared for an object instance. Since prototype methods are not defined within the execution context of the constructor function they do not have access to these variables via the lexical environment.
-
JSLitmus - Prototype/Closure Speed
Cool example of bench marking with JSLitmus. This example test the construction of objects based on the Prototype and Closure approaches. This technically is not really a valid test between these techniques, since there are several differences between in this implementation that invalidates the precision of the results.
-
OOP - Inheritance Parasitic Example
Using the parasitic pattern introduced by Douglas Crockford. It follows the principles off the adapter design pattern.
-
OOP - Inheritance Prototype Example
Using the prototype to declare class members.
-
OOP - Closure Example
Using closures to declare class members.
-
OOP - Prototype Example
Using the prototype to declare class members.
-
OOP - jLight Example
Follows jQuery's factory pattern.
-
OOP Prototype Inheritance Example
Shows an example of how to use prototype for inheritance. This also tests accessing the base classes private members in the derived object's setOptions method.
-
Immediately Invoked Function Expression (IIFE)
Two examples that show how IIFE can be used to sandbox variables declared within the scope of the anonymous function expression. Check the global object after running these examples - you shouldn't see any references from the code executed.
-
Closure Example
Primitive example of a closure and how lexical scoping (scope chain) can be leveraged.
-
Type Inference
jQuery 1.7.2, HTML, CSS, JavaScript