Live data from Hacker News

Cheatsheet for the modern JavaScript

github.com

11–20 of 37 posts

Re: Cheatsheet for the modern JavaScript

#11

This is probably a fine resource. Can't really judge it - I avoid JavaScript to the extend humanly possible. But please - could someone end the devaluation of the word cheatsheet . A cheatsheet should be just that - a sheet of paper or its digital equivalent, with a few short, clear notes of essentials. Not a rambling document. Not something with a table of contents.

Agree. I was expecting something that one could print on maximum two A4 pages. This here is a rather long pamphlet.

Re: Cheatsheet for the modern JavaScript

#12

This is probably a fine resource. Can't really judge it - I avoid JavaScript to the extend humanly possible. But please - could someone end the devaluation of the word cheatsheet . A cheatsheet should be just that - a sheet of paper or its digital equivalent, with a few short, clear notes of essentials. Not a rambling document. Not something with a table of contents.

Thank you. For comparison, these are real cheatsheets:

* https://zeroturnaround.com/wp-content/uploads/2017/03/regex-...

* https://rumorscity.com/wp-content/uploads/2014/08/10-Best-VI...

* https://wch.github.io/latexsheet/latexsheet-1.png

Re: Cheatsheet for the modern JavaScript

#13

Ugh, why can't JavaScript programmers learn from others languages first? Making all your variables const is just going to confuse most people WHEN THEY'RE NOT CONSTANT. Stop with the const spam already, you just look like dicks. I am waiting for the articles in 3 years time, "const isn't constant" as the JavaScript community tediously explain to each other ref. vs value types like it's the 1990s. Just use let and sto…

But the values are const? You just need to understand the implication of const in javascript.

Why would you choose to weaken the communication in your code by choosing `let` over `const` when you have no intention of reassign the value? `let` would just confuse the reader as they'd start anticipating the reassignment.

Compare:

```

// A variable containing an object that will not be reassigned

const a = { foo: 10};

// This is still valid

a.foo = 10;

```

vs

```

// A variable containing an object that might be reassigned.

let a = { foo: 10};

// This is still valid

a.foo = 10;

```

The first example says more about your intent and throwing that information away is a bad idea.

Re: Cheatsheet for the modern JavaScript

#14

This is probably a fine resource. Can't really judge it - I avoid JavaScript to the extend humanly possible. But please - could someone end the devaluation of the word cheatsheet . A cheatsheet should be just that - a sheet of paper or its digital equivalent, with a few short, clear notes of essentials. Not a rambling document. Not something with a table of contents.

Thank you. For comparison, these are real cheatsheets: * https://zeroturnaround.com/wp-content/uploads/2017/03/regex-... * https://rumorscity.com/wp-content/uploads/2014/08/10-Best-VI... * https://wch.github.io/latexsheet/latexsheet-1.png

Thanks for the cheatsheet examples. They bring back fond memories of the laminated cheatsheets I used to buy at the bookstore. But it's been a long time since I used one of those; now I just want everything in digital form to keep my backpack light.

It was interesting that these are all bitmap image files at a rather low resolution. The text is so blurry on all of them! It made me wonder: do people actually use these kinds of image cheatsheets? They wouldn't print well, and zooming in on screen just gives blurry text. My old laminated sheets had crisp high-quality printed text.

It would be different if they were in a vector format, of course. But since I'm not printing them anyway, the traditional cheatsheet is no longer a useful format for me. I much prefer a short document like the OP's "cheatsheet" with legible text that I can scroll through on any device without having to zoom in and pan around.

I suppose one could object to the "sheet" part, since you can't print a document like this on a single sheet of letter or A4 paper. But that doesn't bother me at all: I started my programming career on Teletype machines that used roll paper, and we routinely printed out cheatsheets of varying length. There was no set height to a sheet: it ended wherever you tore it off the roll.

What would be a better name for a document like this that serves the purpose of a traditional cheatsheet but is in a format more suited for digital reading? Maybe "A short guide to ..."?

(Updated with more stories)

Re: Cheatsheet for the modern JavaScript

#15

Earlier quoted context omitted.

Thank you. For comparison, these are real cheatsheets: * https://zeroturnaround.com/wp-content/uploads/2017/03/regex-... * https://rumorscity.com/wp-content/uploads/2014/08/10-Best-VI... * https://wch.github.io/latexsheet/latexsheet-1.png

