JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = "sgra";

alert(checkDuplicate(str));