Clear the'\ x1B [2J\ x1B [0f' and 'x1B [2J\ x1B] [3J\ x1B [H'] in the console source code

looking at the source code of create-react-app, I see a tool file clearConsole.js , which can clear the console:

.
function clearConsole() {
  process.stdout.write(process.platform === "win32" ? "\x1B[2J\x1B[0f" : "\x1B[2J\x1B[3J\x1B[H");
}

1. What are "x1B [2Jx1B [0f" and "x1B [2Jx1B] [3Jx1B [H"] here?
2. Why does this have the effect of clearing the console?

Thank you!

Mar.13,2021

console supports some escape sequences to do some special things. Different operating system terminals have different support for escape sequences. X1B is the asc code of ESC, and the latter 2J is some kind of escape sequence. There are many escape sequences that can be used, such as controlling the cursor, color, etc. Please refer to Wikipedia: https://en.wikipedia.org/wiki.

You can find that 2J is clear entire screen in the

link.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d3e0-2c385.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d3e0-2c385.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?