Reputation: 1
<button onclick="document.location = 'default.asp'">HTML Tutorial</button>
I can't understand why default.asp is in separate quotations. Actually I am learning HTML with CSS. And this Java code appeared in the course out of nowhere so I need help to understand this
Upvotes: 0
Views: 100
Reputation: 24965
When you define a string, you can do so in various ways.
'A string'
"A string"
`A template literal which is a kind of string`
The difference between the three, in relation to your question, is which one you choose to start the string. That is called the delimiter. Once you start a string with a delimiter, the next instance of it will terminate the string, unless you escape it.
So in your example, the inner string uses single quotes so it does not terminate the outer string, which has a delimiter of double quotes.
Upvotes: 1