Closed Thread
Results 1 to 4 of 4

Thread: Whats my error?

  1. #1
    toxifyshadow's Avatar
    toxifyshadow is offline Programmer
    Join Date
    Mar 2010
    Location
    Oregon
    Posts
    125
    Blog Entries
    5
    Rep Power
    0

    Whats my error?

    My code looks like:
    <body>
    <script type="text/javascript">
    var coin=newArray();
    coin[0]="heads";
    coin[1]="tails";
    document.write(coin[math.round(math.random)]);
    </script>
    </body>
    Nothing shows up.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Apr 2009
    Location
    Uppsala, Sweden
    Posts
    9,547
    Blog Entries
    5
    Rep Power
    98

    Re: Whats my error?

    There's 3 errors in your code above:
    1. math need to have a capital M (Math)
    2. newArray() is two words (new Array())
    3. You randomiser will give you the numbers 0 to 2 inclusive where 1 is picked 50&#37; of the times and 0 and 2 25% each.

  4. #3
    DarkLordoftheMonkeys's Avatar
    DarkLordoftheMonkeys is offline Programming Professional
    Join Date
    Oct 2009
    Location
    Massachussets
    Posts
    255
    Blog Entries
    56
    Rep Power
    11

    Re: Whats my error?

    math needs to be capitalized.
    Life's too short to be cool. Be a nerd.

  5. #4
    toxifyshadow's Avatar
    toxifyshadow is offline Programmer
    Join Date
    Mar 2010
    Location
    Oregon
    Posts
    125
    Blog Entries
    5
    Rep Power
    0

    Re: Whats my error?

    Thanks! It works now.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Hey Whats Up!
    By hansho13 in forum Introductions
    Replies: 3
    Last Post: 07-14-2011, 09:02 AM
  2. Hey Whats up?
    By Madhak in forum Introductions
    Replies: 8
    Last Post: 03-22-2011, 04:11 PM
  3. Whats up
    By mkjt88 in forum Introductions
    Replies: 4
    Last Post: 02-05-2011, 05:09 AM
  4. Whats going on?
    By espdev-darkness in forum C and C++
    Replies: 2
    Last Post: 11-18-2010, 06:42 AM
  5. Whats your most common error?
    By phpforfun in forum General Programming
    Replies: 23
    Last Post: 06-20-2008, 02:33 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts