JavaScript Puzzles

  • Thread starter Jevgeni Kabanov
  • Start date
J

Joost Diepenmaat

Jevgeni Kabanov said:
Just a couple of language puzzles I compiled from a course I took
recently, quite entertaining IMHO:
http://dow.ngra.de/2008/02/28/javascript-puzzlers/

What do you think?

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.
 
J

Jevgeni Kabanov

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
 
J

Joost Diepenmaat

Jevgeni Kabanov said:
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.

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.
 
J

Joost Diepenmaat

Joost Diepenmaat said:
I expect sample code to questions to be self-contained.

Just to not seem like an ass: aside from that issue, it seems to me to
be correct, so good work :)
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top