DEV Community

Cover image for JavaScript Basics for a Senior Dev

JavaScript Basics for a Senior Dev

Jayant on March 21, 2025

Here are the thing we are goona talk about in depth Hoisting Temporal Dead Zone Diff b/w Function & Function Exp. Shallow Copy vs Deep Copy ...
Collapse
 
skamansam profile image
Samuel

You really need to mention structuredClone() as a way to deep copy. It is builtin and requires much less processing than json conversion. It also derefs pointers in a much better way. IMO, it's the best way to deep copy.

Collapse
 
jay818 profile image
Jayant

Pls share your opinion here

Collapse
 
julius_koronci_f8b2a9766d profile image
Julius Koronci

Seems the author doesn't know the difference between what is hoisting and how it looks like, yes the effect is similar to what's described but that's really not what hoisting is about.. hoisting is about how js is compiled and yes it's a compiled language and hoisting is a result or way of how lexing is being done

Collapse
 
tbogard profile image
Erick Rodriguez

I think you need to go beyond map and include filter when sparced elements of an array might include falsy values sucn as null or indefined. You would save ton of time by using array.filter(Boolean).map(...) to assert right data.

Actually I was expecting Proxy object, hashmaps with tiny pointers, and Observables new patterns In this article. Not bad for the first suggestions.

Collapse
 
deathcrafter profile image
Shaktijeet Sahoo

JSON is not the way to deep copy. Yes, it covers basic data types, but you lose any class objects or types that are not supported by JSON. I know you are just providing an example, but you should explicitly mention this as it is a bad habit.

IMO deep copying something you don't know the shape of is a bad habit by default. If required, you should create a function that takes in the object you need and makes a deep copy of it.

Collapse
 
juni0r profile image
Andreas Korth • Edited

Our senior devs spend way too much of their time hoisting and polyfilling. I always found their copies to be way too shallow, especially if you consider how much we pay them. Reading this article really stepped up their game.

Collapse
 
aniruddhaadak profile image
ANIRUDDHA ADAK

What a great read! Thank you for your insights! 🌼

Collapse
 
tehmoth profile image
tehmoth

should probably mention that let and const have a different scope (block scope) than var (function scope)

Collapse
 
chibu profile image
Chibuike Maduabuchi

Top notch

Collapse
 
avelino_nogueira_2f1e3513 profile image
Avelino Nogueira

If your senior js developer needs this article to improve programming you need to talk to HR to do better interviews.... Some of this stuff are basic and incorrect.

Collapse
 
voquanghoa profile image
Võ Quang Hòa

This post is dumb

Collapse
 
repairloader profile image
RepairLoader

Highly recommended

Collapse
 
rina_thakor profile image
Rina Thakor

How to Create a User Registration Form with HTML5, CSS, and JavaScript that includes all types of validations, conditional statements, and functions.