我只是一个初学者。 我正在制作一个程序,用户可以从一个数组中选择对象,然后放置到另一个数组中,在该数组中选择一个随机对象并将其制成变量。 但是,我似乎无法在新数组中对新变量使用相同的属性。

    function verb(first,second,third,fourth,conjugation,chapter) {

    this.first = first;
    this.second = second;
    this.third = third;
    this.fourth = fourth;
    this.conjugation = conjugation;
this.chapter = chapter;
}

var family = new Array();

family[0] = new verb("amo","amare","amavi",'amatum',1,1);
family[1] = new verb("moneo","monere","monitum",2,1);
family[3] = new verb("debeo","debere","debui","debitum",2,1);


for(i=0;i<20;i++) {



    if(chap_beg< i <  chap_end) {
    var randselect  = new Array();   
     randselect.push = family[i];
     var rand = family[Math.floor(Math.random() * family.length)];   

var t = rand.third;
var perfect2 = t.substring(0,(t.length)-2);

===============>>#1 票数:0

你为什么跳过家人[2]? 这部分应该是这样的:

randselect.push(family[i]);
var rand = family[Math.round(Math.random() * (family.length - 1))];

  ask by Hans.Gundlach translate from so

未解决问题?本站智能推荐: