DEV Community

Cover image for Top 20 JavaScript Tricks and Tips for Every Developer πŸš€

Top 20 JavaScript Tricks and Tips for Every Developer πŸš€

Dipak Ahirav on July 29, 2024

JavaScript is a versatile and powerful language, but it can also be tricky to master. Here are 20 JavaScript tricks and tips that every developer s...
Collapse
 
skamansam profile image
Samuel

This is a great article! However, you probably shouldn't use the spread operator to clone nested objects. Objects are references so a shallow clone with the spread operator will clone nested refs, not the objects. You should use structuredClone() instead.

Collapse
 
dipakahirav profile image
Dipak Ahirav

Thanks @skamansam

Collapse
 
medison_chikuta_7922e2fec profile image
Medison Chikuta

Hey, a new to code and am learning JavaScript.

Collapse
 
dipakahirav profile image
Dipak Ahirav

Great to hear you, All the best .

Collapse
 
ashleyd480 profile image
Ashley D

Super helpful @dipakahirav! I like the series you made- you are a wonderful teacher. Currently working on a React JS project myself, and I found these tips really helpful!
πŸš€

Collapse
 
dipakahirav profile image
Dipak Ahirav

Thank you so much for kind words. Means alot.

Collapse
 
moglimanani profile image
manimaran

Great articles. Simpler and neat explanation.

Collapse
 
dipakahirav profile image
Dipak Ahirav

Thanks @moglimanani

Collapse
 
kin7777 profile image
kince marando • Edited

Great insight links , and eye opening for junior and Senior develops.!
Kindly thanks

Collapse
 
dipakahirav profile image
Dipak Ahirav

Your Welcome @kin7777

Collapse
 
marmeden profile image
eneasmarin

Great one. So satisfying to realize that I am using most of them, but still some good ones to include in my work

Collapse
 
tomasdevs profile image
Tomas Stveracek

Great short summary!

Collapse
 
dipakahirav profile image
Dipak Ahirav

Thanks @tomasdevs

Collapse
 
syedmuhammadaliraza profile image
Syed Muhammad Ali Raza

informative article

Collapse
 
michalispapamichael profile image
Michalis Papamichael

informative article

Collapse
 
dipakahirav profile image
Dipak Ahirav
Collapse
 
renterra profile image
Renterra

Cool!

Collapse
 
johnsonsuredotdev profile image
JohnsonSureDotDev

As a newbie I've now got something worth knowing,big thanks to you bro

Collapse
 
blafasel3 profile image
Maximilian Lenhardt

I use everything except Short-Circuit Evaluation, I believe that's a feature to avoid. It's just too different from other programming languages out there and it requires implicit knowledge of what evaluates to truthy or falsy in JavaScript, which is a weird concept in itself (I generally think that loading up special values of classes meaning something else is a bad idea).

Collapse
 
messier82 profile image
Π˜Π³ΠΎΡ€ΡŒ Π’ΠΈΠ½ΠΎΠ³Ρ€Π°Π΄ΠΎΠ²

Just to note - provided examples for object cloning is not deep clone. Which means that if the object has nested arrays/objects - they will still have references to the original objects/arrays. lodash library has "cloneDeep" method which can achieve deep cloning

Collapse
 
akshay_bachhav_ profile image
Akshay Bachhav

Correct. Shallow cloning copies references. Use Lodash cloneDeep for true copies.

Collapse
 
technologyguru profile image
technology

Your article on JavaScript is excellent!

However, it seems to be missing a section on completely hiding JavaScript from the browser. If you’re interested, we can either add this content to your post or provide the text for you to include.

Collapse
 
lanrie_dev profile image
Olanrewaju

Thanks for thisπŸ‘πŸ’―, very helpful

Collapse
 
akshay_bachhav_ profile image
Akshay Bachhav

Concept of nullish coalescing explained very clean... Thanks

Collapse
 
kc900201 profile image
KC

Can we also promote using TypeScript as a superscript of JS?

Collapse
 
dandoy_jeans_d09ac2524993 profile image
Dandoy Jeans

Good read! Thank you!

Collapse
 
lemon_dev profile image
Lemon Confidence

Neat explanation.

I really like the concept of nullish coalescing.

Some concepts I rarely use :⁠-⁠|