如何在JavaScript的特定索引索引中获取值? [英] How to get value at a specific index of array In JavaScript?

查看:84
本文介绍了如何在JavaScript的特定索引索引中获取值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数组,只想获取索引1处的元素/值

I have an array and simply wants to get the element / value at index 1

var myValues = new Array();
var valueAtIndex1 = myValues.getValue(1); // (something like this)

如何获取数组第一个索引的值JavaScript?

How can I get the value at the 1st index of my array in JavaScript?

推荐答案

只需使用索引器

var valueAtIndex1 = myValues[1];

这篇关于如何在JavaScript的特定索引索引中获取值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