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 Create a random number

trying to reproduce the code in the video

what am I missing

var dice= Math.floor( Math.random() * 6 ) + 1; alert('you rolled a ' + dice);

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

This is the same for me when I run your code. It also works for me.

Here are a few things to check:

  • Have you saved your file? If there's an orange dot on the tab, it hasn't been saved.
  • Do you have any browser extensions that might be blocking pop-ups?
  • If you have the JS file linked to an index.html file, have you tried clearing the browser cache or loading the webpage in a private tab? It could be that it's loading in old cached data.
  • Have you tried directly copy/pasting the code into the browser console?

Hope one of these suggestions helps! :sparkles:

Stuart Wright
Stuart Wright
41,119 Points

Your code works fine for me when I paste it into the console. Every time I run it I get a popup saying "you rolled a 1", "you rolled a 4", etc. What happens when you run it?