DEV Community

Discussion on: Need help in Populating HTML Table from a file

Collapse
 
debbiswasgit profile image
debbiswas • Edited

Thanks Edward for reaching out. I see that it fetches exactly same values as in text file inside filter callback. Also its datatype is string for each values

Collapse
 
erellsworth profile image
Edward Ellsworth

So, if the values are exactly the same, the filtered array wouldn't be empty. I'd try adding more to the console.log statement. For example:

console.log(value, value == "p");

If this outputs something like p, false then my guess is the value variable has a phantom space around it. You could test that with something like:

console.log('xx' + value + 'xx');

If there's a phantom space, you should see something like "xxp xx" or "xx pxx"

Thread Thread
 
debbiswasgit profile image
debbiswas

Thank you Ellsworth for your response . I tried putting above checks and see that condition return false but strangely there is no phantom space even.
Alt Text

Thread Thread
 
erellsworth profile image
Edward Ellsworth

Hmm. I'm curious, if you do console.log(lineByline) what does it display? Or maybe console.table(lineByline)?

Thread Thread
 
debbiswasgit profile image
debbiswas

thank you for your response. Attaching the response for console.log(line) , lineByline and console.table(lineByline) inn sequence.

Alt Text

Thread Thread
 
erellsworth profile image
Edward Ellsworth • Edited

I'm not sure what, but something is off about your array. Console.table is only showing the index. Unless this is a browser quirk I'm not aware of, it should be showing corresponding values.

console.table

Thread Thread
 
debbiswasgit profile image
debbiswas

Yes may be browser issue. Let me then try in different browser and check. Thanks