0

How do I connect strings to variables

For example: <script>document.write"hi"(name)</script> I want it to output: Hi Chris (If name = Chris)

10th Dec 2018, 9:06 PM
Christos
Christos - avatar
2 Answers
0
"hi" + name or `hi ${name}`
10th Dec 2018, 9:30 PM
TurtleShell
TurtleShell - avatar
0
if(name == 'Chris') document.write("Hi "+name);
10th Dec 2018, 9:47 PM
Rishi Anand
Rishi Anand - avatar