在循环数组时检索当前索引 [英] retrieve current index while looping an array

查看:80
本文介绍了在循环数组时检索当前索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就是这样,我怎样才能得到当前的指数?无法理解。


谢谢


for(i = 0; myarray.length< i; i ++){< br $> b $ b do_something();

//我需要当前的myarray [索引]

}


再见


-

una volta qui era tutto< table>

this is it, how can i get the current index? couldn''t figure it out.

thank you

for(i=0;myarray.length<i;i++){
do_something();
//i need the current myarray[index]
}

bye bye

--
una volta qui era tutto <table>

推荐答案

motion musso aka:sathia在8/13/2006 10:50 AM发表以下内容:
motion musso aka: sathia said the following on 8/13/2006 10:50 AM:

这就是它,我怎样才能获得当前索引?无法理解。


谢谢


for(i = 0; myarray.length< i; i ++){

do_something();

//我需要当前的myarray [index]
this is it, how can i get the current index? couldn''t figure it out.

thank you

for(i=0;myarray.length<i;i++){
do_something();
//i need the current myarray[index]



alert(myarray [i] ])


-

兰迪

comp.lang.javascript常见问题 - http://jibbering.com/faq &新闻组每周

Javascript最佳实践 - http://www.JavascriptToolbox .com / bestpractices /

alert(myarray[i])

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Randy Webb写道:
Randy Webb wrote:

motion musso aka:sathia said以下是2006年8月13日上午10:50:
motion musso aka: sathia said the following on 8/13/2006 10:50 AM:

>就是这样,我怎样才能得到当前的指数?无法理解。

谢谢

for(i = 0; myarray.length< i; i ++){
do_something();
//我需要当前的myarray [index]
>this is it, how can i get the current index? couldn''t figure it out.

thank you

for(i=0;myarray.length<i;i++){
do_something();
//i need the current myarray[index]



alert(myarray [i])


alert(myarray[i])



谢谢你,这是指针'的价值,我会试着更清楚


myarray [0] =" a";

myarray [1] =" b";

myarray [2] =" c";

myarray [3] =" d";

myarray [4] =" e" ;;

myarray [5] =" f";

myarray [6] =" g"


让'我说我现在有一个:


-

una volta qui era tutto< table>

thank you, this is the pointer''s value, i''ll try to be more clear

myarray[0] = "a";
myarray[1] = "b";
myarray[2] = "c";
myarray[3] = "d";
myarray[4] = "e";
myarray[5] = "f";
myarray[6] = "g";

let''s say i''m now having a:

--
una volta qui era tutto <table>


Randy Webb写道:
Randy Webb wrote:

motion musso aka:sathia said以下是8/13/2006 10:50 AM:
motion musso aka: sathia said the following on 8/13/2006 10:50 AM:

>这就是它,我怎样才能获得当前索引?无法理解。

谢谢

for(i = 0; myarray.length< i; i ++){
do_something();
//我需要当前的myarray [index]
>this is it, how can i get the current index? couldn''t figure it out.

thank you

for(i=0;myarray.length<i;i++){
do_something();
//i need the current myarray[index]



alert(myarray [i])


alert(myarray[i])



谢谢你,这是指针'的价值,我会试着更清楚


myarray [0] =" a";

myarray [1] =" b";

myarray [2] =" c";

myarray [3] =" d";

myarray [4] =" e" ;;

myarray [5] =" f";

myarray [6] =" g"


让'我说我现在有一个:

myarray.reverse();


for(i = 0; myarray.length< i; i ++){

do_something();

//我需要当前的myarray [index]

/ *

现在我希望我的索引显示如下:

6 5 4 3 2 1 0

* /


}

谢谢


-

联合国伏特加时代tutto< table>

thank you, this is the pointer''s value, i''ll try to be more clear

myarray[0] = "a";
myarray[1] = "b";
myarray[2] = "c";
myarray[3] = "d";
myarray[4] = "e";
myarray[5] = "f";
myarray[6] = "g";

let''s say i''m now having a:
myarray.reverse();

for(i=0;myarray.length<i;i++){
do_something();
//i need the current myarray[index]
/*
now I want that my index is shown like:
6 5 4 3 2 1 0
*/

}
thank you

--
una volta qui era tutto <table>


这篇关于在循环数组时检索当前索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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