我遇到了一个奇怪的不Number
想要的NaN
转换,不知道在哪里以及为什么。我显然在这里遗漏了一些东西,但我不知道是什么。
任何建议都是最受欢迎的!;)
这是javascript代码:
updatedAbsoluteResult = currentlyDisplayedRentability * investment
resultAgainstReferencial = updatedAbsoluteResult - appropriateReferencialRentability * investment
$('#a0').html('currentlyDisplayedRentability: ' + typeof currentlyDisplayedRentability)
$('#a1').html('investment: ' + typeof investment)
$('#a2').html('updatedAbsoluteResult: ' + typeof updatedAbsoluteResult)
$('#a3').html('appropriateReferencialRentability: ' + typeof appropriateReferencialRentability)
$('#a4').html('resultAgainstReferencial: ' + typeof resultAgainstReferencial )
$('#a5').html('resultAgainstReferencial: ' + resultAgainstReferencial )
这是 HTML 输出:
currentlyDisplayedRentability: number
investment: number
updatedAbsoluteResult: number
appropriateReferencialRentability: number
resultAgainstReferencial: number
resultAgainstReferencial: NaN
一切都是数字类型,但是当我想返回最终结果时,我得到“不是数字”的结果。任何人都知道为什么?
享受你的周末!