I have a JavaScript array called splitstatus which takes data from a variable called "status". splitStatus[0] and splitStatus[1] contains text inside it .
I doubled checked it by using console.log
let splitStatus=status.split('\n')
for(let i=0;i<splitStatus.length;i++){
console.log(splitStatus[0]); // shows output HI THERE
console.log(splitStatus[1]); // shows output HELLO WORLD
}
The code above is working as i expected, as splitStatus[0] has 'HI THERE' stored inside and splitStatus[1] has 'HELLO WORLD' inside.
ISSUE: "if condition" doesn't work with the "==" operator as shown below
if (splitStatus[0]==' HI THERE '){
//my code
}
when i put just "=" it works, but i want to put "==". Can someone tell me what im doing wrong. Thanks a lot for reading.