
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
...
For further actions, you may consider blocking this person and/or reporting abuse
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.Pls share your opinion here
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
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.
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.
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.
What a great read! Thank you for your insights! 🌼
should probably mention that
let
andconst
have a different scope (block scope) thanvar
(function scope)Top notch
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.
This post is dumb
Highly recommended
How to Create a User Registration Form with HTML5, CSS, and JavaScript that includes all types of validations, conditional statements, and functions.