Node.js Dot Notation as Namespace Mechanism
In node.js, when you have a dot notation like
x.y
the x
is used purely as a namespace,
not as “data”.
Example:
const p = require('path'); const x = p.extname('xyz.html') console.log ( x ); // .html
This is true for about all node.js objects.
This is interesting because the item before the dot is usually considered as a object that represent a piece of data in Object Oriented Programing languages. For example, in JavaScript:
" x ".trim()