【问题标题】:how to add array to operators?如何将数组添加到运算符?
【发布时间】:2017-12-24 00:37:09
【问题描述】:

我只需要一个“是”或“否”,并可能指向正确的方向:)

我想知道我怎么能做到这一点,粉笔与colors.red或colors.blue相同,它只是chalk.red或chalk.blue,但我想制作一个数组具有随机化的不同颜色,例如 console.log(chalk.arraycolor("this is a test"));

对不起,我会引起任何问题,我只需要一个是或否,并可能指向正确的方向:)

this is the code, sorry i could not upload the raw code as its on my raspberry pi

【问题讨论】:

    标签: arrays node.js console.log chalk


    【解决方案1】:

    我想你想要的是chalk[rand]。

    请注意,foo["bar"] 等同于 foo.bar。

    【讨论】:

    • 谢谢你回答我的问题,我知道这很简单,无论如何谢谢人:)
    猜你喜欢
    • 1970-01-01
    • 2021-07-02
    • 1970-01-01
    • 2022-01-23
    • 1970-01-01
    • 1970-01-01
    • 2017-09-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多