Is it possible to remove a code line by its number?

Let’s say I’d like to remove lines that contain a particular code. I’m using the following code:

const cursor = editor.getSearchCursor('// #foldBlock');
while (cursor.findNext()) {
   const lineNumber = cursor.from().line;
   // how can I remove a line using the `lineNumber` value?


Something like editor.replaceRange("", new Pos(line, 0), new Pos(line + 1, 0)) should do it.