After executing JSLint I'm getting the following message:
Wrap the parameter in parens.
1 Expected '(' before 'info'. const valueArr = (info => { // Line 6, Pos 19
I've read the Lint paren rules but still I'm not sure what the problem is and how to handle it. My code:
const valueArr = (info => {
items.forEach(function(item) {
try {
var xhr = new XMLHttpRequest();
.....
} catch (e) {
console.log(e);
}
});
});
Updated:
I already tried to put it with parens, but another warnings came up:
"Expected 'function' and instead saw '=>'. const valueArr = ((info) => {".
const valueArr = ((info) => {
items.forEach(function(item) {
try {
var xhr = new XMLHttpRequest();
} catch (e) {
console.log(e);
}
});
});
This rule enforces parentheses around arrow function parameters regardless of arity.
(source)
That rule determines that this line:
const valueArr = (info => {
Should be changed to this:
const valueArr = ((info) => {
Because arrow function parameters must be surrounded by parentheses.