Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulmalhotra/24b5aa19ec1c3067c7482a30c7df0c7e to your computer and use it in GitHub Desktop.
Save rahulmalhotra/24b5aa19ec1c3067c7482a30c7df0c7e to your computer and use it in GitHub Desktop.
This code snippet is used in Default Parameters in ES6 JavaScript Tutorial for SFDC Stop
// * Default value to an object being passed as a parameter using ES6 syntax
function personAge(age, { firstName = 'Richard', lastName = 'Hendricks' } = {}) {
console.log(firstName + ' ' + lastName + ' is ' + age + ' years old');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment