Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Remove elements by changing the array length in JavaScript

This operation is similar to Pop function
<script type="text/javascript">
var x = new Array(0,1,2,3,4);

var firstElement  = x[x.length-1];
x.length = x.length-1;

var secondElement = x[x.length-1];
x.length = x.length-1;

document.write(firstElement)
document.write(secondElement)
document.write(x);
</script>