Seemingly identical strings fail comparison

前端 未结 4 583
星月不相逢
星月不相逢 2021-01-18 01:50

I am encountering a strange issue while comparing two strings. Here is my code:

console.log(x == y);
console.log(\"\'\" + x + \"\'==\'\" + y + \"\'\");
conso         


        
4条回答
  •  太阳男子
    2021-01-18 02:15

    Try to escape your two strings to see what chars are in them. In this case (although Frédéric has covered possible cases) since you're using PGP, you probably have a binary non-printable char present.

    escape(x);
    escape(y);
    

    in your console and you will be able to detect the char in action.

提交回复
热议问题