You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Christopher Fremond f7265a89e8
Update README.md
3 years ago
..
README.md Update README.md 3 years ago

README.md

The Great Escape

Escaping

Quote delimiters can be one of the tricky things to deal with.

Since they are used for delimiting text, they need a trick to include them in our text.

For example, we want a ' (single quote) in or text, but use them as delimiters:

console.log('Houdini once said:')
console.log('Magic is the sole science not accepted by scientists,')
//                    Uh oh... ↙ JS thinks your string ends here
console.log(' because they can't understand it.')
//                       ...and new starts here ↖ that never finish !
// too bad ! a quote, ruined by quotes, ironic and very sad.

The \ (backslash) is used for that:

Everytime there is an extra special character into your string, putting a \ in front of it will escape it and doing so will let JS understand you meant the litteral following character and not the delimiter, or whatever else the character normaly means for a string

Instructions

Nothing can stop you now with that new knowledge. Like Houdini, master of escapes, in this exercise you are going to escape some strings:

  • Create a escapeFromDelimiters that includes all 3 quotes (`, " and ').

  • Create a escapeTheEscape that includes a backslash (\).

“How did I escape? With difficulty. How did I plan this moment? With pleasure.”
― Alexandre Dumas, The Count of Monte Cristo