Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • May 10 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 27 19:46
    @mstellaluna banned @zhonghuacx
  • Apr 25 17:12
    @mstellaluna banned @cmal
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:09
    thecodingaviator commented #31179
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:07
    thecodingaviator commented #31182
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator commented #31190
  • Apr 01 18:05
    thecodingaviator commented #31157
  • Apr 01 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

  • Apr 01 18:04
    thecodingaviator closed #31157
  • Apr 01 18:04
    thecodingaviator closed #33788
  • Apr 01 18:04
    thecodingaviator commented #33788
  • Apr 01 18:02
    thecodingaviator closed #31059
Suzanne Atkinson
@AdventureBear
yes
yes, lat element less than size elements
Sudeepto
@Sudeepto
@AdventureBear I solved your problem :) Reply if you want help okay ??
Suzanne Atkinson
@AdventureBear
ooh yes pleeeeeze!!!
Sudeepto
@Sudeepto
can I give you the solution code ?? Or some hints ??
@AdventureBear Is it okay here to share solutions ??
Suzanne Atkinson
@AdventureBear
yes there is no restriction or code of conduct prohibiting. FCC is a self-guided learning resource and pairing is encouraged. that's my understanding
Sudeepto
@Sudeepto
 function chunk(arr, size) {
  // Break it up.
  var myArr = [] ;

  while( true )
  if (arr.length > size) {
    myArr.push(arr.splice(0, size)) ;
  }
  else {
    myArr.push(arr) ;
    break ;
  }
  return myArr ;
}

chunk(['a', 'b', 'c', 'd'], 2);
Suzanne Atkinson
@AdventureBear
whoa, splicing an array???
I never would have looked for that.
Sudeepto
@Sudeepto
the splice method dynamically reduces the array and returns the elements as an array itself.
Suzanne Atkinson
@AdventureBear
that must be the key to this challenge!
so once it's splice, push takes care of the rest?
Sudeepto
@Sudeepto
So ['a', 'b', 'c', 'd'].splice(0, 2 ) returns ['a', 'b']
After that ['a', 'b', 'c', 'd'] reduce down to [ 'c', 'd'] as I spliced it out and returned it
Suzanne Atkinson
@AdventureBear
so simple
Sudeepto
@Sudeepto
The first argument of splice is the index of element in the array that you want to start and the second argument is the index one less of which is desired
So for ['a', 'b', 'c', 'd'].splice(0, 2 ) first index is 0th index and 2nd index is 2 - 1th i.e. 1
@AdventureBear After that , we just simply push the spliced index into our result index
Nathan
@terakilobyte
I’d prefer you share hints
lead the person to self discovery
unless the answer is just right there
Sudeepto
@Sudeepto
@AdventureBear Here is the MDN documentation for splice
Splice
Danny Fritz
@dannyfritz
Do any of the challenges focus on debugging js?
Cristián Berríos
@crisberrios
@AdventureBear your method was good though. Many ways to achieve the same. You could have used map, even reduce, or a recursive function.
Sudeepto
@Sudeepto
@terakilobyte Yeah. But @AdventureBear was struggling for many hours. That's why I shared the code with her.
Nathan
@terakilobyte
@dannyfritz none currently
though it would be awesome if we got a pull request with 15-30 challenges that did… ;) ;)
console.log-ging fully works in the sandbox
Sudeepto
@Sudeepto
Okay friends. Good Night . 1:30 AM here. Byee :)
Cristián Berríos
@crisberrios
@Sudeepto
 function chunk(arr, size) {
  // Break it up.
  var myArr = [] ;

  while( true )
  if (arr.length > size) {
    myArr.push(arr.splice(0, size)) ;
  }
  else {
    myArr.push(arr) ;
    break ;
  }
  return myArr ;
}

var a = [];
a[1000] = 'hey';
chunk(a, 2);
Sudeepto
@Sudeepto
@crisberrios Sorry. I use Python the most . So my mindset is geared towards it a bit. That's why I never thought of this particular condition. Direct initialization from an arbitrary index is valid in JS but invalid in Python :P
Cristián Berríos
@crisberrios
hehe don't worry, I'm still trying to change mi mindset from C/C# to JS
Sudeepto
@Sudeepto
@crisberrios Will think about it though. But for now . Buenas Noches :) Adiós
Cristián Berríos
@crisberrios
goodnight!
Nathan
@terakilobyte
JS is the awesome. Better object model than a class oriented language (imo), functions are first class citizens, closure support… it’s just dreamy
and with es6 and support for tail recursion….
not sure what else you could ask for in a programming language
maybe pointers
that’d be pretty cool
Danny Fritz
@dannyfritz
@terakilobyte when i say debugging. i mean using the dev tools in chrome or other browsers, not console.log. :P
Nathan
@terakilobyte
the way bonfire works I’m not sure that’s possible, though it may be
Danny Fritz
@dannyfritz
put a debugger; statement in a bonfire and see what happens. ;)
ah, it hits the statement and shows it in the debugger, but the sandbox times out.
Cristián Berríos
@crisberrios
better reflection
but with es6 things surely got better
well, back to work. putting together an input form for my assigned project
Nathan
@terakilobyte
@dannyfritz yeah the sandbox will be destroyed after 3 seconds
I might be able to write a debug mode for it