These are chat archives for FreeCodeCamp/Help

14th
Oct 2017
heroiczero
@heroiczero
Oct 14 2017 04:02 UTC
@sjames1958gm @daddycardona @Manish-Giri @khaduch @GitHub-Henry @Gersho @DarrenfJ TY for the usual people helping people out.
CamperBot
@camperbot
Oct 14 2017 04:02 UTC
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 UTC
@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 UTC
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 UTC
@ericmiller777 thank you too :)
CamperBot
@camperbot
Oct 14 2017 04:44 UTC
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 UTC
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 UTC
@daddycardona thanks
CamperBot
@camperbot
Oct 14 2017 05:00 UTC
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 UTC
@daddycardona hello, and ty for the brownies
CamperBot
@camperbot
Oct 14 2017 05:09 UTC
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 UTC
@gishy1 sorry, did you figure it out? Try resetting your code.
gishy1
@gishy1
Oct 14 2017 11:12 UTC
@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 UTC
Hi, need help with countryapi json data, anyone care to help?
Sorin Ruse
@sorinr
Oct 14 2017 11:27 UTC
@shutupchigo what api?
how would I display Name: China and so forth?
bill zhang
@pipilan2017
Oct 14 2017 11:55 UTC
help?how to删除所有的注释标记
korzo
@korzo
Oct 14 2017 11:57 UTC
@shutupchigo data.Response[0].Name
@shutupchigo where data is what you get from JSON.parse
Ken Haduch
@khaduch
Oct 14 2017 11:59 UTC
@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 UTC
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 UTC
@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 UTC
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 UTC
image.png
korzo
@korzo
Oct 14 2017 12:04 UTC
@gishy1 You return from inside the loop
gishy1
@gishy1
Oct 14 2017 12:04 UTC
not understanding @korzo
you mean i remove the return a ?
korzo
@korzo
Oct 14 2017 12:05 UTC
@gishy1 No
@gishy1 return arr[a][0].toUpperCase();
gishy1
@gishy1
Oct 14 2017 12:06 UTC
@korzo i remove it ?
korzo
@korzo
Oct 14 2017 12:07 UTC
@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 UTC
@korzo im not unuderstanding you because
korzo
@korzo
Oct 14 2017 12:12 UTC
@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 UTC
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 UTC
@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 UTC
@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 UTC
@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 UTC
korzo sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1356 | @alpox |http://www.freecodecamp.com/alpox
alpox
@alpox
Oct 14 2017 13:50 UTC
@korzo np :D
Georgia
@georgiawang5332
Oct 14 2017 15:17 UTC
(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 UTC
@korzo thanks bro let me try and work through it
CamperBot
@camperbot
Oct 14 2017 15:25 UTC
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 UTC
@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 UTC
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 UTC
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 UTC
@knight2 congrats
knight2
@knight2
Oct 14 2017 17:03 UTC
@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 UTC
hello everyone what built in function thats returns a "number" or "string" or "array"?
Eric Miller
@ericmiller777
Oct 14 2017 19:01 UTC
@artoodeeto could you explain what your trying to do, and link the challenge.
SwampyPk
@SwampyPk
Oct 14 2017 20:09 UTC
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 UTC
Greetings.
SwampyPk
@SwampyPk
Oct 14 2017 20:15 UTC
Hey
SwampyPk
@SwampyPk
Oct 14 2017 20:35 UTC
Never mind solved it
aRtoo
@artoodeeto
Oct 14 2017 22:39 UTC
@ericmiller777 nvm bro. i got. thanks for the reply though
CamperBot
@camperbot
Oct 14 2017 22:39 UTC
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 UTC

@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 UTC
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 UTC
@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 UTC
ye
MattUnderwood
@MattUnderwood
Oct 14 2017 23:50 UTC

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 UTC
evening fCC
kudos and thank you's to the regulars who keep this place alive
Uriel Guzmán
@Burinson
Oct 14 2017 23:50 UTC
@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 UTC
the one inside filter
Uriel Guzmán
@Burinson
Oct 14 2017 23:52 UTC
@moigithub You mean it should go outside?
Wouldn't that take everything out of scope?
Moisés Man
@moigithub
Oct 14 2017 23:52 UTC
nope.. it should return ONLY after checking ALL source properties
Darren
@DarrenfJ
Oct 14 2017 23:52 UTC
thanks @artoodeeto @ericmiller777 @GitHub-Henry @knight2 @khaduch @GitHub-Henry @heroiczero @daddycardona @sjames1958gm @thekholm80 @Manish-Giri
CamperBot
@camperbot
Oct 14 2017 23:52 UTC
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 UTC
off to watch bad tv
Uriel Guzmán
@Burinson
Oct 14 2017 23:53 UTC
@moigithub :worried:
aRtoo
@artoodeeto
Oct 14 2017 23:53 UTC
@DarrenfJ ohh. i got my first cookie. thank you too bro
CamperBot
@camperbot
Oct 14 2017 23:53 UTC
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 UTC
@moigithub An... if statement?
How can I do that?
Moisés Man
@moigithub
Oct 14 2017 23:57 UTC

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