Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

alert text & variable JavaScript

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);

1 Answers

var name = "John Doe";

function myFunction() {
  alert('Hello ' + name);
}
<button onclick="myFunction()">Checkout</button>
like image 176
Geethu Jose Avatar answered Sep 09 '25 10:09

Geethu Jose