I want to make a recursive function. Consider I have a function named setoptions and I need to set 2 options so what I will do is call my function twice like this.
setoptions ("ajax",true);
setoptions ("lamda",false);
So to avoid it I should be able to write a function in a way that I can define multiple options like
setoptions({
"lamda": false,
"ajax": true
});
This is same as jquery`s attr function. like
$("#ff").attr("href","#");
$("#ff").attr("data-type","blue");
// can be used as
$("#ff").attr({
"data-type": "blue",
"href": "#"
});
Kindly do not provide workarounds as I need to understand such recursion for learning.
Basic setOption function:
var setOption = function (val1, val2) {
$.someplugin(val1, val);
};