Search through a specific value on the database field

Here is the code I have used below to search using a specific field on my database and which is StatusCheck = ‘Active’ and I have used the conditional statements to look through it but then even if the user exists, it skips to the second IF condition to say the user doesn’t exist.

  async search()
const userQuery = new Parse.Query('User');
userQuery.equalTo('username', this.username);
const userResults = await userQuery.find();
if (userResults.StatusCheck = 'Active') {

  const currentUser = Parse.User.current();
  this.firstname = currentUser.get('firstname');
  this.lastname = currentUser.get('lastname');
  this.staffnumber = currentUser.get('staffnumber');
  this.idnumber = currentUser.get('idnumber');

  console.log('User exists');

if(userResults.StatusCheck = 'InActive')
  //this.createCode() != result;
  console.log('User does not exist');

const userResults = await userQuery.find(); is actually an array. So you might want to first check if userResults.length > 0 and then use userResults[0].StatusCheck. You should also be using == instead of = inside the if statements.