Skip to content

Instantly share code, notes, and snippets.

@YasirGaji
Last active February 6, 2022 21:31
Show Gist options
  • Save YasirGaji/c2246bf99b16bdf85f391414602114ce to your computer and use it in GitHub Desktop.
Save YasirGaji/c2246bf99b16bdf85f391414602114ce to your computer and use it in GitHub Desktop.
This script demonstrates object literals in arrow functions for the "Arrow Functions in Javascript" article by Yasir Gaji
// OBJECT LITERAL WITH ARROW FUNCTION EXPRESSION. Undefined result
const obj = () => { name: 'Yasir Gaji' }
console.log(obj());
// OBJECT LITERAL WITH ARROW FUNCTION EXPRESSION. Success result
const ect = () => ({
name: 'Yasir Gaji',
age: 19,
});
console.log(ect());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment