JSFiddle - React, Tailwind, and code Playground

JavaScript

var foo = {}

Object.defineProperties(foo, {

    bar: {
        value: "foo",
        writable: true,
    },
    foo: {
        value: function() {
           console.log(this.bar);
        }
    },
});

foo.bar = "foobar";
foo.foo();  //logs "foobar"

var Env = {};
Env.OP = {};

Env.SystD = {
  env : "syd",
  envName : "SysD",
  url : "https://blah.test.s.com",
  sfEnv : "o-s-d.test.s.com"
}



//console.log(Env.OP.SystD);


Env.OP.SystD = {};

Object.defineProperties(Env.OP.SystD, {

    env: {
        
    },
    envName: {
        value: function() {
        console.log("in set");
           this.env = Env.SystD.env;
           this.url = Env.SystD.url;
           this.sfEnv = Env.SystD.sfEnv;
        }
    },
    url: {
    },
    sfEnv: {
    }    
});

Env.OP.SystD = {
  envName : "Hello"
}

Env.OP.SystD.envName = "adam";

Env.OP.SystD.envName();

debugger;
console.log(Env.OP.SystD);