Can someone please explain this to me? I am attempting to do something if key != ''
var key = "";
if($('div[title="Keyword"]').text() != '') {
key = $('div[title="Keyword"]').text().trim();
}
//this always alerts
if (key != '') { alert(key); }
//this never alerts
if (!key) { alert(key); }
ifwill pass.console.log(key)say?trimkey,key != ''will evaluate totrue, and!keywill evaluate tofalse.key.lengthis 1,key.charCodeAt(0)is 8203. I think I can solve this by checking ifkey.length > 1