我有以下一段代碼將多個字符串轉換爲數字,這很好,但我不喜歡它的外觀,並且想知道我是否可以將它寫入更好辦法。在Javascript中添加多個字符串作爲數字
Number(result.channels.electricity.chan[0].day[0]._)
+ Number(result.channels.electricity.chan[1].day[0]._)
+ Number(result.channels.electricity.chan[2].day[0]._)
+ Number(result.channels.electricity.chan[3].day[0]._)
+ Number(result.channels.electricity.chan[4].day[0]._)
+ Number(result.channels.electricity.chan[5].day[0]._)
是否有更清晰的書寫方式?
無數的方法來包裹一個循環這個 – charlietfl