How do I transform certain array elements into sub-arrays using JavaScript

welcome to shbcf.ru