Platform
Solutions
Resources
Pricing
Sign in
Sign up
Job van der Zwan
Tinkering with code and algorithms for fun
Workspace
Fork
Published
By
Job van der Zwan
Edited
Apr 14, 2021
2 forks
5 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// regional indicator symbol letters
risl
=
"🇦 🇧 🇨 🇩 🇪 🇫 🇬 🇭 🇮 🇯 🇰 🇱 🇲 🇳 🇴 🇵 🇶 🇷 🇸 🇹 🇺 🇻 🇼 🇽 🇾 🇿"
.
split
(
" "
)
Insert cell
import
{
Table
,
Text
}
from
"@observablehq/inputs"
Insert cell
tableData1
=
{
const
data
=
[
]
;
for
(
const
rowLetter
of
risl
)
{
const
row
=
{
"‧"
:
rowLetter
}
;
for
(
const
columnLetter
of
risl
)
{
row
[
columnLetter
]
=
rowLetter
+
columnLetter
;
}
data
.
push
(
row
)
;
}
return
data
;
}
Insert cell
2
Insert cell
Insert cell
flags
=
"🇦🇨 🇦🇩 🇦🇪 🇦🇫 🇦🇬 🇦🇮 🇦🇱 🇦🇲 🇦🇴 🇦🇶 🇦🇷 🇦🇸 🇦🇹 🇦🇺 🇦🇼 🇦🇽 🇦🇿 🇧🇦 🇧🇧 🇧🇩 🇧🇪 🇧🇫 🇧🇬 🇧🇭 🇧🇮 🇧🇯 🇧🇱 🇧🇲 🇧🇳 🇧🇴 🇧🇶 🇧🇷 🇧🇸 🇧🇹 🇧🇻 🇧🇼 🇧🇾 🇧🇿 🇨🇦 🇨🇨 🇨🇩 🇨🇫 🇨🇬 🇨🇭 🇨🇮 🇨🇰 🇨🇱 🇨🇲 🇨🇳 🇨🇴 🇨🇵 🇨🇷 🇨🇺 🇨🇻 🇨🇼 🇨🇽 🇨🇾 🇨🇿 🇩🇪 🇩🇬 🇩🇯 🇩🇰 🇩🇲 🇩🇴 🇩🇿 🇪🇦 🇪🇨 🇪🇪 🇪🇬 🇪🇭 🇪🇷 🇪🇸 🇪🇹 🇪🇺 🇫🇮 🇫🇯 🇫🇰 🇫🇲 🇫🇴 🇫🇷 🇬🇦 🇬🇧 🇬🇩 🇬🇪 🇬🇫 🇬🇬 🇬🇭 🇬🇮 🇬🇱 🇬🇲 🇬🇳 🇬🇵 🇬🇶 🇬🇷 🇬🇸 🇬🇹 🇬🇺 🇬🇼 🇬🇾 🇭🇰 🇭🇲 🇭🇳 �
�🇷 🇭🇹 🇭🇺 🇮🇨 🇮🇩 🇮🇪 🇮🇱 🇮🇲 🇮🇳 🇮🇴 🇮🇶 🇮🇷 🇮🇸 🇮🇹 🇯🇪 🇯🇲 🇯🇴 🇯🇵 🇰🇪 🇰🇬 🇰🇭 🇰🇮 🇰🇲 🇰🇳 🇰🇵 🇰🇷 🇰🇼 🇰🇾 🇰🇿 🇱🇦 🇱🇧 🇱🇨 🇱🇮 🇱🇰 🇱🇷 🇱🇸 🇱🇹 🇱🇺 🇱🇻 🇱🇾 🇲🇦 🇲🇨 🇲🇩 🇲🇪 🇲🇫 🇲🇬 🇲🇭 🇲🇰 🇲🇱 🇲🇲 🇲🇳 🇲🇴 🇲🇵 🇲🇶 🇲🇷 🇲🇸 🇲🇹 🇲🇺 🇲🇻 🇲🇼 🇲🇽 🇲🇾 🇲🇿 🇳🇦 🇳🇨 🇳🇪 🇳🇫 🇳🇬 🇳🇮 🇳🇱 🇳🇴 🇳🇵 🇳🇷 🇳🇺 🇳🇿 🇴🇲 🇵🇦 🇵🇪 🇵🇫 🇵🇬 🇵🇭 🇵🇰 🇵🇱 🇵🇲 🇵🇳 🇵🇷 🇵🇸 🇵🇹 🇵🇼 🇵🇾 🇶🇦 🇷🇪 🇷🇴 🇷🇸 🇷🇺 🇷🇼 🇸🇦 🇸🇧 🇸🇨 🇸🇩 🇸🇪 🇸🇬 🇸�
� 🇸🇮 🇸🇯 🇸🇰 🇸🇱 🇸🇲 🇸🇳 🇸🇴 🇸🇷 🇸🇸 🇸🇹 🇸🇻 🇸🇽 🇸🇾 🇸🇿 🇹🇦 🇹🇨 🇹🇩 🇹🇫 🇹🇬 🇹🇭 🇹🇯 🇹🇰 🇹🇱 🇹🇲 🇹🇳 🇹🇴 🇹🇷 🇹🇹 🇹🇻 🇹🇼 🇹🇿 🇺🇦 🇺🇬 🇺🇲 🇺🇳 🇺🇸 🇺🇾 🇺🇿 🇻🇦 🇻🇨 🇻🇪 🇻🇬 🇻🇮 🇻🇳 🇻🇺 🇼🇫 🇼🇸 🇽🇰 🇾🇪 🇾🇹 🇿🇦 🇿🇲 🇿🇼"
.
split
(
' '
)
Insert cell
tableData2
=
{
const
data
=
[
]
;
for
(
const
rowLetter
of
risl
)
{
const
row
=
{
"‧"
:
rowLetter
}
;
for
(
const
columnLetter
of
risl
)
{
const
combo
=
rowLetter
+
columnLetter
;
row
[
columnLetter
]
=
flags
.
includes
(
combo
)
?
combo
:
""
;
}
data
.
push
(
row
)
;
}
return
data
;
}
Insert cell
// Thanks to Jacob Rus fo the style suggestions
function
flagTable
(
data
)
{
var
t
=
Table
(
data
,
{
rows
:
40
,
width
:
740
}
)
;
t
.
querySelectorAll
(
'td, th'
)
.
forEach
(
cell
=>
{
cell
.
style
.
fontSize
=
'1.4em'
;
cell
.
style
.
padding
=
'0 0'
;
cell
.
style
.
border
=
'none'
;
}
)
;
return
t
;
}
Insert cell
flagTable
(
tableData2
)
Insert cell
Insert cell
tableData3
=
{
const
data
=
[
]
;
for
(
const
rowLetter
of
risl
)
{
const
row
=
{
"‧"
:
rowLetter
}
;
for
(
const
columnLetter
of
risl
)
{
const
combo
=
rowLetter
+
columnLetter
;
const
obmoc
=
columnLetter
+
rowLetter
;
row
[
columnLetter
]
=
flags
.
includes
(
combo
)
&&
flags
.
includes
(
obmoc
)
?
combo
:
""
;
}
data
.
push
(
row
)
;
}
return
data
;
}
Insert cell
flagTable
(
tableData3
)
Insert cell
Insert cell
pairs
=
{
const
data
=
new
Map
(
)
;
for
(
const
flag
of
flags
)
{
const
reversed
=
flag
[
2
]
+
flag
[
3
]
+
flag
[
0
]
+
flag
[
1
]
;
data
.
set
(
flag
,
flags
.
includes
(
reversed
)
?
reversed
:
""
)
;
}
return
data
}
Insert cell
viewof
flagSearch2
=
Text
(
{
placeholder
:
"paste a flag emoji here!"
,
value
:
"🇦🇶"
}
)
Insert cell
{
const
result
=
pairs
.
get
(
flagSearch2
)
;
switch
(
result
)
{
case
undefined
:
return
md
`<span style="font-size:x-large">Please paste a flag emoji into the text field<span>`
;
case
''
:
return
md
`<span style="font-size:x-large">${
flagSearch2
} cannot be reversed 😞<br><br> ${
flagSearch2
} ⮀ ${
flagSearch2
[
2
]
+
flagSearch2
[
3
]
+
flagSearch2
[
0
]
+
flagSearch2
[
1
]
}</span>`
;
default
:
return
md
`<span style="font-size:x-large">${
flagSearch2
} can be reversed! 😊<br><br> ${
flagSearch2
} ⮀ ${
result
}</span>`
}
}
Insert cell
Insert cell
One platform
to build and deploy the best data apps
Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
flagSearch
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
risl
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
tableData1
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Show 2 comments
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
flags
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
tableData2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
flagTable
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
tableData3
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
pairs
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
flagSearch2
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