thx JMRKER
I have tried taking out either the "x=" or "+x",
it's x= and 7 respectively.
Is there any importance for writing "x=" in the function? Can I omit it?
There is another example:
<!DOCTYPE html>
<html>
<body>
<p>Click the button to create a variable, and display the result.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction()
{
var carname="Volvo";
document.getElementById("demo").innerHTML=carname;
}
</script>
</body>
</html>
As I have seen, the function(? sorry if I don't name the parts correctly) here doesn't have anything in quotation after innnerHTML.
Therefore, is the "x="necessary to be put in the function? If so, what's the importance of that? Does it affect anything? I have tried, the factor affects the calculation is y or 2 only. If I change these 2, the output will be affected. To my understanding, x itself is enough for the output. Why bother writing "x="?
Sorry for my clumsy reasoning, I haven't touched science for more than 10 years. I hope I hadn't annoyed you.