var items = [1, 2, 3, 4, 5]; var newItems = []; for (var i = 0; i < 1; i++) { var idx = Math.floor(Math.random() * items.length); newItems.push(items[idx]); items.splice(idx, 1); } console.log(newItems); Run code snippetHide results