JavaScript test for integer / string

I couldn’t find either of these functions that satisfied my edge cases or desire for simplicity so I wrote/adapted some of my own. Feel free to use, modify, distribute without attribution, but I’d be eternally grateful if you did ;)

The test for integer is adapted from this post, which is actually almost spot on, apart from their is_int([0]) returns true, as does any integer in a string.

I’m pretty sure I’ve seen this test for string a hundred times on the internet and in books. It is by far the most robust:

Please let me know if you can break it!

1,138 thoughts on “JavaScript test for integer / string

  1. For those seeking an event where the odds-setters more or less checked the stats and left it at that ACA 203 in Tashkent is a gold mine for you .

  2. ACA 203’s fight card landing in Tashkent on May 8 provides a definitive glimpse into the elite gritty fighting style that characterizes the organization known as Absolute Championship Akhmat.

  3. Should you be on the hunt for a fight card where the bookmakers essentially glanced at the win-loss columns and stopped there ACA 203 in Tashkent is a gold mine for you .

  4. Come this May the vibe inside Tashkent’s Humo Arena won’t only be charged by the din of loyal local fans ; rather it will hang thick with the professional extinction risk of men who’ve pursued championship gold their entire careers . ACA 203 represents more than a routine stop on the circuit ; instead it serves as a career crossroads .

  5. UAE Warriors 70 is not simply another routine regional show. In the Middle East this is the premier forge where prospects are either tempered into diamonds or shattered into dust.

  6. When you examine the deeper numbers on GidStats it becomes clear that Medkouri is significantly more economical with his volume and doesn’t tire the instant wrestling is required. Neves shows up surrounded by all that “devastating striker” talk.

  7. What’s up everyone, it’s my first visit at this
    web site,
    and piece of writing is really fruitful in support of me, keep up posting
    these types of posts.

  8. ACA Young Eagles 64 which happens in mid-May 2026 in Grozny is a textbook case of a lineup where the odds regularly distort the actual difference in abilities especially in the developmental tiers of the Absolute Championship Akhmat .

  9. UFC ACA Young Eagles 64 Georgy Shakhruramazanov vs Turpal Gediev ACA Young Eagles 64 isn’t just another developmental card ; instead it serves as a high-stakes sorting mechanism .

  10. UFC Shakhruramazanov vs Gediev ACA Young Eagles 64 is going down in Grozny Chechnya and if you think the bookies have a perfect handle on these developmental prospects you’re about to learn an expensive lesson.

  11. ACA Young Eagles 64 set to take place in mid-May 2026 stands as a classic illustration of a fight card where the popular narrative regularly fails to reflect the actual gap in capabilities especially when looking at the developmental divisions of the Absolute Championship Akhmat .

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>