我正嘗試使用的forEach拉姆達一個對象中設置一些值:拉姆達的語法正確的JavaScript
var row = {title: "", attribute:"", width: ""};
list.forEach(list =>
row.title = list.label |
row.attribute = list.label |
row.width = "300px"
);
做工精細只聲明row.title = list.label
當我添加的參數,其餘不正常工作。
什麼是正確的語法?
請注意,術語「lambda」實際上從未在JavaScript中使用過。在JS中,「lambda」被稱爲「匿名函數」。 – JJJ
我認爲它被稱爲_arrow function_。 – frhd
你嘗試過{{}嗎?請參閱https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions – Satpal