JavaScript jest zmiennym ciągiem
if (typeof myVar === 'string'){
//I am indeed a string
}
Grepper
if (typeof myVar === 'string'){
//I am indeed a string
}
var value = "test string"
console.log(typeof value === "string")
if (typeof a_string === 'string') {
// this is a string
}
var booleanValue = true;
var numericalValue = 354;
var stringValue = "This is a String";
var stringObject = new String( "This is a String Object" );
alert(typeof booleanValue) // displays "boolean"
alert(typeof numericalValue) // displays "number"
alert(typeof stringValue) // displays "string"
alert(typeof stringObject) // displays "object"