GTU WTAD Practical 2 : Write a JavaScript that demonstrates the use of +=,-=,*=,/= operators

GTU WTAD Practical 2 : Write a JavaScript that demonstrates the use of +=,-=,*=,/= operators

GTU WTAD Practical 2

This program demonstrate use of JavasScript advance operator. JavaScript supports all operator which are supported by general purpose language. But here in this example I am going to discuss the special operator supported by JavaScript that is +=, -=, *=, and /=. This operator is actually combinations of two operators, lets learn by example.

File Name : index.jsp

File Location : Tomcat_Apache\webapps\gtu02\

 

Output

GTU WTAD Practical 2

 

If you are not sure about how to write JavaScript or basic fundamental points for JavaScript, I strongly recommend you to refer my previous post regarding JavaScript to learn basic about JavaScript.

 

Few Important JavaScript Keywords, DO NOT USE IN VARIABLE NAME OR FUNCTION NAME

  • var : This Keyword is used to declare variable in JavaScript.
  • for : This JavaScript Keyword is for Looping Structure.
  • do : This  JavaScript Keyword is for Looping Structure.
  • while : This  JavaScript Keyword is for Looping Structure.
  • break : This JavaScript Keyword is used to break loop on some special condition.
  • continue : This JavaScript Keyword is used for Looping Structure to skip some condition.
  • switch : This JavaScript Keyword is used to write down switch instead of if… else condition.
  • function : This JavaScript keyword is used to declare function in JavaScript.
  • try : This JavaScript keyword is for Exception handling.
  • catch : This JavaScript keyword is for Exception Handling.
  • return : This JavaScript keyword is used to return from function.

 

Whats Default value for Variable in JavaScript ?

undefined (like null in some other languages)

 

Suppose you re-declare same variable will you lost your existing value ?

No

 

var myname = “Adarsh” is a string typeof variable ?

Yes

 

var mymark=100 is a number type of variable ?

Yes

 

var mymark=”100″ is a number type of variable ?

NO. (Its considered as string)

 

How to combine two string in JavaScript ?

 

Whats Difference between using single quote for String and Double quote for string ?

Both are Same (In double quote string you can use apostophe s in between)

 

How many DataTypes are Supported by JavaScript ?

5 (Text,Number, Boolean, Array and Object)

 

How to Declare variable in All Supported Types in JavaScript?

 

How to call/identify function in JavaScript ?

() is used to call function

 

How to find length of string in JavaScript ?

 

How to display special character in JavaScript ?

use \ (escape sequence)

 

Where can we use JavaScript ?

  • on click of submit button for form validation
  • on click of login button for blank text validation
  • on text change of input type text to validate text
  • on page loading completes or other binding with page

 

Some of Useful String Function of JavaScript(output is written in comment)

 

 How to extract sub string from Main String in JavaScript ?

 

 

Number Conversion between Decimal, Binary,Octal and Hex in JavaScript

 

 

 

 

Adarsh Patel

My Self Adarsh Suryakant Patel. Currently I am working as Assistant Professor at Parul Instiute of Engineering and Technology, MCA Department, Limda, Vadodara. Major Responsibility : * Lectures * Organizing Training and Expert Sessions for * Placement and Recruitment * Faculty Representative