here is the code
<button id="show">Show</button>
<script>
function sayMessage (fName, lName) {
let message = `Hello`;
function concatMsg() {
message = `${message} ${fName} ${lName}`;
}
concatMsg();
return message;
}
document.getElementById("show").onclick = sayMessage("Moro", "Mero"); // Not Working!!
console.log(sayMessage("Moro", "Mero"));
</script>
It prints Hello Mohamed Shaker in the console. but when I try it using the button to show it in my html it doesn't work!
I'm trying to get the same result that appeared in the console but in my html page and it didn't work!