Use object literals {}
or Object.create()
to create objects in JavaScript. The object literal syntax is simple and efficient for most use cases.
Example:
const obj = { name: 'John', age: 30 };
Tags: basic, JavaScript, objects
URL: https://www.tiktok.com/@jsmentoring/photo/7456561892916563233