The exercise says create a variable named
favoriteAnimal and set it equal to your favorite animal. I was wondering why the solution uses double quotation marks instead of single quotation marks. I copied the solution below.
let favoriteAnimal = "giraffe";
console.log("My favorite animal: " + favoriteAnimal);
In the example they used single quotation marks. That’s why I’m confused. What is the difference please?
let myPet = 'armadillo';
console.log('I own a pet ' + myPet + '.');
// Output: 'I own a pet armadillo.'
In the examples shown, there is no difference. If, however, you wanted to include an apostrophe in your string literal, you would have the following options.
All three ouput,