JavaScript the Fun Part


home

editor


const log = console.log;

function A( x, y ){
    this.x = x;
    this.y = y;
}

const a = new A( 1, 2 );
log( a );
log( a.x );
log( a.y );

function B( x, y, z ){
    A.call( this, x, y );
    this.z = z;
}

const b = new B( 4, 5, 6 );
log( b );
log( b.x );
log( b.y );
log( b.z );

Update: Tue Aug 06 2019 19:46:26 GMT+0430 (Iran Daylight Time)