Please enable JavaScript.
Coggle requires JavaScript to display documents.
JavaScript notebook 2 - Coggle Diagram
JavaScript notebook 2
Method and Functions
-
Functions
-
expression
-
const result= function(a,b) {return a*b}
const doMoreMath = (a=2, b=2) => a * b;
-
-
-
A function declaration defines a function with the specified parameters starting with the function keyword. A function expression expresses a function inside a variable by assigning the function to the variable.
Arrow functions
keyword 'this'
method inside object, trỏ vào element của chính object đó
-
Function keyword can be hoisted to the global variable, use arrow funtion, see video 08_05
=>: No scope, only refer to the nearest scope
-
-
-
-
-
-
-
-
DOM EVENT
target.addEventListener(element,callback,[,option])
target
window object, document object, object within DOM
element
type of event, to listen to
-
-
-
-
-