Creating Object:
Example 1:
Let name = "Brook"= 249= "/users/avatars/brook-user-1.jpg"= {name, totalreplies, Avatar };addusertosidebar (user);
Example 2:
function Buildmetadata (object) { = parseint (object.id); = Object.updatedat | | Object.createdat; = _buildhashcode (object); = +; return { id, lastupdatedat, hashcode, Issecurehash () { return hashcode >= Issecurehash;}} ;}
Example 3:
function buildtopicelement (topic) { = ' return {title, author, Body};}
Object destructuring:
function Buildmetadata (object) {Let ID = parseint (object.id); Let lastupdatedat = Object.updatedat | | Object.createdat; Let hashcode = 16; Const Issecurehash = 32; return "OK" ); return hashcode >= Issecurehash; } };} Let id = 12" Firday ", obj = =
From the code, we can see, besides object, you can also destructuring function from the object.
[ES6] Objects Create-shorthand && destructuring