0

I am having trouble with passing data into a function ( :O ).

Before passing.

console.log(data); // perfect.

this.filterData(data);// passing data.. 

private filterData(data: any): any
{
console.log(data) // something strange happens, check the print.
}

enter image description here

Thank you guys!

albertosetim
  • 21
  • 1
  • 7
  • 1
    When you logged the array, it had six entries in it. Then code somewhere in your page/app removed those entries from the array. Then you expanded the array in the log. See the linked question's answers for why when you expanded it, you saw the *current* contents of the array (empty), not the contents as they were when you logged it. Note that your code shows two `console.log` calls, but your screenshot only shows **one** of them. – T.J. Crowder Mar 17 '21 at 17:05
  • 1
    Often, rather than stumbling around in the dark with a `console.log` torch, your best bet is to *turn on the lights* with the debugger built into your browser and/or IDE. You could set a breakpoint and examine the contents of the array when the code pauses at the breakpoint. – T.J. Crowder Mar 17 '21 at 17:06
  • Absolutely right! do you have any suggestions to debug Angular in vscode? – albertosetim Mar 17 '21 at 17:15
  • 1
    I'm afraid I haven't tried that particular combination, sorry!. :-) But I would expect to be able to do so,. esp. as all three are MS tech. Good luck! – T.J. Crowder Mar 17 '21 at 17:17

0 Answers0