Java Script Language
- Java Script is a Interpreted Language.
- Source code will convert to the machine code through engine interpreter in Interpreted language .
- Java Script is a Dynamically type language.
- Meaning of Dynamically type : Show errors in run-time.
- Java Script is a case sensitive language.
- Data Types : Boolean
Number (Integer,Float)
Characters(String)
Language specification type(null,undefined)
- Naming convention is same as java language.
- Create variables in java script :
Ex : var myVariable = "Name";
You can add any type of data for this variable.(string/number/null/undefined)
- Constant variables in java script
Variable name should be in capital letters.
EX : var MYVARIABLE = "Name";
- Arrays in Java Script
Same as java.
Add values into array using 'push' key word.
Remove values in array using 'pop' key word.
' Shift ' key word : remove first element.
' Slice ' key word : get a copy of an array.
Ex : var arr = [2];
arr.push(4);
arr = [2,4]
- Operators in java script
Unary (a++ , ++a , --a , a--)
Binary
Relational ( > , < , >= , <= , instance of )
Equality ( == , != , =>= , !== )
Equality operators : == , != Identically Operators : =>= , !==
Multiplicative ( * , / , %)
Addictive ( + , - )
In
- Control - flow
if , if - else , for , while , do - while , if - else - if , switch are same as java
- for - in use instead of for - each loop
- Functions / Methods in java script
EX : Function myFunction(){
console.log ("print my new function ");
}
- Method overloading
Support in java script , but run only last method .
- Java script objects
Ex : 1) var myObj = {};
myObj.name = "Name";
myObj.address = "Address";
myObj.printDetails = function(){
console.log(this.name , this.address);
}
2) var myObj = {
name : "Name",
address : "Address",
printDetails : function(){
console.log(this.name , this.address);
}
};
* Remove methods in object
delete myObj.printDetails;
- Truthly and Falsy check in java script
This feature not include in java.
Ex : Truthly -> if ( [] ) { Falsy -> if ( !0 ) {
console.log (true); console.log ( false );
} }
Difference between Java Script Object and Jason Object
Java Script Jason
var obj = { var obj = {
name : "Name", "name" : "Name",
address : "Address" "address" : "Address"
} }
Comments
Post a Comment