+ 2

p5 has problems in creating global function log.

So I m using p5.js for my project. And when I use it I get the error in title on the console.It says it is because I m using a variable called log.And I m not even using such thing. Can anyone help me to stop getting this warning. And here is my code https://code.sololearn.com/WnbdIs3rpvkf/?ref=app

5th Dec 2018, 12:48 PM
Seniru
Seniru - avatar
2 Réponses
+ 4
You're using it implicitly, because for each html element id, a global variable is created, and you use an element with id="log" ;) You could easily fix it by renaming it, at least by changing the case (id="LOG"), all the more that you don't seems to use it anywhere else ^^ Anyway, the JQuery link version you try to load seems quite old, and don't seems to correctly initialize (after fixing the p5 error, you get a reference error message about $ not defined)... rather use the default one provided by the code playground JQuery template: <script src="https://code.jquery.com/jquery-3.1.1.js"></script>
5th Dec 2018, 1:54 PM
visph
visph - avatar
+ 2
I found that the problem is about id when I accidentally deleted it. Anyway thanks for your help and sharing extra knowledge. And thanks for suggestions.
5th Dec 2018, 2:20 PM
Seniru
Seniru - avatar