JSFiddle - React, Tailwind, and code Playground
by igalst
JavaScript
var object1 = {
a: 1,
b: 2,
c: 3,
d: 4,
e: 5
};
console.log("object1", object1);
var MultiObject = function(a, b) {
this.a = a;
this.b = b;
};
var object2 = new MultiObject(1, 2);
var object3 = new MultiObject(3, 4);
var object4 = object3;
// var variable = [condition] ? [valueTrue] : [valueFalse];
var property = Math.round(Math.random()) ? "a" : "b";
/*if (Math.round(Math.random())) {
property = "a";
} else {
property = "b";
}*/
object4.a = 99;
object3["b"] = 777;
//object3 = null;
object2[property] = "wow!";
console.log("object2", object2);
console.log("object3", object3);
console.log("object4", object4);