Canvas coding: contains java elements? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Canvas coding: contains java elements?

<html> <head></head> <body> <canvas id="canvas1" width="400" height="300"></canvas> <script> var can = document.getElementById("canvas1"); var ctx = can.getContext("2d"); </script> </body> </html> Is the var section part of java? Doesn't ring a bell in the HTML part of my brain. 😕

21st Nov 2018, 1:47 PM
Msizi
7 Answers
+ 6
Msizi inside the script tag is "javascript" its getting the canvas element from the html document you need javascript to draw on the canvas 😉👍
21st Nov 2018, 7:24 PM
D_Stark
D_Stark - avatar
+ 7
Java is not JavaScript, and Ham is not hamster. 🤣😂
21st Nov 2018, 2:14 PM
Calviղ
Calviղ - avatar
+ 5
No, this is the JavaScript code but don't confuse with Java because the 2 program languages is different.
21st Nov 2018, 2:05 PM
program
program - avatar
+ 4
lol,that is JavaScript,not java,any code enclosed within a script tag is JavaScript
21st Nov 2018, 2:00 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 3
Okay you lot. Thank you. Sorry I wrote java instead of JavaScript. An honest mistake. Your responses, nonetheless, have made my day. It's a pity I didn't get such feedback from my Python-related questions.
22nd Nov 2018, 7:21 AM
Msizi
+ 3
Msizi your very welcome 😉 were more then happy to help you with your questions, If you didnt get much response to your python question please use the search bar in Q&A section for similar questions asked, If no joy copy your old post and repost it to put it at the top of the page for people to see, make sure you delete the old post to prevent duplicate posts 😉.
22nd Nov 2018, 7:56 AM
D_Stark
D_Stark - avatar
+ 1
JavaScript it is. Not java
21st Nov 2018, 2:01 PM
Roneel
Roneel - avatar