Dumping whole array: console.log and console.dir output “… NUM more items]”

前端 未结 5 1943
悲&欢浪女
悲&欢浪女 2020-12-04 23:34

I am trying to log a long array so I can copy it quickly in my terminal. However, if I try and log the array it looks like:

[\'item\',
 \'item\',
  >>m         


        
5条回答
  •  离开以前
    2020-12-04 23:53

    Michael Hellein's answer didn't work for me, but a close version did:

    console.dir(myArray, {'maxArrayLength': null})
    

    This was the only solution that worked for me as JSON.stringify() was too ugly for my needs and I didn't need to write the code to print it out one at a time.

提交回复
热议问题