Shallow Comparison Javascript vs Deep Comparison Javascript

preview_player
Показать описание
Learn the difference between shallow comparison, deep comparison and javascript comparison by building this functions with me from scratch. Shallow comparison works faster but can't support nested arrays and objects. Deep comparison is the slowest but compares every single nested value.

MOST POPULAR COURSES

SERVICES THAT I'M USING

CONNECT WITH ME!

REFERENCES

TIMESTAMPS
0:00 Introduction
0:33 Javascript comparison
2:34 Shallow comparison
10:01 Deep comparison

This video is NOT sponsored. Some product links are affiliate links which means if you buy something I'll receive a small commission.
Рекомендации по теме
Комментарии
Автор

Endlich ein komplettes Tutorial, sehr nuetzlich und schoen erklaert! Danke!!!

mihaipascu
Автор

just say super awesome simple explanation i ever see in youtube.

jahidhasanjibon
Автор

I found your channel two days ago and I'm in love with your teaching style. You are awesome, please don't stop teaching.
I'm really having hard time with authentication in node js(sessons, jwt, oauth, custom authentication), Any chance to learn it from you?

rajan-ub
Автор

I love how you take your time to explain things.. clear and precise diction.. !

frederickobeng-nyarko
Автор

Mesej yang jelas, struktur yang jelas, mudah difahami, terima kasih

小惠陈
Автор

Pretty good tutorial. But I guess one more case we can check where the second object i.e the target have some extra keys than the source.
source:- {a:"name", b: "myName"}
target:- {a:"name", b: "myName", c: "anotherName"}
Currently shallowCompare(source, target) will give true which isn't correct. You might agree to it

We can fix that by adding a condition to check the keys length
if (typeOf(source) === "object")
{
if (Object.keys(source).length !== Object.keys(target).length) {
return false;
}
return => source[key] === target[key]);
}

jainlokesh
Автор

Great video. Very informative. Thank you for sharing it.

shvideo
Автор

Great teaching, please keep on teaching more !

waldBestMusics
Автор

it would be great if there is a playlist of similar videos at this level of concept. I really enjoyed this one. Thank you.

vanlongpham
Автор

Great video and excellent explanation, thank you for sharing!

daryaleylian
Автор

I find this video very interesting. Thank you !

mariamitsotsolashvili
Автор

Great work, learnt something today :)

LeoL
Автор

What if the sequence of key pair value inside object is different?For eg :- How we can compare this
{name : 'xyz', age :3} and {age:3, name:'xyz'}
will the function deepclone you made will work for this.?

rajuljadia
Автор

Any difference between the standard JavaScript typeof and your helper function typeOf?

tolulopemalomo
Автор

Suggestion for the next video: deep cloning; I don't like using Lodash, but the need for cloning is very common for a large number of projects 😬

a_lodygin
Автор

Nice videos as always. By the way you're pronouncing "target" incorrectly. You're saying "tarjet" instead of "target".

IkraamDev