+ 2

Could you teach me why this code doesn't run at all?

https://code.sololearn.com/WqBdK8wuD4ez/#html

19th Jan 2018, 7:28 PM
aaa
5 Answers
+ 8
Assuming you're trying to write a p5.js code , here is a p5.js template that you can use. https://code.sololearn.com/WLM925qWCbFa/?ref=app And all those lines of code between line 13-25 will go inside the code block function draw() { // line 13-25 goes here. }
19th Jan 2018, 8:15 PM
Ranjan Bagri
Ranjan Bagri - avatar
+ 6
From where you get this code? And what you want to do with it?
19th Jan 2018, 7:54 PM
Ranjan Bagri
Ranjan Bagri - avatar
+ 4
1. You need to call function, “draw”. Just defining it won’t make it run. 2. Functions like rect(), background(), and all of the drawing functions you used are for Processing JS, not actual JavaScript (I did the same thing a few years ago).
19th Jan 2018, 7:56 PM
Jacob Pembleton
Jacob Pembleton - avatar
+ 3
Thank you for all the answers! They helped me a lot! I watched this tutorial ( https://www.khanacademy.org/computing/computer-programming/programming/animation-basics/p/making-animations ) to study javascript and I tried the code out to know how it works then it didn't run at all so I was wondering why it didn't run.
19th Jan 2018, 8:26 PM
aaa
+ 2
Write onload="draw()" in your body tag as an attribute. And also write your function as: function draw() And the code is also not correct. That's why it is not running :)
19th Jan 2018, 8:04 PM
Saidmamad Gulomshoev
Saidmamad Gulomshoev - avatar