r/learnjavascript • • Jul 20 '21

JavaScript Facts: Object And Array

252 Upvotes

23 comments sorted by

6

u/senocular Jul 20 '21

Typo for "04.":

let anObj = {left:3, right: 2};
console.log(anObj.left); // -> 1

The initial literal should use left: 1 or the log should output // -> 3

The use of // -> for "05." can be a little confusing too since unshift() returns the length of the array and shift returns the number shifted off the array. Neither return the modified array as the use // -> suggests

1

u/hsnice Jul 20 '21

Thanks, senocular

10

u/GalacticCmdr Jul 20 '21

Is there something really wrong with the art in panel 2? Like a baby head on a Frankenstein body. It just looks very odd to the point of distraction.

-7

u/Reddit-Book-Bot Jul 20 '21

Beep. Boop. I'm a robot. Here's a copy of

Frankenstein

Was I a good bot? | info | More Books

26

u/HashFap Jul 20 '21

This techie "Alegra" type illustration style is cancer.

4

u/[deleted] Jul 21 '21

It’s super unsettling. Doesn’t feel welcoming or warm. Can’t stand it.

7

u/BazilExposition Jul 20 '21

Should've stick to random animals.

6

u/contactlite Jul 20 '21 edited Jul 21 '21

Substance over style, please.

Not using monospace was a bold choice.

Not letting a line of code not fit on a line (like in 01) is disappointing.

Please practice good habits and industry norms in tutorial/educational material.

4

u/ngqhoangtrung Jul 21 '21

Appreciate the tutorial but the style is kinda distracting tbh. Why would a guy listening to something on his phone be relevant to deleting a property of an object?

1

u/[deleted] Nov 24 '21

Lol you copied this code from Eloquent JavaScript, word for word, code for code, don’t claim it as your own.

0

u/hsnice Nov 24 '21

Yeah, I was reading Eloquent JavaScript that time. And found this thing interesting to share.

3

u/Banamagrammer Jul 20 '21

Fact 5 person is legit. They're coding on a (stinky) Nintendo DS.

1

u/SpractoWasTaken Jul 21 '21

Idk where these comics are coming from but I enjoy them

1

u/[deleted] Nov 24 '21

All copied straight from Eloquent JavaScript

1

u/vieggly_ofc Jul 21 '21

Those people seem suspiciously happy, it doesn't fit this whole javascript thing!

2

u/smrkhan55 Jul 20 '21

Illustration is similar to Gojek's insta handle. Can someone shed some light on this?

0

u/[deleted] Jul 20 '21

That should a cheat sheet

-2

u/Prexsplay Jul 20 '21

👍🏾

21

u/[deleted] Jul 20 '21

[removed] — view removed comment

7

u/FriesWithThat Jul 20 '21

Well, #1 looks to specifically be addressing arrays. I'd say for #1 to be more precise it should say:

The elements in an array are stored as the array's properties, using its index in the array as a property name. The index is of type 'number'.

Length is a property on the array prototype, and is typically accessed using dot notation.

Just to expand, for beginners dropping into that slide:

const arr = [1, 2, 3, 4, 'last element'];
arr[1];  // 2
arr.indexOf(1) // 0
arr[arr.length - 1] // last element
arr.length // 5