2

What does mean 'get' inside a javascript function?. This 'get' is used many time in the return. I stumbled upon this code:

var getHost = function () {
    return {
        get linux() {
            return process.platform === 'linux';
        },
        get windows() {
            return process.platform === 'win32';
        },
        get mac() {
            return process.platform === 'darwin';
        },
    };
};

Return value is { linux: [Getter], windows: [Getter], mac: [Getter] }.

Jose Angel
  • 328
  • 2
  • 16

0 Answers0