113k views
4 votes
Write a concatenation expression that adds a single character to a string.

User Schodge
by
8.0k points

1 Answer

3 votes

Final answer:

To concatenate a single character to a string, you can use the '+' operator in JavaScript.

Step-by-step explanation:

A concatenation expression in JavaScript can be used to add a single character to a string. Here's an example:

var string = 'Hello';
var character = 'o';
var newString = string + character;
console.log(newString); // Output: 'Helloo'

In this example, we have a string variable called 'string' with the value 'Hello'. We also have a character variable called 'character' with the value 'o'. The concatenation expression 'string + character' adds the character to the end of the string, resulting in a new string 'Helloo'.

User Gbinflames
by
8.4k points