Save to the same folder as the active document's saved location

In ExtendScript, you could use the following code to save a JPG in the same folder as the active document’s saved location. Is there a method to achieve this in UXP?
Save to the active document’s saved location without requiring the user to choose the destination folder in a dialog.

var jpeg_options = new JPEGSaveOptions();

jpeg_options.quality = 10;
app.activeDocument.saveAs(new File(app.activeDocument.path + "/" + app.activeDocument.name.replace(/\.[^.]+$/, "") + ".jpg"), jpeg_options, true);

Any information would be greatly appreciated.