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. 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

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

              
                <script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<body>
<main id="main-doc">
      <nav id="navbar">
        <header>JavaScript Documentation</header>
        <a href="#Where_to_find_JavaScript_information" class="nav-link">Where to find JavaScript information</a><br>
        <a href="#What_JavaScript_is" class="nav-link">What JavaScript is</a><br>
        <a href="#JavaScript_and_Java" class="nav-link">JavaScript and Java</a><br>
        <a href="#JavaScript_and_the_ECMAScript_specification" class="nav-link">JavaScript and the ECMAScript specification</a><br>
        <a href="#Getting_started_with_JavaScript" class="nav-link">Getting started with JavaScript</a><br>
      </nav>
  <section class="main-section" id="Where_to_find_JavaScript_information">
    <header>Where to find JavaScript information</header>
       <p>The JavaScript documentation on MDN includes the following:</p>
       <ul>
         <li>Learn Web Development provides information for beginners and introduces basic concepts of programming and the Internet.</li>
         <li>JavaScript Guide (this guide) provides an overview about the JavaScript language and its objects.</li>
         <li>JavaScript Reference provides detailed reference material for JavaScript.</li>
       </ul>
       <p>If you are new to JavaScript, start with the articles in the learning area and the JavaScript Guide. Once you have a firm grasp of the fundamentals, you can use the JavaScript Reference to get more details on individual objects and statements.</p>
  </section>
  <section class="main-section" id="What_JavaScript_is">
    <header>What JavaScript is</header>
        <p>JavaScript is a cross-platform, object-oriented scripting language used to make webpages interactive (e.g., having complex animations, clickable buttons, popup menus, etc.).  There are also more advanced server side versions of JavaScript such as Node.js, which allow you to add more functionality to a website than simply downloading files (such as realtime collaboration between multiple computers). 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>
        <p>This means that in the browser, JavaScript can change the way the webpage (DOM) looks. And, likewise, Node.js JavaScript on the server can respond to custom requests from code written in the browser.</p>
  </section>
    <section class="main-section" id="JavaScript_and_Java">
    <header>JavaScript and Java</header>
        <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>
        <p>Java is a class-based programming language designed for fast execution and type safety. Type safety means, for instance, that you can't cast a Java integer into an object reference or access private memory by corrupting Java bytecodes. Java's class-based model means that programs consist exclusively of classes and their methods. Java's class inheritance and strong typing generally require tightly coupled object hierarchies. These requirements make Java programming more complex than JavaScript programming.</p>
        <p>In contrast, JavaScript descends in spirit from a line of smaller, dynamically typed languages such as HyperTalk and dBASE. These scripting languages offer programming tools to a much wider audience because of their easier syntax, specialized built-in functionality, and minimal requirements for object creation.</p>
        <p>For more information on the differences between JavaScript and Java, see the chapter Details of the object model.</p>
  </section>
    <section class="main-section" id="JavaScript_and_the_ECMAScript_specification">
    <header>JavaScript and the ECMAScript specification</header>
        <p>JavaScript is standardized at Ecma International — the European association for standardizing information and communication systems (ECMA was formerly an acronym for the European Computer Manufacturers Association) to deliver a standardized, international programming language based on JavaScript. This standardized version of JavaScript, called ECMAScript, behaves the same way in all applications that support the standard. Companies can use the open standard language to develop their implementation of JavaScript. The ECMAScript standard is documented in the ECMA-262 specification. See New in JavaScript to learn more about different versions of JavaScript and ECMAScript specification editions.</p>
        <p>The ECMA-262 standard is also approved by the ISO (International Organization for Standardization) as ISO-16262. You can also find the specification on the Ecma International website. The ECMAScript specification does not describe the Document Object Model (DOM), which is standardized by the World Wide Web Consortium (W3C) and/or WHATWG (Web Hypertext Application Technology Working Group). The DOM defines the way in which HTML document objects are exposed to your script. To get a better idea about the different technologies that are used when programming with JavaScript, consult the article JavaScript technologies overview.</p>
  </section>
    <section class="main-section" id="Getting_started_with_JavaScript">
    <header>Getting started with JavaScript</header>
        <p>Getting started with JavaScript is easy: all you need is a modern Web browser. This guide includes some JavaScript features which are only currently available in the latest versions of Firefox, so using the most recent version of Firefox is recommended.</p>
        <p>The Web Console tool built into Firefox is useful for experimenting with JavaScript; you can use it into two modes: single-line input mode, and multi-line input mode.</p>
        <code id="codetitle">Single-line input in the Web Console</code>
         <p>The Web Console shows you information about the currently loaded Web page, and also includes a JavaScript interpreter that you can use to execute JavaScript expressions in the current page.</p>
         <p>To open the Web Console (Ctrl+Shift+I on Windows and Linux or Cmd-Option-K on Mac), open the Tools menu in Firefox, and select "Developer ▶ Web Console". </p>
         <p>The Web Console appears at the bottom of the browser window. Along the bottom of the console is an input line that you can use to enter JavaScript, and the output appears in the panel above:</p>
      <img src="https://media.prod.mdn.mozit.cloud/attachments/2019/04/03/16569/cd1f493b4e146f9b4dcf55e46577245d/2019-04-04_00-15-29.png" alt="I <3 Mozilla">
      <p>The console works the exact same way as eval: the last expression entered is returned. For the sake of simplicity, it can be imagined that every time something is entered into the console, it is actual surrounded by console.log around eval, like so.</p>
        <code id="codequote">function greetMe(yourName) {
  alert("Hello " + yourName)
}
console.log(eval('3 + 5'))</code>
      <p></p>
        <code id="codetitle">Multi-line input in the Web Console</code>
      <p>The single-line input mode of the Web Console is great for quick testing of JavaScript expressions, but although you can execute multiple lines, it's not very convenient for that. For more complex JavaScript, you can use the multi-line line input mode.</p>
        <code id="codetitle">Hello world</code>
      <p>To get started with writing JavaScript, open the Web Console in multi-line mode, and write your first "Hello world" JavaScript code:</p>
        <code>(function(){
  "use strict";
  /* Start of your code */
  function greetMe(yourName) {
    alert('Hello ' + yourName);
  }
  
  greetMe('World');
  /* End of your code */
})();</code>
      <p>Press Cmd+Enter or Ctrl+Enter (or click the Run button) to watch it unfold in your browser!</p>

