Question from the Javascript test

Accessing nested object properties in Javascript

Hard

What will the following code display:

let myObj = {
    a : 'A',
    b : 'B',
    c : {
        d : 'D',
        e : 'E',
        f : {
            g : 'G'
        },
        h : 'H'
    }
};

let { c : { f : { g: foo}, e: baz, b: bar }  }= myObj;

console.log(foo, bar, baz);
Author: Jean-marie CléryStatus: PublishedQuestion passed 2142 times
Edit
1
Community Evaluations
developer avatar
Other
Benoit
17/09/2024
question inutile. Personne ne code comme ça
developer avatar
Spelling / formatting error
Justin
07/05/2024
One liners for objects are unreadable
developer avatar
Auteur anonyme
20/05/2024
Indeed !