• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can someone help me with this assignement? (Function)

 
Mimi Sini
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've read my lecture over and over, I can't seem to figure this one out.

Complete the following script that generates two random numbers for variables m and n in the range of 0 to 10 and displays the result of m/n.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What specifically are you having problems with?
 
Mimi Sini
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no idea how to display m divided by n, I thought it was document.write(m/n) or using for, but I'm not getting it.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah! document.write() is only useful for inline script when the page is being initially displayed. It's not generally useful for events after the page load so it's not used very much.

If you want to display something as part of the HTML page, there are a number of ways to do it. The easier is a property on elements named innerHTML. Search around a bit for that term and you should be able to find some examples of its use.
 
Mimi Sini
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My instructions are that I can only add code to the body of the function, and not add, remove or change anything after the brace
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shouldn't be an issue.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic