<head>
<title>Technical Documentation Page</title>
<link rel="stylesheet" href="main.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="navbar-holder">
<div class="heading-ul">
<h1 class="js-docs">
JS Documentation
</h1>
<ul>
<li>
<a href="#intro">
Introduction
</a>
</li>
<li>
<a href="#wyak">
What you should already know?
</a>
</li>
<li>
<a href="#JavaScript_and_Java">
Javascript and Java
</a>
</li>
<li>
<a href="#hello">
Hello World
</a>
</li>
<li>
<a href="#vars">
Variables
</a>
</li>
<li>
<a href="#devars">
Declaring Variables
</a>
</li>
<li>
<a href="#varsco">
Variables Scope
</a>
</li>
</ul>
</div>
</div>
<div class="main-section">
<div class="intro-section">
<h3 id="intro">
Introduction
</h3>
<p class="intro-body">
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.
<br><br>
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 class="intro-desc">
<li class="intro-desc-list">
<p class="intro-body">
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.
</p>
</li>
<li class="intro-desc-list">
<p class="intro-body">
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.
</p>
</li>
</ul>
<h3 id="wyak">
What you should already know
</h3>
<p class="intro-body">
This guide assumes you have the following basic background:
</p>
<ul class="intro-desc">
<li class="intro-desc-list">
<p class="intro-body">
A general understanding of the Internet and the World Wide Web (WWW).
</p>
</li>
<li class="intro-desc-list">
<p class="intro-body">
Good working knowledge of HyperText Markup Language (HTML).
</p>
</li>
<li class="intro-desc-list">
<p class="intro-body">
Some programming experience. If you are new to programming,
try one of the tutorials linked on the main page about JavaScript.
</p>
</li>
</ul>
<h3 id="JavaScript_and_Java">
JavaScript and Java
</h3>
<p class="intro-body">
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.
<br>
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>
<h3 id="hello">
Hello World
</h3>
<p class="intro-body">
To get started with writing JavaScript, open the Scratchpad and
write your first "Hello world" JavaScript code:
<br>
<div class="code" style="background-color: rgb(219, 219, 219);padding: 15px;font-family: 'Courier New', Courier, monospace;">
<p class="code">
function greetMe(yourName) { alert("Hello " + yourName); }
greetMe("World");
</p>
</div>
<br />
Select the code in the pad and hit Ctrl+R to watch it unfold in your browser!
</p>
<h3 id="vars">
Variables
</h3>
<p class="intro-body">
You use variables as symbolic names for values in your application.
The names of variables, called identifiers, conform to certain rules.<br /><br />
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>
<h3 id="devars">
Declaring Variables
</h3>
<p class="intro-body">
You can declare a variable in three ways:
With the keyword var. For example,
<div class="code" style="background-color: rgb(219, 219, 219);padding: 15px;font-family: 'Courier New', Courier, monospace;">
<p class="code">
var x = 42.
</p>
</div>
<br />
This syntax can be used to declare both local and global variables.
<br /> <br />
By simply assigning it a value. For example,
</p>
<h3 id="varsco">
Variable scope
</h3>
<p class="intro-body">
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.
<br /> <br />
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.
<div class="code" style="background-color: rgb(219, 219, 219);padding: 15px;font-family: 'Courier New', Courier, monospace;">
<p class="code">
if (true) { var x = 5; } console.log(x); // 5
</p>
</div>
<br />
This behavior changes, when using the let declaration introduced in ECMAScript 2015.
<br /><br />
<div class="code" style="background-color: rgb(219, 219, 219);padding: 15px;font-family: 'Courier New', Courier, monospace;">
<p class="code">
if (true) { let y = 5; } console.log(y); // ReferenceError: y is not defined
</p>
</div>
</p>
</div>
</div>
</body>
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap');
html,
body {
min-width: 290px;
color: #4d4e53;
background-color: #ffffff;
font-family: 'Open Sans', Arial, sans-serif;
line-height: 1.5;
}
.main-container{
width: 100vw;
}
.navbar-holder{
position: fixed;
min-width: 290px;
top: 0px;
left: 0px;
width: 300px;
height: 100%;
border-right: solid;
border-color: rgba(0, 22, 22, 0.4);
}
.js-docs{
color: black;
margin: 10px;
text-align: center;
font-size: 1.8em;
font-weight: thin;
}
.navbar-holder ul {
height: 88%;
padding: 0;
overflow-y: auto;
overflow-x: hidden;
}
.navbar-holder li {
color: #4d4e53;
border-top: 1px solid;
list-style: none;
position: relative;
width: 100%;
}
.navbar-holder a{
display: block;
padding: 10px 30px;
color: #4d4e53;
text-decoration: none;
cursor: pointer;
}
.main-section{
position: absolute;
margin-left: 310px;
padding: 20px;
margin-bottom: 110px;
}
@media only screen and (max-width: 815px) {
/* For mobile phones: */
.navbar-holder ul {
border: 1px solid;
height: 207px;
}
.navbar-holder {
background-color: white;
position: absolute;
top: 0;
padding: 0;
margin: 0;
width: 100%;
max-height: 275px;
border: none;
z-index: 1;
border-bottom: 2px solid;
}
.main-section {
position: relative;
margin-left: 0px;
margin-top: 270px;
}
}
@media only screen and (max-width: 400px) {
.main-section {
margin-left: -10px;
}
.code {
margin-left: -20px;
width: 100%;
padding: 15px;
padding-left: 10px;
padding-right: 45px;
min-width: 233px;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.