How to judge the difference between two objects with different nesting levels?

now there is a requirement to judge the difference between the two objects, and awkwardly, there is only a difference in the nesting level between the two objects:: > _ <:

var a = {
      1:{
        2:{
          3:"3"
        }
      }
    }
var b = {
      4:{
        5:"5"
      }
    }
The a, b, c attributes of

objects are all indefinite, and the number is also indefinite

.

is there a simple operation to determine which object it is?

Mar.23,2021

does not quite understand your requirements, is to determine whether two objects have the same depth? Or judge whether two objects are not equal
1. If you just judge the depth, then iterate through it recursively, get the depth of each object, and then compare
2. If you are judging whether two objects are equal, it is also a recursive traversal, and whether each layer is equal

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5df32-44cb5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5df32-44cb5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?