How to append a string value during assignment in Javascript?
问题 Hey i dont know if that is possible but i want to set a given variable in js by reference . What i want to do is, that each time i pass a string to the function addstring that the value of the textfield is added like += function addstring(string) { document.getElementById("string").value = string; // its a textfield } How can i do that? 回答1: += works fine. var str = "stack"; str += "overflow"; console.log(str); //alert(str); Use firebug!! stackoverflow 回答2: Javascript does not support passing