Is this the correct way to access a column through a pointer?

时间:2016-07-11 22:50:48

标签: javascript parse-platform

I have a pointer to the user class and I am trying to access the phone number. The name of the column inside the user class is "phone". Is this the correct way to access the value?

query.include("User");
query.each(function(test) {
  var usernum = test.get('User.phone');
});

1 个答案:

答案 0 :(得分:0)

您可以将test.get('User')视为_User,然后使用user.get('phone')

query.include("User");
query.each(function(test) {
  var user = test.get('User');
  if(user) console.log(user.get('phone'));
});