Skip to content
Subhajit Sahu edited this page Dec 8, 2022 · 18 revisions

Remove last value.

Alternatives: pop, pop$.
Similar: push, pop, shift, unshift.


function pop$(x)
// x: an array (updated!)
const xarray = require('extra-array');

var x = [1, 2, 3];
xarray.pop$(x);
// → [ 1, 2 ]

x;
// → [ 1, 2 ]

var x = [1, 2, 3, 4];
xarray.pop$(x);
// → [ 1, 2, 3 ]


References

Clone this wiki locally