score:1

Accepted answer
String.prototype.toNumber = function() { return parseFloat(this.toString());}

// or
String.prototype.toNumber = function() { return parseFloat(this as string);}

Related Query

More Query from same tag