How to get a last element of ES6 Map/Set without iterations(forEach or for of) pass through a full length of the container?
const getLastItemInMap = (map) => [...map][map.size-1]; const getLastKeyInMap = (map) => [...map][map.size-1][0]; const getLastValueInMap = (map) => [...map][map.size-1][1];