r/learnjavascript • • Jul 19 '21

Just in case you are a visual learner.

155 Upvotes

14 comments sorted by

16

u/mareksl Jul 19 '21 edited Jul 19 '21
  • The arr.slice() example is wrong.[1, 2, 3, 4].slice(1, 3) would return [2, 3]

  • The arr.find() example is misleading. [1, 2, 3, 4].find(1) would throw, as Array.prototype.find() takes a function that should return a boolean, e.g. [1, 2, 3, 4].find(el => el === 2)

3

u/SulfaThePutra Jul 20 '21

Thanks for pointing out. Array.slice() is mistakenly wrong. And about Array.find(), you see it's written "find an element which passes the test" which means it takes a function the run the test. But I get what you are pointing at, and what you explained is correct.

3

u/[deleted] Jul 20 '21

2

u/SulfaThePutra Jul 20 '21

It's all about amount of attention you put when learning. He was trying people on street and he had all their attention which lead to the results he is talking about. But In daily life, where everything is just going like usual, there are only certain media that catches your attention and that makes you absorb more of what is being shown/taught. That defines the type of learner you are. And I am not saying that you are born with it or you cannot make a change, but you do have a preference when it comes to type of the content

P.S - I love his work and had watched this video already

2

u/techmnml Jul 20 '21

Damn that’s wild. I walked by this being filmed a few weeks ago and have been wondering what it was for. So random I actually found out given how much content is out there in the world.

1

u/[deleted] Jul 20 '21

Small world!

2

u/METALz Jul 20 '21

Might be a slight rant but I only write this because of the account is only advertising this site (which is not an actual site but a discord group) but anyways it seems we moved to the "every day the same topic just with different stock images presenting them" instagram posts.

I personally welcome these instead of the unnecessary long medium/etc blog posts but at least put more effort into them and ask your group of "industry experts" to check the slides for errors and think from a beginner's perspective how it would be the most clear.

1

u/SulfaThePutra Jul 20 '21

Hey, thanks! seems like you are very good at giving opinions. Can you help me with something, because why not? please provide me with some remarks on this one as well - https://www.instagram.com/p/CReC4QqDT1U/ I would really love that.

1

u/diimitra Jul 20 '21

I'm pretty dumb... on the 2nd slide, the find blue triangle, how can it return a blue triangle if there is no blue triangle in the array ? I'm I overthinking this or ?

1

u/SulfaThePutra Jul 20 '21

blue is just highlighting but yeah, got you 😀

2

u/kiwiL92 Jul 20 '21

wow .. so nice

2

u/redderper Jul 20 '21

With pop it not only removed the last item in the list, but also returns that item

1

u/schroeder8 Jul 20 '21

Same with shift()

2

u/schroeder8 Jul 20 '21

In addition to every() there is also some()