This page expects console.log window open.
	No need to understand how "helpers" made, just understand what they do.

	

Object.create

Method exist since JS.1.8.5. Syntax: Object.create(proto[, propertiesObject]); // Given object `a` var a = { aa : 'AA' }; // can be used a prototype for object `b` var b = Object.create( a ); // which supplies to object b the properties of parent. // b.aa === 'AA' evaluates to true. // `b` can be assigned another properties: b.bb = 'BB'; cons( a, b ); a.aa = 'new value'; cons( 'change in prototype reflects in descendant: b.aa = ' + b.aa ); cons( 'proper properties are:' ); helpers.each( b, function( prop, value ) { cons( 'prop=' + prop + ' value = ', value ); }); cons( 'properties with prototype chain:' ); helpers.each( b, function( prop, value ) { cons( 'prop=' + prop + ' value = ', value ); }, 'full' ); // When b changes properties assinged from prototype, b.aa = 'overriden'; // then property a.aa becomes unavailable to `b`, but this does not change the property of `a`. // Exercise 1. Check this in browser. // The possible pros: // change in ancestor immediately available in descendant. // long look up time through chain. // The possible cons: // change in ancestor affects descendant; // if this case, clone ancestor object instead of prototyping. // Exercise 2: What will be a prototype chain for `x` below: var x = { xx : 'XX' }; var y = Object.create( x ); y.yy = 'YY'; x = Object.create( y ); // Check your conclusion in browser. // // More complex exercises are using closure and constructors.