Consider this snippet:
const obj1 = {1:1, 2:1, 3:1}
const obj2 = {1:1, 4:1, 9:1}
for(let key in obj1){
if(!(key ** 2 in obj2)) return false
}
Can the Big O of this algorithm considered O(n) or it should be O(n^2) because of:
if(!(key ** 2 in obj2))
Is considered to loop through all items (search) of obj2
** Note**: assume the length of obj1 and obj2 are equal