Tag <pre> in HTML is used to display text in a formatted and preserved format.
This is one of the tags used to display code or specially formatted text.
<pre>
function greet() {
console.log("Hello, world!");
}
greet();
</pre>
Result
function greet() { console.log("Hello, world!"); } greet();
Tag <pre> preserves the original formatting of the text, including spaces and line breaks. This allows for accurate and readable display of code snippets.