Zed-King Institute
    All Notes

    O Level · Chapterwise Notes

    Chapter 6: JavaScript

    Zed-King Study app · Free

    O Level students across India practise here, free

    Daily M1–M4 quizFull 100-question mocksAll-India rank
    Open the free app

    Google login · no Play Store needed

    🏆 Free All-India Sunday Mock · Sun, 29 Nov, 11 AM · CCC + O LevelRegister

    About this PDF

    JavaScript basics — variables, operators, functions and events

    This is part of the free O Level M2-R5.1 study material in the Zed-King Study Zone. You can read every page above in your browser, or download the file and study offline. Zed-King Group of Institute is a NIELIT Study Centre in Kaithal, Haryana, and all of this material follows the current NIELIT syllabus.

    Course
    O Level — NIELIT Foundation Diploma
    Module
    M2 — M2-R5.1: Web Designing and Publishing
    Section
    Chapterwise Notes
    Format
    PDF — read online or download
    Price
    Free, no sign-up required

    Text from this PDF

    The opening pages as plain text — open the reader above for tables, diagrams and the full file.

    CHAPTER-6 JavaScript and Angular JS “ Data • Logic • Output ” Topics Covered Introduction to JavaScript Features & Uses of JS Variables, Data Types & Constants Operators in JavaScript Control Statements (if, else, switch)

    Events & Event Handling JavaScript in Web Pages (Client-side Scripting)

    INDEX Section Topic Name Page No.

    6.0 JavaScript and Angular JS -

    6.1 Introduction to Client Side Scripting Language -

    6.1.1 Advantage and Disadvantage of Client Side Scripting -

    6.1.2 JavaScript -

    6.1.2.1 Adding JavaScript with HTML File -

    6.2 Variables in JavaScript -

    6.2.1 Declaring JavaScript Variables -

    6.2.2 Scope of the Variable -

    6.2.3 Datatypes in JavaScript -

    6.3 Operators in JavaScript -

    6.4 Condition Statements in JavaScript -

    6.5 JavaScript Popup Boxes -

    6.6 JavaScript Events -

    6.7 Basic Form Validations in JavaScript -

    6.8 Angular JS -

    6.8.1 Advantage of Angular JS -

    6.8.2 Disadvantage of Angular JS -

    6.8.3 How to Write First Angular JS Program - Concepts of Angular JS (Modules, Directives, Expression, Controller, Scope, Validations, Filters, Services, Testing)

    Chapter 6 – JavaScript and Angular JS

    6.0 JavaScript and Angular JS JavaScript – It is a client-side scripting language used to make webpages interactive.

    It is executed inside the browser (like Chrome, Edge, Firefox).

    Invented by Brendan Eich.

    Invented in May 1995.

    Created at Netscape Communications Corporation.

    First name Mocha, then LiveScript, finally JavaScript.

    Made to make web pages interactive and dynamic.

    Helps to validate forms, handle events, and add animations.

    Developed in only 10 days.

    Standardized by ECMA International as ECMAScript (in 1997).

    Runs on client-side (browser) but now also on server-side (Node.js).

    Brendan Eich later helped to create Mozilla Firefox.

    AngularJS – It is a JavaScript framework developed by Google to make web applications dynamic and easy to manage.

    6.1 Introduction to Client-Side Scripting Language Scripting Language A scripting language is a lightweight programming language used to control another software application.

    Client-side scripting runs on the user’s browser (not server).

    Examples:

    JavaScript VBScript AngularJS Uses:

    Validating user input before sending data to server Showing popup messages Changing HTML/CSS dynamically

    6.1.1 Advantages and Disadvantages of Client-Side Scripting Advantages:

    1. Fast execution – runs on browser.

    2. Reduces server load.

    3. Better user interaction.

    4. Can change webpage content without reloading.

    Disadvantages:

    1. Less secure – code is visible to user.

    2. May not run if JavaScript is disabled.

    3. Browser dependent.

    6.1.2 JavaScript Definition:

    JavaScript is an interpreted, object-based scripting language used to create dynamic and interactive webpages.

    Extra Exam Points JavaScript code is written using the <script> tag in HTML.

    The <script> tag can be placed in <head> or <body> section.

    External JS is linked using:

    <script src="filename.js"></script> JavaScript code always ends with a semicolon ( ; ) (recommended).

    A JavaScript file must be saved with extension .js JavaScript is case-sensitive (e.g., alert is different from Alert).

    JavaScript runs line by line (interpreted language).

    Browser executes JavaScript using its JavaScript Engine.

    Internal and External JS should be placed before closing </body> tag for fast loading.

    JavaScript can change:

    HTML content HTML style (CSS)

    HTML attributes Page behavior JavaScript is used to add interactivity to a webpage.

    Inline JS is not recommended because it makes code hard to maintain.

    External JS is the best practice because it supports reusability.

    JavaScript can also be written in browser Developer Console (Shortcut: F12).

    JavaScript can control events like click, mouseover, keypress, etc.

    Script tag must be properly opened and closed to run JS correctly.

    External JS files load faster due to caching.

    Features:

    Case sensitive Lightweight Event-driven Platform independent Can be embedded in HTML

    6.1.2.1 Adding JavaScript with HTML File

    1. Inline JavaScript Written directly inside an HTML tag.

    <button onclick="alert('Hello!')">Click Me</button>

    2. Internal JavaScript Written inside the <script> tag in the same HTML file.

    <script> document.write("Welcome to JS!"); </script> JavaScript is written inside <script> tag Internal JS display() function prints Hello Students! on the page When you click the button function runs message appears

    3. External JavaScript Saved in a separate .js file and linked using src attribute.

    <script src="script.js"></script> 1st file:- Index.html 2nd File:- Script.js JavaScript code is written in script.js (external file).

    HTML connects it using:

    <script src="script.js"></script> Button click runs the JS function from the external file.

    More chapterwise notes for M2-R5.1

    Try this HTML, CSS and JavaScript live — free

    Type any tag or style from these notes into our free editor, press Run and see the page change. The explained examples show the code and the result side by side.

    Prepare for O Level with expert guidance

    Classroom training, practical labs and exam registration at Zed-King Institute, Kaithal.

    Drag me!