Hackforge Academy

Category: javascript

Template literals

Published on 16 Jul 2026

Explanation

Template literals use backticks (`) to create strings.

Code:

const name = 'John';
console.log(`Hello ${name}`);

Explanation

Variables can be embedded using ${}.

Code:

const age = 25;
console.log(`Age: ${age}`);

Explanation

Expressions can also be evaluated inside template literals.

Code:

console.log(`Total: ${10 + 20}`);

Explanation

Template literals support multi-line strings.

Code:

const text = `Line 1
Line 2`;

Explanation

They improve readability compared to string concatenation.

Code:

console.log(`Welcome to HackForge Academy`);

๐Ÿš€ Learn Spring Boot with real-world projects

๐Ÿ’ก Build REST APIs step by step

๐Ÿง  Improve backend development skills

๐ŸŽฏ Get career-ready practical training

Join Our Free WhatsApp Community

Direct access to niche-specific mentors and peers on WhatsApp.

๐Ÿ

Python Community

Discuss Django, FastAPI, AI integration, and automation scripts with 15k+ developers.

Join Python Community
โš›๏ธ

React Community

Master Next.js, Framer Motion, and State Management. Share your latest UI components.

Join React Community
โ˜•

Java Community

Deep dives into Spring Boot, Microservices architecture, and high-performance backend ops.

Join Java Community