Home TechnologyProgrammingJava Script Subscribe to RSS

Please Please Please.. Can You Help Me Do Following Task Using JavaScript?

Write a JavaScript program that prompts the user for a number and prompt user to input that number of names. Those names should be collected into an array and after array is filled the sorted list should be printed on the page.

Answer Question

1 Answer - Sort by: Date | Rating

    Try this: (pls remove the quote marks and the rectangular braces IN each line of the code.. This site does not seem to support 'code' as it is... (may be it gets executed!!)
    ============================
    " [html]
    " [body                                                              ]
    " [script type="text/javascript"                             ]                  
    "[ var a = array(10);                                         ]
    " [var i,n;                                                          ]

    "[ for(i=0; i<10; i++)                                         ]
    "[ {                                                                   ]
    "[    n = PROMPT("Enter name ","");                     ]
    "[    a[i] = n;                                                      ]
    "[ }                                                                    ]

    "[ document.write(a.sort());                                 ]
    "[ </script>                                                        ]
    "[ </body>                                                         ]
    "[ </html>                                                          ]

    ===============================

    Happy programming!!

    2 0

    Fukinalla 

    answered 2 years ago

      More

      More

         
         

        Ask a Question via Twitter

        Send a question to @askblurtit and we will publish it online and send you a reply everytime you receive an answer.

        Blurtit Store

        Get T-shirts, hoodies, caps and more at the Blurtit store

        Blurtit International