|
Not short but almost understandable. Given a text editor, save the following text as drawline.html: <canvas id="myCanvas" width="500" height="300"></canvas>
<script>
const ctx = myCanvas.getContext( "2d" );
// Draw the line
ctx.beginPath();
ctx.moveTo( 50, 50 ); // Starting point
ctx.lineTo( 200, 150 ); // Ending point
ctx.stroke();
document.write( "Hello World" );
</script>
JavaScript is quite forgiving. No need for the HTML preambles. "document.getElementById" is a nicety that can also be ignored.Nonetheless, I (born 1947) too miss the simplicity of BASIC, the plethora of magazines for beginners, the many shelves of "for dummies books". And, especially, that we were all beginners. These days, full stack developers and AI are priestly classes that that, currently, do not facilitate the investigation by newbs of the black boxes they create. Nonetheless, I look forward to AI being able to read aloud Python, Rust, Cobal, Euler notation, Greek or whatever in ways that I may understand. |