I have this code:
var arr = "val=value1&val2=value2"; //coming from query string
var [key, val] = arr.split('=');
return "." + swapped[key.toLowerCase()][val.toLowerCase()];
however, I am having this error on the second line:
Expected identifier
I am having this issue on IE, it's working fine on chrome/firefox.
Any ideas?
I am doing maintenance for an existing site and they're having this issue on IE.
Edit
Here's the full code I have:
url = decodeURI(url);
var swapped = Object.keys(settings).reduce(function (obj, key) {
obj[key.toLowerCase()] = Object.keys(settings[key]).reduce(function (obj2, key2) {
obj2[settings[key][key2].toLowerCase()] = key2;
return obj2;
}, {});
return obj;
}, {});
return url.toLowerCase().split(/[?&#]/).slice(1).map(function (arg) {
var [key, val] = arg.split('=');
return "." + swapped[key.toLowerCase()][val.toLowerCase()];
});
var key = arr.split('=')[0]; var value = arr.split('=')[1];