【发布时间】:2021-01-29 21:04:19
【问题描述】:
所以,我有:
const Transaction = {
all: [{
description: 'Luz',
amount: -50000,
date: '23/01/2021',
}, {
description: 'Website',
amount: 056,
date: '23/01/2021',
}, {
description: 'Internet',
amount: -25000,
date: '23/01/2021',
}, {
description: 'App mobile',
amount: 900000,
date: '23/01/2021',
}]
}
然后我在控制台上打印它而不做任何事情:
const App = {
init() {
Transaction.all.forEach((transaction) => {
console.log(transaction)
})
}
输出是:
{description: "Luz", amount: -50000, date: "23/01/2021"}
{description: "Website", amount: 46, date: "23/01/2021"}
{description: "Internet", amount: -25000, date: "23/01/2021"}
{description: "App mobile", amount: 900000, date: "23/01/2021"}
为什么网站数量(声明为056)变成了46??
【问题讨论】:
-
056是 八进制 转换为46十进制。 -
感谢 VLAZ 我不知道并解决了声明数量的问题:Number('056')
标签: javascript