Live data from Hacker News

A book series on JavaScript

github.com

21–30 of 111 posts

Re: A book series on JavaScript

#21

I wouldn't normally do this, but since his books have popped up on here at this exact moment.. Kyle's teaching some short JS classes in London this coming week if you wanna come: https://ti.to/cooperpress/kyle-simpson-quick-workshops/ (disclosure: I'm the organiser)

/disclaimer/disclosure/

(When you disclose something, it's a disclosure.)

Re: A book series on JavaScript

#22
post #10
post #8

An entire book is dedicated to "this", when it's only "the stuff on the left side of the dot" (it changed my life when i understood that)

It's just one chapter and the rest of the book is about prototypes and inheritance. It's also not just 'the stuff on the left side of the dot'. using strict mode, call/apply, the new keyword and arrow functions have influence on what `this` is. And they are applied in a certain order of precedence you need to know.

I found it pedantic as well. 'This' really is just the object to the left of the dot, unless 'new' is used to invoke the function with a brand new 'this' object. Functions called without a 'left-of-the-dot' argument, not having a 'this' injected, just see that of the global scope (Window). Call and apply allow to explicitly inject the 'this' object. That pretty much sums up at least 80% of the chapter.

Re: A book series on JavaScript

#23
post #21

I wouldn't normally do this, but since his books have popped up on here at this exact moment.. Kyle's teaching some short JS classes in London this coming week if you wanna come: https://ti.to/cooperpress/kyle-simpson-quick-workshops/ (disclosure: I'm the organiser)

/disclaimer/disclosure/ (When you disclose something, it's a disclosure.)

You're correct - thanks! I've fixed it, for anyone else wondering what this is about.

Re: A book series on JavaScript

#25

From what I read, the author uses double quotes for string literals, "some string". Most of the style guides and linters recommend using single quotes, any idea on the advantage of each?

There is no difference in JavaScript, they have the same semantics & meaning.

However, single quotes have two advantages (IMO, since this is obviously subjective):

1. can be typed without shift on US keyboard layout

2. I use double quotes inside string literals (e.g. for quoting bad input in error messages) more often than single quotes (mostly used for contractions) so not having to escape double quotes by default is convenient.

Standard (and I guess eslint?) support "single quotes unless a single quote appears in the string", which is ideal (for me).

Re: A book series on JavaScript

#26
post #6

I can highly recommend these books. They're one of the only books that do a real deep-dive into the language. I often have to interview people for javascript jobs. It's astonishing how few of them actually get how the `this` keyword, closures, prototypes etc work. So the title of the series may be arrogant, but not wrong.

It's understandable since it was designed to be a scripting language, easy to pick up and be productive with only a superficial understanding.

You have to get your mind oriented to concepts like closures and prototypes - there's a natural barrier there between the js dev and the real expert. People can get jobs without making the leap. I would think they can keep their job. But at some point having only the superficial understanding will have to be compensated for, maybe in technical debt.

Re: A book series on JavaScript

#27

From what I read, the author uses double quotes for string literals, "some string". Most of the style guides and linters recommend using single quotes, any idea on the advantage of each?

I do use double quotes in my JS projects, mostly out of habit though.

One reason I can think of why people use double quotes is because JSON only supports double quotes and it's not uncommon to deal with JSON when you program in JS.

Re: A book series on JavaScript

#28

If you search Amazon for these titles, you'll see the author reacting poorly to bad reviews.

Someone commented on his free e-book by saying "meh", and he replied: Note that this review not only is completely unhelpful with just the single word "meh", leaving me nothing as an author to do to improve... but also that this review was from the kindle edition, which is FREE. ChrisP got a free copy of my book -- intentionally offered that way at a loss of income to both me and my publisher -- and took the time to…

Bad reviews are a contemporary version of book burning.

Re: A book series on JavaScript

#30

From what I read, the author uses double quotes for string literals, "some string". Most of the style guides and linters recommend using single quotes, any idea on the advantage of each?

I prefer double quotes to single quotes to strings: When you write C and C++ a single quote generates a character 8 byte literal. A double quote is a string an array of characters.
Post reply on HN