I'm new in learning JavaScript. Just for some test I built this function and call it and assign a variable in it to a complete result. Is there a way use the function like this example?
Here I want to just pass #country in the dom(i) function. So it should be getElementById("maid"), and after calling it, assign = maid to put this maid variable after innerHTML =.
I'm wondering is it possible to write JavaScript function like this way?
var maid = "Made In Yiappa";
function dom(i) {
var docs = document.getElementById(i).innerHTML;
return docs;
}
dom("country") = maid;
<p> The result is: <span id="country"></span> </p>