KandZ – Tuts

We like to help…!

JavaScript 6 ๐Ÿงฌ escape characters and template literals

a - escape characters
escape characters are used to represent special characters in strings
example = "This is a backslash: \\"; โ†’ This is a backslash: \
example = 'He said, \'Hello!\''; โ†’ He said, 'Hello!'
example = "She said, \"Hi there!\""; โ†’ She said, "Hi there!"
example = "Line 1\nLine 2"; โ†’ Line 1
Line 2
example = "This is an octal escape: \101 (\u0041 in hex)"; โ†’ This is an octal escape: A (Unicode 0x0041)
example = "This is a hex escape: \x41 (\u0041 in octal)"; โ†’ This is a hex escape: A (Unicode 0x0041)
example = "This is a Unicode escape: \u03A9 (Omega symbol)"; โ†’ This is a Unicode escape: ฮฉ (Greek Capital Letter Omega)

b - template literals
template literals provide a new way to work with strings
They allow to embed expressions inside string literals using `
This makes it easier to create multi-line strings and perform string interpolation.
Template Literals, introduced in ES6 (ECMAScript 2015)
let greeting = `Hello, ${name}!`; โ†’ Basic Usage
let message = `
This is a
multi-line string.` โ†’ Multi-Line Strings
`The sum of ${a} and ${b} is ${a + b}.` โ†’ Expression Interpolation

Stop using slow, ad-bloated tool sites! ๐Ÿคฎ

๐Ÿ”Ž Search “KandZ Tools” on Google to use many professional utilities for free.

KandZ.me is the ultimate minimalist hub for:
โœ… Finance (Mortgage, Interest, Inflation)
โœ… Tech (Base64, JSON, Dev Suite, IP)
โœ… Health (BMI, BMR, TDEE)
โœ… Productivity (Timer, Workspace, QR)

โšก๏ธ Fast & Private
๐Ÿ”’ No data leaves your device
๐Ÿ’Ž 100% Free

๐Ÿ”— Use it now: https://tools.kandz.me
๐Ÿ”– Bookmark itโ€”youโ€™ll need it later!

Leave a Reply