es6-arrow-functions Flashcards
1
Q
What is the syntax for defining an arrow function?
A
let myFunction = (arg1, arg2, ...argN) => { statement(s) }… -https://www.programiz.com/programiz.com
(param1, param2, …, paramN) => { … }…
-https://dmitripavlutin.com/dmitripavlutin.com
(p1) => { statements }…
- https://www.javascripttutorial.net/javascripttutorial.net
let func = (arg1, arg2, ..., argN) => expression;… -https://javascript.info/javascript.info
const sum = (a, b) => a + b… -https://www.digitalocean.com/digitalocean.com
2
Q
When an arrow function’s body is left without curly braces, what changes in its functionality?
A
If its a single expression it doesnt need {}, if its a multi-line code block it needs {}, if there is no curly brace the expression will be evaluated and returned
3
Q
How is the value of this determined within an arrow function?
A
It will copy the value from its parent scope