Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
const res = await fetch("/api/users/1").then(r => r.json()); const { id, name, email, role = "user", profile: { avatar = null } = {} } = res; // Array of records const { data: users = [], meta: { total, page } = {} } = await getUsers(); users.forEach(({ id, name }) => console.log(id, name));
Result
Open