【发布时间】:2012-03-01 12:24:51
【问题描述】:
我希望我的变量数组(在 JavaScript 中)有 2 个值:一个引号和一个真值或假值。 这是代码中最好放入的部分:
var q = new Array()
q[0]='There are some people who live in a dream world, and there are some who face reality; and then there are those who turn one into the other. <i>-By Douglas Everett</i>'
q[1]='Whether you think you can or whether you think you can\'t, you\'re right! <i>-Henry Ford</i>'
q[2]='I know of no more encouraging fact than the unquestionable ability of man to elevate his life by conscious endeavor. <i>-Henry David Thoreau</i>'
q[3]='Do not let what you cannot do interfere with what you can do. <i>-John Wooden</i>'
这是我拥有的众多引用之一(很快就会成为琐事,我从另一个站点借用了一些代码来随机生成其中一个。) 例如,我希望 q[3] 成为引号和真值或假值。
这可能吗?关于我应该如何做的任何建议?
我是初学者,如果这是一个明显的问题,我很抱歉。
【问题讨论】:
标签: javascript arrays variables object