JavaScript, commonly abbreviated as JS, is high-ranking, mostly just-in-time, and multiparadigm assembled. It has curly bracket notation, intuitive scripting, object-orientation concept, and high-class functions.
JavaScript gained popularity because of the following features,
- Increased execution speed as it is interpreted and not compiled
- Easy to learn and implement.
- It is supported by all modern browsers with built-in interprets.
- It works efficiently with other languages, to provide an optimal web solution.
- JavaScript is both capable of Front-End and Back-End.
- Provides greater performance for websites and web applications with reduced code length.
Some facts about JavaScript,
- JavaScript along with HTML and CSS forms the 3 main components of WWW or the World Wide Web.
- JavaScript was developed under project Mocha.
- JavaScript was created in just 10 days, covering very limited functionalities.
- JavaScript is an interpreted language.
- According to Github Octoverse, although JavaScript has not seen any growth, then also is among the top languages used on the web.
Fundamentals Of JavaScript
- There are no specific data types (e.g:-var t) in JavaScript.
- There are if for, switch, while, do-while, break, continue; similar to Java or C# in JavaScript.
- document.write() is used to display an output in JavaScript.
- There are some dialogues in JavaScript, which are as follows:
- Alert- OK
- Confirm- OK/CANCEL
- Prompt- Input
- Function- There is a 'function' keyword, which is used for function in JavaScript.
Some Examples of JavaScript
A simple program of JavaScript.
<html>
<head>
<title>MY TITLE</title>
</head>
<body>
<script type="text/javascript">
document.write("Most Welcome in JavaScript")
</script>
</body>
</html>
How many data types are in JavaScript
Answer
There are two types of data types in JavaScript.
Primitive data type
- String
- Number
- Boolean
- Undefined
- Null
Non-primitive (reference) data type
- Object
- Array
- RegExp
Frames in JavaScript
Answer
Frames allow you to divide the page into several rectangular areas and to display a separate document in each rectangle. Each of those rectangles is called a "frame".
Here is an example
<FRAMESET ROWS="75%, *" COLS="*, 40%">
<FRAME SRC="framea.html">
<FRAME SRC="frameb.html">
<FRAME SRC="framec.html">
<FRAME SRC="framed.html">
<NOFRAMES>
<H1>No Frames? No Problem!</H1>
Take a look
<A HREF="noframes.html">no-frames</A>
The version is
- </NOFRAMES>
- </FRAMESET>
Nested Frames
<FRAMESET ROWS="15%,*">
<FRAME SRC="titlebar.html" NAME=TITLE SCROLLING=NO>
<FRAMESET COLS="20%,*">
<FRAME SRC="sidebar.html" NAME=SIDEBAR>
<FRAME SRC="menu.html" NAME=RECIPES>
</FRAMESET>
<NOFRAMES> No frames? No Problem! Take a look at our
<A HREF="menu.html">no-frames</A> version. </NOFRAMES>
</FRAMESET>
Targeting Frames
Each frame is given a name, using <FRAME NAME="...">. These names uniquely identify each frame. Using these names, the links in other frames can tell the Browser, which frame does the link target.
<FRAMESET COLS="20%,*">
<FRAME SRC="sidebar.html" NAME=SIDEBAR>
<FRAME SRC="main.html" NAME=MAIN>
</FRAMESET>
To target one of these frames, the link should have a TARGET attribute set to the name of the frame, where the linked page should appear. Thus, for example, this code creates a link totfetacos.html and targets the link to the MAIN frame:
<A HREF="tfetacos.html" TARGET=MAIN>my link</A>
JavaScript Addition Operators
JavaScript addition operator ( + ) serves two main purposes in JavaScript. The first is to perform a simple addition to the numbers.
The second operation is to perform a string concatenation (combine the strings).
<script>
var a = 3;
var b = 2;
var c = a + b;
document.write(c);
</script>
JavaScript subtraction operator
JavaScript subtraction operator ( - ) also serves two purposes in your code. The first is to perform simple subtraction on the numbers (6 - 2). The second operation is to specify negative numeric values (-20).
Subtraction
<script>
var a = 10;
var b = 3;
var c = a - b;
document.write(c);
</script>
JavaScript multiplication operator
JavaScript multiplication operator ( * ) is used to multiply the numbers.
<script>
var a = 4;
var b = 3;
var c = a * b;
document.write(c);
</script>
JavaScript division operator
JavaScript division operator ( / ) is used to divide the numbers.
<script>
var a = 8;
var b = 4;
var c = a / b;
document.write(c);
</script>
JavaScript increment operator
JavaScript increment operator ( ++ ) is used to increase a number by 1.
Example
<script>
var i = 0;
i++;
document.write(i);
</script>
JavaScript decrement operator
JavaScript decrement operator ( -- ) is used to decrease a number by 1.
Example
<script>
var i = 1;
i--;
document.write(i);
</script>
JavaScript block statement
JavaScript block statements are the curly braces ( { } ), you see everywhere. They are used to establish the code, which is to be compartmentalized into a specific function or a statement.
The lines of the code inside of a block statement are often intended to represent that they are part of the block statement. The following are some examples, showing the curly braces establishing the blocks of the compartmentalized code.






Join the conversation! Your thoughts help the community grow.