Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 19 2020 20:09
    @krisb1220 banned @Gastony
  • May 14 2020 22:38
    @bjorno43 banned @minitechtips_twitter
  • May 14 2020 22:37
    @bjorno43 banned @real-action
  • Feb 01 2020 00:26
    @bjorno43 banned @Ndoua
  • Jan 07 2020 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)

Zaluth
@Zaluth
i'm still stuck in seek and destroy challenge, any hints?
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, 4);
Diego Mayer
@Chrono79
@Zaluth join is a string, it'll never be equal to a number
David Park
@dhp1161
has anyone done [138] convert C to F?
fahrenheit = fahrenheit *(9/5) +32;
this is not working...
Diego Mayer
@Chrono79
@dhp1161 because that's wrong, read the algorithm again
David Park
@dhp1161
clearly...
Alexander Køpke
@alexanderkopke
@dhp1161 seems you should use the celcius variable
David Park
@dhp1161
lmao
Diego Mayer
@Chrono79
@dhp1161 it's celsius btw
David Park
@dhp1161
yeah wtf am i doing
Zaluth
@Zaluth
@Chrono79 what should i do then?
David Park
@dhp1161
got it... I am retarded
Diego Mayer
@Chrono79
use indexOf with an array, don't use strings
Zane Hewgley
@zhewgley
@dhp1161 trial and error. Gotta learn from mistakes.
which i seem to be doing a lot haha
manugp
@manugp
Need a little help with Javascript. I wanting to try nesting functions for making the code to TitleCase a sentence. But I am getting the error "TypeError: value.shift is not a function".
The code is;

function titleCase(str) {
str = str.split(' ').map(function(value){
return value.split('').unshift(value.shift().toUpperCase).join();
}).join();
return str;
}

titleCase("I'm a little tea pot");

Diego Mayer
@Chrono79
@manugp because value isn't an array probably, yes, value is a string
manugp
@manugp
So what can I do here
Zaluth
@Zaluth
@Chrono79 i still don't get it, won't it just return the position?
Diego Mayer
@Chrono79
@Zaluth you could use that with filter, -1 it isn't there, any other value, it's there
David Amanze
@GodKingShogun
does anyone know if i can use the replace method after i use the split method
Diego Mayer
@Chrono79
@manugp use string methods
@GodKingShogun no, replace is a string method, split returns an array
manugp
@manugp
@Chrono79 How about this

function titleCase(str) {
str = str.split(' ').map(function(value){
return value.split('').unshift(value.split('').shift().toUpperCase).join();
}).join();
return str;
}

titleCase("I'm a little tea pot");

Zaluth
@Zaluth
@Chrono79 like an if else?
Diego Mayer
@Chrono79
@manugp nope, try substr, slice or substring
@Zaluth no need, return arrayToDestroy.indexOf(element)===-1 <- that keeps the elements that you shouldn't destroy
David Amanze
@GodKingShogun
@Chrono79 lets say i use the replace method and i want to replace the first letter in each word in a string can i use .toUpperCase in the replacement part of the replace method
Diego Mayer
@Chrono79
@GodKingShogun yes, you can use a function
Zaluth
@Zaluth
@Chrono79 but indexOf returns only the first occurrence
Diego Mayer
@Chrono79
you're using map @Zaluth
David Amanze
@GodKingShogun
@Chrono79 ok. how do i target the first letter in each word of a string
Diego Mayer
@Chrono79
@GodKingShogun with a regex
David Amanze
@GodKingShogun
would it be the /D
@Chrono79
Diego Mayer
@Chrono79
@GodKingShogun I don't think so
David Amanze
@GodKingShogun
@Chrono79 i dont think any of the prior lessons taught me how to target the first letter of each word
Diego Mayer
@Chrono79
@GodKingShogun That's why you should stick with string index and simple functions like slice (at least for the time being)
It can be done with a regex, but in FCC there are no lessons about it
David Amanze
@GodKingShogun
@Chrono79 i don't think the prior lessons have taught me string index or slice to lol
too*
David Amanze
@GodKingShogun
@Chrono79 oh yea i remember that lesson. it's been a while
lol
Zaluth
@Zaluth
@Chrono79 i'm still so lost
function destroyer(arr) {
  var args = [].slice.call(arguments);
  var slice = args.slice(1);

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

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

  var seek = arr.filter(filter);
  return seek.indexOf(slice) === -1;

}

destroyer([1, 2, 3, 1, 2, 3], 2, 3, 4);
Diego Mayer
@Chrono79
@Zaluth the indexOf goes inside your filter function