Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么要在javascript对象属性中添加双引号?_Javascript - Fatal编程技术网

为什么要在javascript对象属性中添加双引号?

为什么要在javascript对象属性中添加双引号?,javascript,Javascript,我反复查看账单清单,看看每个月有多少收入 let total = 0 for (const singleBill of bills) { const date = new Date(singleBill.appointment.date); const month = date.toLocaleString("fr-FR", {month: "long"}); if (periodAmounts[month]) periodAmounts[month] += single

我反复查看账单清单,看看每个月有多少收入

let total = 0
for (const singleBill of bills) {
    const date = new Date(singleBill.appointment.date);
    const month = date.toLocaleString("fr-FR", {month: "long"});
    if (periodAmounts[month]) periodAmounts[month] += singleBill.amount;
    else periodAmounts[month] = singleBill.amount;
    total += singleBill.amount;
}
console.log(periodAmounts);
我不明白月名
“février”
周围出现的引号,而不是
janvier
。怎么解释呢

// output of console log : Object { "février": 0, janvier: 50 }
更新

原来我使用的浏览器(firefox ubuntu)会自动在属性中添加引号(如果有特殊字符)。此处
février
更改为
“février”


无法提供有效的代码段/代码笔,因为它与浏览器相关。

能否在实时代码段中发布一个(并提及哪个浏览器)?看起来很有趣,我怀疑它和
é
有关,但我无法在Chrome 71上复制它,您在哪个JavaScript环境下运行此代码?如果我用那些properties.Firefox测试一个对象,我不会在chrome的console.log输出中得到引号。在chrome中确实没有报价问题。这不是个问题,但它困扰着我。我的代码有什么需要更改的吗?或者在某处添加引号?我在Firefox中也看到了引号。这很奇怪。Firefox ubuntu quantum 1.0