These are chat archives for FreeCodeCamp/Help

14th
Oct 2017
heroiczero
@heroiczero
Oct 14 2017 04:02
@sjames1958gm @daddycardona @Manish-Giri @khaduch @GitHub-Henry @Gersho @DarrenfJ TY for the usual people helping people out.
CamperBot
@camperbot
Oct 14 2017 04:02
heroiczero sends brownie points to @sjames1958gm and @daddycardona and @manish-giri and @khaduch and @github-henry and @gersho and @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 3365 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 6650 | @manish-giri |http://www.freecodecamp.com/manish-giri
:cookie: 539 | @gersho |http://www.freecodecamp.com/gersho
:cookie: 385 | @daddycardona |http://www.freecodecamp.com/daddycardona
:cookie: 388 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 8552 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 2128 | @darrenfj |http://www.freecodecamp.com/darrenfj
Albert Cardona II
@daddycardona
Oct 14 2017 04:43
@sjames1958gm @daddycardona @Manish-Giri @khaduch @GitHub-Henry @Gersho @DarrenfJ @heroiczero thank you to all my sweet hearts LOL is it February yet LOL
CamperBot
@camperbot
Oct 14 2017 04:43
daddycardona sends brownie points to @sjames1958gm and @manish-giri and @khaduch and @github-henry and @gersho and @darrenfj and @heroiczero :sparkles: :thumbsup: :sparkles:
:cookie: 389 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 8553 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 1877 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 3366 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 6651 | @manish-giri |http://www.freecodecamp.com/manish-giri
:cookie: 540 | @gersho |http://www.freecodecamp.com/gersho
:star2: 2129 | @darrenfj |http://www.freecodecamp.com/darrenfj
Albert Cardona II
@daddycardona
Oct 14 2017 04:44
@ericmiller777 thank you too :)
CamperBot
@camperbot
Oct 14 2017 04:44
daddycardona sends brownie points to @ericmiller777 :sparkles: :thumbsup: :sparkles:
:cookie: 319 | @ericmiller777 |http://www.freecodecamp.com/ericmiller777
Albert Cardona II
@daddycardona
Oct 14 2017 04:49
tomorrow I will take on the Binary Agents I had someone help explain recursion better :) and finished up steam roller :)
Eric Miller
@ericmiller777
Oct 14 2017 05:00
@daddycardona thanks
CamperBot
@camperbot
Oct 14 2017 05:00
ericmiller777 sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 386 | @daddycardona |http://www.freecodecamp.com/daddycardona
Henry
@GitHub-Henry
Oct 14 2017 05:09
@daddycardona hello, and ty for the brownies
CamperBot
@camperbot
Oct 14 2017 05:09
github-henry sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 387 | @daddycardona |http://www.freecodecamp.com/daddycardona
Eric Miller
@ericmiller777
Oct 14 2017 09:08
@gishy1 sorry, did you figure it out? Try resetting your code.
gishy1
@gishy1
Oct 14 2017 11:12
@ericmiller777 ya bro was that the longest word challenge eventually, now the title challenge is the next.
hello wanted to ask can you pop individual characters of a string in an array?
shutup
@shutupchigo
Oct 14 2017 11:15
Hi, need help with countryapi json data, anyone care to help?
Sorin Ruse
@sorinr
Oct 14 2017 11:27
@shutupchigo what api?
how would I display Name: China and so forth?
bill zhang
@pipilan2017
Oct 14 2017 11:55
help?how to删除所有的注释标记
korzo
@korzo
Oct 14 2017 11:57
@shutupchigo data.Response[0].Name
@shutupchigo where data is what you get from JSON.parse
Ken Haduch
@khaduch
Oct 14 2017 11:59
@daddycardona - thanks for the cheers, and good luck with the recursion - it's tricky to understand that concept sometimes!
CamperBot
@camperbot
Oct 14 2017 11:59
khaduch sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 388 | @daddycardona |http://www.freecodecamp.com/daddycardona
Ken Haduch
@khaduch
Oct 14 2017 12:00
@heroiczero - to you and @DarrenfJ and the "regulars" - have a great day and thanks for keeping the rooms going!
CamperBot
@camperbot
Oct 14 2017 12:00
khaduch sends brownie points to @heroiczero and @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1879 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 2131 | @darrenfj |http://www.freecodecamp.com/darrenfj
gishy1
@gishy1
Oct 14 2017 12:03
image.png
korzo
@korzo
Oct 14 2017 12:04
@gishy1 You return from inside the loop
gishy1
@gishy1
Oct 14 2017 12:04
not understanding @korzo
you mean i remove the return a ?
korzo
@korzo
Oct 14 2017 12:05
@gishy1 No
@gishy1 return arr[a][0].toUpperCase();
gishy1
@gishy1
Oct 14 2017 12:06
@korzo i remove it ?
korzo
@korzo
Oct 14 2017 12:07
@gishy1 It will return first letter from first word
You have to replace it
arr[a] is current word. And you have to modify it and uppercase first letter
gishy1
@gishy1
Oct 14 2017 12:08
@korzo im not unuderstanding you because
korzo
@korzo
Oct 14 2017 12:12
@gishy1
function titleCase(str) {

    var arr = str.split(' ');
  for (var a = 0; a < arr.length; a++) {
    arr[a] = arr[a].toLowerCase();
    arr[a] = arr[a][0].toUpperCase() + arr[a].substr(1);
  } 

  return arr.join(' ');

}
@gishy1
arr[a] = arr[a].toLowerCase(); lower case the word
@gishy1 arr[a] = arr[a][0].toUpperCase() + arr[a].substr(1);
then uppercase first letter of word , add rest of the word and assign it back to arr[a]
gishy1
@gishy1
Oct 14 2017 12:21
i thought the for loop would run through and capitalise the first letters in each of the strings?
korzo
@korzo
Oct 14 2017 12:23
@gishy1 return returns from function.
@gishy1 toLowerCase and to UpperCase return new string, so you have to assign it
str.toLowerCase() does nothing
you have to assign it back:
str = str.toLowerCase()
gishy1
@gishy1
Oct 14 2017 12:41
@korzo bro im sorry im not fully getting it
@korzo t
arr[a] = arr[a].toLowerCase();
arr[a] = arr[a][0].toUpperCase() + arr[a].substr(1);
part is confusing me
korzo
@korzo
Oct 14 2017 13:50
@gishy1
function titleCase(str) {
  var arr = str.split(' ');
  for (var a = 0; a < arr.length; a++) {
    var word = arr[a];
    word = word.toLowerCase();
    var firstLetter = word[0].toUpperCase();
    var restOfTheWord = word.substr(1);
    var finalWord = firstLetter + restOfTheWord;
    arr[a] = finalWord;
  }
  return arr.join(' ');
}
@alpox thanks
CamperBot
@camperbot
Oct 14 2017 13:50
korzo sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1356 | @alpox |http://www.freecodecamp.com/alpox
alpox
@alpox
Oct 14 2017 13:50
@korzo np :D
Georgia
@georgiawang5332
Oct 14 2017 15:17
(Where (here is the title and the answer, you can refer to this website to see the meaning of the whole sentence)? -----> includes (inputs [inputs.length-1] === true https://stackoverflow.com/questions/40630580/javascript-to-fixed-method)))
inputs.length-1 ----> Why subtract 1?
gishy1
@gishy1
Oct 14 2017 15:25
@korzo thanks bro let me try and work through it
CamperBot
@camperbot
Oct 14 2017 15:25
gishy1 sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 624 | @korzo |http://www.freecodecamp.com/korzo
Moisés Man
@moigithub
Oct 14 2017 15:34
@georgiawang5332 cuz array indices start counting from 0
but length counts from 1
soo arr= [1,2,3,4] <-- u have 4 elements (length)
and element 4 is on arr[3] (index 3)
mukul23
@mukul23
Oct 14 2017 15:40
1.png
I am getting an error message for so many days on the beta.freecodecamp.org maps section
And this is the same error I am getting on my friend's laptop too
knight2
@knight2
Oct 14 2017 17:01
FREEDOM
onto backend api and microservice projects.
Soon I shall be one of the 5% who completed everything buwahaha
Henry
@GitHub-Henry
Oct 14 2017 17:02
@knight2 congrats
knight2
@knight2
Oct 14 2017 17:03
@GitHub-Henry the journey has just begun :P
@mukul23 beta course is quite buggy. But the first four sections should be fine. Just hit control + enter, or manually select the next part in the menu on the left. If you google your section header + freecodecamp when you think you are right but getting an error, there is almost always some post about what is right/wrong on some github issue
This is only for the first 4 sections
also sometimes errors can be fixed for submission by just adding a query string with any random input after can have a section submit when it isn't submitting before.
aRtoo
@artoodeeto
Oct 14 2017 17:15
hello everyone what built in function thats returns a "number" or "string" or "array"?
Eric Miller
@ericmiller777
Oct 14 2017 19:01
@artoodeeto could you explain what your trying to do, and link the challenge.
SwampyPk
@SwampyPk
Oct 14 2017 20:09
Hey guys, does anyone here know how to properly convert a string to double?
Been playing around with 'std::stod' but I can't figure it out :(
Joseph
@revisualize
Oct 14 2017 20:14
Greetings.
SwampyPk
@SwampyPk
Oct 14 2017 20:15
Hey
SwampyPk
@SwampyPk
Oct 14 2017 20:35
Never mind solved it
aRtoo
@artoodeeto
Oct 14 2017 22:39
@ericmiller777 nvm bro. i got. thanks for the reply though
CamperBot
@camperbot
Oct 14 2017 22:39
artoodeeto sends brownie points to @ericmiller777 :sparkles: :thumbsup: :sparkles:
:cookie: 320 | @ericmiller777 |http://www.freecodecamp.com/ericmiller777
Uriel Guzmán
@Burinson
Oct 14 2017 23:08

@Burinson
I need some help with a challenge

function whatIsInAName(collection, source) {
  // What's in a name?

  // Only change code below this line
  for (let prop in collection) { // prop = arr[#]
    var ArrWithSource = collection.filter((function(objects){
      // Return the array that has the following condition:
      var sourceProp = source[Object.keys(source)];
      // Property of the source key
      var sourceKey = [Object.keys(source)];
      // Key of the source value

  return objects[sourceKey] === sourceProp;  
     // Filter the array where the requested property is equal to the one inside the source argument
})); 

    return ArrWithSource;
}
  // Only change code above this line  
}

whatIsInAName([{ "a": 1, "b": 2 },
               { "a": 1 }, 
               { "a": 1, "b": 2, "c": 2 }],
              { "a": 1, "b": 2 });

My code only works when the source argument only has 1 object
It passed the challenges where it only has 1 object (the first 2)
But I don't know how to make it work with 2 objects (a and b)
When I console.log(sourceKey) it returns 0 : (2) ["a", "b"] length : 1 __proto__ : Array(0)
And that's how it's supposed to work, the problem is that console.log(objects[sourceKey]); returns undefined because it can't check both at the same time
I need a way to first check a, then b and so on...

Moisés Man
@moigithub
Oct 14 2017 23:41
returning too soon.. u need to check all source props first @Burinson
u can also remove that for..in statement
Uriel Guzmán
@Burinson
Oct 14 2017 23:46
@moigithub What statement?
@moigithub Oh, you're right, I don't need the for..in because filter is a looper, right?
Moisés Man
@moigithub
Oct 14 2017 23:49
ye
MattUnderwood
@MattUnderwood
Oct 14 2017 23:50

Hi All,

I'm working on implementing jQuery into my Quote Generator project. I want to have the color of my twitter button, body background, and button background change when I click the button. I've gotten the twitter button and body background to work but the button won't change color! Here is a link to my codepen https://codepen.io/MattUnderwood/pen/ZJjjOb

any feedback is appreciated!

Darren
@DarrenfJ
Oct 14 2017 23:50
evening fCC
kudos and thank you's to the regulars who keep this place alive
Uriel Guzmán
@Burinson
Oct 14 2017 23:50
@moigithub
function whatIsInAName(collection, source) {
  // What's in a name?

  // Only change code below this line

    var ArrWithSource = collection.filter((function(objects){
      // Return the array that has the following condition:
      var sourceProp = source[Object.keys(source)];
      // Property of the source key
      var sourceKey = [Object.keys(source)];
      // Key of the source value

   return objects[sourceKey] === sourceProp; 
     // Filter the array where the requested property is equal to the one inside the source argument
})); 

    return ArrWithSource;
}
  // Only change code above this line  


whatIsInAName([{ "a": 1, "b": 2 },
               { "a": 1 }, 
               { "a": 1, "b": 2, "c": 2 }],
              { "a": 1, "b": 2 });
Which return statement is the one that is too soon?
Moisés Man
@moigithub
Oct 14 2017 23:51
the one inside filter
Uriel Guzmán
@Burinson
Oct 14 2017 23:52
@moigithub You mean it should go outside?
Wouldn't that take everything out of scope?
Moisés Man
@moigithub
Oct 14 2017 23:52
nope.. it should return ONLY after checking ALL source properties
Darren
@DarrenfJ
Oct 14 2017 23:52
thanks @artoodeeto @ericmiller777 @GitHub-Henry @knight2 @khaduch @GitHub-Henry @heroiczero @daddycardona @sjames1958gm @thekholm80 @Manish-Giri
CamperBot
@camperbot
Oct 14 2017 23:52
darrenfj sends brownie points to @artoodeeto and @ericmiller777 and @github-henry and @knight2 and @khaduch and @heroiczero and @daddycardona and @sjames1958gm and @thekholm80 and @manish-giri :sparkles: :thumbsup: :sparkles:
:cookie: 315 | @artoodeeto |http://www.freecodecamp.com/artoodeeto
:cookie: 321 | @ericmiller777 |http://www.freecodecamp.com/ericmiller777
:star2: 3368 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 1881 | @heroiczero |http://www.freecodecamp.com/heroiczero
:cookie: 391 | @github-henry |http://www.freecodecamp.com/github-henry
:cookie: 389 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 6652 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 1508 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 8556 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:cookie: 130 | @knight2 |http://www.freecodecamp.com/knight2
Darren
@DarrenfJ
Oct 14 2017 23:52
off to watch bad tv
Uriel Guzmán
@Burinson
Oct 14 2017 23:53
@moigithub :worried:
aRtoo
@artoodeeto
Oct 14 2017 23:53
@DarrenfJ ohh. i got my first cookie. thank you too bro
CamperBot
@camperbot
Oct 14 2017 23:53
artoodeeto sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2132 | @darrenfj |http://www.freecodecamp.com/darrenfj
Uriel Guzmán
@Burinson
Oct 14 2017 23:54
@moigithub An... if statement?
How can I do that?
Moisés Man
@moigithub
Oct 14 2017 23:57

one way

loop on all sources
        if (source prop !== collection prop)
                 return false;   //one prop dont match
return true; //all matches

anther way is using .every method