Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Working With Numbers The Random Challenge

Tobi Bankole
Tobi Bankole
2,901 Points

My Solution - feedback welcome

Hi all, just completed this task after scratching my head for a bit. Anyway I could clean it up better or use fewer lines of code?

https://w.trhou.se/aqfl9qy6de

6 Answers

Dmitry Polyakov
Dmitry Polyakov
4,989 Points

It's working. Looks more correct

Tobi Bankole
Tobi Bankole
2,901 Points

Thank you so much for taking the time to put me straight!

Tobi Bankole
Tobi Bankole
2,901 Points

Sorry, I dont know whats going on tbh. The link works on my laptop, my PC and my phone

Dmitry Polyakov
Dmitry Polyakov
4,989 Points

It's says page doesn't exist. maybe it exists only locally on your computer

Dmitry Polyakov
Dmitry Polyakov
4,989 Points

Why did you put an argument inside Math.random()?

Math.random(number)????

Tobi Bankole
Tobi Bankole
2,901 Points

I thought that was the correct syntax, am I horrifically incorrect? ^^;

Dmitry Polyakov
Dmitry Polyakov
4,989 Points

Normally you don't put anything inside the parentheses in Math.random()

Tobi Bankole
Tobi Bankole
2,901 Points

Thank you for that does this look much better?

https://w.trhou.se/aqfl9qy6de

Dmitry Polyakov
Dmitry Polyakov
4,989 Points

As you proceed through the course you'll understand yourself how you can improve the same code.