Platform
Resources
Pricing
Sign in
Get started
Alex Wein
Workspace
Fork
Public
By
Alex Wein
Edited
Jan 23, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import
{
words
}
from
'@a-lexwein/find-a-big-word'
Insert cell
fitsThePattern
=
(
word
)
=>
{
if
(
word
.
length
!=
letterCount
)
return
false
for
(
let
index
=
0
;
index
<
word
.
length
;
++
index
)
{
if
(
word
[
index
]
===
word
[
index
+
1
]
)
return
true
}
return
false
}
Insert cell
words
.
filter
(
fitsThePattern
)
Insert cell
alphabet
=
'abcdefghijklmnopqrstuvwxyz'
.
split
(
''
)
;
Insert cell
fitsThePatternLetter
=
(
word
,
letter
)
=>
{
if
(
word
.
length
!=
letterCount
)
return
false
for
(
let
index
=
0
;
index
<
word
.
length
;
++
index
)
{
if
(
(
word
[
index
]
===
word
[
index
+
1
]
)
&&
word
[
index
]
==
letter
)
return
true
}
return
false
}
Insert cell
words
.
filter
(
x
=>
fitsThePatternLetter
(
x
,
'i'
)
)
Insert cell
list
=
alphabet
.
map
(
x
=>
(
{
letter
:
x
,
words
:
words
.
filter
(
y
=>
fitsThePatternLetter
(
y
,
x
)
)
}
)
)
Insert cell
letterDiv
=
(
x
)
=>
{
const
words
=
x
.
words
.
join
(
", "
)
const
el
=
html
`<div>
<h2 class="letter">${
x
.
letter
.
toUpperCase
(
)
} - ${
x
.
words
.
length
} words</h3>
<p class="wordlist">${
words
}</p>
</div>`
return
el
}
Insert cell
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
letterCount
Edit
Add comment
Copy import
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
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
fitsThePattern
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
alphabet
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
fitsThePatternLetter
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
list
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
letterDiv
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML