Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

plus in javascript

/*
The plus sign is an operator in JavaScript.
It is used to add numbers and concatenate
(join) strings.
*/
console.log(1 + 1); // -> 2
console.log("Hello " + "world!"); // -> Hello world!
// Note: adding a string and a number will coerce the number into a string
console.log(1 + " world!"); // -> 1 world!
console.log("Hello " + 1); // -> Hello 1
 
PREVIOUS NEXT
Tagged: #javascript
ADD COMMENT
Topic
Name
3+6 =