I would like to know in which time complexity I am traversing my nested JS Object. For traversing the JS Object I am using three nested for-loops e.g.
Sketch of the For-Loop:
for(const page in object){
for(const group in page){
for(element in elements){
}
}
}
I need to visit every element of each elements for each group a page has.
JS Object:
{
"Page 1":{
"Group 1": {
"Elements": [
"Element 1",
]
},
"Group 2": {
"Elements": [
"Element 1"
]
}
},
"Page 2":{
"Group 1": {
"Elements": [
"Element 1",
"Element 2"
]
}
}
}
Is it O(n) due to the fact that I am visiting each elements only a single time?