#How to check a word is exist in database

4 messages · Page 1 of 1 (latest)

late kernel
wise terrace
#

Hi, when you use push, it will create an array. The code you showed only checks if what you get back is not null or undefined which is not exactly what you want. To check if someone is inside an array you can use the includes method, here is an example:

let data = await db.get(...);
if (data.includes("hi")) {

}

The if will only execute if the array contains hi.

late kernel
#

ahh i see

#

thank you!