JSFiddle - React, Tailwind, and code Playground

by Aaron Zhang

JavaScript

(function (String) {
    String.prototype.startsWith = function (str2) {
        var exp = new RegExp('^' + str2);
        if (exp.exec(this)) {
            return true;
        }
        return false;
    };
    String.prototype.endsWith = function(str2){
        var exp = new RegExp('' + str2 + '$');
        if (exp.exec(this)) {
            return true;
        }
        return false;
    };
})(String);