Hi, I'm trying to add a toBool() "method" inside the Object object using prototype... something like this:
Object.prototype.toBool = function ()
{
switch(this.toLowerCase())
{
case "true": case "yes": case "1": return true;
case "false": case "no": case "0": case null: return false;
default: return Boolean(string);
}
}
var intAmount = 1;
if(intAmount.toBool())
But I'm having an issue trying to access the value of the object from inside the same object method this.toLowerCase()
How should it be done?