JSFiddle - React, Tailwind, and code Playground

JavaScript

var text = 'google.co.uk';

var index = text.indexOf('.');

var first = text.substring(0, index)

var second = text.substring( index + 1);

alert(first);
alert(second);