我在这里试图弄清楚这个过程中我不知道该怎么做,我打印出来了(CMD):'变量1 /变量2 = NaN',其中两个变量都是数字2
testData.topics[z].percentageMark :2
testData.topics[z].questions.length :2
typeof(testData.topics[z].percentageMark) :number
typeof (testData.topics[z].questions.length) :number
FINAL : testData.topics[z].percentageMark :NaN
这是代码的结果(对大对象不好意思):
console.log("testData.topics[z].percentageMark :" + testData.topics[z].percentageMark);
console.log("testData.topics[z].questions.length :" + testData.topics[z].questions.length);
console.log("typeof(testData.topics[z].percentageMark) :" + typeof (testData.topics[z].percentageMark));
console.log("typeof (testData.topics[z].questions.length) :" + typeof (testData.topics[z].questions.length));
testData.topics[z].percentageMark = ((testData.topics[z].percentageMarks)/(testData.topics[z].questions.length));
console.log("FINAL : testData.topics[z].percentageMark :" + testData.topics[z].percentageMark);
我真正感到困惑,在这里做什么,我看不出这里简单的划分是行不通的。
第5行代码...'percentageMarks'!=='percentageMark' –