These are chat archives for FreeCodeCamp/Help

1st
Oct 2015
Chris
@Shifthawke
Oct 01 2015 00:09
I came here to see if I could help and got distracted by rubber duck... That is epic.
Herman Fassett
@HermanFassett
Oct 01 2015 00:12
Wow
Rubber Duck sounds awesome
Chris
@Shifthawke
Oct 01 2015 00:14
I have a question in the main room if people will take a gander? Pretty please? for Batman?
Herman Fassett
@HermanFassett
Oct 01 2015 00:16
I don't really like geese
Chris
@Shifthawke
Oct 01 2015 00:16
But it's a good gander.
Lays golden eggs
Herman Fassett
@HermanFassett
Oct 01 2015 00:17
But a gander is a male goose
Chris
@Shifthawke
Oct 01 2015 00:17
is it?
hmmm. I always wondered about that.
darien23
@darien23
Oct 01 2015 00:25
hello can somone help me im having trouble adding an action attribute to a form element
Chris
@Shifthawke
Oct 01 2015 00:27
sure
lay it on me.
The problem.
yeah
Herman Fassett
@HermanFassett
Oct 01 2015 00:28
We're here to help
*try
darien23
@darien23
Oct 01 2015 00:28
Make sure your form has an action attribute which is set to /submit-cat-photo.
<form>

<input type="text" placeholder="cat photo URL">

</form>
this is what i have so far
the other 2 steps i have done already, just cant figure out how to do the last one
Herman Fassett
@HermanFassett
Oct 01 2015 00:30
which waypoint is this?
darien23
@darien23
Oct 01 2015 00:31
create a form element
Herman Fassett
@HermanFassett
Oct 01 2015 00:32
So the action element
that attribute goes inside the first form tag
It's just like giving an element a class or an id
You give the form element an action
action="/submit-cat-photo"
darien23
@darien23
Oct 01 2015 00:36
Hm, i seem to be having problems still.
smellyd
@smellyd
Oct 01 2015 00:36
I am on 214. What am I doing wrong?

function reverseString(str) {
var array = str.split(",").reverse().join(" ");

return array;
}

reverseString("hello", "Howdy", "Greetings from Earth");

Herman Fassett
@HermanFassett
Oct 01 2015 00:36
What's your code @darien23 ?
Wrong split argument @smellyd
You're telling it to split the string at every comma, yes?
smellyd
@smellyd
Oct 01 2015 00:37
yes
remove "" ?
darien23
@darien23
Oct 01 2015 00:37
<form>
action="/submit-cat-photo"
<input type="text" placeholder="cat photo URL">

</form>
Herman Fassett
@HermanFassett
Oct 01 2015 00:38
Should just be split("");
Well
smellyd
@smellyd
Oct 01 2015 00:38
Tried that and it still fails
Herman Fassett
@HermanFassett
Oct 01 2015 00:39
join should also just be join("") with no space
smellyd
@smellyd
Oct 01 2015 00:39
yep, I had the wrong join arg
thanks !
CamperBot
@camperbot
Oct 01 2015 00:39
if you want to thank someone, put an @ before their name!
Herman Fassett
@HermanFassett
Oct 01 2015 00:39
@darien23 the action goes inside the tag
smellyd
@smellyd
Oct 01 2015 00:40
thanks @HermanFassett
CamperBot
@camperbot
Oct 01 2015 00:40
smellyd sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 235 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Herman Fassett
@HermanFassett
Oct 01 2015 00:40
No problem ;)
@darien23 just as if you were giving an id <form id="test-form"> so the action would be placed
darien23
@darien23
Oct 01 2015 00:41
I tried that , but maybe i did the wrong way. I got it now
thanks @HermanFassett
CamperBot
@camperbot
Oct 01 2015 00:41
darien23 sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 236 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Herman Fassett
@HermanFassett
Oct 01 2015 00:41
Yep
Jesse L Lawson
@rocketNeck
Oct 01 2015 00:48
So I'm failing one test.... any thoughts?
Chris
@Shifthawke
Oct 01 2015 00:49
which test?
Jesse L Lawson
@rocketNeck
Oct 01 2015 00:49

Return the lowest index at which a value (second argument) should be inserted into a sorted array (first argument).

For example, where([1,2,3,4], 1.5) should return 1 because it is greater than 1 (0th index), but less than 2 (1st index).

function where(arr, num) {



  // Find my place in this sorted array.
  for (var i = 0; i < arr.length; i++){
    if (arr[i] >= num){

      return arr.indexOf(arr[i]);
    }
  }
}

where([10, 20, 30, 40, 50], 35, "");
the last test is looking for when the num argument is larger than any value in the array
Chris
@Shifthawke
Oct 01 2015 00:50
I haven't done this way point, but if you send me the way point I'll gladly look it over.
Herman Fassett
@HermanFassett
Oct 01 2015 00:51
@cannibal-dance lemme look
xD
Chris
@Shifthawke
Oct 01 2015 00:51
Herman is the best. <3
Herman Fassett
@HermanFassett
Oct 01 2015 00:51
Argh dinner time, let's see what @Shifthawke can do
Chris
@Shifthawke
Oct 01 2015 00:51
ugh
Jesse L Lawson
@rocketNeck
Oct 01 2015 00:51
lol :)
Chris
@Shifthawke
Oct 01 2015 00:52
I will do my best.
Jesse L Lawson
@rocketNeck
Oct 01 2015 00:53
I tried to add one to the arr[i] index as an else statment...
Adam Sickmiller
@progmacattack
Oct 01 2015 00:53
@cannibal try a while loop
Jesse L Lawson
@rocketNeck
Oct 01 2015 00:53
it caused my other tests to fail
@progmacattack ok I'll try that
Chris
@Shifthawke
Oct 01 2015 00:54
It's always the loops.
Herman Fassett
@HermanFassett
Oct 01 2015 00:54
Lol I promise I'm leaving, you just need another statement to check if the input is greater than values in the array
This is awkward, but something like this
else if (arr[i] < num && i == arr.length - 1)
      return arr.length;
