I have an array containing user inputs and I want to display the last five inputs from the array in HTML:
function display_last_five()
{
var e = "<hr/>";
e += array.slice(Math.max(array.length - 5, 0)) + " ";
document.getElementById('Result').innerHTML = e;
}
What I get:
Input1,Input2,Input3
What I want:
Input1 Input2 Input3
In there a way to manipulate the output or is the input stored incorrect?
toStringimplementation of an array; usejoininstead.