Please enable JavaScript.
Coggle requires JavaScript to display documents.
Functions (Array iterators (Sorting (problem with numbers (pass callback),…
Functions
variables
local
defined inside
with var
var a;
global
defined outside
no var
a;
hoisting
moving a value
definition position
not important
variables
hoisted
allways
values
not hoisted
leads to undefined
tips
define variables
at top
functions
declared
hoisted on top
anonymous
Call-back
function
used as argument
use only reference
without ()
Array iterators
Sorting
problem with numbers
pass callback
return a - b
overflow !!!
use a>b etc.
Good for strings
forEach
item value
index
map
map values
attributes
item value
index
array
reduce
create single value
parameters
callback
parameters
previous value
current item
initial value
previous
filter
filter out values
attribute
callback
current number