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!

4,693 thoughts on “JavaScript test for integer / string

  1. Dinleyin millet Ödemeler aylarca sürüyor destek yok Neredeyse tamamen bırakıyordum Her şey çok hızlı ve güvenli — 1xbet yeni giriş kolay Her gün özel bonus ve bedava bahis kampanyaları var Neyse kaybetmeyin diye tıkla — 1xbet güncel adres 1xbet güncel adres Tek adres 1xbet giriş Bahis yapan herkese yolla

  2. Herkes merhaba Bazı siteler ödeme yapmıyor Neredeyse bahis işini bırakıyordum Her şey şeffaf ve hızlı — 1xbet güncel giriş Her gün bonus ve bedava bahis var Neyse kendiniz görün — xbet xbet Tek adres 1xbet Bahis yapan herkese yolla

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>