Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
February 23, 2022 04:54 pm GMT

isFunctions in Javascript

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 lets 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 :)


Original Link: https://dev.to/urstrulyvishwak/isfunctions-in-javascript-5d0h

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To