JSFiddle - React, Tailwind, and code Playground

by chrisramakers

JavaScript

// Extending the String Object
function outputbackwards(){
    var out = "";
    for (i=this.length-1;i>=0;i--) {
        out += this.charAt(i);
    }
    return out;
}
String.prototype.backwards=outputbackwards;

// Extending the Number object
function getDouble() {
    return this * 2;
}
Number.prototype.double = getDouble;


// Try it
var myName = "Chris Ramakers";
//document.write(myName.backwards(), '<hr>');

var myAge = 29;
//document.write(myAge.double());