JSFiddle - React, Tailwind, and code Playground

HTML

<button id="button">Тест</button>

JavaScript

var button = document.getElementById('button');

button.addEventListener('click', function () {
    test();
}, false);


/**
 * Phone
 */
function Phone(name, size) {
    this.name = name || 'Phone';
    this.size = size || {
        w: 50,
        h: 50
    };
    
    this.showNameAndSize = function () {
        var size = this.size;
        alert(name + ' - width: ' + size.w + ', height: ' + size.h);
    };
}

Phone.prototype.getName = function () {
    alert(this.name);
};

Phone.prototype.getSize = function () {
    var size = this.size;
    alert('width: ' +size.w + '; height: ' + size.h);
};

/**
 * Nokia
 */
function Nokia(name, size) {
    Phone.apply(this, arguments);
};

function test() {
    
    var nokia_1 = new Nokia(),
        nokia_2 = new Nokia('Nokia 6600', {w: 100, h: 200});

    if (nokia_1.hasOwnProperty('getName')) {
        nokia_1.getName();
    } else {
        console.log('getName is undefined');
    }
    
    if (nokia_1.hasOwnProperty('getSize')) {
        nokia_1.getSize();
    } else {
        console.log('getSize is undefined');
    }
    
    if (nokia_1.hasOwnProperty('showNameAndSize')) {
        nokia_1.showNameAndSize();
    } else {
        console.log('showNameAndSize is undefined');
    }
    
    if (nokia_2.hasOwnProperty('getName')) {
        nokia_2.getName();
    } else {
        console.log('getName is undefined');
    }
    
    if (nokia_2.hasOwnProperty('getSize')) {
        nokia_2.getSize();
    } else {
        console.log('getSize is undefined');
    }
    
    if (nokia_2.hasOwnProperty('showNameAndSize')) {
        nokia_2.showNameAndSize();
    } else {
        console.log('showNameAndSize is undefined');
    }
    
    
}