Challenge 21 Megathread

Welcome to challenge #21!

Use this thread for any and all questions relating to challenge 21

3 Likes

so… when do we find which team submitted first? haha

2 Likes

I think [BugBusters] won, as they are first one in the leader board…
Congratulation and see you next year )))

3 Likes

Reads task This will be easy.
Writes first part Okay, and now onto the next one.
For… wait, input and output are the same. Why am I writing logic here?

6 Likes

It’s finally over ! Congratulation everyone and good luck !

5 Likes

Merry Christmas !! I’ll miss you all!! :santa:

8 Likes

Well as someone that didn’t know anything beyond the name javascript when I started to being able to finish this last challenge on my own in just over 30 minutes with a snack in the middle I have to say this was a lot of fun!

Wanted to say thanks to everyone that added to the discussion along the way, it had definitely helped me out when I felt lost and confused!

10 Likes

Don’t think the site sorts the leaderboard properly. This is the leaderboard when I checked it around 12:06pm EST:


There were 7 teams who had 720, BugBusters not one of them. I think it might actually be sorted in reverse order… so maybe UdeSwinceurs won??

2 Likes

It was cool. Let me win the Oculus Quest :smiley: :laughing:

1 Like

Although they may have changed it for this final challenge (and I would have strongly approved), in the past days, the leaderboard was sorted in two steps:

Step 1 - sort descending by points (highest point teams placed above those with fewer points)
Step 2 - sort by when the team was originally registered, within point groups. In other words, among those with the same number of points, there was no distinction at all for who submitted earlier, or any other important characteristic.

If they did not change the setup, AND if the leaderboards updated as quickly as the submissions were accepted, the winner could be any of the seven shown on that screen capture. The time stamps will presumably be clear on LHL’s side to determine the actual winner. BugBusters was probably one of the first teams ever registered, so once they finally equaled the others in points, they would show up at the top of the list. (No, it isn’t intuitive, but at least it was consistent - assuming it didn’t change since yesterday.)

2 Likes

this was neat. looking forward to future challenges

4 Likes
for (let data of exchanges){
    const sentence = data.origin + ":" + " " + data.message;
    let value = sentence.split();
    let key = "transcript";
    
    if (newObj[key]) {
       console.log(newObj[key].push(value));
    }
  }

My code is not working from here. Can someone please help me out?

i don’t think you need to split the sentence again when you just put it together. the value youre looking for should be the sentence itself

walk it…

2 Likes

There are several things happening here.

As jackammo points out, you don’t need to split sentence. Instead, you’ll see that in the expected output, transcript is an array containing all those sentences. So you’ll need to push those sentences into an array. But before you can push those sentences, you’ll need to set up an empty array data structure to hold them.

One other thing is to consider what you need your loop to do, versus what things can be done outside of the loop.

For example, each time your loop goes through each element of exchanges, it’s declaring a key variable and assigning it the string transcript. But if you only need to do this once, you can move it outside of the loop.

Likewise with setting up any data structures.

1 Like

Thanks and I agree. My theory was that the team at the bottom was the first (ie they put the latest to compete a challenge at the top of list), but the team I saw at bottom of the 720 stack is no longer there. So that means last night when I toom the screenshot the bottom team was the “newest” to register, but since then other teams that are “newer” have completed the challenge.

Alright, then there’s hope yet haha!

let newObj = {};
  const sentence = exchanges.origin + ":" + " " + exchanges.message;
  let valuesArray = [];
  let key = Object.assign(newObj, {transcript: sentence});
  console.log(valuesArray.push(key));
  

I dont even understand anymore, everytime I try to push it keeps giving me returning 1

Thank you everyone and @LHL-Team for these amazing 21 days. We are all winners after these 21 days, it could be gift cards, grand prizes, js knowledge, coding habit (as it takes 21 days to built a habit) or maybe just some fun. Good luck for the future folks.

I hope we have some more challenges very soon :smiley: !!!

Merry Christmas and Happy coding to y’all :snowman_with_snow: :tada:

1 Like

you weren’t too far off in your previous post. for the transcript part of the solution, you want to create an empty array BEFORE the for loop. Then inside the loop, append the sentence to the end of the array

Yes, you do still need your for loop in order to loop through exchanges and grab every sentence and push it into your valuesArray.

Also, when setting a property key for an object, there’s a simpler, more direct way.

objectName.keyNameYouWant = valueYouWant