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

[ad_1]

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

[ad_2]

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