JSFiddle - React, Tailwind, and code Playground

by fkling

JavaScript

Y = "foo bars baz";
X = "bar";

alert(Y.substring(0, Y.indexOf(X) + X.length))