Public
Edited
Apr 3, 2023
Importers
Insert cell
Insert cell
Insert cell
function alpha2flag(alpha2) {
let a = alpha2.slice(0,2).toUpperCase() // only two UC chars
if (a.length < 2) {
return
}
let first = a.charCodeAt(0) + 127397
let second = a.charCodeAt(1) + 127397
let fh = "&#x" + first.toString(16) + ";"
let sh = "&#x" + second.toString(16) + ";"
var elem = document.createElement("div");
elem.innerHTML = fh + sh;
return elem.textContent
}
Insert cell
alpha2flag("ua")
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.
Learn more