[Solved] Is there a function for retrieving last array’s element value?


Please try this

function myfn(){
    var array = [1,0,0,0,1,0]; //that may change depending on the user inputs
    var b=0;
    if(array[array.length-1] == 0)
        document.getElementById('print').textContent="Last element is 0";

}

1

solved Is there a function for retrieving last array’s element value?