Jonathan Lee Slew
@jlslew
Oct 01 2015 00:55
This message was deleted
Herman Fassett
@HermanFassett
Oct 01 2015 00:55
Ok cya
Jesse L Lawson
@rocketNeck
Oct 01 2015 00:56
fyi the suggested link is for the sort() method. In other words, push the number to the array, sort it, then find the index...
Chris
@Shifthawke
Oct 01 2015 00:56
Dinner!
Jesse L Lawson
@rocketNeck
Oct 01 2015 00:56
nom
i swear i am working on a pork chop at this very moment
but someone here let me know how lame it would be to do a sort() and have to do an function(a, b) to organize it
holla @SaintPeter
Adam Sickmiller
@progmacattack
Oct 01 2015 01:00
@cannibal-dance i sorted mine
@cannibal-dance what would the function do
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:01
did you use? numbers.sort(function(a, b) { return a - b; });
Adam Sickmiller
@progmacattack
Oct 01 2015 01:01
@cannibal-dance no i just sorted the array like arr.sort()
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:01
ah
the function:
var scores = [1, 10, 2, 21];
scores.sort(); // [1, 10, 2, 21]
// Watch out that 10 comes before 2,
// because '10' comes before '2' in Unicode code point order
that's from MDN
Adam Sickmiller
@progmacattack
Oct 01 2015 01:02
@cannibal then after confirming the number argument was smaller than the final number in the array i looped through the array looking for the last number in the array that was smaller than the number argument
@cannibal-dance oh that's interesting
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:04
i got a err saying sort() is not a function the first couple of times so i started trying other things
Adam Sickmiller
@progmacattack
Oct 01 2015 01:04
@cannibal-dance .sort() is good enough for the challenge but you are right it is imperfect
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:05
maybe my implementation was off
Adam Sickmiller
@progmacattack
Oct 01 2015 01:05
arr.sort() should do it
just put that as the first line of your function
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:11
hmm : " arr.sort(); is not a function "
Jose E. Pimentel
@jedpimentel
Oct 01 2015 01:13
@cannibal-dance can you post the whole code?
Adam Sickmiller
@progmacattack
Oct 01 2015 01:15
@cannibal-dance do you have it in a loop or something?
Hans van Riet
@hansinla
Oct 01 2015 01:19
@cannibal-dance Are you sure arr is an array?
Don Price
@KingHippo
Oct 01 2015 01:21
Will anyone provide some feedback on my portfolio page? I just have one section complete, the navigation has not been implemented yet.
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:21
no i had something like ```
Don Price
@KingHippo
Oct 01 2015 01:21
This message was deleted
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:21
function where(arr, num){
  arr.push(num);
  arr.sort();

}
Jose E. Pimentel
@jedpimentel
Oct 01 2015 01:22
This message was deleted
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:23
I got it now though. I used @HermanFassett code to check for numbers that are larger than any in the array
function where(arr, num) {
  // Find my place in this sorted array.
  for (var i = 0; i < arr.length; i++){
    if (arr[i] >= num){

      return arr.indexOf(arr[i]);
    }else if (arr[i] < num && i == arr.length - 1){
      return arr.length;
    }
  }
}

where([10, 20, 30, 40, 50], 30, "");
thanks @HermanFassett
CamperBot
@camperbot
Oct 01 2015 01:23
cannibal-dance sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 237 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Garrett Schultz
@garettschultz
Oct 01 2015 01:24
Hello campers, I am stuck on this javascript pop function stuff. They dont even give me an example to go off of to understand, all I have to work with is what a pop function does. and now their asking me to create one.
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:24
the else if saved me :smile:
SM
@nogo10
Oct 01 2015 01:25
Ziplines any luck using the Twitter api OAuth.io client side without own server? Anyone know if thTwitter API is accessible without setting up code server side?
Herman Fassett
@HermanFassett
Oct 01 2015 01:25
:P
SM
@nogo10
Oct 01 2015 01:27
@gratschultz2013 pop() Removes the last element of an array, and returns that element
Garrett Schultz
@garettschultz
Oct 01 2015 01:28
I know, thats what the description says, but they dont give an example of how to do it is what im saying.
Jon Love
@jayvolr
Oct 01 2015 01:28
anArray:pop()
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:28
@HermanFassett I never would have thought to return the arr.length... It is so obvious I slipped in it. But stroke of genius, love it.
Garrett Schultz
@garettschultz
Oct 01 2015 01:29
blob
Jonathan Coleman
@jondcoleman
Oct 01 2015 01:29
@KingHippo cool design - I presume the links aren't supposed to do anything yet.
Herman Fassett
@HermanFassett
Oct 01 2015 01:29
That is an example in the comments, yes?
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:30
indeed
Garrett Schultz
@garettschultz
Oct 01 2015 01:30
im supposed to remove the last item from myArray, but how am i supposed to understand how to do it if they dont even give a step by step example
Jonathan Coleman
@jondcoleman
Oct 01 2015 01:30
@KingHippo the navigation font size could be bumped up a little I think.
Herman Fassett
@HermanFassett
Oct 01 2015 01:30
@gratschultz2013
Jon Love
@jayvolr
Oct 01 2015 01:30
@gratschultz2013 You would kust need to put :pop() at the end of line 10, right?
Herman Fassett
@HermanFassett
Oct 01 2015 01:30
Hehe
Garrett Schultz
@garettschultz
Oct 01 2015 01:31
Wow the easiest stuff is always the most confusing
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:31
myArray.pop();
Herman Fassett
@HermanFassett
Oct 01 2015 01:32
Yes @KingHippo looks like a good start and a nice logo
Don Price
@KingHippo
Oct 01 2015 01:32
@jondcoleman thanks! Yeah I haven't implemented navigation yet. That font size is definitely to small
CamperBot
@camperbot
Oct 01 2015 01:32
kinghippo sends brownie points to @jondcoleman :sparkles: :thumbsup: :sparkles:
:star: 104 | @jondcoleman | http://www.freecodecamp.com/jondcoleman
Don Price
@KingHippo
Oct 01 2015 01:32
thanks @HermanFassett
CamperBot
@camperbot
Oct 01 2015 01:32
kinghippo sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 238 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:33
@gratschultz2013 the better you understand: https://developer.mozilla.org the better off you will be. It's like an open book test.
Don Price
@KingHippo
Oct 01 2015 01:33
Do any of you know of a good way to implement a single page design?
Kind of like the example
SM
@nogo10
Oct 01 2015 01:34
@gratschultz2013 see perfect example here http://www.w3schools.com/jsref/jsref_pop.asp
Herman Fassett
@HermanFassett
Oct 01 2015 01:34
@nogo10 wrong person?
darien23
@darien23
Oct 01 2015 01:34
can someone help me
Herman Fassett
@HermanFassett
Oct 01 2015 01:34
Sure @darien23
@nogo10 nvm
lol
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:35
@darien23 someone will try!
Garrett Schultz
@garettschultz
Oct 01 2015 01:35
thank you @nogo10 @cannibal-dance
CamperBot
@camperbot
Oct 01 2015 01:35
gratschultz2013 sends brownie points to @nogo10 and @cannibal-dance :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for cannibal-dance
:star: 262 | @nogo10 | http://www.freecodecamp.com/nogo10
Colton Ehrman
@coltonehrman
Oct 01 2015 01:35
Is there something wrong with Bonfire: Symmetric Difference
shouldnt this code work?
function sym(args) {

  var arrays = [];
  var diffs = [];

  for(var i = 0; i < arguments.length; i++) {
    arrays.push(arguments[i]);
  }

  diffs[0] = arrays.reduce(function(previous, current) {
    return previous.filter(function(element) {
      return current.indexOf(element) == -1;
    });
  });

  arrays.reverse();

  diffs[1] = arrays.reduce(function(previous, current, index, array) {
    return previous.filter(function(element) {
      return current.indexOf(element) == -1;
    });
  });

  return diffs.reduce(function(previous, current) {
    return previous.concat(current).filter(function(element, index, array) { return array.indexOf(element) === index });
  });
}

sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]);
Garrett Schultz
@garettschultz
Oct 01 2015 01:36
I have issues with comprehending things the first time i read something so it explains the mass confusion
darien23
@darien23
Oct 01 2015 01:36
i just figured it out.
nwm but thanks @HermanFassett
Herman Fassett
@HermanFassett
Oct 01 2015 01:36
Good job :)
CamperBot
@camperbot
Oct 01 2015 01:36
darien23 sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:warning: darien23 already gave hermanfassett points
Jesse L Lawson
@rocketNeck
Oct 01 2015 01:37
@darien23 bam!
Hans van Riet
@hansinla
Oct 01 2015 01:37
@nogo10 Do you ask about the twitter API because of the Quotes tweet?
Don Price
@KingHippo
Oct 01 2015 01:38
@jondcoleman I bumped the font-size to 1em. I think it looks much better now
SM
@nogo10
Oct 01 2015 01:39
@hansinla yes
Colton Ehrman
@coltonehrman
Oct 01 2015 01:39
can someone help me?
SM
@nogo10
Oct 01 2015 01:39
@hansinla I did the zipline but the bonus twitter function isnt up yet
Hans van Riet
@hansinla
Oct 01 2015 01:39
@nogo10 The best and easiest way to go about that is to use Twitter intent.
https://dev.twitter.com/web/intents
Aayush Kapoor
@xeoneux
Oct 01 2015 01:40
@coltonehrman Your Array.filter method returns an Array
Colton Ehrman
@coltonehrman
Oct 01 2015 01:40
yes...?
Aayush Kapoor
@xeoneux
Oct 01 2015 01:41
@coltonehrman Array.reduce method doesn't know what to do with it
Colton Ehrman
@coltonehrman
Oct 01 2015 01:41
what do u mean?
i filter after i reduce
Fausto Ramírez L.
@faustor21
Oct 01 2015 01:41
Hi, the voting app http://votingapp.herokuapp.com/ for the Basejumps: Build a Voting App seems down.. anybody knows if this is momentary...
Aayush Kapoor
@xeoneux
Oct 01 2015 01:42
@coltonehrman You're reducing after your filter but with the incorrect return type
SM
@nogo10
Oct 01 2015 01:42
@hansinla ok thanks Ill check it out. looks a lot simpler
CamperBot
@camperbot
Oct 01 2015 01:42
nogo10 sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 403 | @hansinla | http://www.freecodecamp.com/hansinla
Jonathan Coleman
@jondcoleman
Oct 01 2015 01:42
@KingHippo yeah looks much better
Colton Ehrman
@coltonehrman
Oct 01 2015 01:42
where @xeoneux
Aayush Kapoor
@xeoneux
Oct 01 2015 01:42
@coltonehrman
diffs[0] = arrays.reduce(function(previous, current) {
    return previous.filter(function(element) {
      return current.indexOf(element) == -1;
    });
  });
Colton Ehrman
@coltonehrman
Oct 01 2015 01:43
i dont see the problem
IgnisCerebrum
@IgnisCerebrum
Oct 01 2015 01:43
Can anyone help me with Waypoint: Make Object Properties Private?
Don Price
@KingHippo
Oct 01 2015 01:43
@jondcoleman thanks!
CamperBot
@camperbot
Oct 01 2015 01:43
kinghippo sends brownie points to @jondcoleman :sparkles: :thumbsup: :sparkles:
:warning: kinghippo already gave jondcoleman points
Chris
@Shifthawke
Oct 01 2015 01:43
We will try. Post it. @IgnisCerebrum
What do you have and what are you stuck on?
IgnisCerebrum
@IgnisCerebrum
Oct 01 2015 01:44
//Let's create an object with a two functions. One attached as a property and one not.
var Car = function() {
  this.gear = 1;
  function addStyle(styleMe){
    return 'The Current Gear Is: ' + styleMe;
  }
  this.getGear = function() {
    return addStyle(this.gear);
  };
};

var Bike = function() {
  // Only change code below this line.
  this.speed = 100;
  function addUnit(value) {
    return value + "KM/H";
  }

  getSpeed = function () {
    return addUnit(speed);
  };

};

// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();

if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};
Aayush Kapoor
@xeoneux
Oct 01 2015 01:44
@coltonehrman What would you like the Array.reduce method to do?
IgnisCerebrum
@IgnisCerebrum
Oct 01 2015 01:44

"We can also create private properties and private methods, which aren't accessible from outside the object.

To do this, we omit the word this from the property or method declaration.

See if you can keep myBike.speed and myBike.addUnit private, while making myBike.getSpeed publicly accessible.
"

Colton Ehrman
@coltonehrman
Oct 01 2015 01:45
i use reduce to find the difference in arrays
Hans van Riet
@hansinla
Oct 01 2015 01:45
@IgnisCerebrum Use var in your constructor.
Herman Fassett
@HermanFassett
Oct 01 2015 01:45
@IgnisCerebrum we could tell you... what've you tried?
Chris
@Shifthawke
Oct 01 2015 01:45
too late lol.
Hans van Riet
@hansinla
Oct 01 2015 01:45
@Shifthawke My bad
Chris
@Shifthawke
Oct 01 2015 01:45
lol.
Herman Fassett
@HermanFassett
Oct 01 2015 01:45
That's not the answer
IgnisCerebrum
@IgnisCerebrum
Oct 01 2015 01:45
It says to omit the word this. So I did. It didn't accept it.
Chris
@Shifthawke
Oct 01 2015 01:45
We want em to try first.
Herman Fassett
@HermanFassett
Oct 01 2015 01:46
Because you need to add this to getSpeed also
Don Price
@KingHippo
Oct 01 2015 01:46
@jondcoleman did you instinctively hover over the logo or did it take a moment to move towards it?
Jonathan Coleman
@jondcoleman
Oct 01 2015 01:47
@KingHippo took a moment but discovering the animation was cool
I wouldn't think it needs to change
IgnisCerebrum
@IgnisCerebrum
Oct 01 2015 01:47
Dammit, it was the browser again. It loads Explorer, and I forget to switch to Firefox, so it doesn't accept any of my word. Never mind!
Thanks @Shifthawke
CamperBot
@camperbot
Oct 01 2015 01:47
igniscerebrum sends brownie points to @shifthawke :sparkles: :thumbsup: :sparkles:
:star: 358 | @shifthawke | http://www.freecodecamp.com/shifthawke
Colton Ehrman
@coltonehrman
Oct 01 2015 01:47
help someone :/
CamperBot
@camperbot
Oct 01 2015 01:47
no wiki entry for: someone
:pencil: click here to create one now!after creating your page type update to reload it here
Chris
@Shifthawke
Oct 01 2015 01:47
Did you get it? Starting over?
@IgnisCerebrum
Colton Ehrman
@coltonehrman
Oct 01 2015 01:47
lol
Herman Fassett
@HermanFassett
Oct 01 2015 01:48
xd
Colton Ehrman
@coltonehrman
Oct 01 2015 01:48
i think the bonfire is messed up
Chris
@Shifthawke
Oct 01 2015 01:48
I'm trying lol
Herman Fassett
@HermanFassett
Oct 01 2015 01:48
@coltonehrman what do you need
Don Price
@KingHippo
Oct 01 2015 01:48
@jondcoleman I wasn't sure if people would click on it or not. Thanks
CamperBot
@camperbot
Oct 01 2015 01:48
kinghippo sends brownie points to @jondcoleman :sparkles: :thumbsup: :sparkles:
:warning: kinghippo already gave jondcoleman points
Colton Ehrman
@coltonehrman
Oct 01 2015 01:48
Bonfire: Symmetric Difference
CamperBot
@camperbot
Oct 01 2015 01:48

:fire:Bonfire: Symmetric Difference :link:

function sym(args) {
  return arguments;
}

sym([1, 2, 3], [5, 2, 1, 4]);

Create a function that takes two or more arrays and returns an array of the symmetric difference of the provided arrays.

more info:  bf details | bf links | hint

Colton Ehrman
@coltonehrman
Oct 01 2015 01:48
mines not passing but it shoudld
function sym(args) {

  var arrays = [];
  var diffs = [];

  for(var i = 0; i < arguments.length; i++) {
    arrays.push(arguments[i]);
  }

  function findDiff(array) {

  }

  diffs[0] = arrays.reduce(function(previous, current) {
    return previous.filter(function(element) {
      return current.indexOf(element) == -1;
    });
  });

  arrays.reverse();

  diffs[1] = arrays.reduce(function(previous, current, index, array) {
    return previous.filter(function(element) {
      return current.indexOf(element) == -1;
    });
  });

  return diffs.reduce(function(previous, current) {
    return previous.concat(current).filter(function(element, index, array) {
      return array.indexOf(element) === index });
  });
}

sym([1, 2, 5], [2, 3, 5], [3, 4, 5]);
Aayush Kapoor
@xeoneux
Oct 01 2015 01:48
@coltonehrman The Array.reduce method will start replacing the other arrays with the array returned by Array.filter
Herman Fassett
@HermanFassett
Oct 01 2015 01:48
Oh lol that's the one I'm on once I decide to go back to bonfires...
Colton Ehrman
@coltonehrman
Oct 01 2015 01:49
yes i know @xeoneux
assert.sameMembers(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]), [1, 4, 5], 'should return the symmetric difference of the given arrays');should return the symmetric difference of the given arrays: expected [ 1, 4 ] to have the same members as [ 1, 4, 5 ]
shouldnt it be [1,4]
not [1,4,5]
5 is in every array
lonirose
@lonirose
Oct 01 2015 01:51
I don't understand how the Bonfire: Factorialize a Number lesson wants me to write the code?
function factorialize(num) {
  return num;
}

factorialize(5, '');
Herman Fassett
@HermanFassett
Oct 01 2015 01:51
Hmm
Hans van Riet
@hansinla
Oct 01 2015 01:51
@coltonehrman No first you take the diff of the first two arrays and compare the result with the last array. Now, your code must work with any number of arrays.
Chris
@Shifthawke
Oct 01 2015 01:51
Oh gosh that one. @lonirose
Herman Fassett
@HermanFassett
Oct 01 2015 01:51
@lonirose use a for loop
Colton Ehrman
@coltonehrman
Oct 01 2015 01:51
@lonirose do u kno how to factorialize?
Chris
@Shifthawke
Oct 01 2015 01:51
Definitly a loop.
And don't think too far into it like I did.
Colton Ehrman
@coltonehrman
Oct 01 2015 01:51
@hansinla sorry?
could u clarify
Aayush Kapoor
@xeoneux
Oct 01 2015 01:52
@coltonehrman
diffs[0] = arrays.reduce(function(previous, current) {
    return previous.filter(function(element) {
      if (current.indexOf(element) == -1) return false;
      else return true;
    });
  });
@coltonehrman This works?
Colton Ehrman
@coltonehrman
Oct 01 2015 01:52
@xeoneux u dont need the if
it works?
nope
Aayush Kapoor
@xeoneux
Oct 01 2015 01:53
return current.indexOf(element) == -1 ? false : true;
Hans van Riet
@hansinla
Oct 01 2015 01:53
@coltonehrman [1, 2, 5] & [2, 3, 5] yields as result [1, 3 ]. [1, 3] & [3, 4, 5] give [1, 4, 5]
IgnisCerebrum
@IgnisCerebrum
Oct 01 2015 01:54
@Shifthawke I got it, I was right the first time. Thanks!
CamperBot
@camperbot
Oct 01 2015 01:54
igniscerebrum sends brownie points to @shifthawke :sparkles: :thumbsup: :sparkles:
:warning: igniscerebrum already gave shifthawke points
Chris
@Shifthawke
Oct 01 2015 01:54
good lol. And good job on the first try ^_^ @IgnisCerebrum
Colton Ehrman
@coltonehrman
Oct 01 2015 01:54
im not following @hansinla
Hans van Riet
@hansinla
Oct 01 2015 01:54
@coltonehrman That’s how symmetric difference works.
Fausto Ramírez L.
@faustor21
Oct 01 2015 01:55
@xeoneux this is enought return current.indexOf(element) === -1;
enough*
Colton Ehrman
@coltonehrman
Oct 01 2015 01:56
lol @hansinla well could u try and explain symmetric difference better? or point me somewhere?
cause i just thought it meant find the numbers that are only in one array but not in the others
Hans van Riet
@hansinla
Oct 01 2015 01:56
@coltonehrman So after every comparison of two arrays you store the result and use that to compare to the next array (if there’s any).
Colton Ehrman
@coltonehrman
Oct 01 2015 01:56
so lets use an example
[1, 2, 5], [2, 3, 5], [3, 4, 5]
3 arrays
compare [1, 2, 5], [2, 3, 5] first
difference is 1
so compare 1 to [3, 4, 5]
and then difference is [1,3,4,5]
not same as what assert says
Aayush Kapoor
@xeoneux
Oct 01 2015 01:58
@coltonehrman There's no 3 in the first array
Hans van Riet
@hansinla
Oct 01 2015 01:58
@coltonehrman I corrected above, I made a type. For more examples: https://en.wikipedia.org/wiki/Symmetric_difference
Aayush Kapoor
@xeoneux
Oct 01 2015 01:58
@coltonehrman Shouldn't the comparison return [1, 3] at the first step?
Colton Ehrman
@coltonehrman
Oct 01 2015 01:58
oh right @xeoneux
so then it would be [1,4,5] huh
Hans van Riet
@hansinla
Oct 01 2015 01:59
@xeoneux Yes, exactly
Colton Ehrman
@coltonehrman
Oct 01 2015 01:59
ok i think i get it
k brb
darien23
@darien23
Oct 01 2015 02:00
How do i post code with the black background?
Herman Fassett
@HermanFassett
Oct 01 2015 02:00
wiki format
CamperBot
@camperbot
Oct 01 2015 02:00

:point_right: code formatting [wiki]

Inline code

alt text

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks and then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

darien23
@darien23
Oct 01 2015 02:02

...

<form action="/submit-cat-photo" id="cat-photo-form">
<label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality" checked> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Energetic</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
...

not right lol
Aayush Kapoor
@xeoneux
Oct 01 2015 02:02
@darien23 Backticks
darien23
@darien23
Oct 01 2015 02:02

'''

<form action="/submit-cat-photo" id="cat-photo-form">
<label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality" checked> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Energetic</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
'''

CamperBot
@camperbot
Oct 01 2015 02:02
:bulb: to format code use backticks! ``` more info
Herman Fassett
@HermanFassett
Oct 01 2015 02:03
` typically right above your Tab key
Chris
@Shifthawke
Oct 01 2015 02:04
three times then hit enter and watch the magic.
darien23
@darien23
Oct 01 2015 02:04
<form 
      action="/submit-cat-photo" id="cat-photo-form">
  <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
  <label><input type="radio" name="indoor-outdoor"> Outdoor</label>
  <label><input type="checkbox" name="personality" checked> Loving</label>
  <label><input type="checkbox" name="personality"> Lazy</label>
  <label><input type="checkbox" name="personality"> Energetic</label>
  <input type="text" placeholder="cat photo URL" required>
  <button type="submit">Submit</button>
</form>
Your form element should have the background-color of green.
Herman Fassett
@HermanFassett
Oct 01 2015 02:05
Which one is that?
Chris
@Shifthawke
Oct 01 2015 02:06
also, why is the main form broken up?
Douglas Luce
@Doug-Luce
Oct 01 2015 02:07
function repeat(str, num) {
  // repeat after me


for(var i = 0; i < num; i++){
  str = str.concat(str);
}


  return str;
}

repeat("abc", 3, "");
Matt Trifilo
@itxchy
Oct 01 2015 02:08
Hey AngularJS wizards, any idea why my weather app is calling each API twice? I'm at a loss. http://codepen.io/dprsky/pen/PPwmdw
Douglas Luce
@Doug-Luce
Oct 01 2015 02:08
This returns too many combinations, I believe because it's adding them together on every iteration. Why can't I just write str.concat(str);
darien23
@darien23
Oct 01 2015 02:08
@HermanFassett Use and ID attribute to style an element
Chris
@Shifthawke
Oct 01 2015 02:08
way point link?
Jose E. Pimentel
@jedpimentel
Oct 01 2015 02:08
@Doug-Luce you might want to use a new variable to hold the answer, adding to that empty array within the for loop
Herman Fassett
@HermanFassett
Oct 01 2015 02:09
@Doug-Luce just having str.concat(str) doesn't assign it to anything, that's why you have to set something equal to it
It doesn't change the original string tha tis
@darien23 what are you stuck with?
Jose E. Pimentel
@jedpimentel
Oct 01 2015 02:10
put console.log(str) inside the for loop and you should be able to see (in the console) what's going on
Douglas Luce
@Doug-Luce
Oct 01 2015 02:10
@jedpimentel Ah okay, I see. Thank you. Got it working.
CamperBot
@camperbot
Oct 01 2015 02:10
doug-luce sends brownie points to @jedpimentel :sparkles: :thumbsup: :sparkles:
:star: 324 | @jedpimentel | http://www.freecodecamp.com/jedpimentel
Marco Castro
@mfcastro
Oct 01 2015 02:10

function findLongestWord(str) {
str= str.split(" ");

var current = 0;
var largest = 0;
for(i=0; i<str.length+1;i++){ current = str[i].length; if(current > largest){
largest = current;
}
if(i === 10){
return largest;
}
}

}

findLongestWord("The quick brown fox jumped over the lazy dog");

Can someone help me find what is wrong with this?
Colton Ehrman
@coltonehrman
Oct 01 2015 02:11
YESS!
Aayush Kapoor
@xeoneux
Oct 01 2015 02:11
@mfcastro The for loop should run till i < str.length - 1
darien23
@darien23
Oct 01 2015 02:11
giving my form element a background color of green
Aayush Kapoor
@xeoneux
Oct 01 2015 02:11
@coltonehrman Did it work?
Marco Castro
@mfcastro
Oct 01 2015 02:12
no it didn't
Colton Ehrman
@coltonehrman
Oct 01 2015 02:12
yup
function sym(args) {

  var arrays = [];

  for(var i = 0; i < arguments.length; i++) {
    arrays.push(arguments[i]);
  }

  function findDiff(arr1, arr2) {

    var arrs = [arr1,arr2];
    var diff = [];

    diff[0] = arrs.reduce(function(previous, current) {
      return previous.filter(function(element) {
        return current.indexOf(element) == -1;
      });
    });
    arrs.reverse();

    diff[1] = arrs.reduce(function(previous, current) {
      return previous.filter(function(element) {
        return current.indexOf(element) == -1;
      });
    });

    return diff.reduce(function(previous, current) {
      return previous.concat(current).filter(function(element, index, array) {
        return array.indexOf(element) === index });
    });;
  }

  return arrays.reduce(function(prev, curr, index, arr) {
    return findDiff(prev,curr);
  });
}

sym([1, 2, 5], [2, 3, 5], [3, 4, 5]);
Jose E. Pimentel
@jedpimentel
Oct 01 2015 02:12
@mfcastro if(i === 10){ return largest; } you'r issue is with thte return statement what's that 10 for?
Marco Castro
@mfcastro
Oct 01 2015 02:13
that checks if the i is equal to 10, if so then it returns the largest number
Herman Fassett
@HermanFassett
Oct 01 2015 02:13
@darien23 they want you to do this with using an id so your style would look like this
#cat-photo-form {
     // Set background color
}
Jose E. Pimentel
@jedpimentel
Oct 01 2015 02:14
@mfcastro so, it only returns a value if there are 10 or 11 words in the sentence? else it doesn't return anything?
Chris
@Shifthawke
Oct 01 2015 02:14
Then put the ID into the form element. @darien23
Marco Castro
@mfcastro
Oct 01 2015 02:14
This message was deleted
CamperBot
@camperbot
Oct 01 2015 02:14
:bulb: to format code use backticks! ``` more info
Jose E. Pimentel
@jedpimentel
Oct 01 2015 02:15
oh, and in the loop it should be i < arr.length (if arr has 3 elements, arr.length=3, with the final element being arr2)
Chris
@Shifthawke
Oct 01 2015 02:15
The ID that Herman mentions goes into the style element. @HermanFassett
oops
@darien23 I meant him lol
Herman Fassett
@HermanFassett
Oct 01 2015 02:15

