JavaScript Puzzles

Discussion in 'Javascript' started by Jevgeni Kabanov, Mar 7, 2008.

  1. Jevgeni Kabanov, Mar 7, 2008
    #1
    1. Advertisements

  2. 1.2 will only work if you actually have a print() function
    defined. AFAIK most browsers have a print function defined that will
    print (using the printer, if there is one) the entire page regardless of
    any arguments given to the print function.

    The code in 2 will give an exception even before running the statements
    in the questions.

    The answer to question 4.1 is incorrect

    All answer to question 5 are incorrect.

    Question 6: see 1.2.
     
    Joost Diepenmaat, Mar 7, 2008
    #2
    1. Advertisements

  3. You can define print() as alert(). All results were tested with Rhino
    JavaScript engine, which is identical to Mozilla one (and also
    developed by Mozilla). It has a built-in print() function.

    Jevgeni Kabanov
     
    Jevgeni Kabanov, Mar 7, 2008
    #3
  4. Please don't top-post. I see now that you expect the code of all
    questions to be run sequentially in the same environment. You're not
    making that at all clear in your page. I expect sample code to questions
    to be self-contained.
     
    Joost Diepenmaat, Mar 7, 2008
    #4
  5. Just to not seem like an ass: aside from that issue, it seems to me to
    be correct, so good work :)
     
    Joost Diepenmaat, Mar 7, 2008
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.