function message (className, text) {
/*Esta variável*/var message = document.getElementById("message");/*Esta variável*/
message.className = className;
message.innerHTML = text;
setTimeout(function () {
message.innerHTML = "";
}, 2000);
}
I'm just going to use this variable within this function, but I believe that if I leave it as a local every time I call this function JavaScript will have to access the HTML again to fetch this element, how global the element will already be caught. What is more performative?