@mfcastro it should be

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

instead of +1
and remove the

if(i === 10){
     return largest;
}

and just put return largest; outside of the loop

Chris
@Shifthawke
Oct 01 2015 02:15
Sorry Herman.
Herman Fassett
@HermanFassett
Oct 01 2015 02:16
;)
darien23
@darien23
Oct 01 2015 02:16
Im confused
Chris
@Shifthawke
Oct 01 2015 02:16
<3, still friends after my bad tag? @HermanFassett
This message was deleted
Marco Castro
@mfcastro
Oct 01 2015 02:17
@HermanFassett you rock, thank you so much!!
CamperBot
@camperbot
Oct 01 2015 02:17
mfcastro sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 239 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Herman Fassett
@HermanFassett
Oct 01 2015 02:17
@Shifthawke let me think about it
You're welcome @mfcastro
Chris
@Shifthawke
Oct 01 2015 02:17
@darien23 Pm me and I'll explain it further
Aw okay. I shall be waiting over yonder in the dockers room. @HermanFassett
Herman Fassett
@HermanFassett
Oct 01 2015 02:17
@Shifthawke ok, still friends
Chris
@Shifthawke
Oct 01 2015 02:17
Yay!
Herman Fassett
@HermanFassett
Oct 01 2015 02:17
:P
darien23
@darien23
Oct 01 2015 02:18
How do i do that, lol . sorry im new
Chris
@Shifthawke
Oct 01 2015 02:18
its okay lol I'll pm you
I swore I just heard a cricket.
Broll
@Broll52
Oct 01 2015 02:50
hi, i'm doing js "make instances of objects with a constructor" and I don't know why the solution is wrong/

var Car = function() {
this.wheels = 4;
};

// Only change code below this line.
var myCar = new Car(){
this.engines = 1;
};

//Add the property "engines" to myCar, and make it a number.

Herman Fassett
@HermanFassett
Oct 01 2015 02:53

Should be just

var myCar = new Car();
myCar.engines = 1;

I think

Chris
@Shifthawke
Oct 01 2015 02:53
I think so too
Herman Fassett
@HermanFassett
Oct 01 2015 02:55

Doing

var Car = function() {
   this.wheels = 4;
   this.engines = 1;
};

Would work (though not for this exercise)
But what you were trying doesn't really work as you're initializing an object and then adding curly brackets...

Broll
@Broll52
Oct 01 2015 03:00
ok, yeah that worked. thanks.
CamperBot
@camperbot
Oct 01 2015 03:00
if you want to thank someone, put an @ before their name!
Broll
@Broll52
Oct 01 2015 03:02
so can "this." not be used in this case. like
```
...wait
var myCar = new Car(){
   this.engines = 1;
And without that first curly bracket i forgot to delete.
vere perrot
@perrot
Oct 01 2015 03:05
I found a bug in Bonfire: Falsy Bouncer. The helpful message at the last test case is"[false, null, 0] should return []". I create a function call "bouncer([false, null, 0], "");" to test it. It returns a empty array. I think my solution is right, but the system can not let me pass it. Anybody has the same problem?
Herman Fassett
@HermanFassett
Oct 01 2015 03:06
I got past that one
What's your code @perrot
vere perrot
@perrot
Oct 01 2015 03:08

function bouncer(arr) {
// Don't show a false ID to this bouncer.
array=arr.filter(isBigEnough);
console.log(array);
return array;
}
function isBigEnough(value) {
return (value != 0 && value!=null && value != undefined && value.length!=0 && value!=false&&value!=NaN);
}

bouncer([7, "ate", "", false, 9], "");
bouncer(["a", "b", "c"], "");
bouncer([false, null, 0], "");

Herman Fassett
@HermanFassett
Oct 01 2015 03:10
Apparently it's returning NaN in the test list... But when putting it in function it looks like it returns []
I think it's a bug as my previously working code doesn't work
vere perrot
@perrot
Oct 01 2015 03:14
Can I fix it?
Herman Fassett
@HermanFassett
Oct 01 2015 03:16
wait
Rex Schrader
@SaintPeter
Oct 01 2015 03:18

@perrot Normally I don't give solutions, but this problem is actually a trick question.
Just Replace this code:

function isBigEnough(value) {
return (value != 0 && value!=null && value != undefined && value.length!=0 && value!=false&&value!=NaN);
}

with this:

function isBigEnough(value) {
return value;
}
@perrot The reason that it works is because you don't need an === or, frankly, anything to test if something is true or false (or truthy or `falsey) in js. JS does it for you. All you need to do is put the value somewhere where it will be tested by an if statement (which happens inside the filter function)
Herman Fassett
@HermanFassett
Oct 01 2015 03:20
Also see this FreeCodeCamp/FreeCodeCamp#3540
vere perrot
@perrot
Oct 01 2015 03:21
thank you @HermanFassett
CamperBot
@camperbot
Oct 01 2015 03:21
perrot sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 242 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
vere perrot
@perrot
Oct 01 2015 03:26
It's work. Thank you for your information. @SaintPeter
CamperBot
@camperbot
Oct 01 2015 03:26
perrot sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 800 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Oct 01 2015 03:26
@perrot :D
Jorge Cortes
@jcortes
Oct 01 2015 03:47
hello anyone knows how to solve Bonfire: Truncate a string?
Rex Schrader
@SaintPeter
Oct 01 2015 03:47
@jcortes Yup
Herman Fassett
@HermanFassett
Oct 01 2015 03:47
x)
Rex Schrader
@SaintPeter
Oct 01 2015 03:47
@jcortes But we are honor bound not to tell you how. We can just help you understand how to solve it yourself.
Chris
@Shifthawke
Oct 01 2015 03:48
And help they will. They're awesome at explaining.
But don't ask for straight up answers -shakes head no-
Rex Schrader
@SaintPeter
Oct 01 2015 03:48
@jcortes Warning: There might be first grade math involved.
Herman Fassett
@HermanFassett
Oct 01 2015 03:48
lol
Rex Schrader
@SaintPeter
Oct 01 2015 03:49
@Shifthawke Oh, he can ASK . . . we'll just take glee in saying no.
@jcortes Anyway, lay it on me - you got any code or are you totally lost?
Chris
@Shifthawke
Oct 01 2015 03:49
I partially expect arielle to come in like Judge judy, aim a gavel and say very deeply, NOOOOO
Rex Schrader
@SaintPeter
Oct 01 2015 03:50
(Maybe I scared him off)
Chris
@Shifthawke
Oct 01 2015 03:50
lol Me too.
Rex Schrader
@SaintPeter
Oct 01 2015 03:50
Oh well, story time for kidlet.
Herman Fassett
@HermanFassett
Oct 01 2015 03:50
Wasn't me
Chris
@Shifthawke
Oct 01 2015 03:51
yay for story time.
Which story?
Is it the hungry Caterpillar?
I love that story.
Jorge Cortes
@jcortes
Oct 01 2015 03:54
@SaintPeter any help would be great any tip
I got this but is not working
function truncate(str, num) {
  // Clear out that junk in your trunk
  var s = str.slice(0, num);

  return s + '...';
}

truncate("A-tisket a-tasket A green and yellow basket", 11, "");
Chris
@Shifthawke
Oct 01 2015 03:55
consensus before I spend money I don't want to let go of. is "
JavaScript and JQuery: Interactive Front-End Web Development" From Jon something or other a good book? I mean does it explain and give more than the general gloss over?
Herman Fassett
@HermanFassett
Oct 01 2015 03:59
@jcortes It would be num - 3 to make up for the ..., but then again you also need to check if the str is longerthan num
Rex Schrader
@SaintPeter
Oct 01 2015 04:04
@jcortes You're almost there. Don't forget to figure out what happens if the string is shorter than num
Jorge Cortes
@jcortes
Oct 01 2015 04:05
ok got it thanks
function truncate(str, num) {
  // Clear out that junk in your trunk
  if(num < str.length)
    str = str.slice(0, num-3) + '...';

  return str;
}

truncate("A-tisket a-tasket A green and yellow basket", 11, "");
CamperBot
@camperbot
Oct 01 2015 04:05
if you want to thank someone, put an @ before their name!
Jorge Cortes
@jcortes
Oct 01 2015 04:06
@SaintPeter @HermanFassett thanks
CamperBot
@camperbot
Oct 01 2015 04:06
jcortes sends brownie points to @saintpeter and @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 803 | @saintpeter | http://www.freecodecamp.com/saintpeter
:star: 244 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
vickyg12
@vickyg12
Oct 01 2015 04:10
Hi friends, i am current now in the challenge of Bonfire: Reverse a String .
Can someone help me
whatever code i type and run the code it says "cannot read property 'split' of undefined "
Herman Fassett
@HermanFassett
Oct 01 2015 04:12
Show what you've tried @vickyg12
Rex Schrader
@SaintPeter
Oct 01 2015 04:12
@vickyg12 Three steps:
1) Convert the string str into an array using the .split String function
2) Reverse the array you just created with the .reverse Array function
3) Convert your array back into a string with .join
@vickyg12 Finally, I encourage you to use http://repl.it to develop your bonfires. Here, I set it up for you: https://repl.it/BMUO
vickyg12
@vickyg12
Oct 01 2015 04:13
@SaintPeter there is one problem using the first step the str they given in the program is an array... not a single word.. .
Rex Schrader
@SaintPeter
Oct 01 2015 04:13
@vickyg12 You can use console.log statements as you go to check if your code is doing what you expect.
vickyg12
@vickyg12
Oct 01 2015 04:14
function reverseString(str) {
for (var i=0;i<=reverseString.length-1;i++)
{
var string = reverseString[(reverseString.length-1)];
}
var array = string;
array = string.split(' ');
// var array = string.split("");
//str1.split("").reverse().join("");
return str;
}
reverseString("hello", "");
i not completed the code
Herman Fassett
@HermanFassett
Oct 01 2015 04:14
Mmm
vickyg12
@vickyg12
Oct 01 2015 04:14
but the first step itself it shows wrong
while split the string
Herman Fassett
@HermanFassett
Oct 01 2015 04:14
Just saying, it can be done with one line of code in the function
If you scrunch the functions
Rex Schrader
@SaintPeter
Oct 01 2015 04:15
@vickyg12 reverseString is the name of the function. You will not call the function from within itself. The name of the parameter is str
@vickyg12 I strongly advise against trying for a recursive solution
@vickyg12 Delete this code:
for (var i=0;i<=reverseString.length-1;i++)
{
var string = reverseString[(reverseString.length-1)];
}
vickyg12
@vickyg12
Oct 01 2015 04:17
@SaintPeter ok sure
Rex Schrader
@SaintPeter
Oct 01 2015 04:17
@vickyg12 You don't need to define a variable called string, because str is already defined for you - it's the name of the parameter that is passed in:
function reverseString(str) {  // <-- Right there
vickyg12
@vickyg12
Oct 01 2015 04:20
yes boss i got it... but what actually i thought of doing is... since the given str is an array i get the individual array element and i split the characters using split function and then i reverse it using .reverse fn and then by using join i would like to join it.. .
but i struck at the first step itself..
Rex Schrader
@SaintPeter
Oct 01 2015 04:22
@vickyg12 (Sorry if I'm coming on a bit strong here :D )
function reverseString(str) {
     var array = string;  // This is not needed
     array = string.split(' ');  // this is not needed
  // var array = string.split("");    // You can use str here, not string
  //str1.split("").reverse().join("");  // This is actually almost exactly right
  return str;
}
reverseString("hello", "");
Aleksandar B.
@aleksandar-b
Oct 01 2015 04:29
my tic tac toe game is not working, i can beat the comp.
Rex Schrader
@SaintPeter
Oct 01 2015 04:29
@samosale Are you using some variation of the minimax algorithm, or did you roll your own?
Aleksandar B.
@aleksandar-b
Oct 01 2015 04:29
it's frustrating, i have not sleeped all night
@SaintPeter it's spagetti code
Rex Schrader
@SaintPeter
Oct 01 2015 04:30
@samosale Well . . . that's part of the problem, no doubt. Step 1: Go to sleep . Step 2: Try to un-spagettii it.
Aleksandar B.
@aleksandar-b
Oct 01 2015 04:30
@SaintPeter ok
Rex Schrader
@SaintPeter
Oct 01 2015 04:31
@samosale I implemented a version of the Minimax algorithm. I "knew" what I was doing and it was HARD to get right and debug. That was WITH pretty clean code.
@samosale If you don't have even that . . . you have no hope.
vickyg12
@vickyg12
Oct 01 2015 04:38
@SaintPeter i cleared it.... var array = str.split("");
array.reverse();
str = array.join('');
this is what i did..
Thanks ..
CamperBot
@camperbot
Oct 01 2015 04:38
if you want to thank someone, put an @ before their name!
Alexandrix Ikechukwu
@SpaghettiThots
Oct 01 2015 04:39
Please please please. Has anyone looked at the Bouncer bf?
OverTheNeptune
@OverTheNeptune
Oct 01 2015 04:41
@IshMary Falsy Bouncer?
vickyg12
@vickyg12
Oct 01 2015 04:43
@SaintPeter @HermanFassett but i have one small doubt.. in that code... when i change the input reverseString("hello", ""); to something else like reverseString("hello", "buddy"); by adding another word but still when i put console.log(array) only first word is getting displayed ?? am i still writing the wrong one ?? please advice me...
Alexandrix Ikechukwu
@SpaghettiThots
Oct 01 2015 04:43
Yes @OverTheNeptune
OverTheNeptune
@OverTheNeptune
Oct 01 2015 04:44
@IshMary Do you have a specific question or just having trouble getting started?
Aleksandar B.
@aleksandar-b
Oct 01 2015 04:50
@SaintPeter I somehow menaged to hardcode that problem, and now i think it is working. I need more testing. But real work is ahead of me bc I must implement choice of player(X or O). That will be pain. It is 7 in the morning, i must get some sleep.bye and tnx.
Alexandrix Ikechukwu
@SpaghettiThots
Oct 01 2015 04:51
Of course I've started @OverTheNeptune . FCC isn't even running my tests. Lemme paste my code.
OverTheNeptune
@OverTheNeptune
Oct 01 2015 04:52
@IshMary OK :)
Alexandrix Ikechukwu
@SpaghettiThots
Oct 01 2015 04:52

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  //var falsy = [false, null, 0, "", undefined, NaN];
  function rumove{
    for(var i = 0; i < arr.length; i++){
      if(arr[i] == false){
        arr.splice(i, 1);
      }
    }
  }
  arr.filter(rumove);
  return arr;
}

