freeCodeCamp/guide/chinese/certifications/javascript-algorithms-and-d.../basic-javascript/declare-string-variables/index.md

16 lines
419 B
Markdown
Raw Normal View History

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