Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <main class="container">
  <form id="isoform" onsubmit="processForm()">
    <h2>Are these two strings Isomorphic?</h2>
    <label for="string1">String 1</label>
    <input type="text" name="string1" autofocus>
    <label for="string2">String 2</label>
    <input type="text" name="string2" autofocus>

    <article id="result"></article>



                html {
  height: 100%;

* {
  box-sizing: border-box;

body {
  background-image: linear-gradient(to top right, rgb(101, 115, 255), rgb(111, 114, 247), rgb(120, 114, 239), rgb(130, 113, 231), rgb(139, 112, 223), rgb(149, 111, 215), rgb(158, 111, 208), rgb(168, 110, 200), rgb(177, 109, 192), rgb(187, 108, 184), rgb(196, 108, 176), rgb(206, 107, 168));
  background-attachment: fixed;
  color: white;
  font-family: Helvetica;
  font-size: 1.5em;
  margin: 0;
  min-height: 100%;

.container {
  display: grid;
  align-items: center;
  height: 100vh;
  justify-content: center;
  padding: 0.5em;

input, button {
  font-size: 1em;
  margin-bottom: 0.5em;
  border-radius: 0.1em;
  border: none;
  padding: 0.2em;

button {
  margin-top: 2em;
  display: block;
  padding: 0.5em 1em;

article {
  margin-top: 1em;


                function isomorphicStrings (str1, str2) {
  const charIndexMap = new Map();

  if (str1.length !== str2.length) {
    return 'Strings are not the same length';
  if (new Set(str1).size !== new Set(str2).size || !str1.length || !str2.length) {
    return `Strings are not isomorphic`

  for (let i = 0; i < str1.length; i++) {
    let cs1 = str1[i];
    let cs2 = str2[i];
    if (!charIndexMap.has(cs1)) { 
      charIndexMap.set(cs1, cs2);
    } else if (charIndexMap.get(cs1) !== cs2) {
      return `Strings are not isomorphic at Character: ${cs1}`;
  return `Strings ${str1} and ${str2} are isomorphic! 🎉`;

 * Not part of isomorphic string logic, just powering the HTML form for the checker
function processForm() {
  const form = document.querySelector("#isoform");
  const formData = new FormData(form);
  const str1 = formData.get("string1");
  const str2 = formData.get("string2");
  const resultsContainer = document.querySelector("#result");
  resultsContainer.innerHTML = isomorphicStrings(str1, str2);