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
Jack Lyons
@JackEdwardLyons
ah ok
so...
Dan Logajan
@hiltydiggs
you could use sourceKey.length
Islam Ibakaev
@dagman
@JackEdwardLyons what about this :smile:
function whereAreYou(first, second){
  var cond = JSON.stringify(second).slice(1, -1).split(',');
  console.log(cond);
  return first
  .map(function(el) {
    return JSON.stringify(el);
  })
  .filter(function(el) {
      for(var condition of cond) {
          if(!el.includes(condition)) return false;
      }
      return true;
  })
  .map(function(el) {
      return JSON.parse(el);
  });
}
@JackEdwardLyons have just made it for u
Jack Lyons
@JackEdwardLyons
haha my eyes just glaze over that code
thanks @dagman
CamperBot
@camperbot
jackedwardlyons sends brownie points to @dagman :sparkles: :thumbsup: :sparkles:
:cookie: 586 | @dagman |http://www.freecodecamp.com/dagman
Jack Lyons
@JackEdwardLyons
but i have no idea whats going
Islam Ibakaev
@dagman
@JackEdwardLyons it is not hard at all
Jack Lyons
@JackEdwardLyons
so you slice away the brackets on source ?
Islam Ibakaev
@dagman
@JackEdwardLyons yep
Jack Lyons
@JackEdwardLyons
then return first right away? why?
Islam Ibakaev
@dagman
@JackEdwardLyons the first get under .map .fiter and .map
Dan Logajan
@hiltydiggs
@dagman nice work!
Islam Ibakaev
@dagman
@JackEdwardLyons you should check docs on this methods and also JSON.stringify and JSON.parse and i bet all stuff suddenly will be easy to understand
@hiltydiggs thx :smile:
CamperBot
@camperbot
dagman sends brownie points to @hiltydiggs :sparkles: :thumbsup: :sparkles:
:cookie: 554 | @hiltydiggs |http://www.freecodecamp.com/hiltydiggs
Jack Lyons
@JackEdwardLyons
ok thanks @dagman
CamperBot
@camperbot
jackedwardlyons sends brownie points to @dagman :sparkles: :thumbsup: :sparkles:
:warning: jackedwardlyons already gave dagman points
Islam Ibakaev
@dagman
@JackEdwardLyons yw
Gabriel Alexandre
@GabrielShaad
Any help with the navbar?
Jack Lyons
@JackEdwardLyons
can someone please explain nested for loops with variables that have something like this
variable[i][j]
when it is nested in two loops
what does that mean
Greg Duncan
@GregatGit
@JackEdwardLyons i simple one would be to console.log each number in this arr var myArr = [ [1, 2 ], [3, 4 ] ];

@JackEdwardLyons

var myArr = [ [1,2], [3,4]];

for (var i = 0; i < myArr.length; i++){
    for (var j = 0; j < myArr[i].length; j++)
        console.log(myArr[i][j]);
}

the second for loop is nested in the first

Jack Lyons
@JackEdwardLyons
ah ok
so its not like bracket notation?
so it adds [i] first then [j]
Greg Duncan
@GregatGit
console.log(myArr[1][0]); / / => 3
@JackEdwardLyons there is no adding
Jack Lyons
@JackEdwardLyons
it displays
Greg Duncan
@GregatGit
it accesses it
var myArr = [ [1,2], [3,4]];
myArr[0][1] = 'apple';

for (var i = 0; i < myArr.length; i++){
    for (var j = 0; j < myArr[i].length; j++)
        console.log(myArr[i][j]);
}
that for loop would put out
1
apple
3
4
Greg Duncan
@GregatGit
@JackEdwardLyons I looked at your code
source.length is undefined
Jack Lyons
@JackEdwardLyons
ok
Greg Duncan
@GregatGit
source is an object.
Jack Lyons
@JackEdwardLyons
thanks @GregatGit i think i got it
CamperBot
@camperbot
jackedwardlyons sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 612 | @gregatgit |http://www.freecodecamp.com/gregatgit
Jack Lyons
@JackEdwardLyons
yeah, so this code...
collection[i][sourceKey[j]]
how does it work?
Greg Duncan
@GregatGit
@JackEdwardLyons do you know how to run a snippet in the chrome dev tools?
collection[i][sourceKey[j]] - collection is an array so collection[i] will give you the first thing in the collection that happens to be an object