pass dynamic value in js string html code example
Example 1: how to pass dynamic string in string javascript
const poem = "The Wide Ocean";
const author = "Pablo Neruda";
const favePoem = `My favorite poem is ${poem} by ${author}.`;
Example 2: pass dynamic javascript value to html
function myFunction(no) {
if (document.getElementById("showHide"+no).style.display=="none")
{
document.getElementById("showHide"+no).style.display="block";
}
else
{
document.getElementById("showHide"+no).style.display="none";
}
}