I am getting Safari ReferenceError: Can't find variable: Set
error from safari browser. I have checked other browsers but I didn't get any this error all codes working fine for me.
Is anyone can help me here what is wrong here and what is the solution to work my code from all browsers?
Full Demo
Problem Line
var charactersX = new Set([
0,
32, // space
13 // enter
// add other punctuation symbols or keys
]);
// Convert characters to charCode
function toCharCodeX(char) {
return char.charCodeAt(0);
}
var forbiddenCharactersX = new Set([
toCharCodeX("_"),
toCharCodeX("-"),
toCharCodeX("?"),
toCharCodeX("*"),
toCharCodeX("\\"),
toCharCodeX("/"),
toCharCodeX("("),
toCharCodeX(")"),
toCharCodeX("="),
toCharCodeX("&"),
toCharCodeX("%"),
toCharCodeX("+"),
toCharCodeX("^"),
toCharCodeX("#"),
toCharCodeX("'"),
toCharCodeX("<"),
toCharCodeX("|"),
toCharCodeX(">"),
toCharCodeX("."),
toCharCodeX(","),
toCharCodeX(";")
]);