将数组和字符串合并到数组中

BT1*_*101 0 javascript arrays

我有这样的输入:

const a = 'lol',
      b = ['1','2','3'],
      c = 'c';
Run Code Online (Sandbox Code Playgroud)

我想合并它,这样输出就是这个数组:

['lol', '1', '2', '3', 'c']
Run Code Online (Sandbox Code Playgroud)

我试过像这样的传播运算符

const arr = [...a, ...b, ...c]
console.log(arr)
Run Code Online (Sandbox Code Playgroud)

但它安慰

["l", "o", "l", "1", "2", 3, "c"]

Sno*_*now 5

如果它是一个数组,则仅使用传播:

const arr = [a, ...b, c];
Run Code Online (Sandbox Code Playgroud)

更动态地,使用.flat

const arr = [a, ...b, c];
Run Code Online (Sandbox Code Playgroud)