Azeem812
2 weeks ago

How to assign value to global variable outsie of a function

Posted 2 weeks ago by Azeem812

var MyTotal

function calculateTotal(no){

                var price=document.getElementById("price"+no).value;
               
                var qty=document.getElementById("qty"+no).value;
                    
                    
                var total=price*qty; 
                  alert(total);
               
                return total;

i want to assign total variable value to MyTotal variable,how do this?

Please sign in or create an account to participate in this conversation.