Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8066165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:53:43+00:00 2026-06-05T11:53:43+00:00

I am not sure if I am using the correct terms for what I

  • 0

I am not sure if I am using the correct terms for what I am trying to do so please excuse that.

Mootools More has an Fx.Elements class that allows you to tween a collection of elements. The set method of the class only accepts an object and allows me to set the original values, however I am not sure how many elements I’ll be having to tween as the HTML will be generated dynamically.

Here is my theory of what I want to do:

var n = $$('.element').length; // 5
var myObj = {};
var value = 0;
var i;

for (i = 0; i < n; i++) {
    myObj = {
      i: { property : value }
    }                        
}

console.log(myObj);

//    What I get:
//    Object { i : { property: 0 } }

//    What I would like:
//    Object { 
//      0 : { property : 0 
//      },
//      1 : { property : 0 
//      },
//      2 : { property : 0 
//      },
//      3 : { property : 0 
//      },
//      4 : { property : 0 
//      }
//    }          

The above, obviously, only sets the i property of the object 5 times. I need i to iterate upwards.

I hope I have explained better than I think I have!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:53:45+00:00Added an answer on June 5, 2026 at 11:53 am

    When using the object literal syntax keys are always treated as strings – even without quotes. Besides that, you overwrite the whole object everytime.

    This code does what you want. Note that I changed it to i < n since you’ll get i = 5 in the last loop which does not fit to the example you posted.

    for(var i = 0; i < n; i++) {
        myObj[i] = {
            property: value
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure if I have the correct terms above, but what I'm trying
I'm not 100% sure that I'm using the correct terminology or if I'm leaving
I'm not quite sure what the correct terms are, but what I'm trying to
I'm not sure if I'm using the correct terms, but I am curious how
Not sure if I am using the correct term, but it's not child/parent since
I'm trying to extend (not sure what is the correct term for this kind
I'm not sure I'm using all the correct terminology here so be forgiving. I
I'm not sure if I'm using the correct terminology to describe my questions so
I'm not sure if I'm using the correct term here, but let's say I
I'm not sure if I am using the correct term. I have several Nginx

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.