Skip to content

Commit 8c252c9

Browse files
committed
Array mcq
1 parent 520f848 commit 8c252c9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Array/plus.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
3+
4+
/*
5+
The + operator is used for string concatenation when one of the operands is a string.
6+
*/
7+
console.log("1"+1)//11
8+
9+
console.log(1 +"1")//11
10+
console.log(1-"1")//0
11+
12+
//addition arihematic
13+
console.log(1+1)//2
14+
15+
console.log([]+[])//""
16+
console.log([]+1)//"1"
17+
console.log([1]+[2])//"12"
18+
console.log([1]+{})//"1[object Object]"
19+
console.log({}+{})//[object Object][object Object]
20+
console.log([]+{})//[object Object]

0 commit comments

Comments
 (0)