I am trying to eject every results of an array that contain alphabetic characters. For this, I use :
if(gtin.toString().length != 13 || /[a-z\-]+/ig.test(gtin) == true) {
gtin = "null";
}
It's works for some variable… But not every time. For exemple :
- CS230
- C1
- L3940-noir
All of this variables will still appear on the array. Do you have an idea why this doesn't work ? Thank you !