How can I tell if string contains both a Single-quote (') and a double-quote (")?
A quick way to check if the string contains both a single quote and a double quote.
if (str.indexOf('\'') >= 0 && str.indexOf('"') >= 0) {
//do something
}
edit: if the character is in the first position, indexOf will return zero.
I'm guessing you want something like /['||"]/.test(str);