Home > Web Front-end > JS Tutorial > Example code for the definition of strings in javascript_Basic knowledge

Example code for the definition of strings in javascript_Basic knowledge

WBOY
Release: 2016-05-16 17:08:09
Original
798 people have browsed it
Copy code The code is as follows:



< ;title>Definition of string in javascript
<script> <br>//Definition of string<br>//First type<br>var str = new Array(); <br>alert(str);//Empty character<br>//Second type<br>var str2 = new Array("hello"); <br>alert(str2);//hello <br>//Third type The kinds of <br>/* <br>String objects can be created explicitly using string literals. <br>String objects created in this way (in standard string form) are handled differently from String objects created using the new operator. <br>All string literals share a common global string object. If you add an attribute for a string literal, it is available to all standard string objects: <br>*/ <br>var str3 = "hello"; <br>alert(str3);//hello <br> </script>




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