I'm new to JavaScript. I want to remove last element from an array, without using pop method. I've tried using length property, but I'm getting undefined in my console. Please help!
function lastElement(array) {
return array[array.length-1];
}
lastElement([3,4,5,6]);