Monday, 23 May 2011

Complete Operators in JavaScript





Complete Operators in JavaScript

Arithmetic Operators: To perform the arithmetic functionalities.

EX . +,-,*,/,%,

Concatenating Operator (+): To concatenate a string value with another type of value.

Increment and decrement operator (++ / --): To increase or to decrease the variable value. It is divided into two types.

1.Pre Increment / Pre Decrement : These operators increase or decrease the variable values initially and later performs the remaining functionalities.

2.Post Increment / Post Decrement : First the statement functionality will execute after that it increases or decreases the variable values.
Sample Script :
<script>
x=100
y=x++
y=++x
</script>
When y=x++ then y is 100x is 101
When y=++x is 102x is 102.
Comparison Operations: These operators compare two variable values and returns true of false.

Identical True : It compares both variable values along with data types.

Sample Script:
<script>
x=100
y="100"
alert (x==y)
alert(x===y)
</script>
(===) It calculates variables and also values.

Sample Script :
<script>
x=100
x*=2
alert(x)
</script>

Negation Operators: This operator changes the sign of the variable.

Sample Script:
<script>
x=-100
alert(-x)
</script>

Logical Operators: These operators checks the conditions and returns the Boolean value.

Conversion Functions: By using this function we can convert one data type value into another data type value.

Parse Int: It s a function tries to convert each and every character as number up to the possible conversions. It returns the converted value.

Sample Script :
<script>
x="2a23"
alert (parseInt(x))
</script>

False Flow : Coverts an input as throttling point numbers.

Eval: It evaluates the string as automatic expression.

Is no a number: This function checks the input variable is true or not and it returns if it is not an Intisar.

Sample Script :
<script>
alert(isNaN(‘scott’)
</script>

0 comments:

Post a Comment