Announcement

Collapse
No announcement yet.

Any JavaScript experts out there?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Any JavaScript experts out there?

    I'm doing this for an assignment in college. It compares numbers from two arrays. However, it won't seem to display onscreen. Here's what I have.
    Code:
    <script language="JavaScript">
    
    var i
    var list1 = new Array(10)
    var list2 = new Array(10)
    
    for (i = 0; i < 10; i++)
    {list1[i] = Math.round(100 * Math.random())
    list2[i] = Math.round(100 * Math.random())}
    
    for (i = 0; i < 10; i++)
    {
    if ((list1[i]) > (list2[i]))
    {document.write((list1[i]) + " is greater than " + (list2[i])}
    else
    {document.write((list1[i]) + " is less than " + (list2[i])}
    }
    </script>
    Any ideas how to fix this?

    #2
    Re: Any JavaScript experts out there?

    You missed brackets.


    dork.

    Comment


      #3
      Re: Any JavaScript experts out there?

      Damn, if this were two years ago, I probably could understand that.

      Comment


        #4
        Re: Any JavaScript experts out there?

        Eh, it's extremely basic.. kinda funny that's supposed to be college work..

        Comment

        Working...
        X