HOW TO: SHALLOW CLONE (COPY) VS DEEP CLONE OF JAVASCRIPT OBJECTS

By: Saurav

2018-12-11 00:24:00 UTC

A recent rendezvous in the javascript world gave me the incentive to write this short blog. Mainly, I will compare and contrast the various method through which we can copy one hash to another.

Lets get started:

Suppose, we have a hash initial_hash and we want to create another hash which is a copy of the
 first hash. Of course, we want a new hash which is completely isolated from the first hash:

let initial_hash = {1: true, 2: true, 3: false}

Owned & Maintained by Saurav Prakash

If you like what you see, you can help me cover server costs or buy me a cup of coffee though donation :)