How to add and remove sheets using a JavaScript macro in Calc?

As per @joshua4 's suggestion, I’m posting this question so they can submit their solution to it here.

You do this in the exact same ways as with any other language.
[Tutorial] Introduction into object inspection with MRI

To expand on what Villeroy is saying…

https://forum.openoffice.org/en/forum/viewtopic.php?f=74&t=49294

http://www.openoffice.org/api/

then search under the Office API reference field.

This will add a sheet as the second sheet:

//Mini-dmonstration of how to add a sheet
//	for Calc using LibreOffice implementation of Rhino

//Import the Uno runtime interfaces
importClass(Packages.com.sun.star.uno.UnoRuntime);
importClass(Packages.com.sun.star.uno.XInterface);

//Import the Uno Calc interfaces
importClass(Packages.com.sun.star.sheet.XSpreadsheetDocument);
importClass(Packages.com.sun.star.sheet.XSpreadsheets);
importClass(Packages.com.sun.star.container.XIndexAccess);

//Rhino seems to have these handled...
//importPackage(java.type);
//importClass(java.lang.Integer);

//Get sheets object
var polySheets = UnoRuntime.queryInterface(
	XSpreadsheetDocument, XSCRIPTCONTEXT.getDocument()
	).getSheets();
var xspreadsheetsSheets = UnoRuntime.queryInterface(XSpreadsheets, polySheets);

//Insert new sheet in position 2 (i.e. index 1)
xspreadsheetsSheets.insertNewByName("NewerSheet", 1); //Will throw if name is not unique

//End