Platform
Resources
Pricing
Sign in
Get started
Cora Davis's Workspace
Workspace
Fork
Public
By
Cora Davis
Edited
Apr 2, 2024
Insert cell
Insert cell
Insert cell
viewof
range
=
Inputs
.
range
(
[
0
,
100
]
,
{
label
:
"Choose an Integer"
,
step
:
1
}
)
Insert cell
integer
=
{
let
integer
=
range
;
integer
=
range
*
(
range
+
1
)
/
2
;
return
integer
;
}
Insert cell
viewof
n
=
Inputs
.
range
(
[
0
,
100
]
,
{
label
:
"Amount"
,
step
:
1
}
)
Insert cell
{
let
sum
=
0
;
for
(
let
index
=
1
;
index
<=
n
;
++
index
)
{
sum
=
sum
+
index
;
}
return
sum
;
}
Insert cell
Insert cell
viewof
range1
=
Inputs
.
range
(
[
0
,
100
]
,
{
label
:
"Choose an integer"
,
step
:
1
}
)
Insert cell
integer1
=
{
let
integer1
=
range1
;
if
(
range1
%
3
===
0
||
range1
%
5
===
0
)
{
integer1
=
range1
*
(
range1
+
1
)
/
2
;
}
return
integer1
;
}
Insert cell
viewof
n2
=
Inputs
.
range
(
[
0
,
100
]
,
{
label
:
"Amount"
,
step
:
1
}
)
Insert cell
{
let
sum
=
0
;
for
(
let
index
=
1
;
index
<=
n2
;
++
index
)
{
if
(
index
%
3
===
0
||
index
%
5
===
0
)
{
sum
=
sum
+
index
;
}
}
return
sum
;
}
Insert cell
Insert cell
palindrome
=
(
word
)
=>
{
let
wordArray
=
word
.
split
(
""
)
;
let
reverseArray
=
wordArray
.
reverse
(
)
;
let
reverseWord
=
reverseArray
.
join
(
""
)
;
if
(
word
===
reverseWord
)
{
return
true
;
}
else
if
(
word
!==
reverseWord
)
{
return
false
;
}
}
Insert cell
palindrome
(
"racecar"
)
Insert cell
palindrome
(
"car"
)
Insert cell
isPalindrome
=
(
word
)
=>
{
for
(
let
index
=
0
;
index
<
word
.
length
;
++
index
)
{
if
(
word
[
index
]
!==
word
[
word
.
length
-
index
-
1
]
)
{
return
false
;
}
}
return
true
}
Insert cell
isPalindrome
(
"racecar"
)
Insert cell
isPalindrome
(
"car"
)
Insert cell
Insert cell
largeNumber
=
(
numbers
)
=>
{
let
biggestNumber
=
numbers
[
0
]
;
for
(
let
index
=
1
;
index
<
numbers
.
length
;
++
index
)
{
if
(
numbers
[
index
]
>
biggestNumber
)
{
biggestNumber
=
numbers
[
index
]
;
}
}
return
biggestNumber
;
}
Insert cell
largeNumber
(
[
34
,
12
,
54
,
8
]
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
let
randomNums
=
[
]
;
for
(
let
index
=
0
;
index
<
1000
;
++
index
)
{
randomNums
.
push
(
Math
.
random
(
)
)
;
}
return
randomNums
;
}
Insert cell
{
let
randomNums
=
[
]
;
let
tally
=
0
;
while
(
tally
<
10000
)
{
randomNums
.
push
(
Math
.
random
(
)
)
;
tally
=
tally
+
1
}
return
randomNums
;
}
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
range
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
integer
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
n
Add comment
Copy import
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
range1
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
integer1
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
n2
Add comment
Copy import
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
palindrome
Add comment
Copy import
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
isPalindrome
Add comment
Copy import
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
largeNumber
Add comment
Copy import
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
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