Skip to main content
question improvement
Source Link
abhisekp
  • 111
  • 1
  • 1
  • 4

In javascript, Line Feed and Carriage Return behaves similarly.

Which one to use and when?

OR

Can it be used alternatively?

Unicode Characters:

<script>
  Line Feed: alert("Hello\u000A

Carriage \u0009Return: World");\u000D

Code:

<script>
    alert("Hello \x0D0A\u000A World"World - <LF>");
    alert("Hello \u000D World"World - <CR>");
</script>

Line Feed and Carriage Return behaves similarly.

Which one to use when?

OR

Can it be used alternatively?

<script>
    alert("Hello \u0009 World");
    alert("Hello \x0D0A World");
    alert("Hello \u000D World");
</script>

In javascript, Line Feed and Carriage Return behaves similarly.

Which one to use and when?

OR

Can it be used alternatively?

Unicode Characters:

Line Feed: \u000A

Carriage Return: \u000D

Code:

<script>
    alert("Hello \u000A World - <LF>");
    alert("Hello \u000D World - <CR>");
</script>
Source Link
abhisekp
  • 111
  • 1
  • 1
  • 4

Line Feed or Carriage Return - What to use?

Line Feed and Carriage Return behaves similarly.

Which one to use when?

OR

Can it be used alternatively?

<script>
    alert("Hello \u0009 World");
    alert("Hello \x0D0A World");
    alert("Hello \u000D World");
</script>