Thanks for the cheatsheet examples. They bring back fond memories of the laminated cheatsheets I used to buy at the bookstore. But it's been a long time since I used one of those; now I just want everything in digital form to keep my backpack light. It was interesting that these are all bitmap image files at a rather low resolution. The text is so blurry on all of them! It made me wonder: do people actually use these…

Summary? Overview?

Re: Cheatsheet for the modern JavaScript

#16
post #5

I usually just do just enough javascript, but didn't know the difference between let and var, not it makes sense. the explanation of reduce made sense too.

I always use `const` unless i can't otherwise `let`. There is no place for `var` although everyone has an opinion this has always worked for me.

Re: Cheatsheet for the modern JavaScript

#17

Ugh, why can't JavaScript programmers learn from others languages first? Making all your variables const is just going to confuse most people WHEN THEY'RE NOT CONSTANT. Stop with the const spam already, you just look like dicks. I am waiting for the articles in 3 years time, "const isn't constant" as the JavaScript community tediously explain to each other ref. vs value types like it's the 1990s. Just use let and sto…

I also don't get this point (I am not the brightest bulb :D)

In Typescript anyway, `const` means I am not allowed to reassign. Attempting to change it just will cause compiler warnings. If you mean that, ignore Typescript and tooling, and that once the code is in the browser executing, then consts can be changed.... Who cares about that?

Re: Cheatsheet for the modern JavaScript

#18

Earlier quoted context omitted.

Thank you. For comparison, these are real cheatsheets: * https://zeroturnaround.com/wp-content/uploads/2017/03/regex-... * https://rumorscity.com/wp-content/uploads/2014/08/10-Best-VI... * https://wch.github.io/latexsheet/latexsheet-1.png

Thanks for the cheatsheet examples. They bring back fond memories of the laminated cheatsheets I used to buy at the bookstore. But it's been a long time since I used one of those; now I just want everything in digital form to keep my backpack light. It was interesting that these are all bitmap image files at a rather low resolution. The text is so blurry on all of them! It made me wonder: do people actually use these…

Why are you being downvoted for this?

AFAICT these are low-res previews of high-quality PDF cheat sheets you can buy.

Re: Cheatsheet for the modern JavaScript

#19

Ugh, why can't JavaScript programmers learn from others languages first? Making all your variables const is just going to confuse most people WHEN THEY'RE NOT CONSTANT. Stop with the const spam already, you just look like dicks. I am waiting for the articles in 3 years time, "const isn't constant" as the JavaScript community tediously explain to each other ref. vs value types like it's the 1990s. Just use let and sto…

You seem to be mixing up the concepts of "constant" and "immutable". In the context of JS, constant is a characteristic of the variable identifier and only suggests that it will never be reassigned to point to another value or reference in the current scope. The mutability of the referenced value is entirely up to the definition of said value's type (hence why stuff like Immutable.js exists).

The idea that JS programmers can't learn from others' languages first is an odd one considering that, if I remember correctly, const in JS has the same semantics as the final keyword in Java and it's the default semantics of any local variable in Rust, so it's not something that seems to be out of the ordinary or falling out of favor.

Re: Cheatsheet for the modern JavaScript

#20

Ugh, why can't JavaScript programmers learn from others languages first? Making all your variables const is just going to confuse most people WHEN THEY'RE NOT CONSTANT. Stop with the const spam already, you just look like dicks. I am waiting for the articles in 3 years time, "const isn't constant" as the JavaScript community tediously explain to each other ref. vs value types like it's the 1990s. Just use let and sto…

I get your point, but I'm not sure I share your cynicism. For instance, a "constant" container with mutable contents is the first example given in Practical Common Lisp [0]:

    (defvar *db* nil)

    (defun add-record (cd) (push cd *db*))
    (defun make-cd (title artist rating ripped)
      (list :title title :artist artist :rating rating :ripped ripped))

    (add-record (make-cd "Roses" "Kathy Mattea" 7 t))
If you're concerned about this kind of thing, we should be encouraging novice programmers to stop using language features they don't understand.

[0]: http://www.gigamonkeys.com/book/practical-a-simple-database....

Post reply on HN