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)

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:
:star2: 4930 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Jacob
@jdc101214

Ive got a question about .replace.
Can you use a variable as the parameter, such as
```var hello = "hello";

```

Ive got a question about .replace.
Can you use a variable as the parameter, such as
var me = "hello"; 
var text = "hello world";
var answer = text.replace(me);
Jason Luboff
@JLuboff
@jdc101214 Yes you can use variables with .replace
Jacob
@jdc101214
What is the proper syntax?
@JLuboff
Walid Ashri
@walidashri
@jdc101214 you still need 2nd arg in replace
Jacob
@jdc101214
@walidashri That wasnt a literal example
David Amanze
@GodKingShogun
i am working on a challenge and i am trying to think of how to apply the code to solve the problem. is it possible to call .split() two times in a row
Walid Ashri
@walidashri
ok sorry but this gonna work :+1:
Jason Luboff
@JLuboff
@GodKingShogun What do you mean by call split twice?
Jacob
@jdc101214
@JLuboff Where does it talk about the variables?
RhinoTek
@RhinoTek
I am stuck on 'Stand In Line' with no idea where to start. Anyone get there yet?
Jason Luboff
@JLuboff
@jdc101214 Did you look through it? There's examples throughout the page..
David Amanze
@GodKingShogun
@JLuboff can i go str.split(" ").split(" ") or is that bonkers
Jacob
@jdc101214
is there?
Stephen James
@sjames1958gm
@GodKingShogun bonkers