This site has been updated.
Reload to display the latest version?
(click here)

Tag:  vanilla js

Test whether variable is a number

18 July, 2020
The post title “Test whether variable is a number” looks like a trivial question, but let’s dig deeper and try to cover all edge cases. I will split it into two problems and will cover them separately. isNumber First I’ll start with the simple problem. You have variable that may or may not be a number. Write a function that will return if it is in fact ‘number’ or otherwise. Here I only need to check the type of given variable. In this situation I have two edge cases. The first one is…