在我下面的云代码中,我试图将变量 leanBody 设置为等于某个字符串,但它一直返回一个奇怪的数组 [object Object]。我不知道它为什么这样做。在我努力调试并找到该数组的设置位置时,我尝试过(单独):
- 在全局声明中设置leanBody等于任意字符串
- 然后我尝试将其设置为 varReset 函数中的任意字符串
- 然后我什至注释掉了leanBody = (results.get("messageBody")); 在 afterSave 函数中
我仍然不断收到一条日志,说它等于 [object Object]。
var leanBody = "";
var leanSenderName = "";
var leanSenderId = "";
var randUsers = [];
function varReset(leanBody, leanSenderName, leanSenderId, randUsers){
leanBody = "";
leanSenderName = "";
leanSenderId = "";
randUsers = [];
console.log("The variables were set");
}
Parse.Cloud.afterSave("Lean", function(leanBody, leanSenderName, leanSenderId, randUsers, request) {
varReset(leanBody, leanSenderName, leanSenderId, randUsers);
var leanQuery = new Parse.Query("Lean");
leanQuery.first({
success: function(leanBody, results){
console.log("The first object was retrieved");
console.log("leanBody = " + leanBody);
leanBody = (results.get("messageBody"));
}, error: function(error){
}
});
});