Если 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
Puzzled Pollan