使用计算属性键访问对象值

时间:2017-10-19 10:45:24

标签: javascript object ecmascript-6

我正在写一个小帮手,应该得到一个数组的min项。

该函数将function autoCalculatePlanner(week, year) { alert("Accessed Function. Week = " + week + " Year = " + year); xhttp = new XMLHttpRequest(); xhttp.open("GET", "ajax/auto_calculate_planner.php?week=" + week + "&year=" + year, true);; xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { alert("State Ready"); document.getElementById("test").innerHTML = this.responseText; alert("Document Submitted"); } else { document.getElementById("test").innerHTML = "Error"; } }; xhttp.send(); } 作为第一个参数和"路径"访问对象属性'休息'参数。

例如:Array

console.log:minItem(stops, 'duration', 'total');

预期:// [object object][duration][total]



// Number, Which is the value of total




0 个答案:

没有答案