Answers for "if in javascript string"

16

if string javascript

if (typeof myVar === 'string') { /* code */ };
Posted by: Guest on July-23-2020
29

javascript contains substring

var str = "We got a poop cleanup on isle 4.";
if(str.indexOf("poop") !== -1){
	alert("Not again");
}
//use indexOf (it returns position of substring or -1 if not found)
Posted by: Guest on July-18-2019
1

if is a string javascript

function isString(x) {
  return Object.prototype.toString.call(x) === "[object String]"
}
Posted by: Guest on April-06-2021

Code answers related to "if in javascript string"

Code answers related to "Javascript"

Browse Popular Code Answers by Language