<p>In the following pages, this guide introduces you to the JavaScript syntax and language features, so that you will be able to write more complex applications.</p>

<p>But for now, remember to always include the (function(){"use strict"; before your code, and add })(); to the end of your code. You will learn what these mean, but for now they can be thought of as doing the following:</p>
      <ol>
        <li>Massively improve performance.</li>
        <li>Prevent stupid semantics in JavaScript that trip up beginners.</li>
        <li>Prevent code snippets executed in the console from interacting with one-another (e.g., having something created in one console execution being used for a different console execution).</li>
      </ol>
      All information is kindly provided by <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Introduction" target="_blank">developer.Mozilla.org</a> for educational purposes. God bless!
  </section>

</main>
</body>
              
            
!

CSS

              
                @import "https://fonts.googleapis.com/css?family=Ubuntu:400,700";

body {
  margin: auto;
  max-width: 1000px;
  background-color: #fcfcfc;
}

#main-doc {
  background-color: #fcfcfc;
  font-family: 'Ubuntu', sans-serif;
}

main section {
  margin-left: 250px;
  font-size: 20px;
  padding: 20px;
}

#navbar {
  position: fixed;
  height: 100%;
  width: 250px;
  z-index: 1;
  background-color: #fcfcfc;
  top: 0;
  left: 50%;
  padding: 30px 5px 0 15px;
  margin-left: -500px;
}

#navbar header {
  font-size: 30px;
  padding: 6px 8px 6px 16px;
  font-weight: 600;
}

#navbar a {
  padding: 6px 8px 6px 16px;
  text-decoration: none;
  font-size: 25px;
  color: #818181;
  display: block;
}

#navbar a:hover {
  color: #C71585;
}

@media screen and (max-width: 600px) {
  #navbar {
  position: static;
  height: 150px;
  width: 100%;
  background-color: #fcfcfc;
  margin-bottom: 200px;
  left: 0;
  margin-left: 0px;
  }
  main section {
  margin-top: 0px;
  margin-left: 20px;
  font-size: 20px;
}
}
  
.main-section {
}

.main-section header {
  font-size: 1.5em;
  font-weight: 600;
}

.main-section img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 600px;
}

code {
  display: inline-block;
  background-color: #eeeeee;
  border-left: 4px solid #407e99;
  padding: 20px 40px;
}



#codetitle {
  background-color: #333333;
  color: #fcfcfc;
  padding:  5px 5px 5px 20px;
  font-size: 25px;
}
              
            
!

JS

              
                
              
            
!
999px

Console