当前位置:网站首页>(JS) handwriting depth comparison
(JS) handwriting depth comparison
2022-06-29 11:11:00 【Yu Cainiao, who asked not to be named】
// Deep comparison
function isObject(obj) {
return typeof obj==="object" ? true : false;
}
function isEqual(obj1,obj2) {
if(!isObject(obj1) || !isObject(obj2)) {
return obj1 === obj2;
}
if(obj1 === obj2) {
return true;
}
// Take out obj1 and obj2 Of key
const obj1Keys = Object.keys(obj1);
const obj2Keys = Object.keys(obj2);
if(obj1Keys.length !== obj2Keys.length) {
return false;
}
for(let keys in obj1) {
// Recursive comparison obj1 and obj2 Value
var result = isEqual(obj1[keys],obj2[keys]);
if(!result) {
return false;
}
}
return true
}
var obj1 = {
a:100,
b:100,
c:{
x:100,
y:200
}
}
var obj2 = {
a:100,
b:100,
c:{
x:100,
y:200
}
}
console.log(isEqual(obj1,obj2)) //true
边栏推荐
- 5.移植uboot-设置默认环境变量,裁剪,并分区
- Several methods of enterprise competition analysis: SWOT, Porter five forces, pest "suggestions collection"
- np.astype()
- Specific method and example program of Siemens s7-200smart control stepping motor
- (JS)状态模式
- 工具箱之 IKVM.NET 项目新进展
- 在Clion中使用EasyX配置
- Modbustcp protocol network learning single channel infrared module (double-layer board)
- dropout层
- NUC980开源项目16-从SPI FLASH(W25Q128)启动
猜你喜欢

Google Earth Engine(GEE)——GEDI L2A Vector Canopy Top Height (Version 2) 全球生态系统数据集

任职 22 年,PowerShell 之父将从微软离职:曾因开发 PowerShell 被微软降级过

Course design for the end of the semester: product sales management system based on SSM

Graduation season · advanced technology Er - workers in the workplace

Modbustcp protocol WiFi wireless learning single channel infrared module (round shell version)

Using EasyX configuration in clion

【NLP】文本生成专题1:基础知识

毕业季·进击的技术er - 职场打工人

math_数学表达式&等式方程的变形&组合操作技巧/手段积累

STM32F1與STM32CubeIDE編程實例-超聲波測距傳感器驅動
随机推荐
(JS)手写深比较
[digital signal modulation] realize signal modulation and demodulation based on am+fm+dsb+ssb, including Matlab source code
(JS)数组去除重复
Spark - Task 与 Partition 一一对应与参数详解
【NLP】文本生成专题1:基础知识
Modbustcp protocol network learning single channel infrared module (medium shell version)
在线SQL转HTMLTable工具
BS-GX-017基于SSM实现的在线考试管理系统
Recommended embedded learning books [easy to understand]
常见电机分类和驱动原理动画[通俗易懂]
直击产业落地!飞桨重磅推出业界首个模型选型工具
(JS)数组方法:slice和splice
(JS)手写bind函数
dropout层
Shell quotation marks and escape are rarely noticed, but they are often used in writing scripts
(JS)模仿indexOf方法寻找字符串中某个字符的位置
TTL serial port learning infrared remote control module can be extended to network control
Mastering the clever use of some shell wildcards will make us write with half the effort
crypto 1~5
5.移植uboot-设置默认环境变量,裁剪,并分区