An Interest In:
Web News this Week
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
- April 14, 2024
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
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To