Function


#1

I dn’t understand this line pls explain(const pressPowerButton = () => {)


#2

Think of it as a refactoring of the ES5 form,

var pressPowerButton = function () {};
const pressPowerButton = () => {};

The latter form is the ES6 arrow function syntax, about which you will learn more (both here and in your own reading).


#3

Arrow Function Syntax

in your example the pressPowerButton has no parameters, in which case the parentheses are necessary as syntax

and if there is one parameter, then no parentheses are are required for syntax purposes


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.