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
Yingjie (Iris) Hu
@huyingjie
@padunk Thank you;)
CamperBot
@camperbot
huyingjie sends brownie points to @padunk :sparkles: :thumbsup: :sparkles:
:cookie: 418 | @padunk |http://www.freecodecamp.org/padunk
Yingjie (Iris) Hu
@huyingjie
@khaduch Thank you for your long feedback. I will add “No results found”. I don’t know why “Random” button splits when coding.
CamperBot
@camperbot
huyingjie sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3681 | @khaduch |http://www.freecodecamp.org/khaduch
Roman Struna
@RomchyFCC

Darren and I decided to make a beginner friendly project on GitHub to learn the basics of working on a project with a group. The good 'ol learn by doing technique, if anyone is interested in joining

https://github.com/RomchyFCC/collaborative_effort

You can fork this repo and get started.
You don't need to know any programing language for this.

Yingjie (Iris) Hu
@huyingjie
@khaduch I added “No results found”. The splitting problem is because of fontawesome 5 icon. I asked in the forum for help.
Yessine
@yessinekebir
Hi guys
Muhammed Hafiz
@zifahm
i need arr=["hello,hi,welcome"] to arr=["hello", "hi", "welcome"] ?
anybody can help?
Marianissimus
@Marianissimus
trying to split a string, are you? :) @zifahm
Sweet Coding :)
@SweetCodingInc
@zifahm
const arr=["hello,hi,welcome"];

const newArr = arr.reduce( (f, c) => {
  return f.concat(c.split(','));
},[]);

console.log(newArr); // ["hello", "hi", "welcome"]
const arr=["hello,hi,welcome"];

const newArr = arr.reduce( (f, c) =>  f.concat(c.split(',')) ,[]);

console.log(newArr); // ["hello", "hi", "welcome"]
Marianissimus
@Marianissimus
are you trying to confuse him? :confused:
Muhammed Hafiz
@zifahm
@SweetCodingInc thanks
Sweet Coding :)
@SweetCodingInc
@zifahm Did I confuse you, as @Marianissimus deems?
Markus Kiili
@Masd925
arr = arr[0].split(","); // [ 'hello', 'hi', 'welcome' ]
@zifahm
Muhammed Hafiz
@zifahm
no problem peeps
Markus Kiili
@Masd925
@SweetCodingInc String.prototype.concat.apply(arr).split(","); would also work on an array with several elements. Reduce one is also nice.
Sweet Coding :)
@SweetCodingInc
@Masd925 :+1:
that prototype one looks clean
Joshua Frias
@Juke-Magic
guys how do i add \n in here?
result = result + [i] + ", ";
Amit Patel
@AmitP88

hey all, I'm stuck on yet another algorithm - Return Largest Numbers in Array. Here's my code so far:


function largestOfFour(arr) {
  // You can do this!






  var maxArr = arr.map(function(max) {

      for (var i = 0; i < arr.length; i++) {    


           return Math.max.apply(null, arr[i]); 

      }


  });            


      return maxArr;


//        return Math.max.apply(null, arr[0]);     







}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);

I understand that this code outputs [5,5,5,5], which is the highest element of the first sub-array. But, I'm having trouble figuring out how my for loop should be. I've tried making a nested for loop using i and j, but that didn't work either.

Markus Kiili
@Masd925
@Juke-Magic Adding a string and an array is not a good idea.
@AmitP88 arr.map... already loops arr elements. No need for that for loop.
Marianissimus
@Marianissimus
@AmitP88 you tell it: for every item of the bigarray (so all 4 sub-arrays), return the largest in the first subarray - arr[i], which it does
Joshua Frias
@Juke-Magic
@Masd925 yep its just for testing stuff
how to i create a line break though?
here is the pen
Marianissimus
@Marianissimus
you return it too soon, it doesn't get the chance to loop through all the subarrays @AmitP88
Amit Patel
@AmitP88
@Marianissimus so I should put my return statement outside the loop?
Markus Kiili
@Masd925
@AmitP88 Better to name it like arr.map(function(innerArray) { so you see that that parameter holds each inner array in its turn.
And just return the largest number of array innerArray from that map callback.
Marianissimus
@Marianissimus
@AmitP88 yes, outside the loop. maybe use the results for each subarray and create a new one? I dont know...
Amit Patel
@AmitP88
@Marianissimus I was thinking of doing that, but wouldn't that break the DRY rule?
Marianissimus
@Marianissimus
why? what are you repeating? you need to return an array, dont you?
Amit Patel
@AmitP88
oh, I thought you meant like:
math.max.apply(null, arr[0]
math.max.apply(null, arr[1]
etc
Marianissimus
@Marianissimus
or use the map/reduce function. it's shorter, of course
Markus Kiili
@Masd925
@AmitP88 You just need to map element arrays to maximum elements of those arrays. So map is a good idea.
Marianissimus
@Marianissimus
@AmitP88 oh, no. use the loop, just dont return the results, use them in a new array;
push them into newarr, for instance
Amit Patel
@AmitP88
ah I see
Joshua Frias
@Juke-Magic
guys help me please
i need ya'll
Amit Patel
@AmitP88
ok, I'll brb. gotta sort this out real quick. thanks @Marianissimus @Masd925 for your tips. I'll let you know how it goes :)
CamperBot
@camperbot
amitp88 sends brownie points to @marianissimus and @masd925 :sparkles: :thumbsup: :sparkles:
:cookie: 456 | @marianissimus |http://www.freecodecamp.org/marianissimus