diff --git a/playground/2-arrow-function.js b/playground/2-arrow-function.js new file mode 100644 index 0000000..e277d9c --- /dev/null +++ b/playground/2-arrow-function.js @@ -0,0 +1,24 @@ +// const square = function(x) { +// return x * x; +// } + +// const square = (x) => { +// return x * x; +// } + +// const square = (x) => x * x; + +// console.log(square(2)); + +const event = { + name: 'Birthday Party', + guestList: ['Andrew', 'Jen', 'Mike'], + printGuestList() { + console.log('Guest list for ' + this.name); + this.guestList.forEach((guest) => { + console.log(guest + ' is attending ' + this.name); + }) + } +} + +event.printGuestList();