javascript - Check if string contains only digits - Stack Overflow

javascript - Check if string contains only digits - Stack Overflow

瀏覽:652
日期:2025-06-13
I want to check if a string contains only digits. I used this: ... how about var isnum = /^\d+$/.test(val); ... string.match(/^[0-9]+$/) != null; ... String....看更多