I have a string like this "aadsa&ss))as(d?"
, i want to get index of all the special characters from it. I have tried following and getting the values, but i am sure there will be some better way of doing this.
var str = "aadsa&ss))as(d?";
var indexes = [];
for (var i = 0; i < str.length; i++) {
if (str[i] === "&" || str[i] === "*" || str[i] === "(" || str[i] === ")" || str[i] === ">" || str[i] === "<" || str[i] === "?") {
indexes.push(i);
}
}