There are times when you don't want a piece of code to run straight away but instead want to wait a while before running the code. setTimeout allows you to specify a function that is to be run after a delay of a specific number of milliseconds.
So why would you want a delay? well there are a number of reasons with the main use being for animation effects.
You can even allow for changing your mind about running the function in between running the setTimeout and when the function actually starts by assigning the value returned from the setTimeout to a variable and then passing that variable into clearTimeout so as to cancel the function's execution before it starts.
A common mistake in using this function is to pass in a string as the first parameter. The function actually takes a function as the first parameter and so when you do make that mistake the browser has to first convert the string to a function before it can run the setTimeout. It is far more efficient if you do the conversion yourself and pass in a function.
s = document.getElementById('searchbox');