Stop Wasting Your Time - Use These 16 JS Utility Functions Instead

Stop Wasting Your Time - Use These 16 JS Utility Functions Instead

Web Dev Simplified

2 года назад

73,111 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@Luke_UPPX
@Luke_UPPX - 06.06.2022 01:56

Thanks man, i recomment to use momentJS for handling dates

Ответить
@dman7776
@dman7776 - 01.06.2022 04:18

You do not need `qs` and `qsa` function. Simply use `const { querySelector } = document`;

Ответить
@user-tx5sr2lt6z
@user-tx5sr2lt6z - 04.05.2022 00:11

Better to add `async` to sleep and change `duration` to `ms`, for example. Some functions using duration in seconds

Ответить
@emsp5558
@emsp5558 - 02.05.2022 22:03

@web dev simplified did you play the guitar intro?

Ответить
@bhumit070
@bhumit070 - 24.04.2022 19:17

and make them npm package and add them in any project

Ответить
@zodiarkesper6073
@zodiarkesper6073 - 07.04.2022 00:11

Title is misleading doesn't relate to content very much
Wouldn't global event handler have bad performance like some events is triggering contantly like mouse move
Last thing why not using slice , it has best performance

Ответить
@rolandasgrigaitis708
@rolandasgrigaitis708 - 05.04.2022 18:37

Thanks to your javascript tutorials I learned how to access all of your video files from your website, so now I can watch them for free and I also uploaded them on torrent so everyone is happy ^^

Ответить
@ankitshukla8640
@ankitshukla8640 - 05.04.2022 14:19

You should rename addGlobalEventListner to aGEL and createElement to cEL

Ответить
@loydcose2780
@loydcose2780 - 05.04.2022 14:02

This is sooo useful, just like CSS we create utilities for less repetition. 🙌

Ответить
@derjansan9564
@derjansan9564 - 05.04.2022 09:12

My createElement() function has a third parameter which is childElements. These childElements will be appended to the newly created element.

Ответить
@dakotazout
@dakotazout - 04.04.2022 20:32

Great vid. Re: your sleep function... what is the benefit of using a Promise with setTimeout vs calling it directly?

Ответить
@stevenleonmusic
@stevenleonmusic - 04.04.2022 19:24

Readable code is always more valuable than easy-to-type code. It's criminal to take descriptive functions and rename them to "qs" and "qsa" and that really kind of highlights the one complaint I have about your channel: You've either never worked with other people or have simply never been told "No" on anything. I like some of these concepts but I don't understand this—very incorrect—notion that programming is slow because things take a long time to type. Programming is slow because we are solving problems, not for lack of short function names. Create a reusable library for sure but make it a good one with descriptive names and built-in documentation.

Ответить
@subham-raj
@subham-raj - 04.04.2022 17:49

And then people say why DSA is given importance. The things mentioned in the video are the easy to medium question from DSA :)

Ответить
@radyy4902
@radyy4902 - 04.04.2022 14:18

if I want to add many classes on element what should I do?

Ответить
@pepp0tube
@pepp0tube - 04.04.2022 13:36

RelativeDateFormat is exaclty what I was looking for and what I was going to implement by myself. Thanks, you saved me a lot of time.

Ответить
@filipusfontanus
@filipusfontanus - 03.04.2022 20:50

You shouldn't be using filter() for the first()/last() methods. It becomes exponentially slower as the array grows in size.
slice(0,n)/slice(-n) are much more efficient and show no significant degradation in performance with larger arrays.

Ответить
@zshn
@zshn - 03.04.2022 04:03

Great video. Many of these should be first class functions.

Ответить
@alvaroprietovideos
@alvaroprietovideos - 03.04.2022 01:47

Hola! It is childish, but it made me happy that you said 'Spain' 😂💃

Ответить
@axe-z8316
@axe-z8316 - 02.04.2022 15:50

doing FE stuff on a PC is why you wont get to 1m subs. ;)

Ответить
@ShadabRezashad
@ShadabRezashad - 02.04.2022 12:17

Nice codes

Ответить
@rishabhanand4270
@rishabhanand4270 - 02.04.2022 01:58

Is it that much harder to write though? The thing is half the time, you end up adding functionality over functionality to the utilities themselves because you reach more complex cases.
If it's genuinely very tough to write (example WebRTC / IndexedDB), please do go ahead and make sure you add as many utils as possible.
And if it's a function you use all the time just with different params from the browser API, please do go ahead and modularise it.
I would argue that using browser APIs directly would be a better choice if the saving is minimal.

