在Javascript中使用变量声明集合

时间:2019-01-24 20:50:21

标签: javascript node.js sendgrid sendgrid-api-v3

这是我的初始代码。 POST.message中的字母和空格有效,但问号无效。

const msg = {
    to: 'form.data@mydomain.com',
    cc: POST.email,
    from: 'form.data@mydomain.com',
    subject: 'New Message From Contact Form',
    text: POST.message
};

我不得不更改此代码。

var msg = {
    to: 'form.data@mydomain.com',
    cc: '',
    from: 'form.data@mydomain.com',
    subject: 'New Message From Contact Form',
    text: ''
};

msg.cc = POST.email;
msg.text = POST.message;

有人可以解释这种行为吗?

0 个答案:

没有答案