//I want when user press key interval stop , than new interval start again but old interval cant stop Answer You have two problems. You have var interval inside your function so it gets reset every time the function runs. setTimeout will call a function, once, after a time period. It won’t clear an interval, you need clearInterval for that.