I have the following code in html:
<canvas id="myCanvas" width =800 height=800>
I want, instead of specifying the width as 800, to call the JavaScript function getWidth() to get the width e.g.
<canvas id="myCanvas" width =getWidth() height=800>
What is the correct syntax to do it? Because what I'm doing doesn't work.
<canvas id="myCanvas" width="800" height="800">and<canvas id="myCanvas" width="getWidth()" height="800">. Is that a typo or an error in the code?