bouncer([7, "ate", "", false, 9], "");
Herman Fassett
@HermanFassett
Oct 01 2015 04:55
@vickyg12 if you wanted to return say an array of all the reversed strings sent in as arguments, you could do something like this
function reverseString() {
    var arr = [];
    for (var i = 0; i < arguments.length; i++)
        arr.push(arguments[i].split("").reverse().join(""));
    return arr;
}
reverseString("hello", "buddy");
Jose E. Pimentel
@jedpimentel
Oct 01 2015 04:56
@IshMary it should be "function rumove(){"
OverTheNeptune
@OverTheNeptune
Oct 01 2015 04:56
@IshMary yep
@IshMary should be function rumove()
Herman Fassett
@HermanFassett
Oct 01 2015 04:57
Or maybe remove() :P
OverTheNeptune
@OverTheNeptune
Oct 01 2015 05:02
@IshMary Also, this one is a bit tricky, but there's a simpler answer if you think about how the Array.filter() function works.
Hint: It "filters" out any values that its callback function return as false.
Alexandrix Ikechukwu
@SpaghettiThots
Oct 01 2015 05:02
I spelt it that way on purpose
Kiddie memories
My brother called it that way
:smile:
OverTheNeptune
@OverTheNeptune
Oct 01 2015 05:02
:)
vickyg12
@vickyg12
Oct 01 2015 05:04
@HermanFassett Thanks buddy understood.. :+1:
CamperBot
@camperbot
Oct 01 2015 05:04
vickyg12 sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 245 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Rex Schrader
@SaintPeter
Oct 01 2015 05:06

@vickyg12 I don't know why they show a second parameter on the input. I can say that you can change the input on the first string for personal testing purposes. IE:

reverseString("this is a test");

and it won't hurt anything.

Alexandrix Ikechukwu
@SpaghettiThots
Oct 01 2015 05:15

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  //var falsy = [false, null, 0, "", undefined, NaN];
  var i = 0;
  if(arr[i] == false){
   arr.splice(i, 1); 
  }
  return arr;
}

bouncer([7, "ate", "", false, 9], "");
Still not working
DTing
@dting
Oct 01 2015 05:16
@IshMary your current code only looks at the first element
you might want to look at array.filter or use a loop
bf bouncer
CamperBot
@camperbot
Oct 01 2015 05:17

:fire:Bonfire: Falsey Bouncer :link:

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  return arr;
}

bouncer([7, 'ate', '', false, 9]);

Remove all falsey values from an array.

more info:  bf details | bf links | hint

DTing
@dting
Oct 01 2015 05:17
bf links
CamperBot
@camperbot
Oct 01 2015 05:17
Alexandrix Ikechukwu
@SpaghettiThots
Oct 01 2015 05:24
@dting even that falls short

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  //var falsy = [false, null, 0, "", undefined, NaN];
  var i = 0;
  for(i; i < arr.length; i++){
    if(!arr[i]){
     arr.splice(i, 1); 
    }
  }
  return arr;
}

bouncer([7, "ate", "", false, 9], "");
DTing
@dting
Oct 01 2015 05:25
you dont want to splice an array you are iterating
if you reduce the length of the array while iterating you will end up skipping elements
Herman Fassett
@HermanFassett
Oct 01 2015 05:26
That's why you put i--; :P
DTing
@dting
Oct 01 2015 05:27
the other reason to avoid splice unless you want this behavior is that it will mutate the input array. Consider instead creating an array and pushing elements that are truthy to that array and returning that after the for loop
Teejay Parker
@TeejayParker
Oct 01 2015 05:38
Does anyone know where i could download visual basic 6.0? or is there a browser version i could use?
Salim BOURIAH
@salimbouriah
Oct 01 2015 06:00
Hi all !!! I'm new and I'd appreciate some help. I started the HTML/CSS tuto right now but when I click on "Run Test" i get this message "$ is not defined". how to advance to the next step please ?
Michelle Z
@mzulli
Oct 01 2015 06:19
@Majeye there are a few online IDEs for vb.net but not sure about vb6
ideone.com for example
Teejay Parker
@TeejayParker
Oct 01 2015 06:23
thank you
CamperBot
@camperbot
Oct 01 2015 06:23
if you want to thank someone, put an @ before their name!
Teejay Parker
@TeejayParker
Oct 01 2015 06:24
thank you @mzulli
CamperBot
@camperbot
Oct 01 2015 06:24
majeye sends brownie points to @mzulli :sparkles: :thumbsup: :sparkles:
:star: 231 | @mzulli | http://www.freecodecamp.com/mzulli
darien23
@darien23
Oct 01 2015 06:26
<style>
  body {
    background-color: black;
    font-family: Monospace;
    color: green;
  }
  .pink-text {
    color: pink;
  }
  .blue-text {
    color: blue;
  }
  #orange-text {
    color: orange;
  }
</style>
<h1 class="pink-text blue-text">Hello World!
</h1>
I need to give my h1 element the id orange-text
im getting confused on how to do it.
tva10
@tva10
Oct 01 2015 06:28
@darien23 use <h1 id="idName" ....> .....
Teejay Parker
@TeejayParker
Oct 01 2015 06:28
<h1 class="orange-text">Hello World!
should help you
err sorry, thats wrong lol
<h1 id="orange-text">Hello World!
there ya go
darien23
@darien23
Oct 01 2015 06:30
but what do i do to the other "pink-text blue-text"
tva10
@tva10
Oct 01 2015 06:30
@darien23 hm they will be overrided by orangeText
I think
Teejay Parker
@TeejayParker
Oct 01 2015 06:31
<h1 id="orange-text" class="pink-text blue-text">Hello World!
the orange will override
darien23
@darien23
Oct 01 2015 06:33
Ok, cool. ty vm
Teejay Parker
@TeejayParker
Oct 01 2015 06:33
np
darien23
@darien23
Oct 01 2015 06:33
Thanks @Majeye
CamperBot
@camperbot
Oct 01 2015 06:33
darien23 sends brownie points to @majeye :sparkles: :thumbsup: :sparkles:
:star: 179 | @majeye | http://www.freecodecamp.com/majeye
Teejay Parker
@TeejayParker
Oct 01 2015 06:33
cheers :)
darien23
@darien23
Oct 01 2015 06:33
thanks @tva10
CamperBot
@camperbot
Oct 01 2015 06:33
darien23 sends brownie points to @tva10 :sparkles: :thumbsup: :sparkles:
:star: 275 | @tva10 | http://www.freecodecamp.com/tva10
Solehjon
@Solehjon
Oct 01 2015 07:02
Nest each of your radio buttons inside its own div with the class col-xs-6. what should to do
?
help me guys
tva10
@tva10
Oct 01 2015 07:07
@Solehjon may be <div class='col-xs-6'> ..radiobutton..</div>
Solehjon
@Solehjon
Oct 01 2015 07:16
@tva10 thanks
CamperBot
@camperbot
Oct 01 2015 07:16
solehjon sends brownie points to @tva10 :sparkles: :thumbsup: :sparkles:
:star: 276 | @tva10 | http://www.freecodecamp.com/tva10
how it works ^
Amardeep
@Amardeep91
Oct 01 2015 07:18
hiii coders
fjurcev
@fjurcev
Oct 01 2015 07:31
Hi @Amardeep91
Yosafat Ariel
@yoskakomba
Oct 01 2015 07:39
Hi guys need help with waypoint:target-html-elements-with-selectors-using-jquery
   $(function() {
     $('button').addClass("animatedbounce");


   });

</script>
is that right?
tva10
@tva10
Oct 01 2015 07:42
@yoskakomba in that task you need to add two classes animated and bounce
@yoskakomba in your code you add one class animatedbounce, may be there are no that class in bootstrap
Yosafat Ariel
@yoskakomba
Oct 01 2015 07:44

```$(function() {
$('button').addClass('animated', 'bounce');

    }); ```

like this?

tva10
@tva10
Oct 01 2015 07:44
@yoskakomba
 $(document).ready(function() {
     $("button").addClass("animated bounce");
  });
use space around
Yosafat Ariel
@yoskakomba
Oct 01 2015 07:45
ok thanks a lot
CamperBot
@camperbot
Oct 01 2015 07:45
if you want to thank someone, put an @ before their name!
Yosafat Ariel
@yoskakomba
Oct 01 2015 07:45
@tva10 thanks alot
tva10
@tva10
Oct 01 2015 07:45
@yoskakomba because then you add some classes in HTML you write <h1 class="class1 class2 class3" ....>....
Yosafat Ariel
@yoskakomba
Oct 01 2015 07:46
ok got that
tva10
@tva10
Oct 01 2015 07:46
no problem
Yosafat Ariel
@yoskakomba
Oct 01 2015 07:46
@tva10 it's like adding multiple class in HTML right?
tva10
@tva10
Oct 01 2015 07:46
@yoskakomba so like that
also May be you can write like $("button").addClass("animated").addClass("bounce");
but may be that will not work
or test cases will not pass task
@yoskakomba so best way look in JQuery documentation
I'm gone out
Yosafat Ariel
@yoskakomba
Oct 01 2015 07:49
  $(document).ready(function() {
    $('button').addClass('animated bounce');
  });
