Posts

10. JQuery

  JQuery - jQuery is a fast, small, and feature-rich JavaScript library.  - It simplifies various tasks such as DOM manipulation, event handling, animation, and AJAX interactions.  - jQuery is a lightweight, "write less, do more", JavaScript library. - The purpose of jQuery is to make it much easier to use JavaScript on your website. - jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code. link :  JQuery   1. Getting Started: Include jQuery: You can include jQuery in your HTML file by adding the following script tag in the `<head>` section: //Path  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> Or you can download the jQuery library from the official website and host it locally. 2. Basic Syntax: Document Ready: To ensure your code runs after the DOM is fully loaded, use the `$(document).ready()` function or the shorth

9. Window and Cookies in Javascript

   Window Object in JavaScript: The window object is a global object in the browser's JavaScript environment.  It represents the browser window or frame and provides various properties and methods for interacting with it. Properties of the window Object: 1. window.innerWidth and window.innerHeight:    - Return the inner width and height of the browser window. 2. window.outerWidth` and `window.outerHeight:    - Return the outer width and height of the browser window including toolbars and scrollbars. 3. window.location:    - Provides information about the current URL and allows navigation to other URLs. 4. window.document:    - Represents the DOM (Document Object Model) of the current page. 5. window.navigator:    - Provides information about the browser and its capabilities. 6. window.localStorage and window.sessionStorage:    - Allow storage of key-value pairs persistently or for the duration of the page session, respectively. Methods of the window Object: 1. window.alert(message)

8. DOM and Event

Image
  Document Object Model (DOM) - Every web page resides inside a browser window which can be considered as an object. - A Document object represents the HTML document that is displayed in that window. The Document object has various properties that refer to other objects which allow access to and modification of document content. - The way a document content is accessed and modified is called the Document Object Model, or DOM. The Objects are   organized in a hierarchy. This hierarchical structure applies to the organization of objects in a Web document. DOM tree - The backbone of an HTML document is tags. - According to the Document Object Model (DOM), every HTML tag is an object. Nested tags are “children” of the enclosing one. The text inside a tag is an object as well. - Every tree node is an object. - All these objects are accessible using JavaScript, and we can use them to modify the page. - Everything in HTML, even comments, becomes a part of the DOM.     window    |    

7. Function in JavaScript

  Function in JavaScript A function in JavaScript is a block of code that contains a group of instructions to perform a particular task. Syntax : Function nameOfFunction(parameters-list) { // Lines of code to be executed to perform a specific task. } Types of Functions in JavaScript There are two types of functions in JavaScript like any other programming language such as C, C++, and Java. 1.Predefined functions 2.User-defined functions 1.Predefined Functions in JavaScript 1. alert(): This function displays an alert dialog box on the browser. 2. confirm(): This function displays a confirmation dialog box and asks the user to choose one from two options. 3. prompt(): The prompt() function displays a prompt dialog box on the browser and prompts the user to enter input. 4. write(): The write() function used to write something on the document. 5. Date(): This function used to get the current date and time. 6. select(): The select() function used to select the pointed object. 7. parseInt(

6. Object and Array in Javascript

  Object in Javascript - An object in JavaScript is an entity or any real-world thing that has a state and behavior. - Here, the state represents properties (characteristics) of an object and behavior represents actions or functionality of an object. - For example, a person is an object. He has properties like black hair, black eyes, fair skin, weight, etc., and actions like eat, sleep, walk, play, study, etc. Object Creation in JavaScript - JavaScript is template based, not class based. Here, we don’t create class to get the object. But, we direct create objects. 1. By object literal 2. By creating an instance of Object directly (using new keyword) 3. Using an object constructor (using new keyword) 1. By object literal - The simplest and the most popular way to create an object in JavaScript is to use object literal. - we create objects with curly braces and  separate properties and values  by using colon (:). Ex :  var objectName = {     propertyName1:value1,     propertyName2:value2

5. String and Math Object in JavaScript

  String in JavaScript  - A string in JavaScript is a sequence of Unicode characters. It is simply an array of characters. Each character takes 16 bits. - Each character in the string has its position or index.  Ex : let name1 = "John"; // Double quotes let name2 = 'Bob'; // Single quotes. String Object in JavaScript - String is an object. Any variable whose value is a string is actually a string object. That is, JavaScript stores a string value as a string object in a variable. - The string object in JavaScript is a wrapper around the string primitive value. It is the most commonly used object in JavaScript. String Creation  Ways to create String in JavaScript There are two ways to create string in JavaScript. They are as follows: 1. By string literal  Ex : let stringname="string value"; 2. By string object (using new keyword and String() constructor) Ex : let str = new String("Hello JavaScript"); - We can also using character array    Note:   - A

3. Operator in Javascript

Image
Operators in JavaScript - Operators in JavaScript are very similar to the operators that appear in the other programming languages, such as C++, or Java. - Operators are used extensively in JavaScript program to perform some sort of calculation, comparison, or assignment on one or more values. Operator Sub-types in JavaScript There are three sub-types of operators in JavaScript. They are: 1. Unary : Unary operator is an operator that takes only a single operand. 2. Binary : Binary operator is an operator that takes two operands. 3. Ternary : Ternary operator is an operator that takes three operands. Precedence of Arithmetic Operators in JavaScript There are two priority levels of arithmetic operation in JavaScript. They are as follows: High priority: * / % Low priority: + – If two or more sets of parentheses occur into the expression one after another, the order of evaluation will be done from the left set towards the right set. Types of Operators in JavaScript In JavaScript programmin