0

I am trying to return multiple parameters with jquery but it gives me only the first parameter

<button class="call">Click</button>

$.readHash = function(a,b){ 
  var a = '1';
  var b = '2';
  return a;
  return b;
}


$(".call").click(function(){
 var a = $.readHash(a);
  alert(a);
  var b = $.readHash(b);
  alert(b);
});

I guess i am doing something worng?

Jack Maessen
  • 1,780
  • 4
  • 19
  • 51
  • 1
    `return` immediately ends a function and returns the value. Nothing after it is called. Put your values in an Object and return the entire Object. But here you are also trying to pass variables `a` and `b` to `readHash()` before you have defined them. – mykaf Jan 26 '23 at 21:06

0 Answers0