Home > Web Front-end > JS Tutorial > body text

Detailed explanation on the use of nested single and double quotes in JS

php中世界最好的语言
Release: 2018-04-19 09:24:00
Original
2411 people have browsed it

This time I will bring you JSdetailed explanation of the use of nested single and double quotes. What are the precautions for the use of nested single and double quotes in JS? The following is a practical case, let’s take a look together. take a look.

Single quotes and double quotes can be nested within each other.

1. Only double quotes can be nested within single quotes.

2. Only single quotes can be nested within double quotes.

3. If you want to nest double quotes within double quotes, the double quotes inside must be escaped (").

4. The escape character in JS is backslash (). Commonly used escape characters are: ', ",, r, n, etc.

Escape characters are when the browser encounters backslash When slash () is used, the character after it will be treated specially and treated as a normal character. The so-called "normal" characters are a, b, c, &, etc.

I believe it. You have mastered the method in the case of this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!

Recommended reading:

JS implementation of data validation and checkbox form submission

JS implements evaluation star rating

The above is the detailed content of Detailed explanation on the use of nested single and double quotes in JS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template