JavaScript: What is Shallow copy ?

A shallow copy of an object is a copy whose properties share the same references (point to the same underlying values) as those of the source object from which the copy was made.

As a result, when you change either the source or the copy, you may also cause the other object to change too — and so, you may end up unintentionally causing changes to the source or copy that you don't expect.

That behavior contrasts with the behavior of a deep copy, in which the source and copy are completely independent.

For shallow copies, it's important to understand that selectively changing the value of a shared property of an existing element in an object is different from assigning a completely new value to an existing element.

For example, if in a shallow copy named copy of an array object, the value of the copy[0] element is {"list":["butter","flour"]}, and you do copy[0].list = ["oil","flour"], then the corresponding element in the source object will change, too — because you selectively changed a property of an object shared by both the source object and the shallow copy.

However, if instead you do copy[0] = {"list":["oil","flour"]}, then the corresponding element in the source object will not change — because in that case, you're not just selectively changing a property of an existing array element that the shallow copy shares with the source object; instead you're actually assigning a completely new value to that copy[0] array element, just in the shallow copy.

In JavaScript, all standard built-in object-copy operations (spread syntax, Array.prototype.concat(), Array.prototype.slice(), Array.from(), Object.assign(), and Object.create()) create shallow copies rather than deep copies.
contrasts

@contrast /'kɔntræst/
* danh từ (+ between)
- sự tương phản, sự trái ngược (giữa)
=the contrast between light and shade+ sự tương phản giữa ánh sáng và bóng tối
=to put colours in contrast+ để cho màu sắc tương phản nhau, để cho màu sắc đối chọi nhau
- (+ to) cái tương phản (với)
* động từ
- làm tương phản, làm trái ngược; đối chiếu để làm nổi bật những điểm khác nhau; tương phản nhau, trái ngược hẳn
=thesee two colours contrast very well+ hai màu này tương phản với nhau rất nổ
=his actions contrast with his words+ hành động của của hắn trái ngược với lời nói của hắn

@contrast
- (Tech) tương phản; độ tương phản

@contrast
- sự tương phản // đối lập, đối chiếu

underlying

@underlying /,ʌndə'laiiɳ/
* tính từ
- nằm dưới, dưới
- (nghĩa bóng) cơ bản, cơ sở
=underlying principles+ những nguyên lý cơ bản

@underlie /'ʌndəlain/
* ngoại động từ underlay; underlain
- nằm dưới, ở dưới
- làm cơ sở cho, làm nền tảng cho (một học thuyết...)