To start with you want to generate a random number based on the length. I see you have a function that will do that, but it seems overly complicated for our needs. I would just use Math.random and Math.ceil, i.e. let newLength = Math.ceil(Math.random()*features.length);
Then you want the new array, for which I would use Array.prototype.slice like so: let portion = features.slice(0, newLength);
To start with you want to generate a random number based on the length. I see you have a function that will do that, but it seems overly complicated for our needs. I would just use
Math.random
andMath.ceil
, i.e.let newLength = Math.ceil(Math.random()*features.length);
Then you want the new array, for which I would use
Array.prototype.slice
like so:let portion = features.slice(0, newLength);
Thank you very much! You`re a true professional