Javascript for循环中对象的引用特定属性
我的解析云代码中有一个Javascript for循环中对象的引用特定属性,javascript,parse-platform,Javascript,Parse Platform,我的解析云代码中有一个matchCenterItem对象,其属性包括categoryId、minPrice等。我要做的是迭代用户拥有的matchCenterItem的每个实例,然后在代码中引用它的特定属性。比如说: Parse.Cloud.define("MatchCenterTest", function(request, response) { var matchCenterItem = Parse.Object.extend("matchCenterItem"); for (
matchCenterItem
对象,其属性包括categoryId、minPrice等。我要做的是迭代用户拥有的matchCenterItem
的每个实例,然后在代码中引用它的特定属性。比如说:
Parse.Cloud.define("MatchCenterTest", function(request, response) {
var matchCenterItem = Parse.Object.extend("matchCenterItem");
for (let i of matchCenterItem) {
console.log(i.categoryId);
console.log(i.minPrice);
}
success: function (httpResponse) {
console.log('It worked!');
response.success('Yay!');
},
error: function (httpResponse) {
console.log('error!!!');
response.error('Request failed');
}
});
这显然是错误的,我只是不知道如何形成语法来正确实现这一点 您需要查询类以查看内容:
Parse.Cloud.define("MatchCenterTest", function(request, response) {
var query = new Parse.Query("MatchCenterTest");
query.limit(10);
query.find().then(function(results) {
for (i=0; i<results.length; i++) {
console.log(results[i].get('categoryId'));
console.log(results[i].get('minPrice'));
}
response.success('Cool');
}, function(error) {
response.error('Uncool');
});
});
Parse.Cloud.define(“MatchCenterTest”),函数(请求、响应){
var query=newparse.query(“MatchCenterTest”);
查询.限额(10);
query.find().then(函数(结果){
(i=0;我可能是@JoeBlow的复制品,我甚至没有注意到,谢谢你提醒我!