DebounceTimer is not defined

Hello!
First of all, I am clearly very newbie at coding, so I apologize for any obvious questions here.
I am trying to create a search bar to filter products on my online store, and for that I created a repeater and connected it to the product’s database.
I used Yoav’s video tutorial for coding the search bar (Wix Code | How to Create a Search for Your Database - YouTube - note that I did not need a drop down menu, so I followed the tutorial only until 3:36), the code worked just fine before setting the debounce timer, but after that, the search bar stopped working entirely.
As you probably know, all the red dots alert for the same error: ‘debounceTimer’ is not defined.

I have searched here on the forum for a solution but haven’t found any.
I appreciate very much if someone can help me.

Hello Juliana,

The problem here is your using a variable (something to hold information/data) without actually creating it which is why it is giving you this error.

To solve this problem you have to declare it at the top of your code like so:

let debounceTimer;

You have to put it somewhere that will allow it to be seen by your other functions and code (Scope)
Experiment with scope - here

Hope this helps,
Majd

Hi Juliana!
You get this error because the debounceTimer is, well, not defined.
You need to add the following row to your code:

let debounceTimer = //whatever you want it to be

Hope it helps!
Best of luck.

Doron. :slight_smile:

Well, I am feeling kind of dumb now, my code had the “let debounceTimer;” at the top, but it was written wrong. My bad!

Thank you both, Majd and Doron, very much! It is working just fine now!