In the above program, the add function is used to find the sum of two numbers. Array traversal and typecasting. You expert code ninjas should already know what this does by now. Example. Consolelog total_js 15. Add Two Number Program in JavaScript - Using javascript we can find sum of any two number, here we receive input from user. But one tiny bit of advice here – We cannot set the prompt() function to have multiple fields at once, nor can we restrict the input to numbers… So stick with using HTML