Q: Proj4js - convert WGS84 to UTM (military grid reference system) Very new to the proj4js library and most things geo-spacial related, so getting my head around all the naming conventions and different types of coordinate systems.
Essentially I'm trying to take a set of WGS84 Lat-Long coordinates from a polygon and convert them to UTM in order to get the corresponding zone in the military grid reference system.
I've tried
const corrdinates = [ [ [ -1.5321158470515384, 52.34135509678963 ],
    [ 0.0777579252987236, 52.310366914514184 ],
    [ 0.01125412258311688, 51.324523354307196 ],
    [ -1.5638793748853044, 51.354439389788006 ],
    [ -1.5321158470515384, 52.34135509678963 ] ] ]

function latLngToMgrsUtmZones(coords) {
  try {
    coords[0] = coords[0].map((p) =>
      proj4(
        "WGS84",
        `utm`,
        p
      )
    );
    console.log('coords', coords);
  } catch (err) {
    console.log(err);
  }
}

latLngToMgrsUtmZones(coordinates);

But this just returns utm. I thought one simply needed pass in the projection name to proj4js and it would convert it.
How does one go about doing this using this library?

A: Based on your coordinates list, the UTM zone is 31. The proj4 definition string for that UTM zone would be:-
"+proj=utm +zone=31 +datum=WGS84 +units=m +no_defs"

You can define a new 'proj4' definition as follows:-
// add a definition of a UTM zone
proj4.defs("EPSG:32631","+proj=utm +zone=31 +datum=WGS84 +units=m +no_defs");

Then, the troublesome function can be updated to:
function latLngToMgrsUtmZones(coords) {
  try {
    coords[0] = coords[0].map((p) =>
      proj4(
        "WGS84",
        "EPSG:32631",
        p
      )
    );
    console.log('coords', coords);
  } catch (err) {
    console.log("ERR: "+err);
  }
}

If you run
latLngToMgrsUtmZones(coordinates);

you will get:-
coords:  [
  [
    [ 191321.4903300695, 5808679.516222329 ],
    [ 300798.59040295583, 5799580.45321534 ],
    [ 291767.8812803207, 5690155.850511101 ],
    [ 182274.43537953158, 5699133.648491979 ],
    [ 191321.4903300695, 5808679.516222329 ]
  ]
]

