So I've been needing something like this for a bit now but never been able to find something that suits my needs, Most likely I'm searching the wrong things!
My goal is to put a parameter from a function like foobar("test") and put the parameter plus some pre-written strings from the function and plus them together and therefore becoming a pre-existing variable...
I think I'm explaining very poorly... but hopefully, the code example gets a better explanation...
I've tried a few simple things that were obvious won't work so I most likely don't need to show what I did...
var text1 = "this is text"
function foo(id) {
object.innerHTML = "text" + 1 // Then plus those together and make it set it to the variable text1
}
foo(1)
Expected: I would want it to write in the object "this is text" because it makes text and the id variable aka a 1 into text1 which is a variable with the string of "this is text"
Actual Results: Obviously that won't work I don't even need to write it to be able to find out that this won't work... Just an example to better explain...
Hopefully you can help, thx!