ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Enterprise Application Development
    EC-332
    Progress0 / 37 topics
    Topics
    1. Overview of Enterprise Application Development: Microsoft technology history2. Introduction to .NET and its architecture3. Concept of MSIL, CLR, CLS, CTS4. Introduction to .NET framework: Managed and Unmanaged Code5. .Net Assembly6. Introduction to C# fundamentals7. Boxing and Unboxing8. Implementing multi-tier architecture9. Introduction to ADO.Net: SQL Injection, parameterized queries10. Usage of data set, Data adapter and command builder in disconnected model11. Introduction to delegate: Multicast delegates12. Introduction to windows forms13. HTML14. Introduction to javascript: javascript and its data types, variables, functions15. Debugging javascript using Firebug16. Introduction to various object models: Browser's Object (BOM), Document Object Model17. Introduction to Jquery: Jquery effects18. Introducing LINQ: LINQ to Objects, LINQ to SQL19. Query syntax, Operations (projection, filtering and join) using Linq Queries20. Introduction to ADO.NET entity framework: The entity data model, CSDL21. Eager vs lazy loading, POCO classes, DBContext API22. Querying entity data models23. Introduction to ASP.NET MVC24. MVC application structure, Controllers overview25. Action Methods, Parameterized action methods26. Introduction to razor syntax27. Code expressions, Code Blocks, Implicit Vs Explicit Code Expression28. Data annotations, Client and Server Side Validation29. Validation and model binding, Validation and model state30. MVC Membership, Authorization and security31. Introduction to service-oriented architecture: SOAP, WSDL32. Service contract, Data contract, XML, WCF bindings33. ABC of WCF, Restful services34. Consuming rest services (CRUD operations) using Jquery AJAX and JSON35. Introduction to web API36. Example of web API using CRUD Example37. MVC routing
    EC-332›Introduction to javascript: javascript and its data types, variables, functions
    Enterprise Application DevelopmentTopic 14 of 37

    Introduction to javascript: javascript and its data types, variables, functions

    6 minread
    1,060words
    Intermediatelevel

    Introduction to JavaScript

    JavaScript is a high-level, dynamic, and interpreted programming language that is commonly used to create interactive effects within web browsers. It is a client-side scripting language, meaning it runs in the web browser, allowing developers to create interactive web pages, handle user events, and manipulate the DOM (Document Object Model) in real-time. JavaScript is an essential technology for web development, alongside HTML and CSS, forming the backbone of web application interactivity.

    JavaScript Features:

    • Dynamic and Lightweight: JavaScript allows developers to write code that is lightweight and can be modified dynamically, making it fast for web applications.
    • Versatile: JavaScript can be used for both client-side and server-side development (Node.js for server-side).
    • Event-Driven: JavaScript reacts to events like clicks, mouse movements, and form submissions.
    • Cross-Platform: JavaScript works on all modern browsers and is also used in cross-platform mobile development (e.g., React Native).

    JavaScript Syntax:

    1. Case Sensitivity: JavaScript is case-sensitive. For example, variable and Variable are treated as different identifiers.
    2. Statements: JavaScript statements end with a semicolon (;), though semicolons are optional in most cases.

    JavaScript Data Types

    JavaScript has several primitive data types and objects that help you store and manipulate data. The primary data types include:

    1. Primitive Data Types:

    • Number: Represents both integer and floating-point numbers.
      let age = 25;   // integer
      let price = 19.99;  // floating point
      
    • String: Represents a sequence of characters.
      let name = "Alice";  // string
      
    • Boolean: Represents a value that is either true or false.
      let isActive = true;   // boolean
      
    • Undefined: A variable that has been declared but not assigned a value is automatically assigned undefined.
      let car;  // undefined
      
    • Null: Represents an intentional absence of any value. It is explicitly assigned.
      let user = null;   // null
      
    • Symbol: A unique and immutable primitive value often used as object property keys (introduced in ES6).
      let sym = Symbol('unique');
      
    • BigInt: Represents integers larger than 2^53 - 1, introduced in ES11 (ECMAScript 2020).
      let bigNum = 123456789123456789123456789n;  // BigInt
      

    2. Complex Data Types (Objects):

    • Object: Represents a collection of key-value pairs, useful for storing more complex data.
      let person = {
          name: "John",
          age: 30,
          city: "New York"
      };
      
    • Array: Represents a list-like collection of values, indexed by numbers.
      let colors = ["red", "green", "blue"];
      

    JavaScript Variables

    In JavaScript, variables are used to store values. There are three ways to declare variables:

    1. var: This is the traditional way to declare variables, but it has some limitations (such as function scoping). It’s considered less commonly used in modern JavaScript.
      var name = "Alice";
      
    2. let: Declares a block-scoped variable (introduced in ES6) that can be reassigned. It’s preferred over var in most cases.
      let age = 25;
      age = 26;  // reassignment is allowed
      
    3. const: Declares a block-scoped variable that cannot be reassigned (it’s constant). It must be assigned a value when declared.
      const pi = 3.14159;  // cannot be reassigned
      

    JavaScript Functions

    A function in JavaScript is a block of code designed to perform a specific task. Functions can accept inputs (parameters) and return outputs (return values). Functions are one of the building blocks of JavaScript, allowing for code reusability and modularity.

    1. Defining a Function:

    You can define a function using the function keyword.

    function greet(name) {
        return "Hello, " + name + "!";
    }
    

    2. Calling a Function:

    Once a function is defined, you can call (or invoke) it by using the function name and providing any required arguments.

    let message = greet("Alice");  // calling the function
    console.log(message);  // Output: Hello, Alice!
    

    3. Function Parameters and Return Values:

    • Parameters: Functions can accept parameters, which are values you pass into the function.
    • Return: Functions can return a value, which can be used or stored in a variable.

    Example:

    function add(a, b) {
        return a + b;
    }
    
    let result = add(5, 3);  // result will be 8
    console.log(result);  // Output: 8
    

    4. Anonymous Functions:

    An anonymous function is a function without a name. It can be assigned to variables or passed as arguments to other functions.

    Example of an anonymous function assigned to a variable:

    const multiply = function(a, b) {
        return a * b;
    };
    console.log(multiply(4, 3));  // Output: 12
    

    5. Arrow Functions (ES6):

    Arrow functions provide a more concise way to write functions. They also have a different behavior for this.

    const subtract = (a, b) => a - b;
    console.log(subtract(10, 4));  // Output: 6
    

    JavaScript Control Structures

    JavaScript also provides several control structures to handle decision-making and looping:

    • If-Else Statement: Used to execute code based on conditions.

      let number = 10;
      if (number > 5) {
          console.log("Greater than 5");
      } else {
          console.log("Less than or equal to 5");
      }
      
    • Switch Statement: A more readable alternative to multiple if-else conditions.

      let day = "Monday";
      switch(day) {
          case "Monday":
              console.log("Start of the week");
              break;
          case "Friday":
              console.log("End of the week");
              break;
          default:
              console.log("Midweek");
      }
      
    • Loops: JavaScript offers several looping mechanisms such as for, while, and forEach.

      For loop:

      for (let i = 0; i < 5; i++) {
          console.log(i);  // Output: 0, 1, 2, 3, 4
      }
      

      While loop:

      let j = 0;
      while (j < 5) {
          console.log(j);  // Output: 0, 1, 2, 3, 4
          j++;
      }
      

    Conclusion

    JavaScript is a powerful and versatile language, enabling developers to create dynamic, interactive web pages. Understanding its fundamental concepts such as data types, variables, and functions is key to mastering the language. By leveraging these tools, you can develop a wide variety of web applications, from simple dynamic effects to full-fledged web applications.

    Previous topic 13
    HTML
    Next topic 15
    Debugging javascript using Firebug

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time6 min
      Word count1,060
      Code examples0
      DifficultyIntermediate