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 http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="documantation.css" />
    <title>Technical Documentation Page</title>
  </head>
  <body>
    <nav id="navbar">
      <header>JS Documentation</header>
      <ul>
        <li><a class="nav-link" href="#Introduction">Introduction</a></li>
        <li>
          <a class="nav-link" href="#What_you_should_already_know"
            >What_you_should_already_know</a
          >
        </li>
        <li>
          <a class="nav-link" href="#JavaScript_&_Java">JavaScript_&_Java</a>
        </li>
        <li><a class="nav-link" href="#HELLO_WORLD">HELLO_WORLD</a></li>
        <li><a class="nav-link" href="#Variables">Variables</a></li>
        <li><a class="nav-link" href="#VARIABLE_SCOPE">VARIABLE_SCOPE</a></li>
      </ul>
    </nav>
    <span style="font-size: 30px; cursor: pointer" onclick="openNav()"
      >&#9776; open</span
    >
    <main id="main-doc">
      <a id="Introduction"></a>
      <section class="main-section" id="Introduction">
        <header id="Introduction">Introduction</header>
        <article>
          <p>
            JavaScript is a cross-platform, object-oriented scripting language.
            It is a small and lightweight language. Inside a host environment
            (for example, a web browser), JavaScript can be connected to the
            objects of its environment to provide programmatic control over
            them.
          </p>
          <p>
            JavaScript contains a standard library of objects, such as Array,
            Date, and Math, and a core set of language elements such as
            operators, control structures, and statements. Core JavaScript can
            be extended for a variety of purposes by supplementing it with
            additional objects; for example:
          </p>
          <ul>
            <li>
              Client-side JavaScript extends the core language by supplying
              objects to control a browser and its Document Object Model (DOM).
              For example, client-side extensions allow an application to place
              elements on an HTML form and respond to user events such as mouse
              clicks, form input, and page navigation.
            </li>
            <li>
              Server-side JavaScript extends the core language by supplying
              objects relevant to running JavaScript on a server. For example,
              server-side extensions allow an application to communicate with a
              database, provide continuity of information from one invocation to
              another of the application, or perform file manipulations on a
              server.
            </li>
          </ul>
        </article>
      </section>
      <a id="What_you_should_already_know"></a>
      <section class="main-section" id="What_you_should_already_know">
        <header id="What_you_should_already_know">
          What_you_should_already_know
        </header>
        <article>
          <p>This guide assumes you have the following basic background:</p>
          <ul>
            <li>
              A general understanding of the Internet and the World Wide Web
              (WWW).
            </li>
            <li>Good working knowledge of HyperText Markup Language (HTML).</li>
            <li>
              Some programming experience. If you are new to programming, try
              one of the tutorials linked on the main page about JavaScript.
            </li>
          </ul>
        </article>
      </section>
      <a id="JavaScript_&_Java"></a>
      <section class="main-section" id="JavaScript_&_Java">
        <header id="JavaScript_&_Java">JavaScript_&_Java</header>
        <article>
          <p>
            JavaScript and Java are similar in some ways but fundamentally
            different in some others. The JavaScript language resembles Java but
            does not have Java's static typing and strong type checking.
            JavaScript follows most Java expression syntax, naming conventions
            and basic control-flow constructs which was the reason why it was
            renamed from LiveScript to JavaScript.
          </p>
          <p>
            In contrast to Java's compile-time system of classes built by
            declarations, JavaScript supports a runtime system based on a small
            number of data types representing numeric, Boolean, and string
            values. JavaScript has a prototype-based object model instead of the
            more common class-based object model. The prototype-based model
            provides dynamic inheritance; that is, what is inherited can vary
            for individual objects. JavaScript also supports functions without
            any special declarative requirements. Functions can be properties of
            objects, executing as loosely typed methods.
          </p>
          <p>
            JavaScript is a very free-form language compared to Java. You do not
            have to declare all variables, classes, and methods. You do not have
            to be concerned with whether methods are public, private, or
            protected, and you do not have to implement interfaces. Variables,
            parameters, and function return types are not explicitly typed.
          </p>
        </article>
      </section>
      <a id="Hallo_World"></a>
      <section class="main-section" id="HELLO_WORLD">
        <header id="HELLO_WORLD">HELLO_WORLD</header>
        <article>
          <p>
            To get started with writing JavaScript, open the Scratchpad and
            write your first "Hello world" JavaScript code:
          </p>
          <code
            >function greetMe(yourName) { alert("Hello " + yourName); }
            greetMe("World");</code
          >
          <p>
            Select the code in the pad and hit Ctrl+R to watch it unfold in your
            browser!
          </p>
        </article>
      </section>
      <a id="Variables"></a>
      <section class="main-section" id="Variables">
        <header id="Variables">variables</header>
        <article>
          <p>You can declare a variable in three ways:</p>
          <p>With the keyword var. For example,</p>
          <code>var x = 42.</code>
          <p>
            This syntax can be used to declare both local and global variables
          </p>
          <p>By simply assigning it a value. For example,</p>
          <code>x = 42.</code>
          <p>or like</p>
          <code>const y = 10</code>
          <p>
            This always declares a global variable. It generates a strict
            JavaScript warning. You shouldn't use this variant. With the keyword
            let. For example,
          </p>
          <code>let y = 13.</code>
        </article>
      </section>
      <a id="Variable_Scope"></a>
      <section class="main-section" id="VARIABLE_SCOPE">
        <header id="VARIABLE_SCOPE">Variable_Scope</header>
        <article>
          <p>
            When you declare a variable outside of any function, it is called a
            global variable, because it is available to any other code in the
            current document. When you declare a variable within a function, it
            is called a local variable, because it is available only within that
            function.
          </p>
          <p>
            JavaScript before ECMAScript 2015 does not have block statement
            scope; rather, a variable declared within a block is local to the
            function (or global scope) that the block resides within. For
            example the following code will log 5, because the scope of x is the
            function (or global context) within which x is declared, not the
            block, which in this case is an if statement.
          </p>
          <code>if (true) { var x = 5; } console.log(x); // 5</code>
          <p>
            This behavior changes, when using the let declaration introduced in
            ECMAScript 2015.
          </p>
          <code
            >if (true) { let y = 5; } console.log(y); // ReferenceError: y is
            not defined</code
          >
        </article>
      </section>
    </main>
  </body>
