字符串为不同对象无法判断值相等

1.首先用encodeURIComponent(str)//可把字符串作为URI 组件进行编码`方法判断encodeURIComponent(str1)、encodeURIComponent(str2)两个表达式的值是否相等
2.如果不相等,则两个字符串并不是同一对象
3.用str.trim()处理字符串,判断出来str1.trim()==str2.trim()

猜你喜欢

转载自blog.csdn.net/rj2017211811/article/details/88017722