Debouncing is a technique used in JavaScript to limit the frequency of a function call that gets triggered repeatedly within a short period. It is often used in scenarios where an event (such as scrolling,resizing or api calls with search input change) can trigger frequent function calls, but you want to ensure that the function is only executed once after a certain delay when the event has stopped. Code to implement 'Debounce' in Javascript: HTML code:

 <input type="text" onkeyup="search()">

JavaScript code:

let timerId;
let delay=1000;

function debounce(callback, delay) {
  if(timerId) {
  timerId = setTimeout(()=>{

function api() {
   console.log('api call code here');

function search() {
  debounce(api, delay);