https://www.padheye.com/2016/02/how-to-truncate-array-in-javascript.html