TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Are You a JavaScript Guru? Try This Test

24 点作者 techdog超过 12 年前

15 条评论

neilk超过 12 年前
This isn't a JavaScript quiz. Mostly it tests if you know how numbers really work, operator precedence, and some obscure coercion rules. Boring.<p>The only slightly relevant question, I thought, was what typeof NaN was. Not knowing that might result is actual bugs.
评论 #5157248 未加载
评论 #5156937 未加载
valdiorn超过 12 年前
Being able to answer these questions has very little to do with being a good javascript developer, because a good javascript developer knows he should never, ever write code like that.<p>Javascript has flaws and pitfalls, to be a good Javascript developer you must know what they are, but is it really necessary to be able to pull the results of (1/null) out of your ass?
lubujackson超过 12 年前
God, I hate this crap. Edge cases != useful knowledge
评论 #5156989 未加载
评论 #5157048 未加载
评论 #5159645 未加载
shepik超过 12 年前
At least two questions are bad.<p>7. a = "5"; b = 2; c = a+++b;<p>Why even ask that? It's boring. And operator precedence is not really important in practive, and it's bad style and no one writes like that. It's a question for junior-level interview, when you can't ask anything meaningful and (because you have to ask anything) you ask _this_.<p>9. (16).toString(16)<p>Oh, so Guru should memorize every obscure parameter, shouldn't he?<p>Other questions are fine, though (except 10. Numerical systems, c'mon, it's 2013, not 1980s)
评论 #5156935 未加载
nirvanatikku超过 12 年前
Surprised to see people claiming that this isn't essential knowledge. Understanding what the system is doing at its core allows you to answer these questions; as 'tricky' as they may seem. If you're dealing with JS, you <i>should</i> know how things are working under the hood. There shouldn't be any memorizing, instead, you should be able to reason what the outcome is in those cases. At least that's what I strive for.
评论 #5157136 未加载
asher_超过 12 年前
This was interesting if nothing else.<p>Maybe its just because I just woke up, but I didn't even realise why Q1 was interesting until after I read the HN comments. Those that are saying these are all useless for practical work are wrong in my opinion. Some of them are, but not all.<p>If you saw Q2 and didn't realise the possibility of it being false, the reasons for that are something you need to learn when dealing with any language that uses floating points. Q3 is something every JS programmer should know, as is Q4.<p>Q5 is more interesting, because the correct answer is "what version of javascript?" Protected terms cannot be used as object properties without being put in quote marks in earlier versions of JS. Doing something like this in an older browser would throw an error.<p>Q6 could have been better, it would be pretty hard to get it wrong. Something like "5" + 2 would have been more interesting because + is overloaded so you would have to know how javascript treated it in different situations, which is close to essential knowledge.<p>Q7 is definitely just trivia. No sane person writes code like that. Q8 is trivia too; easy if youre familiar with JS but not hugely useful. Q9 is easily guessable; I didn't know what the param for toString did but I guessed it correctly.<p>Q10 is important, if you dont know how JS treats numbers with a leading 0 you can get yourself into trouble and have no idea why.<p>Q11 I learned something new, I didn't know about the ~ operator, I wouldn't use it in regular code though.<p>Q12 is regex. Either you knew it or you didn't. If you didn't, you learned about \b, which can be rather useful.
cwbrandsma超过 12 年前
My current favorite questions involve asking people what their favorite Javascript library is, then asking detailed questions about how it works. Even pulling up common functions from the library and ask what is going on.<p>Better questions involve things like variable scoping, modules, arguments, event bubbling, prototypes, etc.<p>Now, where I get stuck: Regular Expressions. I just don't think I will ever get comfortable with that.
评论 #5157114 未加载
voidr超过 12 年前
Answering correctly to these questions only means that you know these edge cases/quirks, heck you could memorize most of them. A real developer should never write code like that.
biscarch超过 12 年前
I'm curious about how the utility of tools such as JSHint/Lint affect how many edge cases a new programmer actually needs to memorize, in the context of hiring said programmer. Unless a programmer is trying to abuse an edge case, wouldn't a Lint tool remove the need for the wrote memorization of all edge cases?
jakub_g超过 12 年前
The thing about Math.PI can be confusing. It allows you to preincrement it, but it actually <i></i>doesn't<i></i> change the value:<p>(function(){console.log(++Math.PI); console.log(Math.PI)})()<p>logs 4.14... and then 3.14.<p>Of course no one sane should write a code like this.
mattparlane超过 12 年前
I think you need more linebreaks between the questions and the answers -- the first four answers were above the fold when I loaded the page.
markzuckerwho超过 12 年前
As someone that writes JS on an almost daily basis I now feel like a n00b.
orangethirty超过 12 年前
Anyone else feel weird they got all of them right?
markzuckerwho超过 12 年前
Can anyone explain the ++Math.PI thing to me?
评论 #5158134 未加载
general_failure超过 12 年前
Looks like this quiz got many people upset. Relax it's just fun. Like jeopardy. Gurus in their own right