Platform
Resources
Pricing
Sign in
Get started
Amazing Design
Workspace
Fork
Published
By
Amazing Design
Edited
Jul 3, 2018
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
{
function
add
(
a
,
b
)
{
a
+
b
}
return
add
(
2
,
2
)
}
Insert cell
{
function
add
(
a
,
b
)
{
return
a
+
b
}
return
add
(
2
,
2
)
}
Insert cell
Insert cell
Insert cell
{
function
add
(
a
,
b
)
{
a
+
b
// thi is a whole expression
return
// this will return undefined
}
return
add
(
2
,
2
)
}
Insert cell
Insert cell
{
function
add
(
a
,
b
)
{
const
sum
=
a
+
b
return
sum
}
return
add
(
2
,
2
)
}
Insert cell
Insert cell
{
function
test
(
)
{
console
.
log
(
'First!'
)
// checkout browser console
return
console
.
log
(
'Second!'
)
// checkout browser console
}
return
test
(
)
}
Insert cell
Insert cell
{
function
addAndMultipy
(
a
,
b
)
{
const
sum
=
a
+
b
const
multiplyResult
=
a
*
b
return
{
sum
:
sum
,
multiplication
:
multiplyResult
}
}
return
addAndMultipy
(
2
,
3
)
}
Insert cell
Insert cell
{
const
add
=
function
(
a
,
b
)
{
return
a
+
b
}
return
add
(
2
,
3
)
}
Insert cell
Insert cell
{
const
addSquares
=
function
(
a
,
b
)
{
return
a
*
a
+
b
*
b
}
return
addSquares
(
2
,
3
)
}
Insert cell
{
const
addSquares
=
function
(
a
,
b
)
{
const
add
=
function
(
a
,
b
)
{
return
a
+
b
}
return
add
(
a
*
a
,
b
*
b
)
}
return
addSquares
(
2
,
3
)
}
Insert cell
{
const
addSquares
=
function
(
a
,
b
)
{
const
add
=
function
(
c
,
d
)
{
return
c
+
d
}
const
multiply
=
function
(
e
,
f
)
{
return
e
*
f
}
const
square
=
function
(
g
)
{
return
multiply
(
g
,
g
)
}
return
add
(
square
(
a
)
,
square
(
b
)
)
}
return
addSquares
(
2
,
3
)
}
Insert cell
Insert cell
{
const
functionWithConsoleLog
=
function
(
a
,
b
)
{
console
.
log
(
'I will not show :)'
)
// checkout browser console
}
}
Insert cell
{
const
functionWithConsoleLog
=
function
(
a
,
b
)
{
console
.
log
(
'I WILL show, because function is invoked below! :)'
)
// checkout browser console
}
functionWithConsoleLog
(
)
}
Insert cell
Insert cell
Insert cell
{
const
foo
=
function
(
)
{
return
arguments
}
return
foo
(
1
,
2
,
'Ala'
,
{
}
,
[
5
,
6
]
)
}
Insert cell
Insert cell
{
const
bar
=
function
(
a
,
b
)
{
return
{
a
:
a
,
b
:
b
,
arguments
:
arguments
}
}
return
bar
(
1
,
2
,
'Ala'
,
{
}
,
[
5
,
6
]
)
}
Insert cell
{
const
sumAllArguments
=
function
(
)
{
let
sum
=
0
for
(
let
i
=
0
;
i
<
arguments
.
length
;
i
++
)
{
sum
=
sum
+
arguments
[
i
]
}
return
sum
}
return
sumAllArguments
(
1
,
2
,
3
,
4
,
5
)
}
Insert cell
{
const
sumAllArgumentsWithHOF
=
function
(
)
{
return
Array
.
from
(
arguments
)
.
reduce
(
(
reduced
,
element
)
=>
reduced
+
element
,
0
)
}
return
sumAllArgumentsWithHOF
(
1
,
2
,
3
,
4
,
5
)
}
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML