May 28, 20223 min

JavaScript Notes: Introduction

Updated: Oct 16, 2022

Mobiprep has created last-minute notes for all topics of JavaScript to help you with the revision of concepts for your university examinations. So let’s get started with the lecture notes on JavaScript.

  1. JavaScript: Introduction

  2. Data Types

  3. Variables

  4. Operators

  5. Functions

  6. Conditional Statements and Loops

  7. Arrays

  8. Objects

  9. DOM Elements

  10. Cookies

  11. Pop Up Box

  12. Exception Handling

Our team has curated a list of the most important questions asked in universities such as DU, DTU, VIT, SRM, IP, Pune University, Manipal University, and many more. The questions are created from the previous year's question papers of colleges and universities.

  1. What is JavaScript?

  2. List out the features of JavaScript.

  3. Why is JavaScript important in web design?

  4. Define JavaScript statement.

  5. Write a note on Comments in JavaScript.
     

JavaScript: Introduction

Question 1. What is JavaScript?

JavaScript is a scripting or programming language that allows you to implement complex features on web pages. Every time a web page does more than just sit there and display static information for you to look at. displaying timely content updates, interactive maps, animated 2D/3D graphics, scrolling video jukeboxes, etc.


Question 2. List out the features of JavaScript.

JavaScript is one of the most popular languages which includes numerous features when it comes to web development. It's amongst the top programming languages as per Github and we must know the features of JavaScript properly to understand what it is capable of.

Some of the features are lightweight, dynamic, functional and interpreted. Now we are going to discuss some important features of JavaScript.

  1. Light Weight Scripting language

  2. Dynamic Typing

  3. Object-oriented programming support

  4. Functional Style

  5. Platform Independent

  6. Prototype-based

  7. Interpreted Language

  8. Async Processing

  9. Client-Side Validation

  10. More control in the browser


Question 3. Why is JavaScript important in web design?

JavaScript (JS) is very popular and adopted universally by every web browser for its support which allows dynamic content to get executed in a webpage. It's an object scripting language which is used in web pages along with markup language HTML. JavaScript does not incorporate or abide by any HTML tags or rules. It is similar to the stand-alone programming language developed by Sun Microsystems. JavaScript got its success worldwide with its integration into the web browsers. JS stands unique as it brings out all the special functionalities in the client’s browser instead of the site’s server.

JavaScript can make the website more interactive and user-friendliness of JavaScript helps easy navigation of the website and helps designers to guide the visitors with additional information or guide them through walkthroughs. Visual effects can also be achieved with JavaScript. JavaScript can be used effectively to create special effects like rollover for images.


Question 4. Define JavaScript statement.

JavaScript statements are composed of:
 
Values, Operators, Expressions, Keywords, and Comments.
 
This statement tells the browser to write "Hello Dolly." inside an HTML element with id="demo":
 
Example:


 
document.getElementById("demo").innerHTML = "Hello Dolly.";
 

Most JavaScript programs contain many JavaScript statements.
 
The statements are executed, one by one, in the same order as they are written.
 
JavaScript programs (and JavaScript statements) are often called JavaScript code.


Question 5. Write a note on Comments in JavaScript.

JavaScript comments can be used to explain JavaScript code, and to make it more readable.

JavaScript comments can also be used to prevent execution, when testing alternative code.

Single Line Comments

Single line comments start with //.

Any text between // and the end of the line will be ignored by JavaScript (will not be executed).

This example uses a single-line comment before each code line:

Example:

// Change heading:
 
document.getElementById("myH").innerHTML = "My First Page";
 
// Change paragraph:

This example uses a single line comment at the end of each line to explain the code:

Example:

let x = 5; // Declare x, give it the value of 5
 
let y = x + 2; // Declare y, give it the value of x + 2
 

Multi-line Comments:

Multi-line comments start with /* and end with */.

Any text between /* and */ will be ignored by JavaScript.

This example uses a multi-line comment (a comment block) to explain the code:

Example:

/*

The code below will change

the heading with id = "myH"

and the paragraph with id = "myP"

in my web page:

*/

document.getElementById("myH").innerHTML = "My First Page";
 
document.getElementById("myP").innerHTML = "My first paragraph.";



Mobiprep is a one stop solution for all exam preparation needs. Get all exam prep resources at a single platform.

Back to Top


    6720
    2