My favourite example of a perfectly valid JavaScript code that shows all the weird stuff that's possible to do with braces, parentheses and few of the ES6 syntax additions:
let a = 1;
let b = 10;
let c = 100;
({ b: a = ++c } = (({ b: c = a } = { c: { b: ++a } }) => ({ b: ++c }))({ b: ++c }));
console.log(a, b, c);
Quite an extreme interview question if you ask me. But can you figure out, using just your head, what will be the output in the terminal?
Top comments (1)
Nice quiz