</script>
still can't pass
I'm sorry I can pass now
tva10
@tva10
Oct 01 2015 07:50
@yoskakomba Use the jQuery addClass() function to give the classes animated and shake to all your elements with the class well.
Yosafat Ariel
@yoskakomba
Oct 01 2015 07:50
thanks alot @tva10
CamperBot
@camperbot
Oct 01 2015 07:50
yoskakomba sends brownie points to @tva10 :sparkles: :thumbsup: :sparkles:
:star: 277 | @tva10 | http://www.freecodecamp.com/tva10
tva10
@tva10
Oct 01 2015 07:51
@yoskakomba $(".well").addClass("animated shake"); that we lost
Yosafat Ariel
@yoskakomba
Oct 01 2015 07:52
I didn't realize that I already pass it and moved to new waypoint hahaha
Karolis
@Luomint
Oct 01 2015 08:45
pomodoro
Joshua Abu
@Absolutestunna
Oct 01 2015 08:47
trying to use jquery to change background images after certain conditions, how do i do it?
here's the code I have
if ((weather.temp > 80){
      $(body).css("background-image", 'url('https://static.pexels.com/photos/8183/pexels-photo-medium.jpg')'
does that look about right?
I think I'm getting hung up on how the quotes are being used in the .css brackets
Avishay
@avishayshushan
Oct 01 2015 09:02
@Absolutestunna
try this
if ((weather.temp > 80){
      $(body).css("background-image", 'url(https://static.pexels.com/photos/8183/pexels-photo-medium.jpg)'
Alexandrix Ikechukwu
@SpaghettiThots
Oct 01 2015 09:13
This message was deleted
I hacked this simple solution:
This message was deleted
function bouncer(arr){

  var arrA = [];

  for(var i = 0; i < arr.length; i++){
    if(Boolean(arr[i]) == true){
      arrA.push(arr[i]);
    }
  }
  return arrA;
}

bouncer([7, "ate", "", false, 9]);
Soumya Rauth
@soumyaRauth
Oct 01 2015 10:08
function diff(arr1, arr2) {

  var newArr=[];
  var newArr2=[];
  var newArr4=[];

  var x=true;

 newArr2=arr1.concat(arr2);
 newArr4=newArr2; 


  function filtering(value,indexOfElement){

    newArr4=newArr2.slice((indexOfElement+1), (newArr2.length));


  for(var j=0;j<newArr4.length;j++){

    if(value!==newArr4[j]){

     x=true;

    }else{

      x=false;
      newArr2.splice(newArr2.indexOf(value),1);
      newArr2.splice(newArr2.indexOf(newArr4[j]),1);

      break;
    }
 }
    if(x===true){
       return true;
     }else{

       return false;
     }
  }

  newArr=newArr2.filter(filtering);

   return newArr;
}

diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
can anyone please help???
Soumya Rauth
@soumyaRauth
Oct 01 2015 10:17
hello everyone..
Ademola Adegbuyi
@ooade
Oct 01 2015 10:24
Hi guys, i'm having some issues setting up c9 for my baseJumps. It always hit a memory limit then stops
alt
DTing
@dting
Oct 01 2015 11:04
@marhyorh I think thats an issue with the new version of angular fullstack
FreeCodeCamp/FreeCodeCamp#3146 this issue talks about hitting this memory limit but there isn't really any sort of resolution. I did my base jumps locally using b/c i felt like using c9 was a bit too sluggish anyways.
Ademola Adegbuyi
@ooade
Oct 01 2015 11:14
Thanks @dting , that's what i'm gonna do
CamperBot
@camperbot
Oct 01 2015 11:14
marhyorh sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1288 | @dting | http://www.freecodecamp.com/dting
Maddy
@maddymaster
Oct 01 2015 12:25

Hi All this is my code, this clears all tasks except one ' " <link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<style>
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}

.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}

.smaller-image {
width: 100px;
}
</style>

<h2 class="red-text">CatPhotoApp</h2>

<p> View more <a href="http://www.freecatphotoapp.com"> cat photos</a> </p>

<img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat">

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p> ' "

The task - Your p element should have the text "View more " (with a space after it). this one fails to clear no matter what
what am I doing wrong?
Please help
I have given the space after it
still no go
Blauelf
@Blauelf
Oct 01 2015 12:29
help format
CamperBot
@camperbot
Oct 01 2015 12:29

:point_right: code formatting [wiki]

Inline code

alt text

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks and then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Aleksandar B.
@aleksandar-b
Oct 01 2015 12:42
Can someone please go to this page and test it to see if they can beat a comp. It is not an algorithm so it must be tested. If you have wined let me know.
http://codepen.io/samosale/full/garjWZ/
Harry Gill
@mygnu
Oct 01 2015 12:47
bonfire boo who
CamperBot
@camperbot
Oct 01 2015 12:47

:fire:Bonfire: Boo who :link:

function boo(bool) {
  // What is the new fad diet for ghost developers? The Boolean.
  return bool;
}

boo(null);

Check if a value is classified as a boolean primitive. Return true or false.

more info:  bf details | bf links | hint

Harry Gill
@mygnu
Oct 01 2015 12:47
bf hint
CamperBot
@camperbot
Oct 01 2015 12:47
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Hugo
@hugoender
Oct 01 2015 12:53
@samosale i cannot win…i dont like it
lol
Maddy
@maddymaster
Oct 01 2015 12:55

Hi all I am stuck at a task, all others clear except one.
The task - Your p element should have the text "View more " (with a space after it). this one fails to clear no matter what
what am I doing wrong?
Please help
I have given the space after it
still no go``` <link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<style>
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}

.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}

.smaller-image {
width: 100px;
}
</style>

<h2 class="red-text">CatPhotoApp</h2>

<p> View more <a href="http://www.freecatphotoapp.com"> cat photos</a> </p>
<img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat">

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p> ```

Aleksandar B.
@aleksandar-b
Oct 01 2015 12:55
@hugoender :smile: tnx
CamperBot
@camperbot
Oct 01 2015 12:55
samosale sends brownie points to @hugoender :sparkles: :thumbsup: :sparkles:
:star: 207 | @hugoender | http://www.freecodecamp.com/hugoender
Hugo
@hugoender
Oct 01 2015 12:57
@maddymaster try using correct formatting to paste code in here to make it easier for us to read and find the issue
help format
CamperBot
@camperbot
Oct 01 2015 12:57

:point_right: code formatting [wiki]

Inline code

alt text

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks and then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Hugo
@hugoender
Oct 01 2015 12:57
use back ticks (located above tab on your keyboard)
Maddy
@maddymaster
Oct 01 2015 12:58
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
.red-text {
color: red;
}
h2 {
font-family: Lobster, Monospace;
}
p {
font-size: 16px;
font-family: Monospace;
}
.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}
.smaller-image {
width: 100px;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<p> View more <a href="http://www.freecatphotoapp.com"> cat photos</a> </p>
<img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat">
<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
Hugo
@hugoender
Oct 01 2015 12:58
@maddymaster much better
Maddy
@maddymaster
Oct 01 2015 12:58
I m so sorry. I now learnt it. thank you @hugoender
CamperBot
@camperbot
Oct 01 2015 12:58
maddymaster sends brownie points to @hugoender :sparkles: :thumbsup: :sparkles:
:star: 208 | @hugoender | http://www.freecodecamp.com/hugoender
Hugo
@hugoender
Oct 01 2015 12:59
Okay so what is the error message you are getting?
Maddy
@maddymaster
Oct 01 2015 12:59
I am stuck at task "Your p element should have the text "View more " (with a space after it)"
the <p> has View more with a space
Hugo
@hugoender
Oct 01 2015 13:00
what waypoint is this?
Maddy
@maddymaster
Oct 01 2015 13:00
Waypoint 22
Nesting an Anchor in HTML
Hugo
@hugoender
Oct 01 2015 13:01
@maddymaster "Now nest your existing a element within a new p element "
<a … >
   <p></p>
</a>
Maddy
@maddymaster
Oct 01 2015 13:02
I tried that too, let me nest a element in new p element
oh okay
Maddy
@maddymaster
Oct 01 2015 13:07
<p> <a href="http://www.freecatphotoapp.com"> Cat Photos </a> View More </p>
Hugo
@hugoender
Oct 01 2015 13:08
@maddymaster you can edit your message by clicking the … next to it
Maddy
@maddymaster
Oct 01 2015 13:08
wow thank you @hugoender
CamperBot
@camperbot
Oct 01 2015 13:08
if you want to thank someone, put an @ before their name!
Hugo
@hugoender
Oct 01 2015 13:09
@maddymaster oops i think i misinformed you
Maddy
@maddymaster
Oct 01 2015 13:09
<a href="http://www.freecatphotoapp.com"> Cat Photos <p> View More </p> </a>
Hugo
@hugoender
Oct 01 2015 13:09
@maddymaster no no i misread the waypoint…give me a second
Maddy
@maddymaster
Oct 01 2015 13:10
both not going through @hugoender
oh okay @hugoender
thank you
CamperBot
@camperbot
Oct 01 2015 13:10
if you want to thank someone, put an @ before their name!
Avil
@Avil172
Oct 01 2015 13:10
@maddymaster delete the space between <p> and V
Alexandrix Ikechukwu
@SpaghettiThots
Oct 01 2015 13:11
@dting Could you look at this?
function destroyer(arr) {
  // Remove all the values

  var value = 0;

  //define a remove function.
  function remove(){
     if (arguments[value]){
       arr[i] = undefined;
     }
  }

  //use filter().
  for(var i = 0; i < arr.length; i++){
    arr.filter(remove);
  }

  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Hugo
@hugoender
Oct 01 2015 13:11
@maddymaster
<p>View more cat photos<a href="http://www.freecatphotoapp.com">cat photos</a></p>
@maddymaster that worked for me
@maddymaster remove the spaces
ionuionut
@ionuionut
Oct 01 2015 13:14
please help me with a code for resize an image in css
Capture.PNG
Hugo
@hugoender
Oct 01 2015 13:15
@ionuionut it’s best if you copy and paste the code in here using the formatting
help format
CamperBot
@camperbot
Oct 01 2015 13:15

:point_right: code formatting [wiki]

Inline code

alt text

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks and then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Hugo
@hugoender
Oct 01 2015 13:16
do that and then let us know what exactly you need help with
@IshMary would you like my help or only @dting ’s?
ionuionut
@ionuionut
Oct 01 2015 13:17
<style> .smaller-image { width: 100px; } </style>.
Hugo
@hugoender
Oct 01 2015 13:17
@ionuionut the back ticks are located above your tab button
Alexandrix Ikechukwu
@SpaghettiThots
Oct 01 2015 13:17
Jeez. Your help is welcome.
Sorry @hugoender
Hugo
@hugoender
Oct 01 2015 13:18
@IshMary alright so the .filter(someFunction) method creates a new array with the values in the array that caused the someFunction to return true
@IshMary in your case…your someFunction is called remove()
ionuionut
@ionuionut
Oct 01 2015 13:19
<style> .smaller-image { width: 100px; } </style>.
Hugo
@hugoender
Oct 01 2015 13:19
so remove() needs to return true for the values in the array that you want to keep
Raygendary
@raygendary
Oct 01 2015 13:19
why use IF statement when there is SWITCH statement in javascript? (beginners question, obviously)
Hugo
@hugoender
Oct 01 2015 13:20
@ionuionut alright awesome… now what’s the problem?
Alexandrix Ikechukwu
@SpaghettiThots
Oct 01 2015 13:20
Yes @hugoender
Hugo
@hugoender
Oct 01 2015 13:20
@raygendary switch statement may be more readable than if else
@raygendary depending on situation
ionuionut
@ionuionut
Oct 01 2015 13:20
it's not working the code
Hugo
@hugoender
Oct 01 2015 13:21
@raygendary you can also use switch in a way where multiple “cases” are carried out for one scenario
Herman Fassett
@HermanFassett
Oct 01 2015 13:21
@raygendary because we're lazy
Hugo
@hugoender
Oct 01 2015 13:21
@raygendary (for example if you don’t end one case with break)
@ionuionut the formatting of that code looks good so what exactly is not working? I need more details to go off of. Help me help you
@ionuionut paste all of your code
ionuionut
@ionuionut
Oct 01 2015 13:23
i will send you a picture
Capture.PNG
Herman Fassett
@HermanFassett
Oct 01 2015 13:23
@raygendary a lot of times I find myself using if-else when it would look nicer and probably perform faster with switch, but there are many cases where you can only use if-else such as when you need to evaluate different expressions for each branch
Raygendary
@raygendary
Oct 01 2015 13:23
@hugoender but the use or what it do is the same?
Hugo
@hugoender
Oct 01 2015 13:23
@ionuionut LOL don’t send me a picture… copy and paste code. I am trying to get you to follow the correct format
@raygendary for the most part…yes
@raygendary there are some differences though
ionuionut
@ionuionut
Oct 01 2015 13:24
thank's for help me hugoender...bye
CamperBot
@camperbot
Oct 01 2015 13:24
if you want to thank someone, put an @ before their name!
Herman Fassett
@HermanFassett
Oct 01 2015 13:26
@raygendary here's a good look at the difference and you can test performance here
switch is generally the fastest
Hugo
@hugoender
Oct 01 2015 13:26
@ionuionut i am sorry but if you cannot take the time to properly paste your code here for us to view it, how do you expect us to take our time to help you?
@ionuionut i am not trying to be difficult or anything… just trying to teach you the correct way of asking for help on here so that in the future you know how to do it and get the most out of these chat rooms
Jepz
@Jepz
Oct 01 2015 13:29
Hints hints ^^
I'm on Bonfire: Convert HTML Entities, the wiki does not use regex but i would like to. Google some, found how I can find special characters and remove them, but how should I depending on the character add right html element? Is it via switch or if's?
Avil
@Avil172
Oct 01 2015 13:30
@ionuionut create a new class inside the style element having the name smaller-image(refer to the example of larger-image class to know how to do it)
then give this class to your img element(see how you gave your p element the red-text class? its done in the same way)
Raygendary
@raygendary
Oct 01 2015 13:30
@HermanFassett @hugoender Thanks guys! it really bother me what is there difference. maybe ill use the if and else if there are only 2 to 3 conditions and multiple for switch no?\
CamperBot
@camperbot
Oct 01 2015 13:30
raygendary sends brownie points to @hermanfassett and @hugoender :sparkles: :thumbsup: :sparkles:
:star: 209 | @hugoender | http://www.freecodecamp.com/hugoender
:star: 249 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Herman Fassett
@HermanFassett
Oct 01 2015 13:30
@Jepz I did it with regex, and though my code is a little redundant, I didn't need any loops or anything
Hugo
@hugoender
Oct 01 2015 13:30
@Jepz regex101.com is a good resource… just a general FYI :)
Jepz
@Jepz
Oct 01 2015 13:31
@HermanFassett :smile: do yo have any stackoverflow post that helped you out?
Herman Fassett
@HermanFassett
Oct 01 2015 13:32
@raygendary yeah, though you'll be forced to use if-else for many conditions if the expression being evaluated isn't always the same
Jepz
@Jepz
Oct 01 2015 13:33
@hugoender know about it :smile: but can regex also add the correct character?
Herman Fassett
@HermanFassett
Oct 01 2015 13:33
@Jepz well I didn't need to look at anything for this. But my code should probably be made to look nicer. I just used .replace(/&/gi, "&amp;") a bunch
Or something like that
You should probably try to make it look nicer :P
Jepz
@Jepz
Oct 01 2015 13:35
@HermanFassett ahhh okay, yea have to be a "nice" way to do it with regex :smile:
Herman Fassett
@HermanFassett
Oct 01 2015 13:35
/&/g would work too lol, see I'm not good with regex
I did get it all on one long line
Jepz
@Jepz
Oct 01 2015 13:36
string.replace(regex, html).replace(regex, html) and so on... did you do it like that?
Herman Fassett
@HermanFassett
Oct 01 2015 13:37
More or less
Raygendary
@raygendary
Oct 01 2015 13:37
@HermanFassett to be honest i really didnt get what you said, i just started learning javascript and i cant follow your jargons or rather i forgot what you mean by expression haha
Jepz
@Jepz
Oct 01 2015 13:38
wow, maybe I should use switch ^^ http://jsperf.com/switch-vs-if-else-and-regex
superfast compared with the others
Herman Fassett
@HermanFassett
Oct 01 2015 13:40

Oh @raygendary , for instance this

if (j == 0) {
    //do something
}
else if (a == 0) {
   // do something else
}

wouldn't really work in a switch statement because you're not testing on one variable. Switch would be like

switch(j) {
    case 0:
        //do something
    case 1:
        //do something else
}

and that's only for j, yes?

and perhaps I should have used ===
Raygendary
@raygendary
Oct 01 2015 13:42
@HermanFassett Ah i see, switch is only for one variable case right?
Blauelf
@Blauelf
Oct 01 2015 13:43

Shouldn't

switch(true) {
  case (j == 0):
    //do something
    break;
  case (a == 0):
   // do something else
}

work? If you really want to use switch, that is...

Samantha Jordan
@Wynterwolf
Oct 01 2015 13:45
I'be been trying to figure this out all morning. One of the exercises says I am missing a </div> tag. But for the life of me, I can't find the missing one. Am I missing something?
Jepz
@Jepz
Oct 01 2015 13:46
@raygendary @HermanFassett correct me if I'm wrong, but you could have a function or number of things happen if a case is triggerd. Kinda like @Blauelf showed.
Herman Fassett
@HermanFassett
Oct 01 2015 13:49
Yeah
I don't use switch a lot just because I'm not good with it lol
Hugo
@hugoender
Oct 01 2015 13:53
@Jepz thats a cool site!
Blauelf
@Blauelf
Oct 01 2015 13:54
There are cases where switch increases readability. And there are cases where you have too many "case" statements.
Herman Fassett
@HermanFassett
Oct 01 2015 13:55
I think I was searching for a reason to not use switch
Learn the ternary operator, it's my fav
Raygendary
@raygendary
Oct 01 2015 13:56
i thought "++" is making the computer count my once, but i saw a code that it adds 1 to the variable value in a while loop?
Herman Fassett
@HermanFassett
Oct 01 2015 13:58
i++; = i+=1; = i = i+1;
Raygendary
@raygendary
Oct 01 2015 14:04
@HermanFassett term is incrementer right?
Avil
@Avil172
Oct 01 2015 14:08
@raygendary i++ is post increment, ++i is pre increment
Raygendary
@raygendary
Oct 01 2015 14:28
@Avil172 Thanks mate!\
CamperBot
@camperbot
Oct 01 2015 14:28
raygendary sends brownie points to @avil172 :sparkles: :thumbsup: :sparkles:
:star: 150 | @avil172 | http://www.freecodecamp.com/avil172
Colton Ehrman
@coltonehrman
Oct 01 2015 15:11
can someone tell me why the return for this has like 20 decimal places instead of two?
function drawer(price, cash, cid) {
  var change = cash - price;
  var drawer = cid.reduce(function(prev, curr) {
    return parseFloat(prev) + curr[1];
  }, 0.00);



  return drawer;
}

// Example cash-in-drawer array:
// [["PENNY", 1.01],
// ["NICKEL", 2.05],
// ["DIME", 3.10],
// ["QUARTER", 4.25],
// ["ONE", 90.00],
// ["FIVE", 55.00],
// ["TEN", 20.00],
// ["TWENTY", 60.00],
// ["ONE HUNDRED", 100.00]]

drawer(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);
vere perrot
@perrot
Oct 01 2015 15:13
Hello my friend,
When I click the unit "Waypoint: Learn how Free Code Camp Works", I get a message "Oops! Something went wrong. Please try again later". I try again later, but the web site always show me this message again.
Jason Fernandes
@whereissql
Oct 01 2015 15:15
@perrot same with me
I tried after you posted here
Jonathan Coleman
@jondcoleman
Oct 01 2015 15:16
@coltonehrman can you post example of return value?
Bryan Wegman
@bwyan
Oct 01 2015 15:17
Does it have something to do with floating point math?
Colton Ehrman
@coltonehrman
Oct 01 2015 15:17
this is the return 335.40999999999997
Jason Wood
@catapixel
Oct 01 2015 15:18
@coltonehrman It's because of your nickels. You're seeing the result of a float division problem...
Colton Ehrman
@coltonehrman
Oct 01 2015 15:18
how do i fix?
Jason Wood
@catapixel
Oct 01 2015 15:18
@coltonehrman convert currency to pennies
Colton Ehrman
@coltonehrman
Oct 01 2015 15:18
ahhh
didnt think of that
thanks
CamperBot
@camperbot
Oct 01 2015 15:18
if you want to thank someone, put an @ before their name!
Colton Ehrman
@coltonehrman
Oct 01 2015 15:19
thanks @catapixel
CamperBot
@camperbot
Oct 01 2015 15:19
coltonehrman sends brownie points to @catapixel :sparkles: :thumbsup: :sparkles:
:star: 400 | @catapixel | http://www.freecodecamp.com/catapixel
vere perrot
@perrot
Oct 01 2015 15:19
@whereissql Maybe something wrong. The manager of web site can solve this problem.
Colton Ehrman
@coltonehrman
Oct 01 2015 15:19
also thanks @bwyan
CamperBot
@camperbot
Oct 01 2015 15:19
coltonehrman sends brownie points to @bwyan :sparkles: :thumbsup: :sparkles:
:star: 215 | @bwyan | http://www.freecodecamp.com/bwyan
vere perrot
@perrot
Oct 01 2015 15:19
@whereissql Thank you so much.
CamperBot
@camperbot
Oct 01 2015 15:19
perrot sends brownie points to @whereissql :sparkles: :thumbsup: :sparkles:
:star: 179 | @whereissql | http://www.freecodecamp.com/whereissql
Bryan Wegman
@bwyan
Oct 01 2015 15:20
Thanks @coltonehrman that was kind of you. I think @perrot deserves the brownie points though.
CamperBot
@camperbot
Oct 01 2015 15:20
bwyan sends brownie points to @coltonehrman and @perrot :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for perrot
:star: 273 | @coltonehrman | http://www.freecodecamp.com/coltonehrman
Colton Ehrman
@coltonehrman
Oct 01 2015 15:31
does .toFixed convert to string?
Blauelf
@Blauelf
Oct 01 2015 15:34
I think it does. Would be less useful otherwise.
Colton Ehrman
@coltonehrman
Oct 01 2015 15:34
does Bonfire: Exact Change have a bug?
Bonfire: Exact Change
CamperBot
@camperbot
Oct 01 2015 15:34

:fire:Bonfire: Exact Change :link:

function drawer(price, cash, cid) {
  var change;
  // Here is your change, ma'am.
  return change;
}

// Example cash-in-drawer array:
// [['PENNY', 1.01],
// ['NICKEL', 2.05],
// ['DIME', 3.10],
// ['QUARTER', 4.25],
// ['ONE', 90.00],
// ['FIVE', 55.00],
// ['TEN', 20.00],
// ['TWENTY', 60.00],
// ['ONE HUNDRED', 100.00]]

drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]);

Design a cash register drawer function that accepts purchase price as the first argument, payment as the second argument, and cash-in-drawer (cid) as the third argument.

more info:  bf details | bf links | hint

Colton Ehrman
@coltonehrman
Oct 01 2015 15:34
cause its checking for two different returns
assert.isArray(drawer(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]), 'message: drawer(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]) should return an array.');message: drawer(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]) should return an array.: expected 'Closed' to be an array
assert.isString(drawer(19.50, 20.00, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]), 'message: drawer(19.50, 20.00, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]) should return a string.');
Blauelf
@Blauelf
Oct 01 2015 15:35
You might have a problem with rounding (0.01 has no exact representation in float)
Colton Ehrman
@coltonehrman
Oct 01 2015 15:35
i already dealt with that problem
Blauelf
@Blauelf
Oct 01 2015 15:35
At least that is what many people experience...
Colton Ehrman
@coltonehrman
Oct 01 2015 15:36
im just confused about the asserts
and these instructions

Return the string "Insufficient Funds" if cash-in-drawer is less than the change due. Return the string "Closed" if cash-in-drawer is equal to the change due.

Otherwise, return change in coin and bills, sorted in highest to lowest order.

ohhh
wait lol nvm
Blauelf
@Blauelf
Oct 01 2015 15:37
The first one should be an array, the second should be a string (not enough change)
Colton Ehrman
@coltonehrman
Oct 01 2015 15:37
i see
NikosAnat
@NikosAnat
Oct 01 2015 15:54
Hi, everyone. I'm stuck in 6/3 lesson, a little help ?
Rex Schrader
@SaintPeter
Oct 01 2015 15:57
@NikosAnat Sure
NikosAnat
@NikosAnat
Oct 01 2015 15:58
The question says to keep myBike.speed and myBike.addUnit private, while making myBike.getSpeed publicly accessible.

var myBike = new Bike();
var myBike = function() {
speed = 100;
function addUnit(value) {
return value + "KM/H";
}

this.getSpeed = function () {
return addUnit(speed);
};

};

and this is what I've done ^
Rex Schrader
@SaintPeter
Oct 01 2015 16:00
@NikosAnat Sure - anything which is declared as this.variableName is public. It means that you can go myBike.variableName from outside the object and get the data back. If you decare something as var variableName, then it's private. You have to then write a function like this.getVariableName that returns the value of variableName - It looks like you're almost there.
@NikosAnat Looks like maybe you're missing a var?
NikosAnat
@NikosAnat
Oct 01 2015 16:01
@SaintPeter Thank you, I'll see what I can do.
CamperBot
@camperbot
Oct 01 2015 16:01
nikosanat sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 806 | @saintpeter | http://www.freecodecamp.com/saintpeter
jbelina
@jbelina
Oct 01 2015 16:08
help pair
CamperBot
@camperbot
Oct 01 2015 16:08

:point_right: bonfire dna pairing [wiki]

Problem Explanation:

  • You will get a DNA strand sequence and you need to get the pair and return it as a 2D array of the base pairs. Keep in mind that the provided strand should be first always.

:pencil: read more about bonfire dna pairing on the FCC Wiki

jbelina
@jbelina
Oct 01 2015 16:08
help pair programming
CamperBot
@camperbot
Oct 01 2015 16:08

:point_right: pair programming and why it is special [wiki]

Pair Programming is an Agile Development practice that was born out of the Extreme Programming movement.

Working as a team of [exactly] two, at a single computer, the pair will slide the keyboard and mouse back-and-forth throughout a "pairing session". This increases the code quality by providing a "greater than the sum of its parts" effect of two developers working on a single problem domain.

The increase in quality of the code, combined with the effect of knowledge and understanding on the project being spread across multiple developers, can produce a large savings in cost on the project as a whole.

In a Test Driven Development (TDD) shop, it is most common for each member of the pair to take turns a) writing a test and b) writing code to pass the test. This "ping pong" yields a cumulative effect on the overall quality of the final product.

To be most effective it is important that pairs are intermixed; not the same couple of developers always working together.

Pair programming is considered to be very "social". It can be akin to a marriage because you learn to cooperate with a peer in a close, give-and-take relationship. As such it is often very difficult to become comfortable with pair programming. Some developers simply NEVER feel quite at-home. In the end, the willingness to share, be a bit vulnerable and work cooperatively toward a better product will make you a far better developer (and a better person overall).

:pencil: read more about pair programming and why it is special on the FCC Wiki

Jason Wood
@catapixel
Oct 01 2015 16:12
Anyone done the "Make It Modular" step for Learnyounode that can offer some help on callbacks?
gaindacode
@gaindacode
Oct 01 2015 16:19
@jbelina where are you at ?
Pratik Ratnaparkhi
@pratikr1593
Oct 01 2015 16:25
var array = [1,2,3,4,5,6,7,8,9,10];
  // Only change code below this line.

array = array.filter(function(val) {

  return val >=5;

});

  // Only change code above this line.
(function() {return array;})();
Craig Morrison
@frogmorton
Oct 01 2015 16:25
@dedicatedfuture why yes, I am
Pratik Ratnaparkhi
@pratikr1593
Oct 01 2015 16:26
Issue: You should have removed all the values from the array that are greater than 4.: expected [ 5, 6, 7, 8, 9, 10 ] to deeply equal [ 1, 2, 3, 4 ]
Craig Morrison
@frogmorton
Oct 01 2015 16:27
This message was deleted
Pratik Ratnaparkhi
@pratikr1593
Oct 01 2015 16:27
anyone?
Eric
@emaclean03
Oct 01 2015 16:33
should post on CamperPracticeProjects probably
Craig Morrison
@frogmorton
Oct 01 2015 16:34
@emaclean03 are you referring to me?
Eric
@emaclean03
Oct 01 2015 16:34
Yeah, sorry
Craig Morrison
@frogmorton
Oct 01 2015 16:34
sorry to bomb the help room... it's cool.
Eric
@emaclean03
Oct 01 2015 16:35
haha np, just figured you'd get more response in the other room "D
Pratik Ratnaparkhi
@pratikr1593
Oct 01 2015 16:35
can anyone help me out?
Coira Ellison
@Coira
Oct 01 2015 16:35
@pratikr1593 i think you got the filter the wrong way round
Himanshu chauhan
@himanshuchauhan
Oct 01 2015 16:35
@pratikr1593 hey
Jon Love
@jayvolr
Oct 01 2015 16:35
@pratikr1593 What's the name of the challenge you're on?
Coira Ellison
@Coira
Oct 01 2015 16:35
it's returning [5,6,7,8 etc], but you need to return < 5
Pratik Ratnaparkhi
@pratikr1593
Oct 01 2015 16:36
@Coira i tried it, it doesnt work
it says: You should have removed all the values from the array that are greater than 4.: expected [ 1, 2, 3, 4, 5 ] to deeply equal [ 1, 2, 3, 4 ]
Jon Love
@jayvolr
Oct 01 2015 16:36
What is it returning now?
remove the equals
<=5 to <5
Pratik Ratnaparkhi
@pratikr1593
Oct 01 2015 16:37
doesn't help
Jon Love
@jayvolr
Oct 01 2015 16:37
Really? What's your code look like now?
Pratik Ratnaparkhi
@pratikr1593
Oct 01 2015 16:37
wait, <5 without = sign worked.
@Coira thanks
CamperBot
@camperbot
Oct 01 2015 16:38
pratikr1593 sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
Jon Love
@jayvolr
Oct 01 2015 16:38
Ok, cool.
CamperBot
@camperbot
Oct 01 2015 16:38
:star: 250 | @coira | http://www.freecodecamp.com/coira
Coira Ellison
@Coira
Oct 01 2015 16:38
@pratikr1593 np! filter returns items that your condition returns true as
@frogmorton hey, i'm not sure if this is too late, but your site looked good, i didn't see any immediate problems
Elizabeth Hatleli
@TheHighPriestess
Oct 01 2015 16:52
Can someone tell me why this fails the test. The regex looks correct to me:
function telephoneCheck(str) {

  var phoneRegex = /^(?:\+?1[-.●]?)?\(?([0-9]{3})\)?[-.●]?([0-9]{3})[-.●]?([0-9]{4})$/;

if (phoneRegex.test(str)) {
    console.log("It's a match");
    return true;

} else {
    console.log("Invalid phone number");
    return false;
}





  //return true;
}



