Unable to store query result inside a variable
The console.log is executed before the promise is fulfilled. This should work:
const checkEmailUsed = (email) =&gt; {
  let sql = &quot;SELECT * FROM users_signup WHERE user_email = ? LIMIT 1&quot;;
  return new Promise((resolve, reject) =&gt; {
    conn.query(sql, email, (err, res) =&gt; {
      if (err) {
        reject(err);
        return;
      }
      resolve(res[0]);
    });
    conn.end();
  });
};

var user = [];
checkEmailUsed(&quot;mikias@email.com&quot;)
  .then((res) =&gt; user.push(res))
  .then(() =&gt; console.log(user))
  .catch((err) =&gt; console.log(err));