Right syntax of lambda javascript
You need curly brackets, as the part after the =>
is a function body:
var row = {title: "", attribute:"", width: ""};
list.forEach( list => {
row.title = list.label;
row.attribute = list.label;
row.width = "300px";
});
(Be advised that if this is the code you are actually running, the values in row
will be set to the values of the last entry in list.)
Try:
var row = {title: "", attribute:"", width: ""};
list.forEach( list => {
row.title = list.label;
row.attribute = list.label;
row.width = "300px"
});
Notice the curly braces.