Java_Script

 

Chapter 1

Introduction

  • Client-side scripting language for web pages.
  • Client-side (runs on users computer not web server)
  • Scripting languages are easier than programming languages.
  • Browser interprets JS statements.
  • Its embedded (add a block of code(JS)in html page from outside) in html page.
  • Its integrated with html.


  • Quick development and easy maintenance.
  • Well perform repetitive and event-invoked task(each time change data)
  • Platform independent because of WWW.
  • Its object-based language not object-oriented.
  • Each web page as collection of several individual elements which are called objects(e.g. image, link etc)
  • JS is not compiled like java.
  • Variable data types not declared(loose typing).
------------------------------------------------------------------------------------------------------------------------

Chapter 2

Ways to put JS code in html


  1. Between the body tag of html
  2. Between the head tag of html
  3. External .js file
 

  1. Between the body tag of html


             
2. Between the head tag of html



3. External .js file


                    demo.html


        
                    external.js






-------------------------------------------------------------------------------------------------------------------------


Chapter 3

JavaScript Comment

Two types of comments in JavaScript

  1. Single-line Comment (//......)
  2. Multi-line Comment (/*.......*/)


  • The JavaScript comment is ignored by the JavaScript engine i.e. embedded in the browser.
  • Its used to make code easy to understand.

-------------------------------------------------------------------------------------------------------


Chapter 4

JavaScript Variable

  • A storage location 
  • Start with a letter (a to z or A to Z), underscore( _ ), or dollar( $ ) sign.
  • Not begin with numbers and other special characters.
  • Case sensitive
  • Declare by the character "var" , "let" ,"const" (e.g. var x = 30;)
  • You cannot re-declare a variable declared with "let" or "conts".







Two types of variables
  1. Local Variables: Local variable is declared inside block or function. Only accessible within the function/block.
  2. Global variables: Declared outside the function and  accessible from any function.

--------------------------------------------------------------------------------------------------------------------------

Chapter 5

JavaScript Data Types

  • JavaScript is a dynamic type language
  • So don't need to specify type of the variable
  • use var, let, const  keywords to specify  a variable
  • It accept both Primitive and Non-primitive (reference) data type


---------------------------------------------------------------------------------------------------------------

Chapter 6

JavaScript Operators

Symbols that are used to perform operations on operands

  1. Arithmetic Operators

2. Comparison (Relational) Operators

        The JavaScript comparison operator compares the two operands. The result is only true or false.




3. Bitwise Operators

  1. Logical Operators
  2. Assignment Operators
  3. Special Operators













Comments

Popular posts from this blog

React_JS

DSA