by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 19 20:09
    @krisb1220 banned @Gastony
  • May 14 22:38
    @bjorno43 banned @minitechtips_twitter
  • May 14 22:37
    @bjorno43 banned @real-action
  • Feb 01 00:26
    @bjorno43 banned @Ndoua
  • Jan 07 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • May 10 2019 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 25 2019 17:12
    @mstellaluna banned @cmal
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:09
    thecodingaviator commented #31179
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:07
    thecodingaviator commented #31182
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator commented #31190
  • Apr 01 2019 18:05
    thecodingaviator commented #31157
  • Apr 01 2019 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

Joseph
@revisualize
Yeah that.
[true, true, false, false, true, false, false, true, true].filter(function (x) { return x });
[23,1,6,12,17,3,2,5,19,86,87].filter(function (x) { return x % 2 === 0 });
function someArguments (name) {
     console.log(name);
     console.log(arguments);
     return "Hello " + name;
}
someArguments("Joseph", "is", "an", "awesome", "guy", "so", "he", "thinks");
Jean Marco Romero
@volkranium
Supp fellow coders????
somebody here feel like all the JS you know is basically syntax?
kish21
@kish21
Hi
Zaluth
@Zaluth
in the seek and destroy challenge, my code returns an empty array, why?
function destroyer(arr) {
  var args = [].slice.call(arguments);
  var slice = args.slice(1);
  var join = slice.join(", ");

  // slice = [2,3]
  // arr = [1, 2, 3, 1, 2, 3]
  // args = [[1, 2, 3, 1, 2, 3], 2, 3]

  function filter(value) {
    return value === join;
  }

  var seek = arr.filter(filter);
  return seek;

}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Moisés Man
@moigithub
@Zaluth what value do u think.. ur join variable have ?
if u call ur function like this destroyer([1, 2, 3, 1, 2, 3], 2, 3);
@GilTorch do u have any code ?
David Amanze
@GodKingShogun
@MessiaHack you still here
Zaluth
@Zaluth
@moigithub join is "2, 3"
Moisés Man
@moigithub
yep.. and do u know HOW filter uses the callback ? @Zaluth
David Amanze
@GodKingShogun
since @MessiaHack isn't here anymore, can someone take a look at my code and see what i did wrong. by the way the challenge wants me to find the longest word in a string
function findLongestWord(str) {
  return str.split(" ").reduce(function(a,b) {
    a.length > b.length ? a.length:b.length;
});
}
Zaluth
@Zaluth
@moigithub it returns an array with the condition in the function
Moisés Man
@moigithub
@GodKingShogun reduce callback need u to RETURN some value.. whatever value u return will be the next value for a variable on next iteration
Stephen James
@sjames1958gm
@GodKingShogun Missing the return value in the "callback"
HeebieGeeBee
@HeebieGeeBee
i think loops are finally really starting to click
Moisés Man
@moigithub

@Zaluth filter have a internal loop
it picks ECH value of the array u apply filter on... and pass it as argument to ur callback function
sooo

[1,2,3,4,5].filter( function (num) {
   console.log(num);
})

will output
1
2
3
4
5

Stephen James
@sjames1958gm
@HeebieGeeBee :+1:
@Zaluth use slice (array) and indexOf in your function
David Amanze
@GodKingShogun
@moigithub and @sjames1958gm i added the return but i am not yet done with the challenge yet. what else is wrong with my code
Stephen James
@sjames1958gm
@GodKingShogun what did you return?
Moisés Man
@moigithub
probably IF u only added the return... the next a value will be a number
Stephen James
@sjames1958gm
@GodKingShogun So your first a is a string - but your subsequent a values are numbers so you have an issue there
@moigithub :+1:
Moisés Man
@moigithub
:D @sjames1958gm
David Amanze
@GodKingShogun

function findLongestWord(str) {
  return str.split(" ").reduce(function(a,b) {
    return a.length > b.length ? a.length:b.length;
});
}
Moisés Man
@moigithub
and numbers do NOT have .length property
Stephen James
@sjames1958gm
@GodKingShogun there are a couple of ways to solve = always make your prev value a number (you have to have initial value of 0)
always make your prev value a string (add a length at the end of your reduce.
Long Phan
@longp
Is anyone able to help me with fileReading question, im trying to parse through a text file
Moisés Man
@moigithub

@Zaluth soooo applying that above example to ur code.. internally its doing

function filter(value) {
    return value === join;
  }

 [1, 2, 3, 1, 2, 3].filter(filter);

return 1 === "2, 3"
return 2 === "2, 3"
etc.. on each iteration
and since that comparation return false.. it filter everything out returning a empty array

David Amanze
@GodKingShogun
@sjames1958gm i did both those things and i am still coming up short
Stephen James
@sjames1958gm
@GodKingShogun Well only one would be needed - let me see
David Amanze
@GodKingShogun

function findLongestWord(str) {
  return str.split(" ").reduce(function(a,b) {
    return a.length > b.length ? a.length:b.length;
}).length;
}
Stephen James
@sjames1958gm
@GodKingShogun so you need to return a : b (so that previous remains a string) so that the last length makes sense
David Amanze
@GodKingShogun
@sjames1958gm so just add a return in front of the a.length part
Aaron
@aaronedwarda
whats up good people!
Stephen James
@sjames1958gm
function findLongestWord(str) {
  return str.split(" ").reduce(function(a,b) {
    return a.length > b.length ? a : b;
}).length;
}
@GodKingShogun By returning the string value the next time a.length makes sense
Aaron
@aaronedwarda
@sjames1958gm checkout out code newbie and javascript jabber today at work, both good! thanks
CamperBot
@camperbot
aaronedwarda sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4929 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
@aaronedwarda Hello
@aaronedwarda Cool!
Aaron
@aaronedwarda
@sjames1958gm it helps to keep all things coding in my brain throughout the day
Stephen James
@sjames1958gm
@aaronedwarda lol
David Amanze
@GodKingShogun
@sjames1958gm ok got it thanks a lot
CamperBot
@camperbot
godkingshogun sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles: