Copying an array from the console
January 16, 2021
Copying an array from the console is a common task when working with JavaScript.
In my case I was playing in the console with a list of emoji, manipulating it and converting it to an array. The code looked like this:
const emoji =
"๐ ๐ ๐ ๐คฃ ๐ ๐ ๐
๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ฅฐ ๐ ๐ ๐ โบ๏ธ ๐ ๐ค ๐คฉ ๐ค ๐คจ ๐ ๐ ๐ถ ๐ ๐ ๐ฃ ๐ฅ ๐ฎ ๐ค ๐ฏ ๐ช ๐ซ ๐ด ๐ ๐ ๐ ๐ ๐คค ๐ ๐ ๐ ๐ ๐ ๐ค ๐ฒ โน๏ธ ๐ ๐ ๐ ๐ ๐ค ๐ข ๐ญ ๐ฆ ๐ง ๐จ ๐ฉ ๐คฏ ๐ฌ ๐ฐ ๐ฑ ๐ฅต ๐ฅถ ๐ณ ๐คช ๐ต ๐ก ๐ ๐คฌ ๐ท ๐ค ๐ค ๐คข ๐คฎ ๐คง ๐ ๐ค ๐คก ๐ฅณ ๐ฅด ๐ฅบ ๐คฅ ๐คซ ๐คญ ๐ง ๐ค ๐ ๐ฟ ๐น ๐บ ๐ ๐ป ๐ฝ ๐ค ๐ฉ ๐บ ๐ธ ๐น ๐ป ๐ผ ๐ฝ ๐ ๐ฟ ๐พ";
const emojiArray = [...emoji];
Since my emojiArray
was a clamped array and the length was big (217) I was not able to copy it from the console and bring it to my VS Code.
After googling a lot I found out there is an option in the console, by right-clicking on the array you can select Store as global variable
.
You will see in the console that a global variable was created named temp1
.
You can use the copy
function to copy the text as a string and then copy it wherever you want since is saved to the clipboard.
After that I was able to paste my emoji in my text editor...Hurray ๐ฅณ
["๐ ๐ ๐ ๐คฃ ๐ ๐ ๐
๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ฅฐ ๐ ๐ ๐ โบ๏ธ ๐ ๐ค ๐คฉ ๐ค ๐คจ ๐ ๐ ๐ถ ๐ ๐ ๐ฃ ๐ฅ ๐ฎ ๐ค ๐ฏ ๐ช ๐ซ ๐ด ๐ ๐ ๐ ๐ ๐คค ๐ ๐ ๐ ๐ ๐ ๐ค ๐ฒ โน๏ธ ๐ ๐ ๐ ๐ ๐ค ๐ข ๐ญ ๐ฆ ๐ง ๐จ ๐ฉ ๐คฏ ๐ฌ ๐ฐ ๐ฑ ๐ฅต ๐ฅถ ๐ณ ๐คช ๐ต ๐ก ๐ ๐คฌ ๐ท ๐ค ๐ค ๐คข ๐คฎ ๐คง ๐ ๐ค ๐คก ๐ฅณ ๐ฅด ๐ฅบ ๐คฅ ๐คซ ๐คญ ๐ง ๐ค ๐ ๐ฟ ๐น ๐บ ๐ ๐ป ๐ฝ ๐ค ๐ฉ ๐บ ๐ธ ๐น ๐ป ๐ผ ๐ฝ ๐ ๐ฟ ๐พ"];