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,645 thoughts on “JavaScript test for integer / string

  1. Здорова народ Брат потерял человеческий облик Родственники в полном отчаянии В диспансер тащить — последнее дело Короче единственные кто взялся за безнадёжный случай — вывод из запоя в стационаре самара недорого Провели полную детоксикацию В общем не потеряйте контакты — вывод из запоя в стационаре вывод из запоя в стационаре Звоните прямо сейчас Это может спасти жизнь

  2. Самара всем привет Брат потерял человеческий облик Соседи уже вызвали участкового В диспансер тащить — последнее дело Короче спасла только госпитализация — запой стационар с комфортными условиями Врачи и медсёстры 24/7 В общем телефон и цены тут — наркология вывод из запоя в стационаре наркология вывод из запоя в стационаре Стационар — это единственный выход Перешлите тем кто в беде

  3. Люди подскажите Брат снова сорвался Дети напуганы Нужна срочная помощь на дому Короче единственное что вытащило из запоя — поставить капельницу от запоя на дому цена выгодная Приехали через 40 минут В общем вся инфа по ссылке — поставить капельницу от запоя https://detoks.kapelnicza-ot-zapoya-ekaterinburg-nmx.ru Звоните прямо сейчас Перешлите тем кто в такой же ситуации

  4. Overall, Big Bass Bonanza offers an engaging blend of entertainment and potential rewards. With its charming graphics, exciting gameplay, and multiple winning features, it provides countless hours of enjoyment. Plus, the availability of the big bass bonanza demo ensures that all players, regardless of experience level, can dive into the fishing adventure with confidence. As you cast your line into the reels, may you net big wins and memorable fish tales! To maximize the winning potential, players must first comprehend the game mechanics. Bigger Bass Bonanza operates on a 3×5 play board with 12 possible paylines. A win is triggered by matching three identical symbols along these paylines. Find the dream catch of the day in Bigger Bass Bonanza slot, the Pragmatic Play slot that’s certainly not fishy!
    https://internationalsourcing.com.au/book-of-dead-arvostelu-ja-pelaajien-kokemuksia/
    Big Bass Bonanza wasn’t much of a game when it was discovered after being released into the waters by Pragmatic Play. It offers players simplified gaming dynamics, but its free spins bonus game caught the eye of many fishing slot enthusiasts.  Playing Bigger Bass Bonanza is just as simple as you would expect from a game built on a pursuit thousands of years old. Simply choose your coins per line, coin value, and total bet. You will then be ready to cast with the best of them. Many casinos change things up occasionally – some more often than others, it doesnt matter if your first wager is successful or not. There is no more information and the complaint remains unsolved, which will be initially added to each collection. You can win a total of 20,000 times the size of your bet in this game, giving you a great chance of getting a jackpot. By the way, you can take a look at the payout table to get an idea of what it pays out. Best online casinos review.

  5. Здорова народ Объездил кучу салонов — везде перекупы То фасады кривые Короче единственные кто не наваривается — кухни на заказ спб с установкой Проект бесплатно В общем вся инфа вот здесь — кухни на заказ производство спб кухни на заказ производство спб Не ведитесь на салоны-прокладки Сам мучался теперь делюсь

  6. Слушайте кто реально сталкивался с такой бедой? Брат снова жестко сорвался после долгого перерыва Соседи уже стучат в стену и грозятся вызвать полицию В обычную государственную больницу тащить человека просто страшно пока чисто случайно не наткнулся на экстренных наркологов с лицензией начиная от качественной детоксикации на месте и заканчивая подбором медикаментов. Врачи приехали на вызов буквально через 40 минут Кому тоже экстренно необходим проверенный круглосуточный телефон наркологии жмите на источник чтобы случайно не потерять контакты поставить капельницу от запоя https://nedorogoy.kapelnicza-ot-zapoya-ekaterinburg-nmx.ru Лучше сразу звонить профессионалам и не заниматься опасным самолечением. обязательно перешлите этот пост тем кто тоже сейчас находится в такой же критической ситуации

  7. Our editor allows you to apply audio effects and filters to audio tracks in video and audio files. Here are some of the most popular ones: sound normalization, volume correction, echo, reverberation, equalizer and others. Whether you want to make a video wedding invitation or edit to enhance your wedding videos, this Vidmore Video Converter is your go-to tool for sure. Don’t be surprised when a video converter tool like Vidmore’s is an option, as it’s an all-in-one video converter equipped with essential editing tools. The software for Windows and Mac features a Toolbox containing various powerful tools like a reverser, rotator, compressor, cropper, and more along with other handy options. Video Editor · Download this Wedding Video editor for FREE now and create beautiful Music Slideshow and share it with friends and family for best occasions.
    https://sites.google.com/view/visitarbetanocasino/%D0%B3%D0%BE%D0%BB%D0%BE%D0%B2%D0%BD%D0%B0-%D1%81%D1%82%D0%BE%D1%80%D1%96%D0%BD%D0%BA%D0%B0
    To cancel your Alight Motion subscription, follow these steps based on your device’s platform. For Android users, open the Google Play Store, tap the profile icon, select “Payments & Subscriptions,” then “Subscriptions,” find Alight Motion, and tap “Cancel Subscription.” For iOS users, open the Settings app, tap your name, go to “Subscriptions,” select Alight Motion, and choose “Cancel Subscription.” No Brasil, muitos usuários procuram por “alight motion mod apk português” e “alight motion mod apk baixar grátis”. Aqui você encontra a versão mais recente, sem marca d’água e com todos os recursos premium. Siga o guia acima para instalar e, se precisar de ajuda, fale conosco. You are now ready to download Alight Motion for free. Here are some notes:

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>