How I fix this error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How I fix this error?

Code: function drawSquare(color) { square.attr('width', 30) .attr('height', 30) .attr('x', 30) .attr('y', 0) .attr('fill', color); }; drawSquare('black'); Error: Uncaught ReferenceError: square is not defined

28th Apr 2020, 11:43 PM
KevinEDB
1 Answer
+ 2
You are referring to a variable that is not in your code (square), either you make sure of the casing. Or define square If you are unable to do that then please provide a link to code that this snippet is from. Someone will be able to help.
29th Apr 2020, 1:24 AM
ODLNT
ODLNT - avatar