get help in general - we have more specialized help rooms here: https://gitter.im/FreeCodeCamp/home
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
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
daddycardona sends brownie points to @ericmiller777 :sparkles: :thumbsup: :sparkles:
:cookie: 319 | @ericmiller777 |http://www.freecodecamp.com/ericmiller777
ericmiller777 sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 386 | @daddycardona |http://www.freecodecamp.com/daddycardona
github-henry sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 387 | @daddycardona |http://www.freecodecamp.com/daddycardona
khaduch sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 388 | @daddycardona |http://www.freecodecamp.com/daddycardona
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
return arr[a][0].toUpperCase()
;
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(' ');
}
arr[a] = arr[a].toLowerCase();
lower case the word
arr[a] = arr[a][0].toUpperCase() + arr[a].substr(1);
return
returns from function.
str = str.toLowerCase()
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(' ');
}
korzo sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1356 | @alpox |http://www.freecodecamp.com/alpox
gishy1 sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 624 | @korzo |http://www.freecodecamp.com/korzo
arr= [1,2,3,4]
<-- u have 4 elements (length)arr[3]
(index 3)
artoodeeto sends brownie points to @ericmiller777 :sparkles: :thumbsup: :sparkles:
:cookie: 320 | @ericmiller777 |http://www.freecodecamp.com/ericmiller777
@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...
for..in
statement
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!
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 });
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
artoodeeto sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2132 | @darrenfj |http://www.freecodecamp.com/darrenfj
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