Connecting Tech Pros Worldwide Help | Site Map

JavaScript Puzzles

  #1  
Old March 7th, 2008, 10:55 PM
Jevgeni Kabanov
Guest
 
Posts: n/a
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?

Jevgeni Kabanov
  #2  
Old March 7th, 2008, 11:15 PM
Joost Diepenmaat
Guest
 
Posts: n/a

re: JavaScript Puzzles


Jevgeni Kabanov <ekabanov@gmail.comwrites:
Quote:
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.




--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
  #3  
Old March 7th, 2008, 11:15 PM
Jevgeni Kabanov
Guest
 
Posts: n/a

re: JavaScript Puzzles


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
Quote:
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 | blog:http://joost.zeekat.nl/| work:http://zeekat.nl/
  #4  
Old March 7th, 2008, 11:35 PM
Joost Diepenmaat
Guest
 
Posts: n/a

re: JavaScript Puzzles


Jevgeni Kabanov <ekabanov@gmail.comwrites:
Quote:
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.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need some JavaScript puzzles Oltmans answers 25 October 9th, 2008 08:45 AM