Javascript String Assignment Operators

后端 未结 6 499
执笔经年
执笔经年 2021-01-17 17:12

How come I can use += on a string, but I cannot use -= on it?

For example...

var test = \"Test\";
var arr = \"⇔\"         


        
6条回答
  •  囚心锁ツ
    2021-01-17 17:25

    Generally, programming languages don't define subtraction for strings. += isn't really addition in the first place, it's concatenation.

提交回复
热议问题