Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Can I put both text and variable in the same alert box I thought the code down would work but it didn't
alert('text'Variable);
Total
var name = "John Doe"; function myFunction() { alert('Hello ' + name); }
<button onclick="myFunction()">Checkout</button>
Add a comment
alert('Your text goes here'+your var goes here);
I find out the code I should have put
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Totaldefined? Please share your full code.