five fun JavaScript questions

L

-Lost

Peter said:
Maybe you want a job with Meebo? You have to pass the test first...

<URL:http://blog.meebo.com/?page_id=254>

I enjoyed these questions. Any other nice little JavaScript quizzes
out there?

I didn't check any of these, but remember taking the W3Schools.com quiz
when I first started dabbling in JavaScript a few months back.

It was rather rudimentary, and some of the answers are not entirely
accurate. Like, "What is the best way to create an array?"

http://en.allexperts.com/q/Javascript-1520/javascript-exam.htm
 
D

dd

I didn't check any of these, but remember taking the W3Schools.com quiz
when I first started dabbling in JavaScript a few months back.

It was rather rudimentary, and some of the answers are not entirely
accurate. Like, "What is the best way to create an array?"

Not quite the wording they use in that w3schools test. They
don't say "best", but they do show 4 examples, only one of
which works. What I found more objectionable was question
12 where they show this as "the correct" for loop construct:

for ( i=0; i<something; i++ )

Right away teaching people to create globals when they meant
to use a local variable. That would make my top 10 of most
commonly made JavaScript mistakes.

Maybe we should have a FAQ entry that shows such a top 10.
I'd put the lack of defensive coding as #1 with these two
examples showing the same problem (not checking if the
object you're about to perform an operation on actually exists):

var mywin=window.open(<<the window params>>);
mywin.some_operation(); //fails if window popup was blocked

or

var myobj=document.getElementById("my_obj_id");
myobj.some_operation(); //fails if that element doesn't exist

The number of times I get asked if I want to debug on live sites
in IE because of these two problems, it's tedious to say the least.

How about it FAQ dudes? A most common mistakes FAQ ?
 
L

-Lost

Randy said:
dd said the following on 4/26/2007 2:00 AM:

That is beyond the scope of newbie classes (although scope should be one
of the first things taught but you can't teach scope until you know some
scripting).

That would make my top 10 of most

#19 is worse:

19. How do you put a message in the browser's status bar?

status("put your message here")
window.status("put your message here")
window.status = "put your message here"
statusbar = "put your message here"

The correct answer? You don't. :)

Never have cared for any of the tutorials on w3schools site.


That is directly covered in the FAQ though. Although it is very very
obtuse to get to it.


#1: Attempting to close a window you didn't open.

Next?
Maybe not the FAQ, but a Notes page, or, even on Matt's page.

Would accessing preexisting collections by alternate DOM methods be a
common mistake?

It does not seem to be a mistake, but rather, a best practice kind of
thing (i.e. Matt's page addition).

Or better yet, maybe just say "getElementById() is not the best method
of accessing FORMs, see <URL
http://www.jibbering.com/faq/faq_notes/form_access.html#faEff>."
 

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
474,164
Messages
2,570,901
Members
47,439
Latest member
elif2sghost

Latest Threads

Top