Escaping quotes syntax

I’m having trouble finding the answer to this question elsewhere. When escaping quotes in a string, why don’t the two backslashes encompass the entire literal quote like:

var myStr = "I am a \"double quoted"\ string inside \"double quotes"\."

Instead, the second backslash resides on the inside of the quote. This doesn’t make sense to me.

I think I found my answer from the next challenge. The backslash always have to precede the quote you are escaping.