Skip to main content
InterviewHubPRO
Section Overview
Q269

Question 269 of 536

Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

50%
JavaScript & V8 Internals (536 Qs)•Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

How do you define multiple properties on an object

junior LevelCode ExamplejavascriptES6+ Modern Syntax

The Object.defineProperties() method is used to define new or modify existing properties directly on an object and returning the object. Let's define multiple properties on an empty object,

javascript
  const newObject = {};

  Object.defineProperties(newObject, {
    newProperty1: {
      value: "John",
      writable: true,
    },
    newProperty2: {},
  });