DEV Community

Discussion on: Review of my first JavaScript code?

Collapse
 
strdr4605 profile image
Dragoș Străinu

There is no need to init the text variable on top of the function. Just init it before setting innerHTML

const text = `Hello ${rebelName}, you have a total of ${xWings} xWing fighter pilots. Good luck!`;
document.getElementById("demo").innerHTML = text;
Collapse
 
novajay2415 profile image
NovaJay2415

Thank you for your feedback! Taken into account.