Format Name Strings

Let's follow the steps:

  • Declare two variables named firstName and lastName and assign them "John" and "Doe" respectively.
const firstName = "John";
const lastName = "Doe";
  • Your task is to write a to combine these names into a single string in the format "last, first" and print ot to the console.
console.log(`${lastName}, ${firstName}`);

Putting it all together:

const firstName = "John";
const lastName = "Doe";
console.log(`${lastName}, ${firstName}`);