2021年4月23日星期五

Javascript loop through a nested object and trying to see if all values are same or not

const tree = {    a : 1,    b : 1,    c : {      a1 : 1,      b1 : 2    }  }  

Here is a sample object in javascript. Is there a way to write a function and trying to see if every node's value in this object is the same or not? if is all same return true otherwise return false. (The deep of the object can be infinite)

https://stackoverflow.com/questions/67238510/javascript-loop-through-a-nested-object-and-trying-to-see-if-all-values-are-same April 24, 2021 at 09:19AM

没有评论:

发表评论