JavaScript accepts both double and single quotes:
document.getElementById(‘demo’).innerHTML = ‘Hello JavaScript’;
JavaScript in <head> or <body>
You can place any number of scripts in an HTML document.
Scripts can be placed in the <body>
, or in the <head>
section of an HTML page, or in both.
Example:-
<!DOCTYPE html>
<html>
<head>
<script>
function myFunction() {
document.getElementById(“demo”).innerHTML = “Paragraph changed.”;
}
</script>
</head>
<body>
<h2>Demo JavaScript in Head</h2>
<p id=”demo”>A Paragraph</p>
<button type=”button” onclick=”myFunction()”>Try it</button>
</body>
</html>
JavaScript Syllabus:-
1. Basic JavaScript Introduction
Chapter 1 contains the basic introduction to the JavaScript language, such as
- What is JavaScript?
- Evolution of JavaScript
- Features of JavaScript
- Advantages and Disadvantages of JavaScript
- How does JavaScript works?
- Structure of a JavaScript program
- How to write JavaScript in Notepad++, Visual Studio Code, and Eclipse IDE?
- How to add JavaScript in HTML?
- How to include External JavaScript in HTML?
2. JavaScript Data Types and Variables
Chapter 2 deals with the most important and basic concepts of JavaScript. They are:
- JavaScript Comments
- JavaScript Keywords
- Data Types in JavaScript
- JavaScript Variables
- Types of Variables in JavaScript
- Key Difference between Var, Let, and Const
3. JavaScript Operators
Chapter 3 deals with operators in JavaScript. In this chapter, we will learn the following topics:
- What are Operators in JavaScript?
- Assignment Operator
- Comparison Operators
- Logical Operators
- Conditional Operators
- Bitwise Operators
- Unary Operators
- TypeOf Operator
- Operator Precedence
4. JavaScript Statement
This chapter deals with the following topics that are as:
- Conditional Statement
- If statement
- If else statement
- Switch statement
- Loop statements
- While Loop
- Do while Loop
- For loop
- Nested for loops
- For In loop
- For Of loop
- Break statement
- Continue statement
5. JavaScript Function
This chapter deals with the following topics that are as follows:
- What is a function in JavaScript?
- How to call a function in JavaScript using arguments?
- Pass By Value in JavaScript
- Function return (or return statement)
- Nested functions
- Rest parameter
- Anonymous functions
- Recursion
- Arrow Function
6. Objects in JavaScript
Chapter 6 in this JavaScript syllabus deals with the following important topics that are as:
- What is an Object?
- Types of Objects
- Array Object
- Properties of Array Object
- Methods of Array Object
- String Object
- Properties of String Object
- Methods of String Object
- Math Object
- Properties of Math Object
- Methods of Math Object
- Date Object
- Global Object
- Properties of Global Object
- Methods of Global Object
- Number Object
- Properties of Number Object
- Methods of Number Object
- Creating your own Objects
7. JavaScript Window and Frame Objects
Chapter 7 in this JavaScript syllabus, deals with the following key topics that are as:
- Top-level Objects
- Window Object
- Creating a Window
- Communicating with the user
- Working with Timeouts
- Some properties of Window Object
- Some other useful methods of Window Object
- Location Object
- Properties of Location Object
- Methods of Location Object
- Document Object
- Properties of Document Object
- Methods of Document Object
- The Navigator Object
- Properties of Navigator Object
- Methods of Navigator Object
- History Object
- Properties of History Object
- Methods of History Object
- Screen Object
- Working with Frames
- Creating frames
- The frame tree
- Accessing frames
- Nested frames
- Frame object model
- Frame element object