-2
使用一些計算我已經爲變量分配了一些值。angularjs:從多個變量中獲取最高值
console.log("Gain_weight is "+ Gain_weight);
console.log("Gain_smoking is "+ Gain_smoking);
console.log("Gain_exercising is "+ Gain_exercising);
console.log("Gain_foodhabits is "+ Gain_foodhabits);
console.log("Gain_parent_heartattack is "+ Gain_parent_heartattack);
console.log("Gain_alcohol "+ Gain_alcohol);
console.log("Gain_occupation "+ Gain_occupation);
console.log("Gain_workinghrs "+ Gain_workinghrs);
這裏我有Gain_weight,Gain_smoking等的值。如何選擇在AngularJS中賦值最高的變量?
您可以使用最多的方法: Math.max(N1,N2,N3,...,NX) HTTP:// WWW。 w3schools.com/jsref/jsref_max.asp – HotTowelie
會將變量的賦值變爲關聯數組嗎? – Sajal
問題沒有顯示任何解決問題的嘗試。這不是一個代碼編寫服務,您至少應該展示自己解決問題的嘗試 – charlietfl