# Js carriage return and backslahes aren't making sense a bit

**URL:** <https://forum.freecodecamp.org/t/js-carriage-return-and-backslahes-arent-making-sense-a-bit/469562>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [July 16, 2021, 11:42am UTC](https://forum.freecodecamp.org/t/js-carriage-return-and-backslahes-arent-making-sense-a-bit/469562 "2021-07-16T11:42:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kewkimb](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kewkimb/32/225926_2.png) [@kewkimb](https://forum.freecodecamp.org/u/kewkimb)\
**Post date:** [July 16, 2021, 11:42am UTC](https://forum.freecodecamp.org/t/js-carriage-return-and-backslahes-arent-making-sense-a-bit/469562/1 "2021-07-16T11:42:44Z")

</div>

I keep seeing things about this “carriage return”, and I have gone through this js list of tutorials one by one and never learned what the heck this means. I can surely look it up, but I was under the impression I would be taught anything of context throughout. Turns out my code was very similar to correct solution and I just ignored that carriage return since I have no idea what it does, I am not sure why other people are including it in their solutions when we haven’t explicitly learned about it. I can interpret what \n does of course.  
This was my code

```auto
var myStr = "FirstLine\n\t\SecondLine\nThirdLine"; // Change this line

```

I saw in the solution to put one backslash before the backslash that actually shows up in the solution in front of second line. How does this second backslash allow the other one to stay?

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36`

**Link to the challenge:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![DanCouper](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dancouper/32/158608_2.png) [@DanCouper](https://forum.freecodecamp.org/u/DanCouper)\
**Post date:** [July 16, 2021, 11:57am UTC](https://forum.freecodecamp.org/t/js-carriage-return-and-backslahes-arent-making-sense-a-bit/469562/2 "2021-07-16T11:57:03Z")

</div>

Carriage return is this key in your keyboard:

 ![Screenshot_20210716-125629](https://global.discourse-cdn.com/freecodecamp/original/3X/c/2/c27527e41003d94f3c580a545d4ae4b6e7f9f0c1.jpeg)

It isn’t taught because it’s just a thing that you use when you input text on a computer. In a string it needs a special escape character because you aren’t using a keyboard, you’re writing a string.

---

<div class="post-metadata">

**Author:** ![kewkimb](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kewkimb/32/225926_2.png) [@kewkimb](https://forum.freecodecamp.org/u/kewkimb)\
**Post date:** [July 16, 2021, 12:33pm UTC](https://forum.freecodecamp.org/t/js-carriage-return-and-backslahes-arent-making-sense-a-bit/469562/3 "2021-07-16T12:33:32Z")

</div>

lol oh, I am sorry, maybe I should have just known that. I knew it was ‘return’ but I didn’t know what carriage return meant. Okay thank you!

---

<div class="post-metadata">

**Author:** ![DanCouper](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dancouper/32/158608_2.png) [@DanCouper](https://forum.freecodecamp.org/u/DanCouper)\
**Post date:** [July 16, 2021, 1:11pm UTC](https://forum.freecodecamp.org/t/js-carriage-return-and-backslahes-arent-making-sense-a-bit/469562/4 "2021-07-16T13:11:42Z")

</div>

I guess it’s falling out of fashion, calling it that isn’t that common now – normally just called “return”, so not that strange. It comes from typewriters (the carriage is the mechanism that’s the top part of the typewriter). A _carriage return_ is a metal bar that moves the carriage back to the start of the line on the piece of paper, then _line feed_ moves the paper up so you can start typing on the next line.

As an aside. Minor thing but kinda important in programming because it changes how text files are saved: Microsoft systems in particular generally use carriage return command then line feed command, Unix systems generally just use a newline command. Text editors now often automatically set the right thing based on what system you’re using, but it still occasionally causes issues

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [July 17, 2021, 12:17pm UTC](https://forum.freecodecamp.org/t/js-carriage-return-and-backslahes-arent-making-sense-a-bit/469562/5 "2021-07-17T12:17:51Z")

</div>

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (`</>`) to add backticks around text.

 ![Pre-formatted-text](https://global.discourse-cdn.com/freecodecamp/original/3X/1/b/1b18854f1059217f29370444396145cc3a0cd8ae.gif)

See [this post](https://forum.freecodecamp.org/t/forum-code-formatting/25574) to find the backtick on your keyboard.  
**Note:** Backticks (`) are not single quotes (’).

---

<div class="post-metadata">

**Author:** ![kewkimb](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kewkimb/32/225926_2.png) [@kewkimb](https://forum.freecodecamp.org/u/kewkimb)\
**Post date:** [July 17, 2021, 12:37pm UTC](https://forum.freecodecamp.org/t/js-carriage-return-and-backslahes-arent-making-sense-a-bit/469562/6 "2021-07-17T12:37:06Z")

</div>

okay, noted, thank you very much!

---

<div class="post-metadata">

**Author:** ![kewkimb](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kewkimb/32/225926_2.png) [@kewkimb](https://forum.freecodecamp.org/u/kewkimb)\
**Post date:** [July 17, 2021, 12:38pm UTC](https://forum.freecodecamp.org/t/js-carriage-return-and-backslahes-arent-making-sense-a-bit/469562/7 "2021-07-17T12:38:35Z")

</div>

oh interesting. I probably won’t use Unix often so I will remember that difference. Very good information, thank you!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [January 16, 2022, 12:39am UTC](https://forum.freecodecamp.org/t/js-carriage-return-and-backslahes-arent-making-sense-a-bit/469562/8 "2022-01-16T00:39:27Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
