JSFiddle - React, Tailwind, and code Playground
JavaScript
if (typeof String.prototype.startsWith != 'function') {
// see below for better implementation!
String.prototype.startsWith = function (str){
return this.indexOf(str) == 0;
};
}
var data = "Pankaj Garg";
var input = 'Pankaj';
if(data.startsWith(input))
{
alert("ok");
}
else
{
alert("not ok");
}