Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Hammad
@newnewb
but the problem is, my sound is waiting for the previous sound to finish so that it could play
Aleksander Gębicki
@Takumar
Hello campers,
this weekend (17-19 November) CodeSchool is offering free learning for everybody.
There is a lot of interesting content to study, so tell your mothers and girls that you are absent ;-)

CodeSchool - free weekend

Tom
@moT01
@bytao7mao get it figured out?
@newnewb have any code? so the audio goes into a queue?
Marius Nicolae
@bytao7mao
@moT01 i'm struggling
can i show the code ?
Tom
@moT01
isnt the code there in the codepen?
yeah is in codepen
Tom
@moT01
so where are you stuck
are you able to get the ids of the winner and loser
Marius Nicolae
@bytao7mao
yes i'm getting the ids, but now i have to implement the condition that the ID of COuntry to be equal to the ID of the Winner / loser
i made a while statement but it doesnt work
Hammad
@newnewb
@bytao7mao It's already solved, someone on frontend help saw it through with me!
help*
Marius Nicolae
@bytao7mao
what O_o
Hammad
@newnewb
oh sorry i meant tom
Tom
@moT01
countries is an object and the id is used as the key it looks like
so if you found the winner id, and it's 171
you should be able to do something like...
var winningCountry = c[winningID].name
no looping needed
Marius Nicolae
@bytao7mao
but i have so many countries ID's how should i not make it without loops
Hammad
@newnewb
Looping means looking through, from what i understand to pick a winner... you just need to pick one out
Marius Nicolae
@bytao7mao
yeah
Tom
@moT01
cause you have the id(key) you can just pick out the one you need
Marius Nicolae
@bytao7mao
so here "var winningCountry = c[winningID].name" where i should state this and why in winning ID i have to loop through
Hammad
@newnewb
you don't have to loop
Tom
@moT01
i dont know how you're getting the ids - i didn't look through that so i dont know where you need it
put it where you want
whereever you need to get the name of the country
Hammad
@newnewb
okay, @bytao7mao explain your train of thoughts? what are you trying to do exactly? and why do you think you have to loop?
Marius Nicolae
@bytao7mao
i have a big chunk of JSON with Battles and countries objects
inside battles i have defenders(def) and attackers(inv)
with ID's and Points
for each
for countries i have only NAmes and ID's which it corespond to Defenders and Attackers
and i want to compare Points and decide the Winner Country by ID if the ID of the Winner or Loser is EQual to that country
Tom
@moT01
so i think you want to loop through the battle is what you're getting at
Hammad
@newnewb
so, you have a lot of battles? and you want to compare who will win in that battle?
Marius Nicolae
@bytao7mao
yeah, loop through the battles, decide which one has higher ammount of points and return ID of it + country ID
@newnewb yep
and return the ID coresponding to country
Hammad
@newnewb
so first issue is that your loop is set to end at 2? I might wanna set it to be? i < x.length?
Marius Nicolae
@bytao7mao
hmm yeah, i should set it to battles.length right ?
i've set to 2 because i wanted to test only
Hammad
@newnewb
what else are you facing problems with?
I really don't understand this json well, any kind of documentation to it?
Marius Nicolae
@bytao7mao
im testing now the country ID to get it by Object.key but it show me always undefined