Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Sight Words</title>
    <link rel="stylesheet" href="" />
  </head>

  <body>
    <h1>Sight Words</h1>
    <p id="wordDisplay"></p>
    <button id="next">Next</button>
    <script src="script.js"></script>
  </body>
</html>

              
            
!

CSS

              
                
              
            
!

JS

              
                const book1 = [
  "the",
  "of",
  "and",
  "a",
  "to",
  "in ",
  "is",
  "you",
  "that",
  "it",
  "at",
  "be",
  "this",
  "have",
  "from",
  "or",
  "one",
  "had",
  "by",
  "words",
  "there",
  "use",
  "an",
  "each",
  "which",
  "she",
  "do",
  "how",
  "their",
  "if",
  "some",
  "her",
  "would",
  "make",
  "like",
  "him",
  "into",
  "time",
  "has",
  "look",
  "my",
  "than",
  "first",
  "water",
  "been",
  "called",
  "who",
  "that",
  "its",
  "now",
  "he",
  "was",
  "for",
  "on",
  "are",
  "as",
  "with",
  "his",
  "they",
  "I",
  "but",
  "not",
  "what",
  "all",
  "were",
  "we",
  "when",
  "your",
  "can",
  "said",
  "will",
  "up",
  "other",
  "about",
  "out",
  "many",
  "them",
  "then",
  "these",
  "so",
  "two",
  "more",
  "write",
  "go",
  "see",
  "number",
  "no",
  "way",
  "could",
  "people",
  "find",
  "long",
  "down",
  "day",
  "did",
  "get",
  "come",
  "made",
  "may",
  "part",
];

// Helper function - Returns a random integer between 0 and the last index of a given array
function getRandomIndex(arr) {
  return Math.floor(Math.random() * arr.length);
}

// Returns the value at a random index of a given array
function getRandomWord(arr) {
  return arr[getRandomIndex(arr)];
}

// Changes the inner html of #wordDisplay to a random word in a given array
function placeWord(arr) {
  document.querySelector("#wordDisplay").innerHTML = getRandomWord(arr);
}

document.querySelector("#next").addEventListener("click", () => placeWord(book1));

              
            
!
999px

Console