JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = 'a=1';
str = str.substring(0, str.indexOf('='));
alert(str);