index.js
function nest(array, insert) {
  let obj;

  array.reverse().forEach(key => {
    obj = { [key]: insert };
    insert = obj;
  });

  return insert;
}
function nest(array, insert) {
  let obj;

  array.reverse().forEach(key => {
    obj = { [key]: insert };
    insert = obj;
  });

  return insert;
}
function nest ( array , insert ) { let obj ; array . reverse ( ) . forEach ( key => { obj = { [ key ] : insert } ; insert = obj ; } ) ; return insert ; }
Nest the insert value into objects with keys from array
Nest the insert value into objects with keys from array