I am trying to write a boolean currying function in javascript.
let s = "ajkjxa";
function isPresent(a) {
return function (b) {
if (b) {
return isPresent(s.includes(b) && s.includes(a));
} else {
return s.includes(a);
}
};
}
console.log(isPresent("a")("j")("x")());//true expected
console.log(isPresent("a")("j")("x")('b')());//false expected
I want isPresent function should return true if the passed arguments present is the given string else it should return false.