0

i will create array and i thought that is success created but that array not normal display when i consle the array.

My code is :

var post = [
  RowDataPacket {
 date: 2022-03-01T23:39:17.000Z,
    id: 30,
    post_id: 467,
    sender_id: 31,
    cum_id: 31,
    content: '<p>Many developers still use the log method to debug their application. For example, to make sure that the code goes somewhere or that a variable has the right value at a given time.</p><p>There are several downsides to this.</p><p>You have no view on the whole life cycle of your application, only on the value of a variable at a given time or the assurance or not that your code is following its logical flow.</p><p>It often happens that console.log are forgotten in several places in the code, which besides a hypothetical loss of performance (tiny, but whose size varies according to the data called through the log method), is not very clean.</p>',
   
  },
  RowDataPacket {
    date: 2022-03-01T23:39:17.000Z,
    id: 31,
    post_id: 468,
    sender_id: 31,
    cum_id: 31,
    content: '<p>Many developers still use the log method to debug their application. For example, to make sure that the code goes somewhere or that a variable has the right value at a given time.</p><p>There are several downsides to this.</p><p>You have no view on the whole life cycle of your application, only on the value of a variable at a given time or the assurance or not that your code is following its logical flow.</p><p>It often happens that console.log are forgotten in several places in the code, which besides a hypothetical loss of performance (tiny, but whose size varies according to the data called through the log method), is not very clean.</p>',
   
   
  }
]
   var rplArrays = [];
  console.log(rplArrays);
   for(var i=0; i < post.length; i++) {  
    rplArrays.push(post[i].post_id);
} 

disply on the window like this photo..

enter image description here

when i click that arrow next to the array then that will display array information.

elyar kk
  • 31
  • 3
  • 1
    Can you please share with us `console.log(post)`? – EzioMercer Mar 10 '22 at 21:03
  • 2
    That is because when you do `console.log(rplArrays)`, it is empty. Then it gets not empty after that. THen when you click on the arrow in devtools it shows you the latest version of `rplArrays`, but it doesn't update the initial `[]`. – programmerRaj Mar 10 '22 at 21:12

0 Answers0