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
 
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
 
syedmuhammadaliraza profile image
Syed Muhammad Ali Raza β€’

informative article

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
 
michalispapamichael profile image
Michalis Papamichael β€’

informative article

Collapse
 
dipakahirav profile image
Dipak Ahirav β€’
Collapse
 
kin7777 profile image

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

Collapse
 
dipakahirav profile image
Dipak Ahirav β€’

Your Welcome @kin7777

Collapse
 
tomasdevs profile image
Tomas Stveracek β€’

Great short summary!

Collapse
 
dipakahirav profile image
Dipak Ahirav β€’

Thanks @tomasdevs

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
 
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
 
akshay_bachhav_ profile image
Akshay Bachhav β€’

Concept of nullish coalescing explained very clean... Thanks

Collapse
 
lanrie_dev profile image
Olanrewaju β€’

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

Collapse
 
kc900201 profile image
KC β€’

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

Collapse
 
lemon_dev profile image
Lemon Confidence β€’

Neat explanation.

I really like the concept of nullish coalescing.

Some concepts I rarely use :⁠-⁠|

Collapse
 
dandoy_jeans_d09ac2524993 profile image
Dandoy Jeans β€’

Good read! Thank you!