0

I tried to swap the values of args in JS Function. My function looks like this:

function swapValues(x,y){ 
return (y,x);}

And I call this function as below:

console.log(swapValues(5,10))

I expected for the output to give me (10,5) but it's 5
So, can you please let me know why it's 5 there?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437

0 Answers0