News for hackers. Stuff that matters.
Re:JavaScript for Impatient Programmers by nottorp on Wednesday July 01, 2020 @07:05AM (#23700148)
Can anyone recomand a “JavaScript for profesional programmers”?

I.e. something that introduces JavaScript assuming you know a lot more about programming than your average JS developer and explains the JS pitfalls in common terms and not js “ecosystem” inventions?

Re:JavaScript for Impatient Programmers by harrygeez on Wednesday July 01, 2020 @07:28AM (#23700285)
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...

Re:JavaScript for Impatient Programmers by LibertyBeta on Wednesday July 01, 2020 @08:25AM (#23700594)
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.

Re:JavaScript for Impatient Programmers by nottorp on Wednesday July 01, 2020 @12:27PM (#23703293)
That's nice but just a start. JS type coercion is only mentioned in passing for example.
Re:JavaScript for Impatient Programmers by vlunkr on Wednesday July 01, 2020 @01:13PM (#23703914)
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.
Re:JavaScript for Impatient Programmers by hombre_fatal on Wednesday July 01, 2020 @01:14PM (#23703926)
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.
Re:JavaScript for Impatient Programmers by nottorp on Wednesday July 01, 2020 @01:59PM (#23704448)
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".

Re:JavaScript for Impatient Programmers by tomlagier on Wednesday July 01, 2020 @07:16PM (#23707990)
I think this is what you're looking for. 3rd result for "Javascript type coercion": https://2ality.com/2019/10/type-coercion.html
Re:JavaScript for Impatient Programmers by nottorp on Thursday July 02, 2020 @06:57AM (#23711914)
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?
Re:JavaScript for Impatient Programmers by tomlagier on Thursday July 02, 2020 @12:16PM (#23714859)
Did you... read the link? It's literally exactly what you're asking for.

Sorry for trying to help I guess, good luck.

Re:JavaScript for Impatient Programmers by nottorp on Thursday July 02, 2020 @01:19PM (#23715557)
I did. It explains type coercion. It’s not a comprehensive JavaScript manual.
Re:JavaScript for Impatient Programmers by tomlagier on Friday July 03, 2020 @01:56PM (#23726025)
> 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#...

Re:JavaScript for Impatient Programmers by IshKebab on Wednesday July 01, 2020 @07:19AM (#23700227)
MDN is by far the best resource on JavaScript. It's most a reference site but they have tutorials too:

https://developer.mozilla.org/en-US/docs/Learn/JavaScript

Maybe a bit too slow if you already know other languages, but you can at least trust it not to give bad advice. There are an absolute mountain of inexperienced JS developers out there giving a lot of bad advice. Take every StackOverflow answer with a fist full of salt. MDN is reliable though.

Re:JavaScript for Impatient Programmers by nottorp on Wednesday July 01, 2020 @07:26AM (#23700267)
Yeah, that’s the whole point. I don’t want to be told how a loop works in kindergarten terms. I want to know the memory and event model and be told in one line why JS has three equality operators. I want a concise list of types and automatic conversions. I want to know how Node’s multitasking differs from Windows 3.1, because my impression now is it doesn’t. Stuff like that, you get the idea.
Re:JavaScript for Impatient Programmers by jwarren on Wednesday July 01, 2020 @07:26AM (#23700273)
As a primarily frontend developer, I've had a couple of good experiences helping some experienced backend developers work through You Don't Know JS[0].

[0] https://github.com/getify/You-Dont-Know-JS

Re:JavaScript for Impatient Programmers by valbaca on Wednesday July 01, 2020 @01:24PM (#23704032)
I'd consider Eloquent Javascript the best JS book out there and actually one of the best programming books I've ever read

https://eloquentjavascript.net/

It may be a bit more introductory than you're looking for, but trust me in that you'll want to read it from front to back as it builds on itself.

It's not short and quick, but it's comprehensive, good, and even fun!

Re:JavaScript for Impatient Programmers by mokanfar on Wednesday July 01, 2020 @12:37PM (#23703407)
Having read many programming books, I find at a professional level, you just want to get straight to the juicy stuff with real life examples. For that, Goal kicker is hands down my go to for that. While you're at it, also download the NodeJS ebook from there too. They're free.

https://books.goalkicker.com/JavaScriptBook/ and https://books.goalkicker.com/NodeJSBook/

Re:JavaScript for Impatient Programmers by brogrammer2018 on Wednesday July 01, 2020 @08:06PM (#23708367)
Thank you for sharing
Re:JavaScript for Impatient Programmers by mattbee on Wednesday July 01, 2020 @08:50AM (#23700763)
There's a new edition of the O'Reilly doorstop "Javascript: The Definitive Guide". I've learned a lot from it and started to use modules, promises and dropped all my horrible old 90s habits.

It reads really well, explains the modern bits as the right way of programming, but also puts the crusty, abandoned bits into the right perspective (if you're looking at old code I guess).

It's not at all a book for new programmers, but for someone who knows Ruby well, it's a great, concise read.

Re:JavaScript for Impatient Programmers by kabes on Wednesday July 01, 2020 @08:10AM (#23700510)
"You don't know js" book series is good for what you describe
Re:JavaScript for Impatient Programmers by solidist on Wednesday July 01, 2020 @08:59AM (#23700826)
JavaScript: The Good Parts by Douglas Crockford. Note that this was written in 2008 but still holds up well.

https://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockfo...

It may be a perfect time for a revision.

Re:JavaScript for Impatient Programmers by throwanem on Wednesday July 01, 2020 @09:53AM (#23701311)
It predates ES5, and a revision is imo long overdue. It was an excellent resource in its day, but there are a lot of good parts too new for it to have covered.
Re:JavaScript for Impatient Programmers by gabrielsroka on Wednesday July 01, 2020 @10:10AM (#23701480)
Re:JavaScript for Impatient Programmers by m12k on Wednesday July 01, 2020 @07:17AM (#23700213)
Books that fit that description, and that I've heard good things about are JavaScript: The Good Parts (but maybe not quite up to date anymore?) and Eloquent JavaScript.
Re:JavaScript for Impatient Programmers by willcipriano on Wednesday July 01, 2020 @07:12AM (#23700192)
Zed Shaw is coming out with a book[0] on the topic, I like his Learn X the Hard Way series so I'll probably pick it up when it arrives.

[0]https://learncodethehardway.org/javascript/

Re:JavaScript for Impatient Programmers by hombre_fatal on Wednesday July 01, 2020 @01:16PM (#23703952)
I miss the old days of Ruby, Mongrel, and Zed Shaw (and drama).

Though I also think I took a liking to the guy when I decided he looked like Neal Stephenson.

[dead]
Re:JavaScript for Impatient Programmers by ActionHank on Wednesday July 01, 2020 @10:07AM (#23701453)
Tell us how you really feel.
Re:JavaScript for Impatient Programmers by Cthulhu_ on Wednesday July 01, 2020 @07:11AM (#23700183)
I have good experiences with Javascript Allongè, I know the author is on here as well. It builds up your understanding of the language from the basics, focusing on JS specific things like function scope and higher-order functions and `this`, without insulting your intelligence.
Re:JavaScript for Impatient Programmers by sks147 on Wednesday July 01, 2020 @07:38AM (#23700345)
I can also vouch for Javascript Allongè. It's a fantastic read.
Re:JavaScript for Impatient Programmers by kofejnik on Wednesday July 01, 2020 @10:37AM (#23701812)
As for introduction, how about this:

> ('b'+'a'+ +'a'+'a').toLowerCase()

>'banana'

Re:JavaScript for Impatient Programmers by lemoing on Wednesday July 01, 2020 @11:00AM (#23702104)
For those curious, the +'a' after the space is a unary addition operator that evaluates to 'NaN'.
Re:JavaScript for Impatient Programmers by e12e on Wednesday July 01, 2020 @12:57PM (#23703713)
See also:

alert(Array(16).join("wat" - 1) + " Batman!");

From: https://www.destroyallsoftware.com/talks/wat

Re:JavaScript for Impatient Programmers by kccqzy on Wednesday July 01, 2020 @04:00PM (#23705838)
I recommend JavaScript: The Good Parts. It's pretty dated by now but still is a quick introduction to JavaScript for professionals. You can then read MDN for new features not covered by the book.
Re:JavaScript for Impatient Programmers by ballenf on Wednesday July 01, 2020 @09:05AM (#23700879)
The Good Parts by Crockford will always be on my list. It's dated in terms of language expansions, but it really will lay the foundation for many of the patterns that are now commonly used.

Kyle Simpson's volumes are excellent.

Eloquent Javascript

The author's earlier ES6 book is great.

Most of the above books have a few chapters you'll end up skimming or skipping.

Re:JavaScript for Impatient Programmers by lowwave on Wednesday July 01, 2020 @09:34AM (#23701129)
Don't know about "Professional" However, if you want to go the LISP route in the tradition of The Little Schemer, then check out: The Little JavaScripter:

https://www.crockford.com/little.html

Re:JavaScript for Impatient Programmers by greggman3 on Friday July 03, 2020 @01:57PM (#23726034)
That's cute but as someone that knows lisp if it doesn't support defmacro then it's not remotely lisp. That's where all the power of lisp is.
Re:JavaScript for Impatient Programmers by lowwave on Wednesday July 01, 2020 @09:35AM (#23701136)
Also in general even if programer don't end up using LISP type of language they get better by just learning it. And Javascript is decent stand in for LISP, as Crockford points out.
Re:JavaScript for Impatient Programmers by nottorp on Thursday July 02, 2020 @09:46AM (#23713001)
I actually know some LISP, among other things. I'm asking specifically about JS.
Re:JavaScript for Impatient Programmers by m90 on Wednesday July 01, 2020 @07:38AM (#23700342)
How much or how little does "your average JS developer" exactly know according to your opinion?
Re:JavaScript for Impatient Programmers by ralphc on Wednesday July 01, 2020 @09:10AM (#23700912)
I'm enjoying Manning Book's "The Joy of JavaScript", in early access but available. I'm currently reading about how mixins are done using JavaScript's unique features, and I'm looking forward to the function programming and algebraic data types.
Re:JavaScript for Impatient Programmers by rauschma on Wednesday July 01, 2020 @11:15AM (#23702336)
(Just in case the title is putting you off: You are describing the goals of this book.)
Re:JavaScript for Impatient Programmers by valbaca on Wednesday July 01, 2020 @01:26PM (#23704056)
I agree. Sounds like this is exactly the book they're looking for:

"No prior knowledge of JavaScript is required, but you should know how to program."

Re:JavaScript for Impatient Programmers by kofejnik on Wednesday July 01, 2020 @10:39AM (#23701841)
but if we're being serious, "Learn X in Y minutes" is pretty efficient, and also Dan Abramov's email series (sign up on his site)
Re:JavaScript for Impatient Programmers by hombre_fatal on Wednesday July 01, 2020 @01:23PM (#23704020)
Dan Abramov makes good, super accessible material on any subject he focuses on. His React series is also good. Guy's a good egg.
Re:JavaScript for Impatient Programmers by ramzis on Wednesday July 01, 2020 @07:35AM (#23700329)
I'd recommend doing an online course where you learn something useful like React and the ES6 syntax will come for free as you go along. I found Udemy to be quite useful.

Otherwise, from a programmer's perspective, JS is like nothing else I've seen and it's not something you want to be using without an abstraction over it, i.e. some framework that makes life less miserable when building something more complex than a form.

I feel like being a 'JS professional', unlike other languages, mostly involves in-depth knowledge of the right tools and not the language itself. Unless, you are interested in building frameworks yourself, which I personally find no need to ever do given the available options.

Re:JavaScript for Impatient Programmers by rimliu on Wednesday July 01, 2020 @07:49AM (#23700402)
This advice is so strange. Do you imply, that learning pure JS is not useful? I dread this attitude. Also, you cannot have "in depth" knowledge of any higher end abstraction whithout knowing the language. By definition it will always be just a superficial knowledge.
Re:JavaScript for Impatient Programmers by ramzis on Wednesday July 01, 2020 @08:43AM (#23700707)
Pure JS obviously has its uses but I am assuming every professional values productivity which one can't often obtain just by knowing JS itself. JS sometimes feels like assembly, you just don't want to touch it, that's why things like TypeScript exist, for example.

Also, saying an abstraction is useless without knowing the language is similar to saying you can't drive a car without knowing how the timing belt or crankshaft works - most people do fine without either. I'm not dismissing the value of JS fluency, just suggesting that it might be unnecessary and a more practical approach can be taken.

Re:JavaScript for Impatient Programmers by filleduchaos on Wednesday July 01, 2020 @09:06AM (#23700884)
> JS sometimes feels like assembly

Every time I see this statement, I wonder what the Venn diagram of people who say so and people who have ever written a line of asm looks like.

Re:JavaScript for Impatient Programmers by hombre_fatal on Wednesday July 01, 2020 @01:27PM (#23704059)
I don't even get it. You write Javascript basically 1:1 the same as Python or Ruby. And I would argue it's even nicer in various cases, from destructuring to lambdas to async/await and first-class Promises.

I wonder if the people say they avoid JS at all costs because it's "like assembly" have been doing that so effectively since 2003 that they never even tried modern JS

Re:JavaScript for Impatient Programmers by nottorp on Wednesday July 01, 2020 @10:12AM (#23701505)
See what I was saying in the OP about the average JS developer :)

It's not even their fault, it's all they know from those online courses or boot camps.

Re:JavaScript for Impatient Programmers by runawaybottle on Wednesday July 01, 2020 @09:37AM (#23701151)
I read a blog of a fresh grad describing ‘this’ keyword in JS. The conclusion he/she had by the end of the article was ‘don’t use “this” keyword unless you are JS expert’.

I always see a pattern with these things. Usually if you don’t learn the language well enough, you probably are also not spending enough time learning the frameworks well enough, and you probably are not learning the DOM/Browser well enough, and you probably have not learned CSS well enough. You will have no choice but to hide behind the frameworks.

The people that just learn React or the latest ES6 think they know good enough JS, but when I see their code I see clear patterns of poor abstractions, separation of concerns, the kind of code that makes you want to take a shower after touching it.

Re:JavaScript for Impatient Programmers by 52-6F-62 on Wednesday July 01, 2020 @12:17PM (#23703165)
Been there. Those who assume or are hubristic enough to think they know enough can be dangerous.
Re:JavaScript for Impatient Programmers by astura on Wednesday July 01, 2020 @11:10AM (#23702259)
I'm curious, do you have a link to the blog post?
Re:JavaScript for Impatient Programmers by ehnto on Wednesday July 01, 2020 @10:58AM (#23702089)
React is a particularly bad way to learn pragmatic Javascript because it's idioms are quite different from how people program in any other scenario but UI dev. It's a UI library and you won't learn much about Javascript programming from it. You will just know React.

You should absolutely learn React if you want to be employed writing with JS, but people should understand where React lies in the context of javascript. It isn't an abstraction of JS, it's a UI library written in JS.

Re:JavaScript for Impatient Programmers by ravenstine on Wednesday July 01, 2020 @11:36AM (#23702624)
> You should absolutely learn React if you want to be employed writing with JS

I know that this probably isn't how you meant it, but I think what you said is a bit misleading to someone who wants to learn JS for a job.

Having skills in React are an almost guaranteed way to get a job writing JS. It's definitely not the only viable way to get employed writing JS. Contrary to popular belief, there are many jobs out there asking for Node.js skills but not necessarily React or any heavy frontend knowledge. You can also make a living doing Vue or Angular, and Svelte is an up and coming framework that will be good to learn and I believe will create lots of jobs. I've been writing mostly Ember.js code for years now, yet I'm employed.

I just want to make sure that learners don't think that it's all React or nothing. Nothing against React, by any means. If someone learns React but it doesn't interest them, their career in JS isn't over.

Re:JavaScript for Impatient Programmers by mr_toad on Wednesday July 01, 2020 @10:14PM (#23709250)
> it's idioms are quite different from how people program in any other scenario but UI dev.

Many of those idioms borrow from ideas (functional programming, reactive programming) outside UI development, and outside JavaScript.

I would think that an experienced programmer starting with JavaScript would appreciate React.

Re:JavaScript for Impatient Programmers by debaserab2 on Wednesday July 01, 2020 @02:37PM (#23704855)
A little learning is a dangerous thing ; Drink deep, or taste not the Pierian spring : There shallow draughts intoxicate the brain, And drinking largely sobers us again.