I have a function like this:
function x(a,b,c) {
eval("window.document.forms['"+ a +"']."+ b +".value = '"+ c +"'");
}
I understand why eval === evil most of the time, so what's the best way to write that function without using eval? Does the below makes sense? Why?
function x(a,b,c) {
window.document.forms[a].b.value = c.toString();
}