take two inputs from user and add them using callback function

The solution for “take two inputs from user and add them using callback function” can be found here. The following code will assist you in solving the problem.

const add = (input1, input2) =>{
console.log(input1+input2);
return input1+input2;
}
const inp = (abc) =>{
let a = parseInt(prompt(“Enter first number”));
let b = parseInt(prompt(“Enter second number”));
inp1 =Number(a);
inp2 =Number(b);
return abc(inp1,inp2);
}
alert(inp(add));

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in