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

419 B
Raw Blame History

title localeTitle
Declare String Variables 声明字符串变量

声明字符串变量

在JavaScript中变量是动态的 。这意味着他们可以在给定时间保存数字,字符串或任何其他数据类型。要声明一个字符串,只需初始化 (创建)一个变量:

var a; 

然后,使用单引号或双引号,声明字符串:

a = "Hello Camper!";