JSFiddle - React, Tailwind, and code Playground
by djp3d
JavaScript
var key = "s"
var s = key.toUpperCase();
var reg = "(\\" + s + ")";
if (key.length > 0) {
if (!isNaN(key.charAt(0))) {
reg = "(" + s + ")";
}
if (key.charAt(0).match(/^[0-9a-z]+$/)) {
reg = "(" + s + ")";
}
} else {
}
console.log("s: "+s);
console.log("reg: "+reg);
console.log("isNaN(key.charAt(0)): "+isNaN(key.charAt(0)));