airbnb/javascript: JavaScript Style Guide

PHOTO EMBED

Thu Aug 19 2021 17:06:40 GMT+0000 (UTC)

Saved by @MattMoniz #object #destructuring

// bad
function getFullName(user) {
  const firstName = user.firstName;
  const lastName = user.lastName;

  return `${firstName} ${lastName}`;
}

// good
function getFullName(user) {
  const { firstName, lastName } = user;
  return `${firstName} ${lastName}`;
}

// best
function getFullName({ firstName, lastName }) {
  return `${firstName} ${lastName}`;
}
content_copyCOPY

https://github.com/airbnb/javascript