16 lines
419 B
Markdown
16 lines
419 B
Markdown
|
---
|
|||
|
title: Declare String Variables
|
|||
|
localeTitle: 声明字符串变量
|
|||
|
---
|
|||
|
## 声明字符串变量
|
|||
|
|
|||
|
在JavaScript中,变量是**动态的** 。这意味着他们可以在给定时间保存数字,字符串或任何其他数据类型。要声明一个字符串,只需**初始化** (创建)一个变量:
|
|||
|
```
|
|||
|
var a;
|
|||
|
```
|
|||
|
|
|||
|
然后,使用单引号或双引号,声明字符串:
|
|||
|
```
|
|||
|
a = "Hello Camper!";
|
|||
|
|
|||
|
```
|