Operators
Normally operators are same in javascript like any language.
Lets consider an example.
var p=5 ;
var q =10;
var z;
z = p+q;
var x;
x=5+5;
o/p : 10
x="5"+"5";
o/p : 55
x=5+"5";
o/p : 55
x="5"+5;
o/p : 55
...
When you want to concat two strings at that time you have to use + sign
For example :
var str = "Welcome" ;
var str1 = "To javascript";
var final ;
final = str + str1 ;
o/p : WelcomeTO javascript.
In above output it doesn't contain space between Welcome and To..
If you want to do that at that time you have to write
final = str + " " + str1;
o/p : Welcome TO javascript.
Comments
Post a Comment