Ask coding questions

← Back to all posts
Can a var BE a var
RainBowLion1 (6)

ok i want to have a code change what its changing depending on a number so i have 10 vars named line1 - line_10 right now i have it so it says: number = "line" + line_number but it does not work is this posible beacuse i dont have to have 10 ifs asking if line_number = 1 - 10?

Comments
hotnewtop
ch1ck3n (2334)
x = "yes"
y = x
console.log(y)

yes

so yes it can

TheBest156 (43)

so you want to know what 1-10 is? Well, if that is it, the answer is -9.