javascript is variable a string
snippet in javascript

javascript is variable a string

user389

if (typeof myVar === 'string'){
    //I am indeed a string
}

js check if variable is string

user5024

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

if (typeof myVar === 'boolean'){
    //I am indeed a boolean
}