How to display the ANSI Escape codes in javascript?

Viewed 900

my code

<!DOCTYPE html>
<html>
<body>

<script>
document.write('\u001b[41m Hello World \u001b[40m');
console.log('\u001b[41m Hello World');
</script> 

</body>
</html>

output output pic

In console the text comes with red background color. But , in web page it comes like this \u001b[41m Hello World \u001b[40m

I want to display all terminal escape codes using javascript. How can I do this with javascript ?

0 Answers
Related