DEV Community

Cover image for Javascript: isFunctions
Kurapati Mahesh
Kurapati Mahesh

Posted on • Edited on

Javascript: isFunctions

In every language, we need to validate data before modifying or displaying it.

So, here in the case of javascript also we almost regularly use these functions and we maintain all these in single util class to reuse quickly.

No further theory let’s jump into stuff.

Basically,

Use the above reference and write isFunctions now:

isNumber

(+/-)Infinity is of type number in javascript as if you want to avoid then you can update logic as:

isBoolean

isString

isObject

isArray

isFunction

isInteger
We can use Number.isInteger(value)

Yes. There are some exceptions based on where do we use these functions.

Please do suggest if I miss any mandatory validations in the above isFunctions.

Hope these help to a little extent instead of going over lengthy explanations around the globe 😝.

Thank you! Happy Reading :)


💎 Love to see your response

  1. Like - You reached here means. I think, I deserve a like.
  2. Comment - We can learn together.
  3. Share - Makes others also find this resource useful.
  4. Subscribe / Follow - to stay up to date with my daily articles.
  5. Encourage me - You can buy me a Coffee

Let's discuss further.

  1. Just DM @urstrulyvishwak
  2. Or mention
    @urstrulyvishwak

For further updates:

Follow @urstrulyvishwak

Top comments (1)

Collapse
 
homan_sohail_be078b2db5f0 profile image
Homan Sohail

Image description