ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalITEC3111Javascript
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    ITEC3111

    Web Engineering

    Progress0 / 24 done
    Topics24
    1Web programming languages (HTML5, CSS3, JavaScript, PHP/JSP/ASP.Net)2HTML53CSS34JavaScript5PHP6JSP7ASP.Net8Design principles of Web based applications9Web platform constraints10Software as a Service (SaaS)11Web standards12Responsive Web Design13Web Applications14Browser/Server Communication15Storage Tier16Cookies and Sessions17Input Validation18Full stack state management19Web App Security - Browser Isolation20Network Attacks and Session Attacks21Large scale applications22Performance of Web Applications23Data Centers24Web Testing and Web Maintenance
    3 min read
    Topic 4 of 24
    Topic Study Note Illustration
    04

    JavaScript

    JavaScript is a high-level, client-side scripting language used to make web pages interactive and dynamic .

    ⚙️ JavaScript (JS)


    📌 1. Definition

    JavaScript is a high-level, client-side scripting language used to make web pages interactive and dynamic.

    👉 It works with:

    • HTML → structure
    • CSS → design
    • JavaScript → behavior

    🧱 2. Basic Syntax

    <script>
      document.write("Hello World");
    </script>
    

    🔑 Key Points

    • Case-sensitive language
    • Statements end with ;
    • Runs inside browser

    🧠 3. Variables

    📌 Definition

    Variables store data values.

    let x = 10;
    const y = 20;
    var z = 30;
    

    ⭐ Types

    • var → old method
    • let → block scope
    • const → constant value

    🔢 4. Data Types

    • Number
    • String
    • Boolean
    • Object
    • Undefined
    • Null
    let name = "Ali";
    let age = 20;
    

    ➕ 5. Operators

    • Arithmetic: + - * / %
    • Comparison: == === !=
    • Logical: && || !
    let sum = 5 + 3;
    

    🔀 6. Control Statements

    1. If-Else

    if (x > 5) {
      console.log("Greater");
    } else {
      console.log("Smaller");
    }
    

    2. Loops

    for (let i = 0; i < 5; i++) {
      console.log(i);
    }
    

    🔧 7. Functions

    📌 Definition

    A function is a block of code that performs a task.

    function greet() {
      alert("Hello!");
    }
    

    With Parameters

    function add(a, b) {
      return a + b;
    }
    

    🧩 8. Events (Very Important)

    📌 Definition

    Events are actions performed by the user.

    ⭐ Common Events

    • onclick
    • onchange
    • onload
    • onmouseover

    ✅ Example

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

    🌳 9. DOM (Document Object Model)

    📌 Definition

    DOM allows JavaScript to access and modify HTML elements.

    ✅ Example

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

    📋 10. Arrays

    let fruits = ["Apple", "Banana", "Mango"];
    

    🧱 11. Objects

    let person = {
      name: "Ali",
      age: 20
    };
    

    ⏱️ 12. Timing Functions

    setTimeout(() => {
      alert("Hello");
    }, 2000);
    

    🌐 13. Form Validation

    function validate() {
      let x = document.forms["myForm"]["name"].value;
      if (x == "") {
        alert("Name must be filled out");
      }
    }
    

    ⚡ 14. ES6 Features (Modern JS)

    • let and const
    • Arrow functions
    • Template literals
    • Modules
    const add = (a, b) => a + b;
    

    📊 15. JavaScript Execution Flow (Diagram)

    User Action → Event Trigger → JavaScript Code → DOM Update → Result Display
    

    ⚠️ 16. Important Rules

    ✔ JavaScript is case-sensitive ✔ Use === for strict comparison ✔ Place scripts at end of <body> for performance ✔ Avoid global variables ✔ Use let/const instead of var


    📈 17. Advantages

    • Makes pages interactive
    • Fast execution (browser-based)
    • Works on all browsers
    • Supports event handling

    ❌ 18. Limitations

    • Security restrictions
    • Cannot access server/database directly
    • Browser compatibility issues

    ❓ 19. Likely Exam Questions

    Short Questions

    1. Define JavaScript.
    2. What are variables in JavaScript?
    3. List data types in JS.
    4. What is DOM?
    5. What are events?

    Long Questions

    1. Explain control statements with examples.
    2. Discuss functions in JavaScript.
    3. Explain DOM manipulation with examples.
    4. Describe JavaScript events.
    5. Explain ES6 features.

    📝 20. Summary / Quick Revision

    • JavaScript = Interactivity

    • Used for:

      • Events
      • DOM manipulation
      • Validation
    • Key concepts:

      • Variables
      • Functions
      • Events
      • DOM

    👉 Works with HTML + CSS to build dynamic websites.


    ← Previous topic 3
    CSS3
    Next topic 5 →
    PHP

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    3mremaining
    561words
    Beginnerlevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Web Engineering