0

I'm trying to understand why my code isn't working. this is a piece of code that I'm creating for a game in canvas. I want to dynamically create an object to capture the radius, x and y coordinates. Eventually this will become a setInterval functon If i can get the console.log to produce I'll be good.

var i;
var circles = {};
for (i = 0; i>10; i++){
  circles[i]= {
    d:Math.floor(Math.random()*50),
    x:Math.floor(Math.random()*500),
    y:Math.floor(Math.random()*500)
    };
    console.log(circles[i].d, circles[i].x, circles[i].x);
};

1 Answer 1

4
for (i = 0; i>10; i++){

should be

for (i = 0; i<10; i++){
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.