Clear line by number

(similar to this thread but slightly different question)

At the moment I’m using this to clear a line:

const line = 3;
editor.replaceRange("\n", { line, ch: 0 }, { line: line + 1, ch: 0 });

Or a bit shorter way:

const line = 3;
editor.replaceRange("", { line, ch: 0 }, { line });

Is this the way to go or is there a more convenient way?

Those look reasonable.

1 Like