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">

JavaScript

var str = "FruityLoops";

str = str.replace(/([a-z])([A-Z])/g, '$1 $2');

alert( str );