One way to achieve this is by using template literals. Template literals are a type of string that allow for dynamic expressions to be embedded within them using ${}.
Here is an example:
index.tsx155 chars6 lines
In the example above, the variables name
, age
and job
are embedded within the string using ${}
. When the code is executed, the values of these variables will be substituted in place of the expressions.
So, if you were to run the following code:
index.tsx27 chars2 lines
You would see the following output:
index.tsx64 chars2 lines
gistlibby LogSnag