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) Creating Reusable Code with Functions Introducing Functions

The code is not working

https://w.trhou.se/x4uytc1d5u

Did this code exactly, when viewing it said , "Lets make a Function" only, no random numbers.

Thanks for the quick response! I did change the + to an = still not working. https://w.trhou.se/x4uytc1d5u

Sorry the M in Math.random was also a lower case, it works, Thanks

3 Answers

There are a few differences in the code. First thing I notice is you're calling a function that doesn't exist. The function you made is alertrandom() but the function you call is alertRandom(). Math isn't capital either, and you're missing a semicolon, lastly there is a plus sign where there should be an equal sign.

You likely would have found these errors in your console if you check there!

I see it now, my mistake , thanks for the help. : )

Steven Parker
Steven Parker
240,995 Points

Missing a semicolon? Where?

Sorry Steven I only answered because I saw your answer only fixed one of his issues, but you updated your answer and he's in good shape now! :)

Steven Parker
Steven Parker
240,995 Points

In random.js on line 1 you define "alertrandom" (with little "r") but on line 5 you call "alertRandom" (capital "R"). Then on line 2 there is a plus sign ("+") following the variable name where there should be an assignment operator ("="), and "Math" is spelled correctly one time but the next time it is "math" (little "m") instead.

Also, while not a syntax error, in index.html the script tag is inside a div element, but normally it would be the last thing in the body.

I know, i see my mistakes , OMG!!! the casing!!! Thanks much

Im a girl lol , yes im good thanks