how to access properties of an object in javascript code example

Example 1: create object javascript

const object = {
  something: "something";
}

Example 2: how to a property from a JavaScript object

delete myObject.regex;
// or,
delete myObject['regex'];
// or,
var prop = "regex";
delete myObject[prop];


/** Demo */
var myObject = {
    "ircEvent": "PRIVMSG",
    "method": "newURI",
    "regex": "^http://.*"
};
delete myObject.regex;

console.log(myObject);

Example 3: js create object with properties

var mycar = new Car('Eagle', 'Talon TSi', 1993);

Example 4: javascript object string property

// Also useful for dynamic strings, e.g. `thing-${variable}`
myObject['thing'] = true;

Example 5: how to create a object in javascript

var about = {
  name:"lanitoman",
  age:1023,
  isHeProgrammer:true
}