如何向数组中添加变量

2022-05-07

以下示例是关于Javascript中包含如何向数组中添加变量用法的示例代码,想了解如何向数组中添加变量的具体用法?如何向数组中添加变量怎么用?如何向数组中添加变量使用的例子?那么可以参考以下相关源代码片段来学习它的具体使用方法。

[英]:how to add variables to an array源码类型:Javascript
// how to add variables/string/value to an array in Javascript

const addArray = [
  "Hello",
  "My",
  "Name",
  "is"
];

// add/append new value/variable/string to the array
addArray.push("Chetan");

console.log(addArray);

本文地址:https://www.itbaoku.cn/snippets/785298.html