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">
<title>Technical Documentation Page</title>

<head>
    <link rel="stylesheet" href="css/style.css" type="text/css">
</head>

<body>
    <nav id="navbar">
        <header id="page-title">Javascript Intro</header>
        <ul id="nav-links">
            <li><a href="#Introduction" class="nav-link">Introduction</a></li>
            <li><a href="#What_You_Should_Know" class="nav-link">What You Should Know</a></li>
            <li><a href="#Javascript_and_Java" class="nav-link">Javascript and Java</a></li>
            <li><a href="#Hello_world" class="nav-link">Hello world</a></li>
            <li><a href="#Comments" class="nav-link">Comments</a></li>
            <li><a href="#Variables" class="nav-link">Variables</a></li>
            <li><a href="#Declaring_Variables" class="nav-link">Declaring Variables</a></li>
            <li><a href="#Data_Types" class="nav-link">Data Types</a></li>
            <li><a href="#Reference" class="nav-link">Reference</a></li>

            


        </ul>
    </nav>


    <main id="main-doc">
        <section class="main-section" id="Introduction">
            <header>Introduction</header>
            <article>
                <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>
            </article>
        </section>
        <section class="main-section" id="What_You_Should_Know">
            <header>What You Should Know</header>
            <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>
        </section>
        <section class="main-section" id="Javascript_and_Java">
            <header>Javascript And 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>
                <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>
            </article>
        </section>
        <section class="main-section" id="Hello_world">
            <header>Hello world</header>
            <article>
                <p>To get started with writing JavaScript, open the Scratchpad if you're using Firefox 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>

            </article>
        </section>
        <section class="main-section" id="Comments">
            <header>Comments</header>
            <p>The syntax of comments is the same as in C++ and in many other languages:</p>
            <code>
// a one line comment
 
/* this is a longer, 
* multi-line comment
*/
                     
/* You can't, however, /* nest comments */ SyntaxError */
                </code>
            <p>Comments behave like whitespace and are discarded during script execution.

            </p>
        </section>

        <section class="main-section" id="Variables">
            <header>Variables</header>
            <p>You use variables as symbolic names for values in your application. The names of variables, called
                identifiers, conform to certain rules.</p>
            <p>A JavaScript identifier must start with a letter, underscore (_), or dollar sign ($); subsequent
                characters can also be digits (0-9). Because JavaScript is case sensitive, letters include the
                characters "A" through "Z" (uppercase) and the characters "a" through "z" (lowercase).</p>
            <p>You can use most of ISO 8859-1 or Unicode letters such as å and ü in identifiers (for more details see
                this blog post). You can also use the Unicode escape sequences as characters in identifiers.</p>
            <p>Some examples of legal names are:</p>
            <code>
Number_hits
temp99
$credit
_name.
</code>
        </section>

        <section class="main-section" id="Declaring_Variables">
            <header>Declaring Variables</header>
            <ul>
                <p>You can declare a variable in two ways. <br>
                    <li> With keyword var. For example,
                </p>
                <code>var x = 42.</code></li>
                <p>This syntax can be used to declare both local and global variables, depending on the execution
                    context.</p>
                <li>
                    <p>With the keyword const or let. For example,</p>
                    <code>
const number = 42;
let x = 1;
            </code>
                    <p> This syntax can be used to declare a block-scope local variable.</p>
                    <p>
                        You can also simply assign a value to a variable For example, x = 42. This form creates an
                        undeclared global variable. It also generates a strict JavaScript warning. Undeclared global
                        variables can often lead to unexpected behavior. Thus, it is discouraged to use undeclared
                        global variables.</p>
                </li>

            </ul>
        </section>

        <section class="main-section" id="Data_Types">
            <header>Data Types</header>
            <p>The latest ECMAScript standard defines eight data types:</p>
            <ul>
                <li>Boolean. true and false.</li>
                <li>null. A special keyword denoting a null value. Because JavaScript is case-sensitive, null is not the
                    same as Null, NULL, or any other variant.</li>
                <li>undefined. A top-level property whose value is not defined</li>
                <li>Number. An integer or floating point number. For example: 42 or 3.14159.</li>
                <li>BigInt. An integer with arbitrary precision. For example: 9007199254740992n.</li>
                <li>String. A sequence of characters that represent a text value. For example: "Howdy"</li>
                <li>Symbol (new in ECMAScript 2015). A data type whose instances are unique and immutable.</li>
            </ul>
            <p>Although these data types are relatively few, they enable you to perform useful functions with your
                applications. Objects and functions are the other fundamental elements in the language. You can think of
                objects as named containers for values, and functions as procedures that your application can perform
            </p>
        </section>

    </section>
    <section class="main-section" id="Reference">
      <header>Reference</header>
      <article>
        <li>All the Documentation on this page is taken from. <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide" target="_blank">MDN web docs</a>
      </article>
      </section>



    </main>










   
</body>

</html>
              
            
!

CSS

              
                nav {
    background-color: #333;
    
    position: fixed;
    left: 0%;
    width: 250px;
    height: 100%;
    /* scroll if it does not fit vertically */
    overflow: auto;
  }

.main-section {
    text-align: left;
    
}

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

  #main-doc{
    position: absolute;
    margin-left:310px;
    padding:20px;
    margin-bottom:110px;
  }

  code{
    display:block;
      text-align: left;
    white-space: pre;
    position: relative;
      word-break: normal;
      word-wrap: normal;
      line-height: 2;
      background-color:#f7f7f7;
    padding:15px;
    margin:10px;
      border-radius:5px;
  }

  @media only screen and (max-width: 815px) {
    /* For mobile phones: */
  #navbar ul{
  border:1px solid;
    height:207px;
  }
}

/* unvisited link */
a:link {
  color: green;
}

/* visited link */
a:visited {
  color: green;
}

/* mouse over link */
a:hover {
  color: red;
}

/* selected link */
a:active {
  color: yellow;
}
              
            
!

JS

              
                
              
            
!
999px

Console