变量值


变量值由任意文本组成,可以选择用单引号(')或 双引号(")括起来。

带引号的变量可以跨多行,而不带引号的变量仅限于单行。

请注意,由 Node.js 解析时,所有值都被解释为文本,这意味着任何值 在 Node.js 中都会变成 JavaScript 字符串。例如下面这些值:0、true 和 { "hello": "world" } 会分别变成字面字符串 '0'、'true' 和 '{ "hello": "world" }', 而不是数字零、布尔值 true 以及带有 hello 属性的对象。

有效变量的示例:

MY_SIMPLE_VAR = a simple single line variable
MY_EQUALS_VAR = "this variable contains an = sign!"
MY_HASH_VAR = 'this variable contains a # symbol!'
MY_MULTILINE_VAR = '
this is a multiline variable containing
two separate lines\nSorry, I meant three lines'