</html>

              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

* {
  font-family: "Poppins", sans-serif;
  box-sizing: border-box;
  scroll-behavior: smooth;
  text-transform: capitalize;
}
body {
  padding-top: 65px;
}
header {
  font-size: 1.2em;
  font-weight: 700;
}

article p,
article ul li,
article code {
  padding: 10px;
  font-size: 0.8em;
}

article code {
  background-color: #dcdcdc;
  font-weight: 500;
  padding: 5px;
  border-radius: 5px;
}

#main-doc {
  padding: 20px 10px;
  position: relative;
  margin-left: 400px;
  margin-bottom: 50px;
}

#navbar {
  height: 100%;
  position: fixed;
  border-right: solid;
  z-index: 1;
  top: 0;
  left: 0;
  width: 17%;
  background-color: #831e1e;
  border-color: rgba(0, 22, 22, 0.4);
}
#navbar li {
  list-style: none;
  position: relative;
  width: 100%;
  border-top: 1px solid;
}

#navbar a {
  padding: 8px;
  text-decoration: none;
  font-size: 15px;
  color: #818181;
  display: block;
  cursor: pointer;
  overflow-wrap: break-word;
}

#navbar a:hover {
  color: #f1f1f1;
  font-weight: 900;
}

#navbar .closebtn {
  position: absolute;
  top: 0;
  right: 25px;
  font-size: 20px;
  margin-left: 50px;
}
@media screen and (max-width: 450px) {
  #navbar {
    padding-top: 15px;
    width: 50px;
  }
  #navbar a {
    font-size: 0.5em;
  }
  #main-doc {
    font-size: 1em;
    font-weight: 400;
  }
}
@media (max-width: 1100px) {
  #navbar {
    padding-top: 5px;
    width: 20%;

    font-size: 0.5em;
  }
  #navbar a {
    font-size: 0.8em;
    font-weight: 200;
  }
  #main-doc {
    font-size: 1em;
    font-weight: 400;
    margin-left: 200px;
  }
}

              
            
!

JS

              
                // !! IMPORTANT README:

// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place. 

/***********
INSTRUCTIONS:
  - Select the project you would 
    like to complete from the dropdown 
    menu.
  - Click the "RUN TESTS" button to
    run the tests against the blank 
    pen.
  - Click the "TESTS" button to see 
    the individual test cases. 
    (should all be failing at first)
  - Start coding! As you fulfill each
    test case, you will see them go   
    from red to green.
  - As you start to build out your 
    project, when tests are failing, 
    you should get helpful errors 
    along the way!
    ************/

// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!

// Once you have read the above messages, you can delete all comments. 

              
            
!
999px

Console