Answers for "javascript if variable is function"

1

How can I test whether a variable has a value in JavaScript?

if (typeof variable == "undefined") {...} --> return true if variable undefined

//An empty string evaluates to FALSE in JavaScript so you can just do:
if (variable) {...}
Posted by: Guest on December-03-2020
6

js check if variable is string

if (typeof myVar === 'integer'){
    //I am indeed an integer
}

if (typeof myVar === 'boolean'){
    //I am i
Posted by: Guest on March-19-2020

Code answers related to "javascript if variable is function"

Code answers related to "Javascript"

Browse Popular Code Answers by Language