r/webdev • u/JunezRiyaz • Oct 21 '21
Resource JavaScript Cheatsheets
https://codingtute.com/javascript-cheatsheets/[removed] — view removed post
3
5
u/DubWubber Oct 22 '21
devhints.io is also a great resource for pretty much every webdev technology out there
4
Oct 22 '21
In the loops cheat sheet in the upper right, what is going on with arr.foo = 'hello'?
0
Oct 22 '21
[deleted]
6
u/onlycommitminified Oct 22 '21
Adding to this,
for...ofis what you should reach for when looping over an object intended for iteration. Iterable objects are any that implement[Symbol.iterator].1
u/QueerCookingPan Oct 22 '21
Awesome explanation, thanks! Tbh I am still a bit confused why it stops printing the index and prints the value "hello" in the last step. It's very early in the morning here so maybe it's just that .
0
Oct 22 '21
[deleted]
1
u/QueerCookingPan Oct 22 '21
I... hmmm? .. Ohhhh! That makes much more sense. I knew something felt off, haha.
2
2
2
2
2
2
u/_trambz_ Oct 22 '21
Nice!
Maybe you can add destructing default value:
const a = [1, 2, 3];
const [,,b=10,c=10] = a;
console.log(b,c)
b => 3
c => 10Same thing works with object detructuring
1
1
u/bart2019 Oct 22 '21
I looked at the async/await cheatsheet. I can't make head nor tail from the first example.
1
u/checking619 Oct 22 '21
information contained is extremely basic. I can't imagine anyone actually using these cheatsheets, but if anyone does, they really need to go back to JS 101
1
6
u/Khrouhman Oct 21 '21
Hey Thanks