Ответить
@thevividversatilechannel4807
@thevividversatilechannel4807 - 01.04.2022 22:56

array.at(-1) can be used instead of array[array.length - 1]

Ответить
@outlawpl
@outlawpl - 01.04.2022 10:22

Very handy. Great video. Thanks!

Ответить
@stylesg7818
@stylesg7818 - 31.03.2022 23:14

Thank you. Very useful indeed.

Ответить
@rayankhan12
@rayankhan12 - 31.03.2022 18:24

These methods are going to be part of ES7!

Ответить
@balajiravi9259
@balajiravi9259 - 31.03.2022 17:54

Really nice 👍

Ответить
@brunocastro4193
@brunocastro4193 - 31.03.2022 13:54

Awesome! So helpfull! I changed the createElement function to .className = value (on key === 'class'), so i can pass all classes in one single string

Ответить
@dimitargetsov9690
@dimitargetsov9690 - 31.03.2022 12:57

I wish two things--feasible ones--at the end of Roland Garros 2022 Rafael Nadal champion and WDS with 1M subscribers...

Ответить
@reddev8906
@reddev8906 - 31.03.2022 12:04

kyle, you can make a pollyfilll for the arrays for example for pluck Array.prototype.pluck = function(key) {return this.map(elem => elem[key])}

Ответить
@anthonyblackford8689
@anthonyblackford8689 - 31.03.2022 10:48

Awesome video, but how would you stack a function, the groupBy for example, suppose you had an array of objects of people like the example, but you wanted to group them by gender, then hair color, then eye color. How would you write something like that? I tried what I thought it would be, but didn't work.

Ответить
@Niksorus
@Niksorus - 31.03.2022 08:22

Amazing video, I love these as a junior ♥️

Ответить
@frankie_nor
@frankie_nor - 31.03.2022 06:45

Thank you, Kyle!!! 👏

Ответить
@kylebelle246
@kylebelle246 - 31.03.2022 06:15

Most useful stuff was definitely the date stuff. Every thing else was of questionable utility but those dates still confuse a lot of devs

Ответить
@romanext921
@romanext921 - 31.03.2022 03:26

Superlike! Why did I not see this earlier... Thank you!

Ответить
@mrrrr9853
@mrrrr9853 - 31.03.2022 02:20

physcotic way to arrange ur method paramaters

Ответить
@bennybar
@bennybar - 31.03.2022 02:05

The number formatter is a life saver. I don't even want to know how many times I've done a replaceAll(".",","), because Denmark uses French decimals

Ответить
@daveit1337
@daveit1337 - 30.03.2022 23:58

This is so cool. Thank you, Kyle.

Ответить
@lifebest4404
@lifebest4404 - 30.03.2022 21:15

Sir how to create uber app backund php

Ответить
@anthonypetruzzi158
@anthonypetruzzi158 - 30.03.2022 20:13

so.... jQuery... you've reinvented jQuery

Ответить
@GG-uz8us
@GG-uz8us - 30.03.2022 20:08

Very helpful.

Ответить
@nitsanbh
@nitsanbh - 30.03.2022 18:51

I think your groupBy implementation is inefficient, because the spread syntax copies the entire object into a new one (and lets the GB dispose the previous) every single iteration

Ответить
@techexpertpremiere
@techexpertpremiere - 30.03.2022 16:39

That's great Tutorial. Thank you.

Ответить
@JimKernix
@JimKernix - 30.03.2022 15:53

Excellent video. Can you do a video on using the underscore as a variable like you do in first and last array functions. I don't quite understand that.

Ответить
@senseicodes
@senseicodes - 30.03.2022 14:53

Man your content is amazing. Been working on a vaniila js project and I have so many utility functions as esm, they are so handy. About to modify some of them to use yours 😂 and add the rest to my huge util.js file. Thanks man. Amazing work.

Ответить
@robertholtz
@robertholtz - 30.03.2022 14:17

Awesome video and great advice. Just as every good chef maintains their personal set of knives, every good programmer should have their personal arsenal of general-use utility functions. Your “bag of tricks” should follow you in your travels as a developer and evolve/improve with repeated use across multiple projects. This has the added benefit of making your work more consistent and therefore easier to maintain over time. Nice work, Kyle!

Ответить