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 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
  • Apr 01 18:02
    thecodingaviator commented #31059
Moisés Man
@moigithub
no need to call replace and tolowercase again
also... this comparison (newString === str return a boolean value true or false..
soo u can directly return the result of that
return newString === str; @Hijerboa
and remove the if
kumquatfelafel
@kumquatfelafel
hahaha... this is what happens when there are too few people asking questions ^^^ :P
Nick Cleary
@Hijerboa
removed the second instance of .replace and .toLowerCase :P
I prob would have punched my computer if it wasn't for you guys. You all rock
kumquatfelafel
@kumquatfelafel
@Hijerboa So... any other questions? Do you want to know how to bake a cake? Simplify your life? Travel back in time? We have those answers and more, and we're all ready and willing to help! :o
Brittani
@Carowyn
Hey, I came back to the perfect conversation...I'm about to attempt the Palindrome one. I'm taking a food break because I sat staring at my computer in confusion lol.
Nick Cleary
@Hijerboa
Yeah one quick question: whats the meaning of life?
One guy told me it was 41 or something
Stephen James
@sjames1958gm
42
kumquatfelafel
@kumquatfelafel
meaningOfLife++;
pablovvb
@pablovvb
So, this is as far as I got, which is nothing. Any hint of why I'm not filtering anything would be fully appreciated!!
function destroyer(arr) {
  // Remove all the values
  var arr2 = arr.slice.call(arguments);
  var arr1 = arr2.shift();
  var newArr = [];
  function a() { 
  return a !== arr2[i];   //this compares each element of arr1 to arr2
  }  
  for (i = 0; i < arr2.length; i++) {  
    newArr = arr1.filter(a);
  }  // deletes the similarities in arr1, and applies the changes to newArr  
//  var newArr = arr.filter(function(a) {return Boolean(!a);
   //                                          });  
  return newArr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Nick Cleary
@Hijerboa
@kumquatfelafel amazing
kumquatfelafel
@kumquatfelafel

@pablovvb a !== arr2[i]?

What is a?

pablovvb
@pablovvb
maybe there's it!!
kumquatfelafel
@kumquatfelafel
pablovvb
@pablovvb
hmm, I'm still not there. I need somehow to compare all the elements in arr1 to the elements in arr2, and a is not doing it because I don't mention arr1 anywhere
kumquatfelafel
@kumquatfelafel
@pablovvb There may be a function that does something along the lines of what you want. See if you can find one https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype
Moisés Man
@moigithub
function greaterThan3( value ) {
     if( value > 3) {return true;}
     else {return false;}
}
[1,2,3,4,5,6].filter ( greaterThan3 )
result : [4,5,6]
pablovvb
@pablovvb
thanks for the tip, @kumquatfelafel . I'll look into it :)
CamperBot
@camperbot
pablovvb sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 377 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
Johnny O'Sullivan
@johnnyosullivan

@pablovvb on the same problem. finding it trickier than I thought.

function destroyer(arr) { 
 var args = arr.slice.call(arguments);
 for (var i = 1; i < args.length; i++)
 var seek = args[i];
 var destroyed = args[0].filter(function(val){
   return val !== seek;
 });
 return destroyed;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);

Any advice would be helpful.

kumquatfelafel
@kumquatfelafel
@pablovvb Also note, as @moigithub points out, you can pass values into a function. Or rather, more importantly, you can provide that function with a parameter which enables you to reference a certain value...
pablovvb
@pablovvb
oooh!! that gets me way closer!
@johnnyosullivan in my humble review, I don't get that args[0]. What does destroyed return?
Moisés Man
@moigithub
@johnnyosullivan what value will destroyed have after run this code...
destroyed = 1;
destroyed = 2;
destroyed = 3;
@pablovvb args is a copy of arguments... which is this [[1, 2, 3, 1, 2, 3] , 2 , 3]
soo args[0] is the first element [1, 2, 3, 1, 2, 3]
which is the same as arr
Johnny O'Sullivan
@johnnyosullivan
@moigithub @pablovvb
[1,2,1,2] is what it's returning right now.
Moisés Man
@moigithub
@johnnyosullivan u not answering the question :)
:point_up: 27 de junio de 2017 20:13 1, 2 or 3
Johnny O'Sullivan
@johnnyosullivan
Am I not? Sorry. Let me revisit.
kumquatfelafel
@kumquatfelafel

@johnnyosullivan what value will destroyed have after run this code...

destroyed = 1;
destroyed = 2;
destroyed = 3;

^this bit. Will destroyed be 1?

pablovvb
@pablovvb
@moigithub @johnnyosullivan man, that's cleaner than mine :P I like it!! (and @johnnyosullivan , I'm exactly in the same place)
Johnny O'Sullivan
@johnnyosullivan
@kumquatfelafel @moigithub oh man, I'm having one of those moments...I don't understand the question.
georgebatton
@georgebatton
jnbjk
kumquatfelafel
@kumquatfelafel

@johnnyosullivan If one were to say

var destroyed = 1;
destroyed = 2;
destroyed = 3;
console.log(destroyed);

What would show up in console?

georgebatton
@georgebatton
Why can't I use for Stand in Line: arr.push(item);
var remove=arr.shift(item);
pablovvb
@pablovvb
@johnnyosullivan I think moi is into something with mine as well. I may be replacing once and again the value I want to get
Saif Ur Rahman
@saifsmailbox98
@georgebatton vvv return remove.
kumquatfelafel
@kumquatfelafel
@georgebatton ^^^ Shift doesn't require an argument.
georgebatton
@georgebatton
why does push require one but shift doesn't?
Saif Ur Rahman
@saifsmailbox98
@georgebatton push adds that to the array, shift is used to remove element.
kumquatfelafel
@kumquatfelafel
@georgebatton Shift just removes first element from array. Doesn't really care what we lowly humans and/or rodents have to say. :p
There's no need for any kind of special input in order to remove an element.
Johnny O'Sullivan
@johnnyosullivan
Wouldn't destroyed just be equal to the number you assign it in those cases?
Moisés Man
@moigithub
@johnnyosullivan code runs from top to bottom
@johnnyosullivan but it WONT have all 3 values
it can be 1 OR 2 OR 3... soo what value will be after the code is executed ?
Johnny O'Sullivan
@johnnyosullivan
3
?
Moisés Man
@moigithub
yep only last value prevails
kumquatfelafel
@kumquatfelafel
aye
Kent Saeteurn
@sansae

Hi all,
I am working on the "Arguments Optional" challenge. I have tested all 5 cases. The returned results are exactly what FreeCodeCamp wants, however, when click submit, only the top two cases are marked as correct. The last 3, which expects "undefined" to be returned, are marked incorrect. When testing for all 3 undefined cases in FCC's editor window, the returned result is "undefined" (It shows on the left hand column).

Does anyone know why FCC won't recognize the returned values of "undefined"?