Let's practice the function syntax:
Task 1
Create function called getFullName
using function declaration syntax.
The function should take 2 arguments, firstName
and lastName
and return
a new string representing the full name.
// Your code here
console.log( getFullName('Bob', 'Smith') ); // expected: Bob Smith
Task 2
Create the same function as a function expression, but this time name it getFullNameExpr
.
// Your code here
console.log( getFullNameExpr('Sarah', 'O\'Connor') ); // expected: Sarah O'Connor
Task 3
Create the same as arrow function, but this time name it getFullNameArrow
.
// Your code here
console.log( getFullNameArrow('Axel', 'Garcia') ); // expected: Axel Garcia
Bonus -
Update the function getFullNameArrow
to use the concise arrow function syntax.
// Your code here
console.log( fullNameArrow('Esther', 'Bernal') ); // expected: Esther Bernal