Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- console.log(1 + 2);
- console.log(1 + "s");
- // Number + Number -> addition
- 1 + 2 // 3
- // Boolean + Number -> addition
- true + 1 // 2
- // Boolean + Boolean -> addition
- false + false // 0
- // Number + String -> concatenation
- 5 + 'foo' // "5foo"
- // String + Boolean -> concatenation
- 'foo' + false // "foofalse"
- // String + String -> concatenation
- 'foo' + 'bar' // "foobar"
- operand + operand = result
- var result = 'b' + 'a' + + 'a' + 'a';
- >> baNaNa
- var result = [1, 2, 3] + [4, 5, 6];
- console.log(result);
- >> '1,2,34,5,6'
Add Comment
Please, Sign In to add comment