How to pass funtion's argument's name as string into nested function? I have 2 variables, let's say name1=5 and name2=10, i wanted to make a function that would use one of those variables values and in other place use the variable's name as string.
var name1 = 5
var name2 = 10
function func(arg){
document.getElementById("a1").innerText = arg //that works fine, it sets the text as 5 or 10
document.getElementById("arg" + "some string").innerText = "some other string" // here i need the argument's name as string, for example "name1".
}
I hope that my question is understandable, english is not my default language.