Really easy question here

hi,

const testerX1 = [5, 6, 7, 8, 9];
document.getElementById("Test_out1").innerHTML = testerX1; // 5,6,7,8,9

const testerX2 = document.getElementById("Test_out1");

What should i do next to get my 5,6,7,8,9 back from testerX2?
Test_out1 is just a p tag

Any help,
thanks

Hi there and welcome. To get back the values from testerX2, access its .innerHTML property and store it in a variable. Logging this variable will return the string "5,6,7,8,9". If you need it as an array, use .split(',') to separate the values and .map(Number) to convert them into numbers.

1 Like