JSFiddle - React, Tailwind, and code Playground

by Lucio Tato

JavaScript

//MyError class constructor
    function MyError(msg){
        this.__proto__.__proto__ = Error.apply(null, arguments);
    };


    function someFunction(){
        try{
            throw new MyError('some message');
        } catch(e){
            //console.log(e);
            //console.log(e.stack);
            // 
            document.body.innerHTML = '<pre>'
            +'e instanceof MyError: '
            + (e instanceof MyError?'TRUE':'FALSE')+'\n\n'
            + e.message+'\n\n'
            + e.stack
            +'</pre>';
        }
    };
        
    someFunction();