Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

if typeof variable javascript

// check if a variable is of a certain type
var myVar = "This is a string";

if (typeof myVar === "string") {
	console.log("It's a string!");
} else if (typeof myVar === "number") {
	console.log("It's a number!");
};
// would return "It's a string!" in this case
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to pass token in laravel in jquery ajax 
Javascript :: asyncstorage react native 
Javascript :: javascript check date greater than today 
Javascript :: change name of html element javascript 
Javascript :: refresh a page in jquery 
Javascript :: concurrently script 
Javascript :: remove after js 
Javascript :: js check if number has decimals 
Javascript :: pangram javascript 
Javascript :: html javascript redirect 
Javascript :: redirect through javascript 
Javascript :: get a element using name in jquery 
Javascript :: color p5js 
Javascript :: regex check from a-z 0-9 
Javascript :: java superscript numbers 
Javascript :: js trigger mouseover 
Javascript :: regex match to first instance 
Javascript :: center an element react native 
Javascript :: download image jquery onclick 
Javascript :: filter array of objects to remove duplicate keys 
Javascript :: javascript check if set 
Javascript :: importing svg into react 
Javascript :: alias import javascript 
Javascript :: how to change css with js 
Javascript :: jquery empty and append 
Javascript :: foreach object js 
Javascript :: javascript get last item in array 
Javascript :: discord js how to mention bot 
Javascript :: nextjs path alias 
Javascript :: ajax delete laravel 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =