JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/ui-lightness/jquery-ui.css">
<img src = "http://dummyimage.com/120x90/f00/fff.png&text=my+image" />

JavaScript

String.prototype.containsWord = function(word) {

    var regex = new RegExp('\\b' + word + '\\b');

    return regex.test(this);

};

var myString = 'This is some random string.';

alert(myString.containsWord("random"));