JSFiddle - React, Tailwind, and code Playground

JavaScript

var classExtension = {
    toYN: function(){
        return this == false ? 'N' : 'Y';
    }
};

function getNewClass(val){
    var newBool = new Boolean(val);
    jQuery.extend(newBool, classExtension);
    return newBool;
}
        
var newTest = getNewClass(false);
if (newTest) alert('Its alive');
if (newTest == false) alert('And still a bool');
alert(newTest.toYN());