Search This Blog

2026/08/11

Javascript:Guess output if given code

 


Guess output of following code.

Code:
setTimeout((a,b)=>{
  console.log(a+b)
},1000,1,2,3)

Output:
3

Explanation:
Here 1000 is timeout deplay microseconds while parameters 1,2,3 are
parameter for callback function inside setimeout,inner callback function prints
a+b i.e 1+2 i.e. 3

No comments:

Post a Comment