如何从带有索引的数组中获取值?

时间:2019-06-19 12:14:58

标签: javascript arrays react-native

如何在React Native中使用索引从数组中获取内容?

我找不到get方法或类似的东西。

1 个答案:

答案 0 :(得分:0)

您可以通过引用索引号来访问数组元素。

Docs

示例:

const array = ['One', 'Two', 'Three'];
// arrays have zero-based indexes
// to get second element:
console.log(array[1]);