Skip to content Skip to sidebar Skip to footer

How To Add 3 Results With Js?

How to add 3 results with js ? I mean I have 3 calculators and I got a result from each one. How to combine them into one result ? Like if one is 3 and another is 7 it would get me

Solution 1:

create a new function called sum_stuff:

functionsum_stuff(input1, input2, input3, output) {
    output.innerHTML = parseInt( input1.innerHTML ) + parseInt( input2.innerHTML ) + parseInt( input3.innerHTML );
}

and call it like:

sum_stuff(c, f, j, elem_to_print_into);

and the elem_to_print_into is another input field

Post a Comment for "How To Add 3 Results With Js?"