JavaScript Inheritance

JavaScript Inheritance

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    <script id="javascript">
        function Computer(processor)
        {
            this.processor = processor;
        }

        Computer.prototype.assemble = function () {
            alert(this.processor + " - computer is assembled");
        };

        var pc = new Computer("i7");
        pc.assemble();

        var pcTest = pc instanceof Computer;
        alert(pcTest);
    </script>
</body>
</html>

image.png