Top 10 Javascript One Liners YOU MUST KNOW!

  Рет қаралды 192,198

developedbyed

developedbyed

Жыл бұрын

🚀 Upgrade your web development skills with my courses: developedbyed.com/
In today's episode, I will show you some awesome tips and tricks with javascript that you can do in one line of code.
💡 If you want to learn more about React, check out my channel for more React tutorials and you can find React courses on my website. developedbyed.com
🛴 Follow me on:
Twitter: / developedbyed
Github: github.com/developedbyed/
Instagram: / developedbyed
#javascript #programming

Пікірлер: 237
@codegenius2932
@codegenius2932 Жыл бұрын
I think what you were calling extraction is actually called destructuring (like it's proper term). Nice video, definitely learnt something new
@simonjanca
@simonjanca Жыл бұрын
Yes that's it. Destructuring works for objects attributes OR even positional properties of Array with Const keyword const [first, second] = [1,2] const {f, s} = {f:1, s:2}
@cipherxen2
@cipherxen2 Жыл бұрын
Who gets to decide which is term is proper and which is not?
@anarchoyeasty3908
@anarchoyeasty3908 Жыл бұрын
@@cipherxen2 the language spec?
@cipherxen2
@cipherxen2 Жыл бұрын
@@anarchoyeasty3908 language specs are not written in stone, they also change
@anarchoyeasty3908
@anarchoyeasty3908 Жыл бұрын
@@cipherxen2 ok let me know when it changes from calling it destructuring and this comment thread will become irrelevant. Until such a time as that occurs, the thing is called destructuring.
@FuckingFrenchBastard
@FuckingFrenchBastard Жыл бұрын
1. Designer Mode 0:47 2. Roll the Dice 1:24 3. Merging Array 2:06 4. Extracting from Objects 3:46 5. Generator Color 5:24 6. Copy to Clipboard 7:54 7. Transitionend 8:47 8. Short is Statements 9:56 9. Console Table 11:28 10. Screen Capture 12:03
@ShadowVipers
@ShadowVipers Жыл бұрын
#4 is known as "destructuring" & #8 are known as "guard clauses"
@bansh3ee
@bansh3ee Жыл бұрын
#5 either "Generate Color" or "Color Generator", but there's already something in JS called a Generator, and that doesn't have a color
@bansh3ee
@bansh3ee Жыл бұрын
#8 guard/guard statement. that's not a JS specific thing.
@ShadowVipers
@ShadowVipers Жыл бұрын
@@bansh3ee True it's not JS Specific but it's still called a guard clause.
@espertalhao041
@espertalhao041 Жыл бұрын
​@@ShadowVipers #8 can also be known as an early return, because you return early in your code, while validating the data. It's a little easier to think about it's reason to exist if you call it an early return. Which is what it does: there's no point in going further because you've done all you can up to that point and you have to leave.
@matet12345
@matet12345 Жыл бұрын
Always amazing to be greeted as "gorgeous" 😅😁
@bm2085
@bm2085 Жыл бұрын
With all due respect, I thought you're already fed up with it. You must be called gorgeous all the time... :$
@elfelipe1996
@elfelipe1996 Жыл бұрын
Damn, people are now hitting on girls on KZbin nowadays. What a time to be alive
@bm2085
@bm2085 Жыл бұрын
@@elfelipe1996 Absolutely not, just stated the obvious!
@ManicMonkey1987
@ManicMonkey1987 Жыл бұрын
Yeah, this guy is a smoothie
@lainverse
@lainverse Жыл бұрын
3:37 I'd like to add that it's worth remembering that using spread operator on arrays have iteration cost attached to it, so the larger the array the slower this works. So, if your code is called many times over it's better to merge arrays in traditional way by pushing elements of one into another. It doesn't matter on small arrays, but on actually large ones (thousands of items) this may cause a noticeable lag. 6:33 6-digit hexadecimal number. In decimal (default representation in console) it can go up to 8 digits. ;)
@CottidaeSEA
@CottidaeSEA Жыл бұрын
Another approach is to have a third array that is updated at the same time as the other two. The downside would be that it has to search for the entries, but if using a map, that can be solved through using proper keys.
@NNNedlog
@NNNedlog Жыл бұрын
Your tutorials are always so engaging and easy to follow 🔥🔥🔥
@AlphaWatt
@AlphaWatt Жыл бұрын
That color generator is awesome!! Tyvm!
@alvarocastillocorrea2610
@alvarocastillocorrea2610 Жыл бұрын
This is really great! Thanks for this content Ed! 🚀
@jaied
@jaied Жыл бұрын
Cool! Although I knew most of these one-liners. Only DesignMode and transitioned events are new to me. Thanks for sharing.
@chiptunesfreemusic5040
@chiptunesfreemusic5040 Жыл бұрын
Gracias querido por estos tips; hace mucho no programaba ni lo más mínimo en js y me voy desactualizando, pero aquí aprendí nuevas funciones y demás
@Raju917707
@Raju917707 Жыл бұрын
Thanks a lot bro. awaiting for more videos from you.
@4Sightfails
@4Sightfails Жыл бұрын
Very fun video, it brings me joy that I knew almost 5 of them.
@eduardointech
@eduardointech 2 ай бұрын
With the first video, the CSS one, you got my like and save, with this second one you got my like and subscribe!
@KGmagicjj
@KGmagicjj Жыл бұрын
This is a nice list, but I would strongly recommend w this being a teaching channel, to mention the technical name of some of these patterns and operators as you go. Spread operator, object destructuring syntax, guard blocks, etc.
@EmmaKAlexandra
@EmmaKAlexandra Жыл бұрын
I've always called the "one line if" a guard statement, or a guard if statement. Helps a ton with nesting.
@bansh3ee
@bansh3ee Жыл бұрын
"guard statement" is a proper term for the thing as well
@bassilmohammad7266
@bassilmohammad7266 Жыл бұрын
Hi ed . I wont to ask you from were you have learned data structure and algorithm? Thank you ed for your courses🌺❤️❤️
@serkan_bayram
@serkan_bayram Жыл бұрын
Hey man, you're videos great as always, do you consider making a video about javascript road map?
@gokulk2060
@gokulk2060 Жыл бұрын
Cool! I like the screen capturing
@mohammedelhoussni
@mohammedelhoussni Жыл бұрын
Thank You Ed This Is Realy Amazing
@kevinvz5387
@kevinvz5387 Жыл бұрын
i love your music taste, super chill
@bilalbeny4172
@bilalbeny4172 8 ай бұрын
thank you for this video, you are awesome!!
@boneykingofsomewhere
@boneykingofsomewhere Жыл бұрын
I created a random background-color generator with copy-to-clipboard inside a hex code div (the hex code shows inside the div). Click the button to generate a random colour and if you like it, click the hex field div to copy it. Great little video that has definitely improved my abilities and knowledge, ta Ed 😀😎
@robertn2997
@robertn2997 Жыл бұрын
Nice video, Blender in combination with Babylon js would be awesome. Not many people make tutorials about Babylon js while it is a great 3D engine for in the browser
@justusmaier
@justusmaier Жыл бұрын
8. is actually called a Guard Clause, very useful to avoid nested if statements!
@injSrc
@injSrc Жыл бұрын
Really coool video 🔥🔥🔥 Cool setup as well 😊 By the way, please tell me the model of your monitor, it looks dope
@khan.hassan
@khan.hassan Жыл бұрын
Very useful thanks for sharing
@slipstream01
@slipstream01 Жыл бұрын
Ed can u please tell mr what monitor are you using? Looks amazing.
@cipriancozma2783
@cipriancozma2783 Жыл бұрын
Really nice video, Ed!
@hassaneoutouaya
@hassaneoutouaya Жыл бұрын
Thank you so much !
@user-ct6sy5ky8p
@user-ct6sy5ky8p Жыл бұрын
Thank you very much!!!
@antoniovm7116
@antoniovm7116 Жыл бұрын
Nice video, I like the way you explain. Nice work dude.
@shrishailgharat1964
@shrishailgharat1964 Жыл бұрын
Grateful for this video 🤝
@ITGirlll
@ITGirlll Жыл бұрын
That merge one liner is great is for interviews
@asafhagbi3638
@asafhagbi3638 Жыл бұрын
Love your energy 👍
@cloudsystem3740
@cloudsystem3740 Жыл бұрын
thank you very much 🙌
@michelebevilacqua8652
@michelebevilacqua8652 Жыл бұрын
Always good content, you're the best
@protopan7722
@protopan7722 Жыл бұрын
Love the new video quality 😍😁
@lewisone
@lewisone Жыл бұрын
Dude. The random hex was super clever. My favorite new trick.
@stepone3040
@stepone3040 Жыл бұрын
Hello plz I m looking for a function or whatever that can help me find list of printers installed on my machine. Thanks lot for your videos
@qodesmith520
@qodesmith520 Жыл бұрын
The random color hex thing blew my mind!
@_the_one_1
@_the_one_1 Жыл бұрын
Awesome! I knew all of them but what was the last one? Didn't know about it
@san4os94
@san4os94 Жыл бұрын
thanks for the tutorial Ed Helms.
@jacquesduplessis6175
@jacquesduplessis6175 Жыл бұрын
Ed called me friend👌🏻 Life complete, haha, These videos are actually golden, keep it up
@user-yj2el4ps3s
@user-yj2el4ps3s Жыл бұрын
Very cool)) Thank you)
@gabrielmessiasdarosa3604
@gabrielmessiasdarosa3604 Жыл бұрын
designMode extremely blows my mind. Great content !
@7heMech
@7heMech Жыл бұрын
The only thing which I didn't know was 5:01, but it's good to revisit things once in a while, great video!
@nekotoriy
@nekotoriy Жыл бұрын
Thanks! By the way, what is theme color name ?
@petrvalenta8835
@petrvalenta8835 Жыл бұрын
Very nice vid Ed! 🚀 That monitor at the beginning, is it Dell? Can you tell me the type? 😊 Cheers!
@vcothur7
@vcothur7 Жыл бұрын
The designmode one is super helpful while designing sites
@_invencible_
@_invencible_ Жыл бұрын
who would have thought...
@michastolarczyk7228
@michastolarczyk7228 Жыл бұрын
What is the lens you used for recording this video?
@michaelhofby
@michaelhofby Жыл бұрын
Hey ED :) ! I saw in one of your other video that you had a vs code theme with a gradient up in the title bar in one of your recent videos and i thought it looked SO cool that i figured out how to do it myself :D ... But now you dont have it anymore i see .
@michaelhofby
@michaelhofby Жыл бұрын
i used the "Custom CSS and JS loader" vs code extension and then custom CSS to color the different elements of vs code :)
@michaelhofby
@michaelhofby Жыл бұрын
I cant post a screenshot of my vs code .. Cuz youtube deletes the comment but yeah , could be cool to see a video on that .
@malyarevich
@malyarevich Жыл бұрын
0:47 Design Mode - awesome feature, I like it! Almost all rest poor, because it is something like part of ECMA standards. Also last one looks impressive. Good job, man, anyway! Thank you!
@reflectivereveriemingle
@reflectivereveriemingle Жыл бұрын
I will make a shortcut of this video to my desktop. Thanks Ed.
@ekoneko6958
@ekoneko6958 3 ай бұрын
After CSS one-liners, now this = New Subscriber here :)
@djpunisha29
@djpunisha29 Жыл бұрын
this man is pure positive energy, lovely human being :)
@bonganintshangase6051
@bonganintshangase6051 Жыл бұрын
The design mode one was very helpful, the rest are also helpful but it's just regular es6 stuff.
@jomoc6112
@jomoc6112 Жыл бұрын
aspiring fan here... i allready new this, but i kinda forgot the other so thanks for the reminder
@IhorVyshniakov
@IhorVyshniakov Жыл бұрын
It's short just fiery content!!! Thanks for this hacks 😉
@Pfoffie
@Pfoffie Жыл бұрын
Doesn't generate colors have an issues with missing leading zeroes in numbers less than 0x100000?
@DiestroCorleone
@DiestroCorleone Жыл бұрын
We love you, Ed. Just wanted to let you know that.
@nclsDesign
@nclsDesign Жыл бұрын
9:22 or you just set the visibility to hidden aswell. This will not transition by itself, so you'll still need opacity, but it will change the value once the transition is done.
@parsonsmarcus
@parsonsmarcus Жыл бұрын
Setting visibility to hidden will disable pointer events on the element, but other elements in the DOM will be affected by its positioning (unless it's set to an absolute or fixed position). To keep the element on the page, you should set it to "display: none;" so that way it will not affect the layout of other DOM elements and be removed from visibility.
@bmehder
@bmehder Жыл бұрын
This is a good one.
@streamx2
@streamx2 Жыл бұрын
what is your monitor please?
@thatsenoughdixit
@thatsenoughdixit 10 ай бұрын
Really good video ❤
@mdsunyshaikh
@mdsunyshaikh Жыл бұрын
What's you display brand & model?
@v324s7
@v324s7 Жыл бұрын
Hi, how are you? I have a question. How to implement animation in Figma on the web-site? I can't find a solution on the internet
@jaiderariza1292
@jaiderariza1292 Жыл бұрын
`console.table(data)` at 11:45 very useful tip!
@Stl71
@Stl71 Жыл бұрын
You are a developer and a successful youtuber, but from the outlook, you could be an actor too. No joke.
@pouriyanourouznejad7090
@pouriyanourouznejad7090 Жыл бұрын
Ur my best teacher 💜
@colindante5164
@colindante5164 6 ай бұрын
Could anyone please explain where the duration was set for the button to fade out before being transitioned to a display of none? (Transitionend 8:47) Thankyou
@guitarplayer1434
@guitarplayer1434 Жыл бұрын
the 70's prono music in the background makes the video
@azzaisme
@azzaisme Жыл бұрын
The extraction is very useful for any Async call
@TrevinAvery
@TrevinAvery Жыл бұрын
The official name is destructuring, just in case you want to look it up
@MoheTheDreamy
@MoheTheDreamy Жыл бұрын
I like the console.table command.
@nunoRRsantos
@nunoRRsantos Жыл бұрын
Very good
@Azamat78726
@Azamat78726 Жыл бұрын
Can somebody tell, what is the name of his Vs Code theme ?
@trickeddev
@trickeddev Жыл бұрын
Array.from(new Set([…..])) is much cleaner than what you did and is the preferred way btw
@ribasenric
@ribasenric Жыл бұрын
Cool tricks! Fun fact: You can make `const copy = (text) => navigator.clipboard.write(text)` even shorter `const copy = navigator.clipboard.write` no need to wrap in another function that takes text and passes text to it.
@wfl-junior
@wfl-junior Жыл бұрын
Technically you can do anything in one line in JavaScript xD
@yoel.taylor
@yoel.taylor Жыл бұрын
Super important to note that the Navigator.Clipboard API only works locally or in HTTPS. So if you want to make an insecure HTTP website, copying text won't work!
@skillzorskillsson8228
@skillzorskillsson8228 Жыл бұрын
I guess that explains why it was not working for me on codepen. Sure, codepen does use HTTPS but i guess it has something to do with it... Because it is not working at all on codepen
@hithankyou123
@hithankyou123 Жыл бұрын
Why is that super important you nerd
@tbuk8350
@tbuk8350 Жыл бұрын
This is definitely important, but it's also 2022, there are no excuses to not have an SSL certificate on your website.
@abodfta6159
@abodfta6159 Жыл бұрын
thsnks
@sunflowertoadtheorbiter7420
@sunflowertoadtheorbiter7420 Жыл бұрын
JSON.stringify(data,null,2)
@eitherplace9844
@eitherplace9844 3 ай бұрын
Well there is a better option for single line if to only run if not null using ?? operator known as null coalescing operator. However it is best to use for value assignment, similar to ternary operator
@Migler1
@Migler1 Жыл бұрын
What vscode theme are you using in this video?
@Mwtorres89
@Mwtorres89 Жыл бұрын
he claims to be using the palenight theme, but here hes using the Community material theme ocean high contrast... you're welcome
@Migler1
@Migler1 Жыл бұрын
@@Mwtorres89 thanks 🙏🏻
@fern9890
@fern9890 Жыл бұрын
Can you make a web3 tutorial?
@synesthetic2979
@synesthetic2979 Жыл бұрын
I like your energy, friend
@RahulRahul-pn4nb
@RahulRahul-pn4nb Жыл бұрын
Awesome
@Mwtorres89
@Mwtorres89 Жыл бұрын
he claims to be using the palenight theme, but here hes using the Community material theme ocean high contrast... you're welcome
@damianos.2954
@damianos.2954 Жыл бұрын
You're crazy. I love u💚( as instructor)😅💪💪💪
@chethiyakd
@chethiyakd Жыл бұрын
Man transitionend will save me tons of time!!!!
@prathamshenoy9840
@prathamshenoy9840 Жыл бұрын
You remind me of the guy in Camera Conspiracies
@andrewsharpe4764
@andrewsharpe4764 2 ай бұрын
For merging arrays, concat is easier to read.
@Pacvalham
@Pacvalham Жыл бұрын
14:07 How about an error or exception?
@yuvasaikiran2259
@yuvasaikiran2259 Жыл бұрын
Good Things devEd mawa
@veyseltosun472
@veyseltosun472 Жыл бұрын
This man a little dr crazy looking . Dude thank you.
@mr.shroom4280
@mr.shroom4280 Жыл бұрын
You make me smile
@beans_dev
@beans_dev Жыл бұрын
I don’t know how many years Ed has been calling me a gorgeous friend on the internet 😂
@mangadi3859
@mangadi3859 Жыл бұрын
maybe its better to set the transitionend event inside the click event and set it to once: true
@rawkeh
@rawkeh Жыл бұрын
I wish I'd known about transitionend a few months ago...
@moinulhossain2108
@moinulhossain2108 Жыл бұрын
cool What is the name of the theme?
@Mwtorres89
@Mwtorres89 Жыл бұрын
he claims to be using the palenight theme, but here hes using the Community material theme ocean high contrast... you're welcome
@Nosleepguy
@Nosleepguy Жыл бұрын
Amazinggggggg 🎉🎉
@lessons3141
@lessons3141 Жыл бұрын
useful
Javascript Layout Animations REALLY SIMPLE TUTORIAL!
32:39
developedbyed
Рет қаралды 75 М.
Top 10 CSS One Liners That Will Blow Your Mind
13:34
developedbyed
Рет қаралды 913 М.
Homemade Professional Spy Trick To Unlock A Phone 🔍
00:55
Crafty Champions
Рет қаралды 58 МЛН
8 Modern JavaScript Concepts You MUST Know Before Learning React
24:12
Top 10 CSS Features You Should Know & Use in 2023
19:56
Lukas | Web Development & Design
Рет қаралды 307 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 457 М.
JavaScript Pro Tips - Code This, NOT That
12:37
Fireship
Рет қаралды 2,5 МЛН
The problems with viewport units
13:23
Kevin Powell
Рет қаралды 354 М.
Junior Vs Senior Code - How To Write Better Code
22:13
Web Dev Simplified
Рет қаралды 1,1 МЛН
top 10 JavaScript tricks
17:18
techsith
Рет қаралды 19 М.
Top 10 Advanced CSS Responsive Design Concepts You Should Know
20:16
Web Dev Simplified
Рет қаралды 503 М.
The JavaScript Survival Guide
14:47
Fireship
Рет қаралды 717 М.
Vite Crash Course | Faster Alternative To CRA
16:24
Traversy Media
Рет қаралды 188 М.
cute mini iphone
0:34
승비니 Seungbini
Рет қаралды 5 МЛН
Simple maintenance. #leddisplay #ledscreen #ledwall #ledmodule #ledinstallation
0:19
LED Screen Factory-EagerLED
Рет қаралды 2,5 МЛН