Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

MDN has a guide called "A re-introduction to JavaScript"[1]. I believe this is what you're looking for

1. https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re...



I can second this recommendation. JS is an odd bugbeast in that it took some design shortcuts early in it's life that aren't really visible without this kind of "here are your primitives" review. It also works like any other language primer in that it doesn't go into needlessly specific domain bound examples. That kind of stuff should be in a stdlib-eqsue doc.

A good read for even for some one like me, who slings JS almost daily.


That's nice but just a start. JS type coercion is only mentioned in passing for example.


I know JS is mocked for the horrible type coercion, but on a day-to-day basis I don't find myself needing to know how it works in detail. All you really need to know is that you should avoid it. Use triple equals and don't try to add or subtract non-matching types.


It specifically gives you an example of how "==" clearly sucks and shows you how "===" fixes it. I don't see why a "guide for professional programmers that know more than the average JS programmer" (as per the request) would need to belabor that any further.


So what types are converted to what, automatically? And is it only for == or there are other traps?

In most languages that I know this is documented. They don't tell you "this sucks don't use it".


I think this is what you're looking for. 3rd result for "Javascript type coercion": https://2ality.com/2019/10/type-coercion.html


Sorry, I'm looking for a comprehensive manual, not a series of random blog posts. I knew about type coercion because everyone laughs at it, but what about the things I don't know to ask about because I don't know they exist?


Did you... read the link? It's literally exactly what you're asking for.

Sorry for trying to help I guess, good luck.


I did. It explains type coercion. It’s not a comprehensive JavaScript manual.


> So what types are converted to what, automatically? And is it only for == or there are other traps?

This is the question that you asked and that I answered.

If you're looking for the language specification, it's here (first result for "Javascript specification"): https://www.ecma-international.org/ecma-262/11.0/index.html#...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: