Avatar ·

Are double and single quotes interchangeable for strings in JavaScript?

Hi everyone! I just started learning JavaScript and got confused about quotes. Tutorials say that strings can be declared with both single (') and double (") quotes. But I don't understand if there is any fundamental difference between them or if they can be used interchangeably?\n\nFor example, I write this code:\n\n```javascript\nlet name = 'John';\nlet greeting = "Hello, " + name;\nconsole.log(greeting);\n```\n\nAnd it works. But if I write like this:\n\n```javascript\nlet message = "It's a beautiful day!";\n```\n\nI get an error. But if I replace the double quotes with single quotes, it works. Why is that?\n\nI've also heard about backticks (`), but I don't yet understand what they're for. Maybe I should always use just one type of quote to avoid confusion? Or are there rules about when to use which?