Using parse.com and the JavaScript SDK, I want to create a query that checks if a user is already existing.
There is example code here, which I've adopted and turned into the below code block. I'm getting an Uncaught ReferenceError: username is not defined error, which I don't understand why?
https://www.parse.com/docs/js_guide#users
var friendFinder = Parse.Object.extend("_User");
var query = new Parse.Query(Parse.User);
query.equalTo(username, "d"); // find users that match
query.find({
success: function (friend) {
if (friendName.length) {
console.log("Success")
}
},
error: function (error) {
//Show if no user was found to match
}
});