I am calling a function on a click event. The return is getting multiplied each time.
btn.on('click', function(){
$.when(foo()).then(funtion(value){
console.log(value);
});
});
function foo(){
//some process
return value;
}
When I click the first time I get one value printed. Second time I get two values and it keeps on increasing.
How to make it return only one value?