telephoneCheck("1 555-555-5555");
Will Moody
@willmoody
Oct 01 2015 17:00
Hey folks! Does anyone know how, in a regular expression, one selects the space between two characters? I'm trying to manipulate strings that are in camelcase, so I'm trying to find a good way to split them up.
I tried reading some regex references, but I don't know what so search for when I'm talking about "", haha
Elizabeth Hatleli
@TheHighPriestess
Oct 01 2015 17:01
@fractal-mind you mean....a blank space?
Daniel Drasdo
@danieldrasdo
Oct 01 2015 17:01
@TheHighPriestess , check out http://www.regexr.com/, it let's you test your regex
Will Moody
@willmoody
Oct 01 2015 17:01
Well yes, but not literally a space haha
Elizabeth Hatleli
@TheHighPriestess
Oct 01 2015 17:01
@danieldrasdo thank yeah...I should do that
CamperBot
@camperbot
Oct 01 2015 17:01
thehighpriestess sends brownie points to @danieldrasdo :sparkles: :thumbsup: :sparkles:
:star: 273 | @danieldrasdo | http://www.freecodecamp.com/danieldrasdo
Daniel Drasdo
@danieldrasdo
Oct 01 2015 17:02
I plugged in your regex and after removing the start and end it selected some numbers below.
Will Moody
@willmoody
Oct 01 2015 17:02
@TheHighPriestess as in your username, I'd be referring to whatever character represents what is between "eH" or "hP"
Like how you can .split("") or .join("")
Elizabeth Hatleli
@TheHighPriestess
Oct 01 2015 17:03
@danieldrasdo it's not working for me
oops...yeah..it is now..sorry
NikosAnat
@NikosAnat
Oct 01 2015 17:04
'''
CamperBot
@camperbot
Oct 01 2015 17:04
:bulb: to format code use backticks! ``` more info
Elizabeth Hatleli
@TheHighPriestess
Oct 01 2015 17:05
@fractal-mind Well...I'm still struggling with regular expressions myself. However, according to this site:
there's a circle character there...that selects a blank space
I don't know if that's what you're talking about though.
Will Moody
@willmoody
Oct 01 2015 17:06
@TheHighPriestess Hmm, thanks for the resource! I'll look it over
CamperBot
@camperbot
Oct 01 2015 17:06
fractal-mind sends brownie points to @thehighpriestess :sparkles: :thumbsup: :sparkles:
:star: 273 | @thehighpriestess | http://www.freecodecamp.com/thehighpriestess
Elizabeth Hatleli
@TheHighPriestess
Oct 01 2015 17:06
So...if it works...why is the bonfire rejecting it?
NikosAnat
@NikosAnat
Oct 01 2015 17:07
This message was deleted
Elizabeth Hatleli
@TheHighPriestess
Oct 01 2015 17:07
or rather..why does it return false?
parv112281
@parv112281
Oct 01 2015 17:07
Hey guys, need some help with one of the waypoints in the basic javascript section, this is the section of that tutorial that starts you on the slot machine, the specs of the problem ask me to randomly generate 3 numbers between 1 and 3 and assign to 3 separate variables
Elizabeth Hatleli
@TheHighPriestess
Oct 01 2015 17:07
oh hold on...
that's because it doesn't work...
NikosAnat
@NikosAnat
Oct 01 2015 17:08
Checking for Palindromes. Any Help ?
function palindrome(str) {
  var array = str;
  array = array.split("");
  array = array.reverse();
  var str2;
  str2 = array.join("");
  if (str === str2){
    return true;
  }
  else{
    return false;
  }
}

palindrome("eye");
Herman Fassett
@HermanFassett
Oct 01 2015 17:08
x)
parv112281
@parv112281
Oct 01 2015 17:08
My basic line of code for generating a random var between 1 and 3 is: var myVar = Math.floor(Math.random() * 3) + 1
Herman Fassett
@HermanFassett
Oct 01 2015 17:09
@NikosAnat you need to remove punctuation
parv112281
@parv112281
Oct 01 2015 17:09
I'm passing all the tests except for the last test which has no message associated with it
NikosAnat
@NikosAnat
Oct 01 2015 17:10
@HermanFassett what punctuation ?
parv112281
@parv112281
Oct 01 2015 17:10
Just wanting to ask if there is something I'm missing or if its a bug in the tutorial
Herman Fassett
@HermanFassett
Oct 01 2015 17:12
@parv112281 the instructions say "You'll need to remove punctuation and turn everything lower case in order to check for palindromes."
Daniel Drasdo
@danieldrasdo
Oct 01 2015 17:12
@TheHighPriestess , did that help at all?
Herman Fassett
@HermanFassett
Oct 01 2015 17:12
Wait, @NikosAnat is what I meant
Sorry @parv112281
Elizabeth Hatleli
@TheHighPriestess
Oct 01 2015 17:13
@danieldrasdo Yes...and I think I told @fractal-mind something tht wsa incorrct about spaces
NikosAnat
@NikosAnat
Oct 01 2015 17:14
@HermanFassett I understand thanks
CamperBot
@camperbot
Oct 01 2015 17:14
nikosanat sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 252 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Elizabeth Hatleli
@TheHighPriestess
Oct 01 2015 17:14
@danieldrasdo thank you
CamperBot
@camperbot
Oct 01 2015 17:14
thehighpriestess sends brownie points to @danieldrasdo :sparkles: :thumbsup: :sparkles:
:warning: thehighpriestess already gave danieldrasdo points
Herman Fassett
@HermanFassett
Oct 01 2015 17:14
Ok @NikosAnat . And it's easiest if you use regex... :P
Daniel Drasdo
@danieldrasdo
Oct 01 2015 17:15
I usually use \s for spaces, but I'm fairly new to regex too
Herman Fassett
@HermanFassett
Oct 01 2015 17:15
I just use a space :D
Elizabeth Hatleli
@TheHighPriestess
Oct 01 2015 17:16
I don't understand why that link had that circle character there for a space. It does not work
Once I deleted it....it worked fine and I just passed the bonfire
So...@fractal-mind ...I did get some good help from that link. HOWEVER, the little black circle that it says is a space...isn't.
jbelina
@jbelina
Oct 01 2015 17:17
@gaindacode I started skipping around a little, I've finished the Basic algorithms and the Intermediate through #4 and need to start on #5 Search and Replace
Craig Morrison
@frogmorton
Oct 01 2015 17:18
@Coira Thanks for checking it out!
CamperBot
@camperbot
Oct 01 2015 17:18
frogmorton sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:star: 251 | @coira | http://www.freecodecamp.com/coira
Will Moody
@willmoody
Oct 01 2015 17:18
@TheHighPriestess Yeah, in looking over their examples, it seems like they use that dot for a placeholder sometimes? If you scroll down a little to where they break down the expression, they don't use the dot
Daniel Drasdo
@danieldrasdo
Oct 01 2015 17:18
Mind if you resubmit your sol and add me as a pairer @TheHighPriestess ? my UN is danieldrasdo
parv112281
@parv112281
Oct 01 2015 17:19
Here is my code for Waypoint: Create a JavaScript Slot Machine: slotOne = Math.floor(Math.random() 3 - 1 + 1) + 1;
slotTwo = Math.floor(Math.random()
3 - 1 + 1) + 1;
slotThree = Math.floor(Math.random() * 3 - 1 + 1) + 1;
Daniel Drasdo
@danieldrasdo
Oct 01 2015 17:19
wiki formatting
CamperBot
@camperbot
Oct 01 2015 17:19

:point_right: code formatting [wiki]

Inline code

alt text

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks and then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Herman Fassett
@HermanFassett
Oct 01 2015 17:20
@parv112281 Math.floor(Math.random() * (3 - 1 + 1)) + 1;
Elizabeth Hatleli
@TheHighPriestess
Oct 01 2015 17:23
@fractal-mind once I removed the dot..and just put a space there...i passed the bonfire. I did find the page helpful though. I read it through carefully.
Tamer Nasser
@tamerNasser
Oct 01 2015 17:24
I have to start working on final website project, c# ASP .net. I can't find any idea. Any ideas guys?
jbelina
@jbelina
Oct 01 2015 17:24

Does anyone else wish they had learned how to use the JavaScript console from "Automated Testing and Debugging" to use while they were working on their algorithms? I'd much rather use console.log to see what's going on inside a function rather than adding a return statement in the middle of a function to figure out why I'm not getting the return results I was expecting...

(For instance, with the palindrome exercise when I forgot to assign the results of one function into the string I was using later for comparisons, so I had uppercase letters or punctionation left over that I wasn't expecting.)

Herman Fassett
@HermanFassett
Oct 01 2015 17:25
Well @jbelina I already knew how to use it :P
jbelina
@jbelina
Oct 01 2015 17:25
@HermanFassett Gee, Thanks! :P
CamperBot
@camperbot
Oct 01 2015 17:25
jbelina sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 253 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Herman Fassett
@HermanFassett
Oct 01 2015 17:25
xD
jbelina
@jbelina
Oct 01 2015 17:28
@Jepz Thanks for the link to jsperf!
CamperBot
@camperbot
Oct 01 2015 17:28
jbelina sends brownie points to @jepz :sparkles: :thumbsup: :sparkles:
:star: 209 | @jepz | http://www.freecodecamp.com/jepz
Jason Fernandes
@whereissql
Oct 01 2015 17:29
@jbelina yeah. thankfully someone brought it up while i was lurking
so much more easier
Herman Fassett
@HermanFassett
Oct 01 2015 17:30
Hmm, I know I brought it up once :P
Jason Fernandes
@whereissql
Oct 01 2015 17:30
lol
Jason Fernandes
@whereissql
Oct 01 2015 17:30
idk who it was, so sure it was you
Herman Fassett
@HermanFassett
Oct 01 2015 17:30
Mmm
Jason Fernandes
@whereissql
Oct 01 2015 17:31
oh nice. that's cool
Daniel
@clevadani
Oct 01 2015 17:48
hey guys I keep getting this message on my browser "Oops! Something went wrong. Please try again later"
Any solution please
Jason Fernandes
@whereissql
Oct 01 2015 17:48
nope
we've been getting that too
we've = i've
Abhisek Pattnaik
@abhisekp
Oct 01 2015 18:01
@whereissql SQL is gone due to too many injections. ;)
Jason Fernandes
@whereissql
Oct 01 2015 18:02
lol
JeremyWBean
@JeremyWBean
Oct 01 2015 18:08
Is anyone out there able to help me with a LEARNYOUNODE problem?
Joshua Abu
@Absolutestunna
Oct 01 2015 18:08
how do you sign in with the new codepen.io?
Herman Fassett
@HermanFassett
Oct 01 2015 18:10
Joshua Abu
@Absolutestunna
Oct 01 2015 18:11
you've got to pay for codepen now?
@HermanFassett
Herman Fassett
@HermanFassett
Oct 01 2015 18:11
No, there's still the free option
Joshua Abu
@Absolutestunna
Oct 01 2015 18:12
The link you sent doesn't have a sign in page
@HermanFassett
Herman Fassett
@HermanFassett
Oct 01 2015 18:12
Do you want sign in or sign up?
Hmm
If it sends you to that page, that means you're already signed in
Joshua Abu
@Absolutestunna
Oct 01 2015 18:13
@HermanFassett don't worry about it. I figured it out..lol. I was already signed in. i never signed out.
Herman Fassett
@HermanFassett
Oct 01 2015 18:14
;P
Daniel Drasdo
@danieldrasdo
Oct 01 2015 18:14
Maybe @JeremyWBean , which one is it particularly?
Anything below Modules I may be able to help with.
JeremyWBean
@JeremyWBean
Oct 01 2015 18:16
@danieldrasdo Thanks. I am actually on the last one: JSON API Server. I am pretty sure my solution is correct but it keeps saying error.... socket hang up.
CamperBot
@camperbot
Oct 01 2015 18:16
jeremywbean sends brownie points to @danieldrasdo :sparkles: :thumbsup: :sparkles:
:star: 275 | @danieldrasdo | http://www.freecodecamp.com/danieldrasdo
Joshua Abu
@Absolutestunna
Oct 01 2015 18:16
what code editor do you recommend for productivity?
@HermanFassett thank you
CamperBot
@camperbot
Oct 01 2015 18:16
absolutestunna sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 255 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Daniel Drasdo
@danieldrasdo
Oct 01 2015 18:18
Good luck @JeremyWBean , these node challenges feel like the Boss level of FreeCodeCamp.
JeremyWBean
@JeremyWBean
Oct 01 2015 18:20
I don't feel like they are very well explained. I have felt very comfortable with everything else, no so much with these. It's like "here is a nail... this is kind of what it does... if you would like to no more about nails, point your browser here... okay, no build a house!" :)
Ingrid
@voodoobettie
Oct 01 2015 18:23
HI all, I have a quick question about sorting arrays (don't worry, not a node question! :))
I understand that arrays are sorted alphabetically. I did some digging, the function that people suggest to use (a-b) seems to be the way to go to sort the array but I don't get why you would use it because if you're trying to sort, isn't that going to subtract the values? I'm confused about that.
function sortNumber(a,b) {
    return a - b;
}

var numArray = [140000, 104, 99];
numArray.sort(sortNumber);
alert(numArray.join(","));
Hans van Riet
@hansinla
Oct 01 2015 18:26
This message was deleted
Ingrid
@voodoobettie
Oct 01 2015 18:27
ah ok. That would make sense but it's sure strange. I hadn't heard of using it that way before (not that I'm an expert)
thanks
CamperBot
@camperbot
Oct 01 2015 18:28
if you want to thank someone, put an @ before their name!
Shair Mir
@ShairMir
Oct 01 2015 18:31
bf where do i belong
CamperBot
@camperbot
Oct 01 2015 18:31

:fire:Bonfire: Where do I belong :link:

function where(arr, num) {
  // Find my place in this sorted array.
  return num;
}

where([40, 60], 50);

Return the lowest index at which a value (second argument) should be inserted into a sorted array (first argument).

more info:  bf details | bf links | hint

Shair Mir
@ShairMir
Oct 01 2015 18:31
hint
CamperBot
@camperbot
Oct 01 2015 18:31
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Hans van Riet
@hansinla
Oct 01 2015 18:34

@voodoobettie This is straight for the MDN website:
If compareFunction is supplied, the array elements are sorted according to the return value of the compare function. If a and b are two elements being compared, then:

If compareFunction(a, b) is less than 0, sort a to a lower index than b, i.e. a comes first.
If compareFunction(a, b) returns 0, leave a and b unchanged with respect to each other, but sorted with respect to all different elements. Note: the ECMAscript standard does not guarantee this behaviour, and thus not all browsers (e.g. Mozilla versions dating back to at least 2003) respect this.
If compareFunction(a, b) is greater than 0, sort b to a lower index than a.
compareFunction(a, b) must always return the same value when given a specific pair of elements a and b as its two arguments. If inconsistent results are returned then the sort order is undefined.

Ben Heavner
@bheavner
Oct 01 2015 18:35
Hi all - I'm confused by forEach... Why doesn't this return [2, 5] and [3, [[4]]]?
[[2, 5], [3, [[4]]]].forEach(function(element) {
    return element;
});
Instead, I get "undefined"
Coira Ellison
@Coira
Oct 01 2015 18:37
hey @bheavner forEach goes through each element in an array and performs a function on it (the one you passed to forEach)
@bheavner it doesn't return anything (except undefined), it just performs that function
Ben Heavner
@bheavner
Oct 01 2015 18:38
ah. so I'd need to do something like
var foo = [];
[[2, 5], [3, [[4]]]].forEach(function(element) {
    foo.push(element);
});
console.log(foo);
Aayush Kapoor
@aayushkapoor206
Oct 01 2015 18:39
Hello World
CamperBot
@camperbot
Oct 01 2015 18:39

welcome to FreeCodeCamp @aayushkapoor206!

Ben Heavner
@bheavner
Oct 01 2015 18:39
thx @Coira
CamperBot
@camperbot
Oct 01 2015 18:39
bheavner sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:star: 252 | @coira | http://www.freecodecamp.com/coira
Coira Ellison
@Coira
Oct 01 2015 18:39
@bheavner i think that would work, but there are functions that will automatically push elements for you
i need to look up which ones tho
Ben Heavner
@bheavner
Oct 01 2015 18:40
@Coira that was just a toy example, but I'm curious about those functions now that you mention them!
let me know if you do look!
Coira Ellison
@Coira
Oct 01 2015 18:41
i have them written down, but where i have no idea! back in a few minutes
@bheavner ok, you might want to look at filter() " Runs the given function on every item in the array and returns an array of all
items for which the function returns true."
and map() "Runs the given function on every item in the array and returns the result of each
function call in an array."
Ben Heavner
@bheavner
Oct 01 2015 18:46
Will do! Thanks again!
CamperBot
@camperbot
Oct 01 2015 18:46
if you want to thank someone, put an @ before their name!
Joshua Abu
@Absolutestunna
Oct 01 2015 18:47
I'm trying to have multiple conditions in one if statement. e.g if value = 1,2,24,15,11, do this? How do I write that code?
Coira Ellison
@Coira
Oct 01 2015 18:47
@Absolutestunna use && (which is AND) or || (which is OR)
e.g. if (value === 1 || value === 2 || ... etc...)
Jose E. Pimentel
@jedpimentel
Oct 01 2015 18:53
@Absolutestunna you could also wrap the logic inside a function, if(valueIsOK(val)), where valueIsOK(val) could just be a switch statment (if you're feeling lazy)
Joshua Abu
@Absolutestunna
Oct 01 2015 18:54
@jedpimentel I'm feeling lazy..lol. But i don't know how to implement your solution.
lol
Chris
@Shifthawke
Oct 01 2015 19:04
I have a question!
Has anyone bought this book
JavaScript and jQuery: Interactive Front-End Web Development Hardcover
Daniel
@clevadani
Oct 01 2015 19:15
hey guys, I'm doing the bonfire and in the reverse a string part I'm stuck
Any advice
Jon Love
@jayvolr
Oct 01 2015 19:20
The three methods you'll probably be using are split(), reverse(), and join()
maftoun95
@maftoun95
Oct 01 2015 19:27
@Shifthawke Oh yea, Thats my favorite text book ive got. Its really well organized and designed. im a fan
That same author also wrote a book called HTML & CSS
Nick Hess
@hessproject
Oct 01 2015 19:29
looking for a hand on my calculator zipline http://codepen.io/hessproject/pen/GpNMwj?editors=001
the calculator seems to work, but I’m trying to make it so that if the last entered character isn’t a digit you can’t hit another function
so no — or ++ or ** for example
however, in the code in commented out, when I uncomment it the whole functionality of the calculator is lost and it will only take one digit, and i’m not sure why
duan walker
@duanwalker
Oct 01 2015 19:30
hey guys! any advice on where to get background images for the local weather BF?
Juan Riquelme
@soulchainer
Oct 01 2015 19:32
http://acasaprogramming.ro/web-designers-ultimate-list-of-free-resources/#stock-photos And also, Flickr filtering with creative commons permisive licenses, @duanwalker. Always respect the work of others.
Chris
@Shifthawke
Oct 01 2015 19:32
@maftoun95 I heard that he did. I think I'll pick that one up too if it's worth it.
Though I have a sneaky suspicion my main piece will be c++
duan walker
@duanwalker
Oct 01 2015 19:33
@soulchainer thanks alot! cheers!
CamperBot
@camperbot
Oct 01 2015 19:33
duanwalker sends brownie points to @soulchainer :sparkles: :thumbsup: :sparkles:
:star: 314 | @soulchainer | http://www.freecodecamp.com/soulchainer
Juan Riquelme
@soulchainer
Oct 01 2015 19:39

@hessproject When you are doing:

lastChar == "+"||"-"||"*"||"/"

I think (didn't test it) you aren't doing what you think you are doing.
You are doing this:

(lastChar == "+") || "-" || "*" ||"/"

For that two checks I would suggest you to do it this way:

"+-*/".indexOf(lastChar) != -1

And the same for the other check. Plus it's clearer.

Nick Hess
@hessproject
Oct 01 2015 19:43
you’re right, when i put the "+"||"-"||"*"||”/“ in parentheses it works as I intended
but i do like your way better. thanks a lot @soulchainer
CamperBot
@camperbot
Oct 01 2015 19:45
hessproject sends brownie points to @soulchainer :sparkles: :thumbsup: :sparkles:
:star: 315 | @soulchainer | http://www.freecodecamp.com/soulchainer
Plessey Mathews
@PlesseyMathews
Oct 01 2015 19:47
Anyone knows why the button in challenge 77 needs to use 2 Bootstrap classes - btn and btn-block. Since btn-block alone does the job why insist on having btn. Thanks
CamperBot
@camperbot
Oct 01 2015 19:47
if you want to thank someone, put an @ before their name!
Nick Hess
@hessproject
Oct 01 2015 19:56
@PlesseyMathews because btn-block alone doesn’t do the job, it doesn’t have all of the functionality that .btn does. .btn will give the button its basic functionality, btn-block just adds extra on top
the full CSS file for bootstrap is here, if you want to look what .btn and .btn-block specifically does https://github.com/twbs/bootstrap/blob/master/dist/css/bootstrap.css
here are all the things that .btn adds
.btn {
  display: inline-block;
  padding: 6px 12px;
  margin-bottom: 0;
  font-size: 14px;
  font-weight: normal;
  line-height: 1.42857143;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  -ms-touch-action: manipulation;
      touch-action: manipulation;
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  background-image: none;
  border: 1px solid transparent;
  border-radius: 4px;
}
but here is all that btn-block does
.btn-block {
  display: block;
  width: 100%;
}
seewhen
@seewhen
Oct 01 2015 20:11
Best feeling in the world: Joining chat to get help with a problem, then understanding what's wrong when writing it out. Man, that can help some times :)
Star Cherrix
@Sparklepaws
Oct 01 2015 20:39
So, I've got issues with this geolocation + simpleWeather thing but I can't really figure out why it's not working:
function loadWeather(position1,position2){
    $.simpleWeather({
        location: position1,
                woeid: position2,
        unit: 'f',
        success: function() {
                    $("#weather1").html("<p>This worked</p>");
                },
        error: function(error) {
                    console.log("Error")
                }
    });
}

$(document).ready( function(){
    navigator.geolocation.getCurrentPosition(function(position) {
    loadWeather(position.coords.latitude,position.coords.longitude);
    })
});
jlind062
@jlind062
Oct 01 2015 20:43
This message was deleted
This message was deleted
maftoun95
@maftoun95
Oct 01 2015 20:59
Bonfire-seek-and-destroy hint
Michael Lefkowitz
@lfkwtz
Oct 01 2015 21:06
Anyone finish Bonfire: Pairwise?
Daniel Drasdo
@danieldrasdo
Oct 01 2015 21:06
I think I have, need some help?
Michael Lefkowitz
@lfkwtz
Oct 01 2015 21:06
I'm looking at the results and one says: pairwise([0, 0, 0, 0, 1, 1], 1) should return 10.');
I thought I understood what they are looking for, but how would you return 10 on that? if you're looking for the sum of indices that equal the number (1 in this instance)
I would think the sum would be index 3 and index 4 --- 0 and 1
so 7. but how would you get 10?
Daniel Drasdo
@danieldrasdo
Oct 01 2015 21:08
Let's private chat, and let me refresh my memory on the bf
Kouty
@koouty
Oct 01 2015 21:14

@Dadsaster @Everybody
I try uninfinitely
But It is no good!

function titleCase(str) {
  str = str.toLowerCase();
  str = str.split('');
  var stur = [];
  for (i = 1; i<str.length; i++) {
    if((str[i - 1]===" ") && (str[i].match([/a-b/i]))) {
      str[i] = str[i].toUpperCase;
      stur.push(str[i]);

    }
    else if (i === 0 && (str[i].match([/a-b/i]))) {
      str[i] = str[i].toUpperCase;
      stur.push(str[i]);

    }
    else {stur.push(str[i]);}
    stur = stur.join('');
    str = stur;
    return str;
  }
};

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

The main problem is that I don't know why the so called toUppercase() method has no influence in the case.
Anyway the present code is lightly more elegant. But all help is welcome!

Coira Ellison
@Coira
Oct 01 2015 21:15
@navyvel quick look, i think you missed () off toUpperCase
Daniel Drasdo
@danieldrasdo
Oct 01 2015 21:19
thanks @leftynaut
CamperBot
@camperbot
Oct 01 2015 21:19
danieldrasdo sends brownie points to @leftynaut :sparkles: :thumbsup: :sparkles:
:star: 271 | @leftynaut | http://www.freecodecamp.com/leftynaut
Boris
@boris-in-london
Oct 01 2015 21:22
function largestOfFour(arr) {

  largestNumber = [];

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

    innerLarge = 0;

    for(var n = 0; arr[i].length - 1 > n; n++) {

      if(arr[i][n] > arr[i][(n + 1)] {
        innerLarge = arr[i][n];
        }
      else if(innerLarge > arr[i][(n + 1)]) {
        continue;
        }
      else {
        innerLarge = arr[i][(n + 1)];
        }
      largestNumber.push(innerLarge);

    } 
  }
  return largestNumber;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
maftoun95
@maftoun95
Oct 01 2015 21:22
Im working on the bonfire seek and destroy which involves an unset number of arguments. The hint points me to the arguments object page which talks about pulling from the arguments object to make a separate array but there are 2 ways shown. Does anyone know why we would use one over the other??
blob
Boris
@boris-in-london
Oct 01 2015 21:24
so... my console is spitting out unknown token { i have no idea what it's on about. but i think i made a syntax error somewhere, much obliged if you can spot it.
DTing
@dting
Oct 01 2015 21:25
@maftoun95 if you dont know how many arguments, your function accepts a variable number of arguments, you much use the arguments object
DJ
@qualitymanifest
Oct 01 2015 21:25
@boris-in-london line 11, you didn't close an if statement
DJ Runas
@djrunas
Oct 01 2015 21:26
Does anyone have any good resources for understanding the Array.filter() function?
Boris
@boris-in-london
Oct 01 2015 21:26
@qualitymanifest haha you've done it! mwah! thank you.
CamperBot
@camperbot
Oct 01 2015 21:26
boris-in-london sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 237 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
DJ Runas
@djrunas
Oct 01 2015 21:27
Been thrusting away at the mozilla documentation, but I guess I don’t grasp it enough to complete the Seek and Destroy bonfire.
Daniel Drasdo
@danieldrasdo
Oct 01 2015 21:27
@qualitymanifest , how'd you do that so fast?
DJ
@qualitymanifest
Oct 01 2015 21:28
no problem. just so you know for the future, all i did was put your code on repl.it, and it had a red box next to line 11 indicating there was an issue on that line.
@danieldrasdo ^
Daniel Drasdo
@danieldrasdo
Oct 01 2015 21:28
Thanks @qualitymanifest
CamperBot
@camperbot
Oct 01 2015 21:28
danieldrasdo sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 238 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
DJ
@qualitymanifest
Oct 01 2015 21:28
yeah i'm not some sort of genius haha
DTing
@dting
Oct 01 2015 21:29
@djrunas did you look at the examples on the mdn page? also you might consider doing it without array filter to help you understand the logic. then make the code more concise by using array.filter
DJ Runas
@djrunas
Oct 01 2015 21:29
@qualitymanifest , you’re a genius to me (✿ ◕‿◕) ᓄ✂╰U╯
Chahan Shah
@Chahanshah
Oct 01 2015 21:29
@boris-in-london if you use an online interpreter like repl.it you can find syntax errors like those a lot faster as it points them out for you
DJ Runas
@djrunas
Oct 01 2015 21:32
@dting trying to go through it without .filter() right now!
Kouty
@koouty
Oct 01 2015 21:36
@Coira Right!
But the output move from "I'm a little tea pot" to "'".
I have a serious logical problem. .when I turn the loop in my mind, first the sentence is all a lowercase sentence, 1- the "i" correspond to the else if proposition and become "i" to upper case that is "I", at this step it is pushed to the empty array called stur and stur become["I"]. 2- the "'" is concerned by the else proposition and stur become ["I", "'"].
After the end of the loop when i is str.length - 1, I expected to convert the stur array to a new sentence and that is not the case.
Boris
@boris-in-london
Oct 01 2015 21:40
@Chahanshah thanks buddy... i've bookmarked it.
CamperBot
@camperbot
Oct 01 2015 21:40
boris-in-london sends brownie points to @chahanshah :sparkles: :thumbsup: :sparkles:
:star: 266 | @chahanshah | http://www.freecodecamp.com/chahanshah
Coira Ellison
@Coira
Oct 01 2015 21:42
@navyvel i think you've made it a little more complicated than it needs to be. you can split the sentence by spaces so your array has whole words in
then capitalize each word and push that word onto your new array
OverTheNeptune
@OverTheNeptune
Oct 01 2015 21:44
@djrunas Array.filter() goes through the entire array and tests each element to see if it should be filtered out or not. It test each element using the function you define in the Array.filter() call. Here's a simple example that tries to break down what's going on.
//Here's an array of numbers that we want to filter
var originalArray = [0, -1, 1, -2, 2, -3, 3];

//Here's a function that tests if a number is greater than zero
function isGreaterThanZero(num) {
    if(num > 0) 
        return true;
    else 
        return false;
}

//Here I filter my originalArray using the isGreaterThanZero function
//and assign the result to filteredArray
var filteredArray = originalArray.filter(isGreaterThanZero);

//filterArray will now contain [1, 2, 3 ]
console.log(filteredArray);
DTing
@dting
Oct 01 2015 21:46

You can think of filter as an instance function that makes:

function filter(arr, conditionFn) {
  var result = [];
  for (var i = 0; i < arr.length; i++) {
    if (conditionFn(arr[i])) {
      result.push(arr[i]);
    }
  }
  return result;
}
filter(arr, conditionFn);

more concise:

arr.filter(conditionFn);
OverTheNeptune
@OverTheNeptune
Oct 01 2015 21:46

@djrunas We could do the exact same thing by defining our function inside the array.filter() call like this.

var originalArray = [0, -1, 1, -2, 2, -3, 3];

var filteredArray = originalArray.filter(function(num) {
    if(num > 0) 
        return true;
    else 
        return false;
})

filteredArray would again contain [1, 2, 3]. I don't know if that helps at all.

Kouty
@koouty
Oct 01 2015 21:46
@Coira
In the past days it's what I make.
But even with your technical I wasn't successful. the toUpperCase() method don't work.
Karolis
@Luomint
Oct 01 2015 21:47
if anyone has any comments about this solution to bonfire Diff Two Arrays, ty
function diff(arr1, arr2) {
  var newArr = [];
  var newArr1 =[];
  var netArr = [];
  var finalArr = [];
  i = 0;

 for(var i = 0; i < arr2.length; i++) {
  if (arr1[i] !== arr2[i]){

    newArr.push(arr1[i]);
    newArr = newArr.filter(Boolean);

  }

 }  
  for(var i = 0; i < arr2.length; i++) {
  if (arr2[i] !== arr1[i]){

    newArr1.push(arr2[i]);
    newArr1 = newArr1.filter(Boolean);

  }

 }    
  netArr = newArr.concat(newArr1);


  for (var i = 0; i < arr1.length + arr2.length; i++)
  if(arr1.indexOf(netArr[i]) == -1 || arr2.indexOf(netArr[i]) == -1) {

  finalArr.push(netArr[i]);

  };

  return finalArr.filter(Boolean);

}
DTing
@dting
Oct 01 2015 21:50
newArr1.filter(Boolean);
DJ Runas
@djrunas
Oct 01 2015 21:50
thanks @OverTheNeptune and @dting for the help!
CamperBot
@camperbot
Oct 01 2015 21:50
djrunas sends brownie points to @overtheneptune and @dting :sparkles: :thumbsup: :sparkles:
:star: 213 | @overtheneptune | http://www.freecodecamp.com/overtheneptune
:star: 1292 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Oct 01 2015 21:50
this filters out falsy values
im not sure that's what you are looking to do
Coira Ellison
@Coira
Oct 01 2015 21:52
@navyvel try changing split('') to split(' ') (i.e split on a space character), and you don't need match. rework the code inside your for loop to capitalize words
DJ Runas
@djrunas
Oct 01 2015 21:53
Oh, @dting, your guys’ examples just helped me understand .filter() is all.
Coira Ellison
@Coira
Oct 01 2015 21:53
you can do it in stages. first split the original string, then in the for-loop push the words without changing them onto a new array
OverTheNeptune
@OverTheNeptune
Oct 01 2015 21:53
@djrunas Glad to help. :)
Coira Ellison
@Coira
Oct 01 2015 21:54
then once you've done that, work out how to capitalize (hint: one way of doing it is to use charAt() and toUpperCase())
DTing
@dting
Oct 01 2015 21:54
@djrunas oh my comment about filtering out falsy values was for @Luomint
DJ Runas
@djrunas
Oct 01 2015 21:54
Oh, LOL
Mmmk dting
Karolis
@Luomint
Oct 01 2015 21:56
@dting yea I left too many filters, but I needed one to get rid of nill values
Kouty
@koouty
Oct 01 2015 21:56
@Coira Yes I know but here is not the problem. Anyway I'm grateful you try hard to help me (-:|]
Karolis
@Luomint
Oct 01 2015 21:56
the last one is enough
DTing
@dting
Oct 01 2015 21:57
@Luomint the other problem that stands out is if arr1 is larger than arr2 im guessing that your code will probably fail under certain cases
Karolis
@Luomint
Oct 01 2015 21:58
@dting yea, I can probably get around that by doing arr1.length + arr2.length and iterate too many times though it's very inelegant
Coira Ellison
@Coira
Oct 01 2015 22:02
@navyvel alright, keep going, you can do this :)
Kouty
@koouty
Oct 01 2015 22:03

@Coira
here is the code with your ameliorations:

function titleCase(str) {
  str = str.toLowerCase();
  str = str.split(' ');
  for (i = 0 ; i < str.length; i++) {
    return (str[i].charAt(0).toUpperCase + str.slice(1));
  }
  str = str.join('');
 return str;
};

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

and the output is: "function toUpperCase() {\n [native code]\n}a,little,tea,pot"
the meaning of this message is mysterious for me.

Herman Fassett
@HermanFassett
Oct 01 2015 22:04
@navyvel it's .toUpperCase()
Rex Schrader
@SaintPeter
Oct 01 2015 22:04
@navyvel You're using return - return leaves the function immeidatly. Instead what you want to do is assign the number to str[i]
Herman Fassett
@HermanFassett
Oct 01 2015 22:05
Don't forget your parentheses
Rex Schrader
@SaintPeter
Oct 01 2015 22:05
@navyvel
for (i = 0 ; i < str.length; i++) {
    str[i] = str[i].charAt(0).toUpperCase + str.slice(1);
  }
DTing
@dting
Oct 01 2015 22:06
@Luomint My suggestion is to iterate over the first array. check if the values are in the second array and push those that are not into a result array. then iterate over the second array push the elements not in the first array into the result arrays. then return the result array
also str = str.join(' '); @navyvel after @SaintPeter 's correction
Karolis
@Luomint
Oct 01 2015 22:08
@dting thanks, it sounds more logical
CamperBot
@camperbot
Oct 01 2015 22:08
luomint sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1294 | @dting | http://www.freecodecamp.com/dting
Kouty
@koouty
Oct 01 2015 22:09
@SaintPeter
You shoot at goal! Now I begin to modify my thinking.
Rex Schrader
@SaintPeter
Oct 01 2015 22:10
@navyvel As a minor point - you're breaking str in an array then assigning it back to str - for clarity it would be better to create a new variable arr and assign it to that. Just to be clear.
Daniel
@clevadani
Oct 01 2015 22:10
Hey guys, I'm still stuck in the "Bonfire: Reverse a String" section. Any ideas on how to proceed?
Rex Schrader
@SaintPeter
Oct 01 2015 22:10
@clevadani Got code?
wiki format
CamperBot
@camperbot
Oct 01 2015 22:10

:point_right: code formatting [wiki]

Inline code

alt text

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks and then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