JS: x.y.z Associativity, Right or Left?

By Xah Lee. Date: . Last updated: .

fun JavaScript problem. Test your knowledge.

// what's the value of x.y.z()

const x = {
    "y.z":function () { return 4;},
    "y":{"z":function () { return 3;}}
};

console.log(x.y.z());

Try it out in your browser console to see the answer. [see JS: How to Use Browser Console]

Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS Basics
  4. JS in Depth
  5. JS Reference
  6. DOM
  7. SVG
  8. JS Misc