Skip to content

Files

Latest commit

 

History

History
21 lines (14 loc) · 557 Bytes

prefer_interpolation_to_compose_strings.md

File metadata and controls

21 lines (14 loc) · 557 Bytes

Pattern: Missing use of interpolation to compose strings

Issue: -

Description

Using interpolation when composing strings and values is usually easier to write and read than concatenation.

Example of incorrect code:

'Hello, ' + name + '! You are ' + (year - birth) + ' years old.';

Example of correct code:

'Hello, $name! You are ${year - birth} years old.';

Further Reading