I have two variables that I need to join and then print the value of a different variable which has the name of the variables I just joined.
I have:
var NoQ = "1234, 4321, 6789"
var NoQ1 = "Number: " + NoQ.slice(0,4);
var NoQ2 = "Number: " + NoQ.slice(5,9);
var i = 1 //i is in a for loop so i++
console.log(NoQ+i)
//prints 1234, 4321, 67891
I want NoQ
and i
to join to technically become NoQ1
before logging.
Expected output: Number: 1234
How do I achieve this?
Any help is appreciated.