Can use charAt(0) === '0' or startsWith('0'). Both work to check if the first character is '0'
var str = "01234"; // Example string
if (str.charAt(0) === '0') {
console.log("First character is 0");
} else {
console.log("First character is not 0");
}
var str = "01234"; // Example string
if (str.startsWith('0')) {
console.log("First character is 0");
} else {
console.log("First character is not 0");
}