Help With Moving a Layer With API 2

Reading the documentation, this is what it says about moving layers…

  • Arrange layers with layer.move(targetLayer, Constants.ElementPlacement) . Added Constants.ElementPlacement for moving layers: "placeAfter" (place below a layer, below group if group layer), "placeBefore" (place above a layer, above group if group layer), and "placeInside" (inside group layers only).
  • Send a layer to the back or bring a layer to the front with layer.sendToBack() and layer.bringToFront() . If layer is within a group, the commands will operate within that group.

The one I am interested in is moving a layer outside a group

I have tried various ways but cannot seem to get any to work

   const layer = app.activeDocument.activeLayers[0]
   layer.move(layer, constants.ElementPlacement.PLACEBEFORE)

Can anyone show me an example on how to do this please

Im still struggling with this if any of you Whiz Kids can help, it would be appreciated

You are trying to move a layer before that same layer. I suppose nothing should happen in such case

Do I have the Syntax right if not the wrong Constant

I guess neither syntax nor constant are wrong.
From the docs:

Moves the layer relative to the layer specified in parameters.

You are moving your layer above that exact same layer. How do you imagine this should work? You need to provide a different layer as first argument, then your layer would be placed before that other layer (if it’s not there yet)

layer.move(someOtherLayer, constants.ElementPlacement.PLACEBEFORE)