r/learnjavascript • u/wilfredinni • Apr 29 '19
I made a Javascript cheat sheet
I don't know if it can help someone else besides me, but, here it is the Github Project and the web site I made.
Contributions and feedback are always welcome.
Edit: fixed the repo link.
3
5
u/MoTTs_ Apr 29 '19 edited Apr 30 '19
The class syntax is just a syntax, and not a full-fledged class based implementation of object oriented paradigm, unlike in languages like Java, or Python, or Ruby etc.
Surprisingly, the implementation of classes in JavaScript, Python, and Ruby are all actually very similar, where classes are themselves objects, and inheritance from instance to class to superclass is done by delegation. Python and JS classes side-by-side.
5
u/serious_case_of_derp Apr 29 '19
Maybe change this under ES6 Arrow Functions?
// to pass a single parameter to an arrow function
const doubler = item => item * 2;
// to pass multiple parameters to an arrow function - parenthesis are needed
const doubler = (item1,item2) => item1 * item2;1
u/Aka_Erus Apr 29 '19
I don't see it, where is the mistake ?
Is it calling " doubler" the second function ?
5
u/Time_Terminal Apr 29 '19
It's not a mistake but an addition they are proposing.
OP doesn't have separate examples for passing 1 variable or more than one variable in arrow functions. u/serious_case_of_derp is saying this should be added.
2
2
1
Apr 29 '19
I think you messed up. The GitHub Project is linked to a Python Cheat Sheet.
2
u/wilfredinni Apr 29 '19
Fixed it!
1
Apr 29 '19
I still can't find the JavaScript link. It takes me to the GitHub repo. Then on the repos site it points to a python cheat sheet website.
1
u/wilfredinni Apr 29 '19
you mean the link to the repo? https://github.com/wilfredinni/javascript-cheatsheet or the webpage?
1
3
u/HarmonicAscendant Apr 29 '19
The lessons in this section handle non-browser features. import won't work on a browser directly. However, we can use various tools to create code out of this to make it work in browser.
Cool cheatsheet, but this is plain wrong. You just add type="module" in the HTML. I have been happily using it for over a year, sod IE, all that nonsense is history.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
Make sure you add '.js' at the end of the import. Import will work well in Node 12 now too with 'experimental modules' enabled:
https://medium.com/@nodejs/announcing-a-new-experimental-modules-1be8d2d6c2ff
or just use https://github.com/standard-things/esm
3
u/r3jjs Apr 30 '19
For the most part, it looks good.
One thing do -- please use another example for String.prototype.split. Using the '' string separate a string into characters only works for strings that it into the Unicode Basic Multilingual plane. Higher-order characters, which longer than two bytes, gets ripped apart.
String.prototype.length has a similar issue.
(Array.from(...) is a good way to split up strings.
2
2
2
u/d3vCr0w Apr 29 '19
Very useful, just by taking a quick look I already found stuff I didn't know about, thank you!
2
2
2
2
2
1
1
12
u/psiph Apr 29 '19 edited Apr 29 '19
This is excellent! Very well done! I'm not a beginner, but I'll still use this!
Maybe make it a separate repo from the Python one? That'd make it easier for me to star, as I'd know why I saved it when coming back to it.
Edit: Nice, the GitHub link is updated now!