+ Plus Operator

Operators

+ Plus Operator

 

On the following example it is used as mathematical plus operator and result is 3

CODE

 

Using double plus means increasing the actual number 1 and result is 3

CODE

 

Using plus string variables will append the next into previous one and result is "Hello World"

CODE

 

On the flllowing examples as one of them is string, it uses string plus operation and result is "123 is the lucky number"

CODE

 

On the flllowing examples as one of them is string, it uses string plus operation and result is "23"

CODE

 

On the flllowing example plus before the string converts it into number and result is 5

CODE

 

On the flllowing example plus before the string converts it into number but as the string is not a number, it returns as NaN

CODE