473,379 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

JavaScript Puzzles

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
Mar 7 '08 #1
3 1446
Jevgeni Kabanov <ek******@gmail.comwrites:
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/
Mar 7 '08 #2
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
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/
Mar 7 '08 #3
Jevgeni Kabanov <ek******@gmail.comwrites:
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/
Mar 7 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: PM | last post by:
Hello!!!! I am com sci student.... I am really interested in C... Does anybody know any free ebooks or websites for puzzles that test the intricacies of C... Please Help.... Casanova
2
by: xPy | last post by:
do you know any links where i can find puzzles, like the 8 queens problem? (I'm not intrested in the solution, only for puzzle...)
11
by: John Salerno | last post by:
Similar to the Python Challenge, does anyone know of any other websites or books that have programming puzzles to solve? I found a book called "Puzzles for Hackers", but it seems like it might be a...
10
by: Tom Cole | last post by:
While I've done javascript work for as long as I can remember (since Netscape first released it), I've only ever used it for trivial things, change a color here, validate a text element there, blah...
2
by: =?Utf-8?B?Q3JtTmV3Ymll?= | last post by:
Hi, 1) I want to hone my problem solving skills and be good at logic. How do I achieve this? 2) Where can I find c# puzzles or c# algorithms. 3) How do I print the values of a N X N matrix...
25
by: Oltmans | last post by:
Hi guys, I'm learning JavaScript and I need some puzzles that can make me a better JavaScript programmer. I mean I'm looking out for programming puzzles (e.g. Project Euler or TopCoder) but I'm...
62
jkmyoung
by: jkmyoung | last post by:
Does anyone have some super, super hard Sudoku puzzles? Back in February this year, I had enough time to finally program a Sudoku solver in Java. Right now, I'm looking for solvable puzzles, but...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.