React: Difference between revisions

Jump to navigation Jump to search
212 bytes added ,  30 September 2019
Returning an object
javascript
Returning an object
Line 64: Line 64:


const lordify = firstName => `${firstName} of Canterbury`;
const lordify = firstName => `${firstName} of Canterbury`;
</source>
Returning an object -- '''DON'T FORGET PARENTHESES!'''
<source lang="js">
const person = (firstName, lastName) => ({
  first: firstName,
  last: lastName
});
console.log(person("Flad", "Hanson"));
</source>
</source>

Navigation menu