How do I additionally test for numbers like 01 or 0080?
This is my current test.
const arr = ["01/05/2023", "1ert", "0fer", "blah", "0", "", "123", "1e3", "1*4", "0080", "1.34", "1,00", "-2"]
function validNumber (a) {
let regex = /^\d+$/;
a.forEach((string) => {
if(!string.match(regex)) {
console.log("not a number:", string)
} else {
console.log(parseInt(string))
}
})
}
this test works however I dont want users thinking they can input numbers with leading zeros.