JavaScript Interview Question
1–10 of 63 posts
Re: JavaScript Interview Question
#2Is it poor etiquette to state what i think the answer is?
Re: JavaScript Interview Question
#3A while back a couple of colleagues sat down and came up with our own set of JS interview questions. Here's what we came up with:
Can the interviewee code: https://gist.github.com/633341
Can the interviewee read/debug code: https://gist.github.com/633087
I used these questions during a couple of interviews. They seemed to work well.
Re: JavaScript Interview Question
#4Is it poor etiquette to state what i think the answer is?
Please do.
Re: JavaScript Interview Question
#5I think they all alert '3' because of the missing 'var' keyword.
Re: JavaScript Interview Question
#6Re: JavaScript Interview Question
#7Although I am playing around with javascript every day (primarily with a game engine), I'm not sure that I would answer the questions correctly without messing around with the code in real-time.
Re: JavaScript Interview Question
#8Seems like a great question to me; lots of JS developers use closures without any real understanding of the implications of using a closure.
Re: JavaScript Interview Question
#9Firefox throws an error with this code because of the missing 3rd parameter to addEventListener. I suggest this change:
Re: JavaScript Interview Question
#10I think they all alert '3' because of the missing 'var' keyword.
This is my thought also, but I'm unsure of how to lock in the correct integer value to the alert, such that clicking each li element pops up the correct number.
I'm guessing one would have to create an object with a scope that holds the right value, on each turn through the loop.