In setTimeout, the 3thrd+n argument is passed to the callback

Published at Jan 13, 2021

I've never realized that everything we pass from the 3thrd + n via setTimeout is actually passed to the callback function:

function checkParams(...args){
  console.log(args); //> ['b', true, 4]
}

setTimeout(checkParams, 200, /* From here til the end will be passed*/ 'b', true, 4);

Resource