panzerdp / dmitripavlutin.com-comments

7 stars 0 forks source link

/make-your-javascript-code-shine-knockout-old-es5-hacks-part-2/ #18

Open panzerdp opened 3 years ago

panzerdp commented 3 years ago

Written on 08/15/2016 07:18:53

URL: https://dmitripavlutin.com/make-your-javascript-code-shine-knockout-old-es5-hacks-part-2/

panzerdp commented 3 years ago

Comment written by collegeimprovements me on 08/17/2016 10:27:30

This is cool. Thanks a lot for this article. I hope you keep writing such articles. :)

panzerdp commented 3 years ago

Comment written by Dmitri Pavlutin on 08/17/2016 10:49:34

Glad you like it! I do plan in the long run to create even more interesting articles :).

panzerdp commented 3 years ago

Comment written by Xavier Haniquaut on 08/18/2016 12:41:53

Hey Dmitri !
Here is one close to the Array.includes() one ;)

Sometime when we wanted to search an element inside an array we used the following pattern :
const needle = haystack.filter(hay => hay === 'needle')[0];
Now we can use the way more semantic :
const needle = haystack.find(hay => hay === 'needle')

What do you think?

panzerdp commented 3 years ago

Comment written by Dmitri Pavlutin on 08/18/2016 14:04:47

Hey Xavier,
Nice catch! The hack haystack.filter(matchFun)[0] is solved using haystack.find(matchFun) nicely.
Methods like .find() in array should have been created in the first JavaScript versions, but not after 20 years :). Better late than never anyway.
Thanks!

panzerdp commented 3 years ago

Comment written by adardesign on 02/13/2017 02:19:37

Thanks for the well written articles

panzerdp commented 3 years ago

Comment written by Dmitri Pavlutin on 02/13/2017 11:37:00

You're welcome!

atengberg commented 1 year ago

Think I've reread many of your articles at least twice in the last two years while learning Javascript, React, etc. Thanks for sharing your knowledge, has made the path to becoming a modern day developer easier!

panzerdp commented 1 year ago

Thanks @atengberg!