'Why isn't my if statement correctly identifying my person variable?
I am currently getting an undefined result for person. I am trying to execute the select statement and get a value so I can use the if statement ?
function createPerson(email, firstName, lastName, notificationInd) {
const person = this.db.run(
`select email_address
from users
where email_address = ?`,
[email],
);
if (person.length > 0) {
console.log("Cannot duplicate email");
} else {
this.db.run(
`INSERT INTO users (email_address,first_name,last_name)
VALUES (?, ?, ?, ?)`,
[email, firstName, lastName],
);
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
