• Question
  • I don't know what it's called but I need help with it

INTERNECION ah I see
Yeah, didn't think much of the gold ring since their ain't anything in my mind for what it could stand for
Now there's something B)

    So basically {stuff:0,stuff2:1,} is called an object and there basically what you CDO people know as sprites.
    so if I had
    var things = {
    thing1: 10,
    thing2: 20,
    };
    then I could say
    things.thing1 which would be 10

    in your case you have an array with a bunch of objects inside of it
    so:

    var acheivements = [
    {
    acheivement:'yey',
    how:'do yey',
    unlocked:false,
    },
    {
    acheivement:'oops',
    how:'do oops',
    unlocked:false,
    },
    ];

    so to see if you have the first acheivement, yey, you would say
    acheivements[0].unlocked
    and it should be true or false(in this case false)

    so now in case you didnt know a good way to go through every acheivement is

    for(var i =0; i < acheivements.length; i++){
    console.log('acheivement number '+i+' unlocked: '+acheivements[ i ].unlocked);
    }

    well hope this helps

      ackvonhuelio oooh ok, thanks, that helped!
      And the stuff at the end with all the "I" yeah I don't even have the slightest clue on how that works-

      Mellow to answer your question the term OOP (Object Oriented Programming) comes to mind, as far as i know there are 2 ways of accessing object properties super easy though there are most likely more than two i will only be showcasing 2 for the sake of simplicity, this is basically an example of what Ack did without the array

      var obj = {
      a: 0, 
      b: "a", 
      c: false
      }  
      console.log(obj["a"] + " : " + obj.a)

        Mellow no he doesnt care about noitif he just want points I love how he lies how he don't care about points but he likes his own post

          2kChubz m a n
          Yes it is strange how a lot of their posts are upvoted by theirself 🤔

          2kChubz hm wait also strange that they say that other people care about it and that they downvote their own posts to put down their own rank, and yet theyre still at A- and have multiple recent posts upvoted by themself 🤔🤔🤔🤔🤔🤔🤔🤔

            ALSO weird how they said they "didn't choose to be a mod-" ok I'll stop before I possibly get banned for no reason, that's all I've got anyway (hopefully)

              Varrience ackvonhuelio

              Oh, also, is there a way I can count how many of a specific type of... erm.. listing(?) I have?
              Like how many "hidden" achievements I have left, or just the total of achievements and completed achievements?

                2kChubz Lying about what I say. Manipulating someone else to think lies. Being disrespectful to me by not heeding the warning I gave you exactly 24 times. And not actually answering my question of us becoming friends so that this controversy can be over. Does jack shit for coding and only making things worse whenever you are online. You only come on to insult me and try and humiliate me. Well i am mod now so I can do something about this injustice. SUSPENDED FOR ONE DAY. For being disrespectful to a mod and not listening to me when I gave you a chance SEVERAL TIMES or helping anyone with what you say and only adding to the problem

                  Mellow I only upvote my own stuff so I can piss off chubz since he cares so much about it. I never chose mod. BRENDAN JUST GAVE IT TO ME. To stop a controversy that Chubz and colack created and escalated to the point where I nearly banned both of them and kept it that way so that it was peaceful at last. I neeever wanted to be here. I only came here because of HACKERS on code.org and I wanted to stop there goddamn reign. AND THEN ALL OF A SUDDEN I got into arguments with people because ALL I DID WAS TRY AND HELP FOR THE TRILLIONTH TIME and being denied that because people didn't like my so-called "unorthodox" way of helping others. AND I EXPLAINED MYSELF CLEAR AND CUT ABOUT SEVEN TIMES OVER. MOST OF THE GODDAMN FORUM WAS ON MY SIDE BECAUSE THEY KNEW I DID NOTHING WRONG. SO please think before you speak and get the other persons side before it gets you somewhere you don't like, that person's bad side. This is a warning. I do not want to have to tell you this again. You are very lucky that you didn't break anymore rules yourself cuz I do not want to deal with people like them ANY LONGER. WE ARE DONE HERE. I am not bringing this up again

                    Do you understand. it is 12:00 AM I am not dealing with this

                    Mellow
                    imma kill two birds with one stone on this
                    varrience probably has a better way but...

                    so anyways here how to for loop

                    for(var i = 0; i < 5; i++){
                    }

                    1. the var i = 0 means your making a variable called i which starts at 0
                    2. the i < 5 means the loop keeps repeating while i is less than 5
                    3. the i++ means i increases by one every time the loop repeats
                      SO, in total, the loop repeats five times.
                      now, to incorporate with arrays:
                      for(var i = 0; i < array.length; i++){
                      }

                      you'll notice its the same as before, except for part two where it now says i < array.length instead of i < 5
                      this means that the for loop repeats array.length times, which means it repeats once for each object/achievement in the array

                    so now we can go through each achievement in the array by using array[i](the ith object in the array, and since i is changing once for each object in the array, we cover all the objects)
                    to sum it up you'd need something like this:
                    var numCompleted = 0;
                    for(var i = 0; i < achievements.length; i++){
                    if(achievements[i].completed === true){
                    numCompleted += 1;
                    }
                    }

                    again, hope this helps and im sure varrience has a better way of doing this but until then your welcome

                      Chat