18th
Apr 2016
jonathanzach
@jonathanzach
Apr 18 2016 00:06
how do I Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator. how do you write this in Javascript ?
Bent Cardan
@reqshark
Apr 18 2016 00:08
@jonathanzach 11%3
var remainder = 11 % 3;
remainder would be equal to 2
jonathanzach
@jonathanzach
Apr 18 2016 00:09
thnxx, i wrote : val remainder; 11 % 3
mikeyb131
@mikeyb131
Apr 18 2016 00:18
hi guys i seem to be struggling on the Counting Cards for some reason, yet I think my code looks the same as what I have just seen on this forum....

var count = 0;

function cc(card) {
// Only change code below this line
switch (card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;

case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count--;
break;

}
if (count >= 1) {
return "Bet";
}
else {
return "Hold";
}

// Only change code above this line
}

// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');

just wondering if I have missed something obvious....
Moisés Man
@moigithub
Apr 18 2016 00:26
@mikeyb131 ur code should returning
example..
"1 Bet"
or "0 Hold"
mikeyb131
@mikeyb131
Apr 18 2016 00:27
Ah I see - thanks, how do I corect for that?
Moisés Man
@moigithub
Apr 18 2016 00:28
u need to include the variable count on ur returning string
return variable+" string";
mikeyb131
@mikeyb131
Apr 18 2016 00:29
thanks for the help - I will add that in. I had that initially but it wasn't passing
Moisés Man
@moigithub
Apr 18 2016 00:29
probably missing the space. between
"0Bet" vs "0 Bet"
mikeyb131
@mikeyb131
Apr 18 2016 00:30
ah yep you're right
Dylan
@dhcodes
Apr 18 2016 00:30
:musical_note: "the space between..."
lol dave matthews
mikeyb131
@mikeyb131
Apr 18 2016 00:30
thanks a lot for your help mate - much appreciated
Moisés Man
@moigithub
Apr 18 2016 00:31
:)
Frank XC
@tenkdayz
Apr 18 2016 00:59
help Make a Person
CamperBot
@camperbot
Apr 18 2016 00:59

# Explanation:

When I started the program I figured I just had to create the six functions mentioned in the details. However, it was not that simple. Creating them as a function was not the right way, I had to create them in a different way to make them a key.

There is also a tricky part as you need six keys no more or less, so at first I had the variable that store the original name as a key too which was wrong.

As for the usage of array, that is optional, you could also create new variable to hold the separated string if you wish but an array is easier to deal with as strings are immutable.

Read the instructions carefully, it is always a good hint in itself to run the code and check what the test results were so you know what to expect but do not fixate yourself on that. Once you understand what you need to do, this problem is very easy and straightforward.

Thom
@Hart2014
Apr 18 2016 01:00

Can anyone help me with JS, I'm on "Word Blanks", and the requirement is: wordBlanks("","","","") should return a string.
wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).
wordBlanks("cat", "little", "hit", "slowly") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).

var result = "";
// Your code below this line

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");

Epety
@epety
Apr 18 2016 01:05
find js
Frank XC
@tenkdayz
Apr 18 2016 01:06
@Hart2014 you have to build a sentence with the provided noun adj verb adv
Thom
@Hart2014
Apr 18 2016 01:06
This is what I've done: result += myNoun + " " + myAdjective + " " + myVerb + " " + myAdverb;
Frank XC
@tenkdayz
Apr 18 2016 01:07
@Hart2014 add "The "+ at the beginning. if that doesnt work
Thom
@Hart2014
Apr 18 2016 01:08
I'll try that
'''
CamperBot
@camperbot
Apr 18 2016 01:08
:bulb: to format code use backticks!  more info
Thom
@Hart2014
Apr 18 2016 01:09
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result += "The" + myNoun + " " + myAdjective + " " + myVerb + " " + myAdverb;

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
No good there, either
Moisés Man
@moigithub
Apr 18 2016 01:09
"Thedog" is outputing...
Thom
@Hart2014
Apr 18 2016 01:09
True
Moisés Man
@moigithub
Apr 18 2016 01:10
u forgot something in middle
Thom
@Hart2014
Apr 18 2016 01:10
It should still work
Moisés Man
@moigithub
Apr 18 2016 01:10
what test is failing ?
Thom
@Hart2014
Apr 18 2016 01:10
wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).
wordBlanks("cat", "little", "hit", "slowly") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).
Frank XC
@tenkdayz
Apr 18 2016 01:12
@Hart2014 "The "
Moisés Man
@moigithub
Apr 18 2016 01:12
This message was deleted
the extra words are optional... as long as ur variables are separated by something
probably u need to refresh ur browser.. or reset code.. do again
@Hart2014
Thom
@Hart2014
Apr 18 2016 01:14
Maybe refresh my browser
Oh my gosh
That worked
Moisés Man
@moigithub
Apr 18 2016 01:14
:D
Thom
@Hart2014
Apr 18 2016 01:14
I've been entering that for an hour now
Thank you @moigithub .
CamperBot
@camperbot
Apr 18 2016 01:14
hart2014 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star: 945 | @moigithub | http://www.freecodecamp.com/moigithub
AaronCs
@AaronCs
Apr 18 2016 01:19
hey guys, what's a good resource for learning ajax?
Alba
@bitavee
Apr 18 2016 01:22
I need help :( Im stuck on the "Stand in Line" under JS. I got the first 2 check marks and the last but I can't get the third: nextInLine([5,6,7,8,9], 1) should return 5
This message was deleted
Coy Sanders
@coymeetsworld
Apr 18 2016 01:22
can you post your code @bitavee ?
Amande
@wormwoods
Apr 18 2016 01:23
function convertToF(celsius) {
// Only change code below this line

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

// Change the inputs below to test your code
convertToF(30);

Alba
@bitavee
Apr 18 2016 01:24

Heres my code so far: function nextInLine(arr, item) {
testArr.push(item);
var item = testArr.shift();

return testArr, item; // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];

Coy Sanders
@coymeetsworld
Apr 18 2016 01:25
just return item, not testArr
Amande
@wormwoods
Apr 18 2016 01:26
function convertToF(celsius) {
// Only change code below this line

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

// Change the inputs below to test your code
convertToF(30);
PK
@arcticfries
Apr 18 2016 01:26
Hi.. I am really confused on the Understanding Uninitialized Variables challenge. I am not able to get the errors to change
I think I can't figure out even the instructions:(
any one can help on it?
Coy Sanders
@coymeetsworld
Apr 18 2016 01:28
you need to give the variables a value @arcticfries, using the equals operator
a = some number
b = some other number
PK
@arcticfries
Apr 18 2016 01:28
hmm. I did that @coymeetsworld but didn't seem to work.. let me try one more thing
Coy Sanders
@coymeetsworld
Apr 18 2016 01:28
ok, if you're still having trouble try posting your code so we can see it
PK
@arcticfries
Apr 18 2016 01:29
it's wierd.. it worked a few minutes ago for two of the errors but now it's gone.. I am not sure what I did or didn't do!
a = a + 1;
b = b + 5;
c = c + " I am a String!";
oops.. this is the code:
a = a + 1;
b = b + 5;
c = c + " I am a String!";
Coy Sanders
@coymeetsworld
Apr 18 2016 01:30
thats whats given for you but you need to define and declare a b and c
you use the keyword var to declare a variable, so var a; creates a
PK
@arcticfries
Apr 18 2016 01:31
darn.. it didn't copy correctly..
a = 5 + 1;
b = 10 + 5;
c = c + " I am a String!";
this is what I have rigt now.
Coy Sanders
@coymeetsworld
Apr 18 2016 01:31
no you need to put it back the way it was
it says not to change that code
also that still won't work because you didn't declare a b or c yet either
PK
@arcticfries
Apr 18 2016 01:32
@coymeetsworld so where am I declaring it? I did it above the line but that didn't work either..
Coy Sanders
@coymeetsworld
Apr 18 2016 01:32
or my mistake, it already comes declared for you
you need to work on this section only:
var a;
var b;
var c;
everything else has to remain untouched
PK
@arcticfries
Apr 18 2016 01:33
it tells me I have define a and b correctly but that c is not and last is not either.
Coy Sanders
@coymeetsworld
Apr 18 2016 01:33
you need to initialize each of those 3 values, with the equals sign.
PK
@arcticfries
Apr 18 2016 01:33
:( I did that and didn't work... but let me try again..
Coy Sanders
@coymeetsworld
Apr 18 2016 01:33
what did you put?
PK
@arcticfries
Apr 18 2016 01:34
give me little x on the left column
and still gives me two errors..

// Initialize these three variables
var a = 5
var b = 10
var c = "I am a String!"

// Do not change code below this line

a = a + 1;
b = b + 5;
c = c + "String!";

Coy Sanders
@coymeetsworld
Apr 18 2016 01:35
good, you just need to put semicolons at the end of those 3 statements
and c needs to be corrected a bit
PK
@arcticfries
Apr 18 2016 01:35
@coymeetsworld Doh!
Coy Sanders
@coymeetsworld
Apr 18 2016 01:35
shouldn't have String! in there
PK
@arcticfries
Apr 18 2016 01:36
yes, took that off.. duhh.. realized that just now.. but still giving me two errors:
c should not contain undefined and should have a value of "I am a String!"
Do not change code below the line
Coy Sanders
@coymeetsworld
Apr 18 2016 01:37
you need to fix c
PK
@arcticfries
Apr 18 2016 01:37
I did.. var a = 5;
var b = 10;
var c = "I am a";
let me reset and clear the code and try again.. sometimes, it works..
Coy Sanders
@coymeetsworld
Apr 18 2016 01:37
c = c + "String!"; c would be "I am aString!"
rkDeason
@rkDeason
Apr 18 2016 01:37
prbly just need a space between a & "
Coy Sanders
@coymeetsworld
Apr 18 2016 01:37
you need a space
PK
@arcticfries
Apr 18 2016 01:38
@rkDeason @coymeetsworld yup.. that was the problem.. Thanks!
CamperBot
@camperbot
Apr 18 2016 01:38
arcticfries sends brownie points to @rkdeason and @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star: 584 | @coymeetsworld | http://www.freecodecamp.com/coymeetsworld
:star: 282 | @rkdeason | http://www.freecodecamp.com/rkdeason
PK
@arcticfries
Apr 18 2016 01:38
it worked!
Coy Sanders
@coymeetsworld
Apr 18 2016 01:38
np @arcticfries
PK
@arcticfries
Apr 18 2016 01:38
Thank you thank you thank you!
Moisés Man
@moigithub
Apr 18 2016 01:38
spaces are overrated
PK
@arcticfries
Apr 18 2016 01:38
lol tell me about it @moigithub :+1:
Moisés Man
@moigithub
Apr 18 2016 01:38
;)
PK
@arcticfries
Apr 18 2016 01:38
This is starting to get tough though:) lol
rkDeason
@rkDeason
Apr 18 2016 01:38
ur welcome! thanks @arcticfries for hanging in there!
CamperBot
@camperbot
Apr 18 2016 01:38
rkdeason sends brownie points to @arcticfries :sparkles: :thumbsup: :sparkles:
:star: 149 | @arcticfries | http://www.freecodecamp.com/arcticfries
PK
@arcticfries
Apr 18 2016 01:39
:)
yeah.. trying to.. I know I need to..
I know JavaScript is super important .. ok back to coding attempt I go:)
rkDeason
@rkDeason
Apr 18 2016 01:40
you can do it! :smile:
Joseph Stivala
@joestivala
Apr 18 2016 01:55
Evening all
heymark
@heymark
Apr 18 2016 02:06
Has anyone here done the Steamroller algorithm challenge?
Apr 18 2016 02:06
@waasiwaasi - looks like no one has responded to your post... are you still around and trying this temperature conversion?
heymark
@heymark
Apr 18 2016 02:12
Different question: is someString.split('').[some array operation].join('') an okay thing to do? I find myself using it a lot on these challenges.
Samuel Cupidon
@Zerazera
Apr 18 2016 02:13
@heymark Not only is it OK, it's quite common
Apr 18 2016 02:13

@heymark

Different question: is someString.split('').[some array operation].join('') an okay thing to do? I find myself using it a lot on these challenges.

That's probably fine- the one thing that you should watch out for is if you have to do multiple such operations in a piece of code - although you would have to really profile the code to see what the performance impact is, and probably not worthwhile for most of these challenges?

heymark
@heymark
Apr 18 2016 02:14
CamperBot
@camperbot
Apr 18 2016 02:14
heymark sends brownie points to @zerazera and @khaduch :sparkles: :thumbsup: :sparkles:
:star: 374 | @zerazera | http://www.freecodecamp.com/zerazera
PK
@arcticfries
Apr 18 2016 02:20
ok i am stuck.. getting following error.. You should use the += operator for each variable
when I try to use it, it gives me different error.. so, what am I doing wrong?

here is the code: var a = 3;
var b = 17;
var c = 12;

// Only modify code below this line

a = a + 12;
b = 9 + b;
c = c + 7;

@pacmanla
Apr 18 2016 02:21
Need help, what can I divide by 2.0 & get 2.2?
PK
@arcticfries
Apr 18 2016 02:21
if I put += parameters at a, b, and c, it fixes that error but then gives me 3 other errors that the calculations are not correct.
heymark
@heymark
Apr 18 2016 02:22
@pacmanla whatever 2.2 * 2.0 is, presumably :)
PK
@arcticfries
Apr 18 2016 02:22
@pacmanla are you trying to get 2.0 or get 2.2 as your final answer?
@pacmanla
Apr 18 2016 02:22
2.2
heymark
@heymark
Apr 18 2016 02:22
@arcticfries can you paste the code that's throwing the error?
PK
@arcticfries
Apr 18 2016 02:23
@heymark

var a = 3;
var b = 17;
var c = 12;

// Only modify code below this line

a = a + 12;
b = 9 + b;
c = c + 7;

@pacmanla 4.4/2.0 = 2.2
@pacmanla
Apr 18 2016 02:23
@PK got it now, & thanks for the help guys
CamperBot
@camperbot
Apr 18 2016 02:23
pacmanla sends brownie points to @pk :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for pk
heymark
@heymark
Apr 18 2016 02:23
@arcticfries sorry, the part where you've inserted the +=
PK
@arcticfries
Apr 18 2016 02:24
I originally had it like this:
Tyler
@tylergross
Apr 18 2016 02:24
function isNumeric(value) {
return /^\d+$/.test(value); } function addTogether() { for(i = 0; i < arguments.length; i++){ var matcher = arguments[i]; if(!isNumeric(arguments[i])){ return undefined; } } if(arguments.length > 1){ var value = 0; for(i = 0; i < arguments.length; i++){ value += arguments[i]; } return value; }else{ var b = arguments[0]; return function(a){ for(i = 0; i < arguments.length; i++){ var matcher = arguments[i]; if(!isNumeric(arguments[i])){ return undefined; } } return a + b; }; } } addTogether(2, "3"); not sure what im doing wrong here, I get all the correct answers when dealing with real numbers, however when they put in "3" or [3] im not returning undefined like im suppposed to any ideas? PK @arcticfries Apr 18 2016 02:24 a += a + 12; b += 9 + b; c += c + 7; but doing so gives me errors on a, b, and c heymark @heymark Apr 18 2016 02:24 @arcticfries gotcha. Syntax is a += 12, etc. PK @arcticfries Apr 18 2016 02:25 yes but I am confused about the code .. not the math lol @heymark its in the Compound Assignment With Augmented Addition challenge Taur'e Anthony @k0decraft Apr 18 2016 02:26 I hate to ask because this seems so simple. I'm not passing my console checks in the Accessing Objects Properties with Variables challenge. Help? // Setup var testObj = { 12: "Namath", 16: "Montana", 19: "Unitas", }; // Only change code below this line; var playerNumber = 16[testObj]; // Change this Line var player = 'Montana'; // Change this Line PK @arcticfries Apr 18 2016 02:27 @k0decraft way over my head:) lol. Tyler @tylergross Apr 18 2016 02:27 [testObj]["16"] @k0decraft what is the objective here? Taur'e Anthony @k0decraft Apr 18 2016 02:27 @arcticfries Really? What challenges are you on? I figured you guys were way ahead of me. I suck lol heymark @heymark Apr 18 2016 02:27 @arcticfries Your syntax is incorrect; you need to have a line that says "a += 12;" rather than "a += a + 12;" Randall Fine @randallfine Apr 18 2016 02:28 thanks @Rafase282 for your help with Checkpoint: Word Blanks CamperBot @camperbot Apr 18 2016 02:28 randallfine sends brownie points to @rafase282 :sparkles: :thumbsup: :sparkles: :star: 1160 | @rafase282 | http://www.freecodecamp.com/rafase282 heymark @heymark Apr 18 2016 02:28 Likewise for the other values. PK @arcticfries Apr 18 2016 02:28 @k0decraft lol neeh.. everyone at different places.. lots of great people who know way more here:). @heymark ohhh.. hmmmm.. let me check.. Thx. CamperBot @camperbot Apr 18 2016 02:28 arcticfries sends brownie points to @heymark :sparkles: :thumbsup: :sparkles: Taur'e Anthony @k0decraft Apr 18 2016 02:28 @tylergross Use the playerNumber variable to lookup player 16 in testObj using bracket notation. CamperBot @camperbot Apr 18 2016 02:28 :star: 184 | @heymark | http://www.freecodecamp.com/heymark Tyler @tylergross Apr 18 2016 02:29 okay so bracket notation is testObj["16"] heymark @heymark Apr 18 2016 02:29 @k0decraft extra comma in your object Tyler @tylergross Apr 18 2016 02:29 would then return "Namath" PK @arcticfries Apr 18 2016 02:29 @heymark dohh!.. holly crap.. I think I been doing this too long today.. I can't beileve I couldn't do that one rgiht! Ken Haduch @khaduch Apr 18 2016 02:29 @tylergross - one thing that you could simplify is that in your function that is being returned, you are only going to get one argument, so you can really just access it with arguments[0] instead of a for loop. And I don't think that your isNumeric function is really doing what you want. For example, the "3" is a string, and the regular expression is perfectly happy to match that as a numeric value, but you don't know that it is really a string - got that? So you really want to try some other testing method. Like typeof, perhaps, or maybe one of the Number methods? Taur'e Anthony @k0decraft Apr 18 2016 02:30 @heymark Yea but that's safe right? I always add an extra comma in my ARRAYs PK @arcticfries Apr 18 2016 02:30 @heymark thx.. I am still learning the lingo and stuff.. don't have much experience on coding .. so very green.. thx for your patience! CamperBot @camperbot Apr 18 2016 02:30 arcticfries sends brownie points to @heymark :sparkles: :thumbsup: :sparkles: :warning: arcticfries already gave heymark points Tyler @tylergross Apr 18 2016 02:30 @khaduch thanks thats a new function to me i'll check it out CamperBot @camperbot Apr 18 2016 02:30 :star: 955 | @khaduch | http://www.freecodecamp.com/khaduch tylergross sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: heymark @heymark Apr 18 2016 02:30 @arcticfries no worries, have fun! Tyler @tylergross Apr 18 2016 02:31 @k0decraft okay so bracket notation is testObj["16"] and if you returned playerNumber it should output "Namath" Cleofe @cleofebelina Apr 18 2016 02:32 can someone help me on the stand in line part on javascript? I just started learning the language a day ago and I have no idea what to do now Taur'e Anthony @k0decraft Apr 18 2016 02:32 @tylergross I don't know if that's the objective here. I've tried that, it didn't work. Maybe I'm not following what you are trying to say... Julian Krispel-Samsel @juliankrispel Apr 18 2016 02:36 @69grams would be happy to help heymark @heymark Apr 18 2016 02:37 @69grams what have you tried so far? Ken Haduch @khaduch Apr 18 2016 02:38 @k0decraft - hey there, I'll try to help. the object is to access one of the values from the object. The values are keyed by various numeric values, so they want you to store a numeric value in the variable that they say to use, then use that with bracket notation (if you look back at the differences between "dot" notation and "bracket" notation, you'll see that there are times when you must use bracket notation. One of those times is when you have the property name stored in a variable. So you just need to set that variable with the number that they tell you to use, then write testObj[ THE_VARIABLE_NAME ] as the method to get the player's name from the object... It's really a stepping stone to get you accustomed to how to access an object's properties using a variable and bracket notation. Cleofe @cleofebelina Apr 18 2016 02:39 @juliankrispel how do I add the number to the end of the array? Ken Haduch @khaduch Apr 18 2016 02:40 @k0decraft - it might be best to reset your code to the initial state, in case you made any edits that would cause problems with the testing. Taur'e Anthony @k0decraft Apr 18 2016 02:40 @khaduch Thanks, but I can't seem to get the challenge to work. I've tried several different set-ups. CamperBot @camperbot Apr 18 2016 02:40 k0decraft sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: :star: 956 | @khaduch | http://www.freecodecamp.com/khaduch Taur'e Anthony @k0decraft Apr 18 2016 02:41 @khaduch Yea I usually always reset when trying out new code. But this still doesn't work Ken Haduch @khaduch Apr 18 2016 02:41 @k0decraft - if you reset the code, I forget what it starts you with? Please post, and I'll go look at my solution to make sure I'm not missing anything... Taur'e Anthony @k0decraft Apr 18 2016 02:42 @khaduch Ok, cool... heymark @heymark Apr 18 2016 02:42 @khaduch starts without any assignment on those last two lines. sekoku @sekoku Apr 18 2016 02:43 Is there anyone I can pester in a PM about Factorizing a Number? I don't want to post my code publically since I don't know FCC's ethic code on that. Taur'e Anthony @k0decraft Apr 18 2016 02:43 // Setup var testObj = { 12: "Namath", 16: "Montana", 19: "Unitas" }; // Only change code below this line; var playerNumber; // Change this Line var player; // Change this Line Tyler @tylergross Apr 18 2016 02:43 @k0decraft haven't been able to figure it out myself, I've got half of it completed with the var player = testObj[16]; heymark @heymark Apr 18 2016 02:43 There you go. The first assignment is exactly what the variable name implies: a number. Ken Haduch @khaduch Apr 18 2016 02:45 @k0decraft - you can get hints from looking at the test code - for example: * playerNumber should be a number * The variable player should be a string * The value of player should be "Montana" * You should use bracket notation to access testObj so, playerNumber should be set to a number. and after the test code is run, player should have the value "Montana"... you should use bracket notation to access testObj. (And you have to access testObj with bracket notation and the playerNumber variable that is set to the appropriate value to return the variable "Montana"...) Cleofe @cleofebelina Apr 18 2016 02:45 arr.push(item); arr.pop(item); Taur'e Anthony @k0decraft Apr 18 2016 02:45 @tylergross Yea, I got 3 out of the 4 checks correct. The testObj is still incorrect for me. Cleofe @cleofebelina Apr 18 2016 02:45 that's what I did heymark @heymark Apr 18 2016 02:46 @sekoku sure, PM me (though I think it's okay to post in here as well) Ken Haduch @khaduch Apr 18 2016 02:46 @k0decraft - show your current code, please. heymark @heymark Apr 18 2016 02:46 @69grams can you post the code that's not working? Taur'e Anthony @k0decraft Apr 18 2016 02:46 @khaduch Thanks again Ken, but I've seen that already and tried following that. I've got 3 out of 4 checks correct right now. CamperBot @camperbot Apr 18 2016 02:46 k0decraft sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: :warning: k0decraft already gave khaduch points Jamie Lipschitz @Jlipschitz Apr 18 2016 02:46 @69grams array.push() adds item to the end of the array. array.pop() removes the last thing in an array and can't actually take any arguments. Cleofe @cleofebelina Apr 18 2016 02:46 function nextInLine(arr, item) { // Your code here arr.push(item); arr.pop(item); return item; // Change this line } // Test Setup var testArr = [1,2,3,4,5]; // Display Code console.log("Before: " + JSON.stringify(testArr)); console.log(nextInLine(testArr, 6)); // Modify this line to test console.log("After: " + JSON.stringify(testArr)); Taur'e Anthony @k0decraft Apr 18 2016 02:47 // Setup var testObj = { 12: "Namath", 16: "Montana", 19: "Unitas" }; // Only change code below this line; var playerNumber = 16; // Change this Line var player = 'Montana'; // Change this Line This gives me 3 out of 4 checks correct. Ken Haduch @khaduch Apr 18 2016 02:47 @69grams - your arr.pop(item); is where you have the problem. heymark @heymark Apr 18 2016 02:47 @69grams if you're trying to remove an item from the beginning of the array, you want shift rather than pop: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift @k0decraft half way there! Cleofe @cleofebelina Apr 18 2016 02:48 Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed. I changed it to shift Taur'e Anthony @k0decraft Apr 18 2016 02:49 @heymark lol, halfway? I have a sad :-( Ken Haduch @khaduch Apr 18 2016 02:49 @k0decraft - okay, you are directly setting the player to "Montana", but you see that that is one of the values in the object. At property "16", and you have a variable playerNumber set to the value 16... so this test You should use bracket notation to access testObj - means that you should be setting the value of player by accessing testObj using the variable playerNumber, and using bracket notation... almost there! ..... heymark @heymark Apr 18 2016 02:49 @k0decraft seriously though, you're very close. Alba @bitavee Apr 18 2016 02:50 @coymeetsworld Thank you sooo much!!!! I just noticed how silly my mistake was. Thanks again :) CamperBot @camperbot Apr 18 2016 02:50 bitavee sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles: :star: 585 | @coymeetsworld | http://www.freecodecamp.com/coymeetsworld Jamie Lipschitz @Jlipschitz Apr 18 2016 02:50 @69grams array.shift() does not take in any arguments either. Cleofe @cleofebelina Apr 18 2016 02:50 yes, I didn't put any Coy Sanders @coymeetsworld Apr 18 2016 02:50 np @bitavee :thumbsup: Jamie Lipschitz @Jlipschitz Apr 18 2016 02:50 post your code @69grams heymark @heymark Apr 18 2016 02:50 @69grams take a look at what you're returning if you're changing arr, do you want to be returning item? Taur'e Anthony @k0decraft Apr 18 2016 02:51 @heymark @khaduch thanks CamperBot @camperbot Apr 18 2016 02:51 k0decraft sends brownie points to @heymark and @khaduch :sparkles: :thumbsup: :sparkles: :warning: k0decraft already gave khaduch points :star: 186 | @heymark | http://www.freecodecamp.com/heymark Taur'e Anthony @k0decraft Apr 18 2016 02:51 Heres my code now, still no luck.. // Setup var testObj = { 12: "Namath", 16: "Montana", 19: "Unitas" }; // Only change code below this line; var playerNumber = 16; // Change this Line var player = testObj[16]; // Change this Line This gives me 3 out of 4 checks too, but it's still not allowing the testObj to pass. Cleofe @cleofebelina Apr 18 2016 02:51 I am returning item Jamie Lipschitz @Jlipschitz Apr 18 2016 02:51 you want to return the array and not the item heymark @heymark Apr 18 2016 02:52 @69grams exactly, and you should be returning the array that you just changed instead. Cleofe @cleofebelina Apr 18 2016 02:52 tried that, didn't work that was what I did first Jamie Lipschitz @Jlipschitz Apr 18 2016 02:52 post your code with the change Cleofe @cleofebelina Apr 18 2016 02:52 function nextInLine(arr, item) { // Your code here arr.push(item); arr.shift(); return arr; // Change this line } // Test Setup var testArr = [1,2,3,4,5]; // Display Code console.log("Before: " + JSON.stringify(testArr)); console.log(nextInLine(testArr, 6)); // Modify this line to test console.log("After: " + JSON.stringify(testArr)); Ken Haduch @khaduch Apr 18 2016 02:52 @k0decraft - final hint - instead of using the 16 in the brackets, you should be using the variable that contains the number "16"... replace the [16] with [ some_variable_name ] using the appropriate variable that you have defined and set to the value "16" just above that last line... Jamie Lipschitz @Jlipschitz Apr 18 2016 02:54 what's the challenge name? The nextInLine function should then return the element that was removed. @69grams Taur'e Anthony @k0decraft Apr 18 2016 02:54 @khaduch thanks man. Yea that final hint basically gave me the answer. I can code like hell so long as my hand is held....when the training wheels are off though....oh shi# CamperBot @camperbot Apr 18 2016 02:54 k0decraft sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: :warning: k0decraft already gave khaduch points heymark @heymark Apr 18 2016 02:57 @69grams sorry, @Jlipschitz is right. I should've read the challenge more closely. Your push line is fine, but the value returned from arr.shift currently isn't going anywhere. Jamie Lipschitz @Jlipschitz Apr 18 2016 02:58 @69grams you want your return to be basically what you're taking out from shift. try looking to do something like return what\i'm\taking\out Ken Haduch @khaduch Apr 18 2016 02:58 @k0decraft - if you're just starting out, there is plenty of confusing material! They try to word this in a way that should be fairly straightforward, but it does require putting together concepts that are sometimes easily forgotten. If you go back and re-read that lesson and the examples that they give you, it is a good learning experience to see what they ARE telling you, especially now that you know the final outcome and solution. The test and examples, especially in these early lessons, give some really good hints about what you need to do. Take your time to get more comfortable with them, and really pay attention as you learn. It does get a lot trickier, so the good foundation from the early lessons is very valuable! Good luck! Luis @zdrifted Apr 18 2016 02:58 I'm having trouble with the Profile Lookup challenge. Any hints? var contacts = [ { "firstName": "Akira", "lastName": "Laine", "number": "0543236543", "likes": ["Pizza", "Coding", "Brownie Points"] }, { "firstName": "Harry", "lastName": "Potter", "number": "0994372684", "likes": ["Hogwarts", "Magic", "Hagrid"] }, { "firstName": "Sherlock", "lastName": "Holmes", "number": "0487345643", "likes": ["Intriguing Cases", "Violin"] }, { "firstName": "Kristian", "lastName": "Vos", "number": "unknown", "likes": ["Javascript", "Gaming", "Foxes"] } ]; function lookUpProfile(firstName, prop){ // Only change code below this line for (i = 0; i < contacts.length; i++) { if( contacts[i][firstName] === firstName && contacts[i][prop] !== undefined ) { return contacts[i][prop]; } if ( contacts[i].hasOwnProperty(firstName) === false) { return "No such contact"; } if( contacts[i].hasOwnProperty(prop) === false ) { return "No such property"; } } // Only change code above this line } // Change these values to test your function lookUpProfile("Akira", "likes"); Taur'e Anthony @k0decraft Apr 18 2016 03:01 @khaduch Thanks man, problem is I'm not just starting out. Granted I'm not employed to do this either, but I'm no beginner either. I seriously think with all this code there should be LOGIC challenges first before Programming. Hell I can't understand this stuff to save my life. CamperBot @camperbot Apr 18 2016 03:01 k0decraft sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: :warning: k0decraft already gave khaduch points Ken Haduch @khaduch Apr 18 2016 03:01 @Rushh - you are off to a pretty good start. Michael Aubrey @mca62511 Apr 18 2016 03:03 is it acceptable to omit brackets on if statements if they only need one line? like $("#blue-button").click(function(){
simon.input.blue();
if (simon.isOn) lightUp($(this)); }); Luis @zdrifted Apr 18 2016 03:03 Thanks. Something is off though, I can't figure it out Ken Haduch @khaduch Apr 18 2016 03:04 @k0decraft - well, I've been programming for years, and I'm amazed at the things that get me stumped now and then... going through these is good, and there is a mix of logic and programming basics here. For some folks there are parts that come more naturally than for others - some of us struggle with everything, but perseverance is essential. I would even say go back and review a section of these lessons, they start to make more sense as you get more exposure to their methodology for trying to teach. As I said - good luck - don't be afraid to ask for help here! Luis @zdrifted Apr 18 2016 03:05 @mca62511 I would guess that you always need the bracket regardless of how long the code is. The javascript interpreter won't read it correctly, otherwise heymark @heymark Apr 18 2016 03:05 @Rushh where is it going wrong? Ken Haduch @khaduch Apr 18 2016 03:05 @Rushh - yes, something is off... you are doing some things incorrectly. Kelvin-penang @Kelvin-penang Apr 18 2016 03:05 // Setup var collection = { 2548: { album: "Slippery When Wet", artist: "Bon Jovi", tracks: [ "Let It Rock", "You Give Love a Bad Name" ] }, 2468: { album: "1999", artist: "Prince", tracks: [ "1999", "Little Red Corvette" ] }, 1245: { artist: "Robert Palmer", tracks: [ ] }, 5439: { album: "ABBA Gold" } }; // Keep a copy of the collection for tests var collectionCopy = JSON.parse(JSON.stringify(collection)); // Only change code below this line function updateRecords(id, prop, value) { if (value !== "", prop !== "tracks") value = prop; if (prop == "tracks", value !=="") collection.tracks.push(value); if (value ==="") delete value.prop; return collection; } // Alter values below to test your code updateRecords(5439, "artist", "ABBA"); For the given id in collection: If value is non-blank (value !== "") and prop is not "tracks" then update or set the value for the prop. If the prop is "tracks" and value is non-blank, push the value onto the end of the tracks array. If value is blank, delete that prop. Always return the entire collection object. I'm supposed to follow the instructions. Can anybody help see what I've done wrong? Michael Aubrey @mca62511 Apr 18 2016 03:06 @Luis No, the JavaScript interpreter reads it fine. brackets are for blocks of code. Any time you use a bracket and you have one line of code, you can just omit the brackets.... BUT I don't know if that's best practices, you know? Taur'e Anthony @k0decraft Apr 18 2016 03:06 @khaduch Thanks. CamperBot @camperbot Apr 18 2016 03:06 k0decraft sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: :warning: k0decraft already gave khaduch points Jamie Lipschitz @Jlipschitz Apr 18 2016 03:06 if (value !== "", prop !== "tracks") can this be done instead of using &&? Ken Haduch @khaduch Apr 18 2016 03:07 @mca62511 - you can omit brackets if there is only one line of code that is to be executed for the condition. A lot of people recommend putting them in anyway, for consistency and to avoid making a mistake in adding another line of code that you think is going to be executed, but then you need the brackets. @k0decraft - you're welcome. Any time I can help, I'll give it a shot! Kelvin-penang @Kelvin-penang Apr 18 2016 03:07 @Jlipschitz duno :) can help? Michael Aubrey @mca62511 Apr 18 2016 03:07 @khaduch alright, thanks, and thanks to @Luis for responding too CamperBot @camperbot Apr 18 2016 03:07 mca62511 sends brownie points to @khaduch and @luis :sparkles: :thumbsup: :sparkles: :warning: could not find receiver for luis :star: 957 | @khaduch | http://www.freecodecamp.com/khaduch Luis @zdrifted Apr 18 2016 03:07 @Kelvin-penang You need to use the && operator in your if statements Kelvin-penang @Kelvin-penang Apr 18 2016 03:08 @Rushh ok, Jamie said so too Jamie Lipschitz @Jlipschitz Apr 18 2016 03:08 try formulating your if's like this if(something > 0 && 5 > 2) { //my code here } you want to enclose what you want to do inside curly braces { } Kelvin-penang @Kelvin-penang Apr 18 2016 03:08 Tried, still got it wrong ok jamie I'll try that Luis @zdrifted Apr 18 2016 03:09 Well you don't have brackets in your if statements but I guess you don't need it if it's only one line of code. I never knew that lol. @kelvin-penang Also, you want to set the value for the prop. Not set prop to the value Kelvin-penang @Kelvin-penang Apr 18 2016 03:10 Tried all that, still got all x's After updateRecords(5439, "artist", "ABBA"), artist should be "ABBA" After updateRecords(2548, "artist", ""), artist should not be set After updateRecords(1245, "tracks", "Addicted to Love"), tracks should have "Addicted to Love" as the last element. After updateRecords(2548, "tracks", ""), tracks should not be set // Setup var collection = { 2548: { album: "Slippery When Wet", artist: "Bon Jovi", tracks: [ "Let It Rock", "You Give Love a Bad Name" ] }, 2468: { album: "1999", artist: "Prince", tracks: [ "1999", "Little Red Corvette" ] }, 1245: { artist: "Robert Palmer", tracks: [ ] }, 5439: { album: "ABBA Gold" } }; // Keep a copy of the collection for tests var collectionCopy = JSON.parse(JSON.stringify(collection)); // Only change code below this line function updateRecords(id, prop, value) { if (value !== ""&& prop !== "tracks") { prop = value; } if (prop == "tracks"&& value !=="") { collection.tracks.push(value); } if (value ==="") { delete value.prop; } return collection; } // Alter values below to test your code updateRecords(5439, "artist", "ABBA"); Jamie Lipschitz @Jlipschitz Apr 18 2016 03:11 if (prop == "tracks", value !=="") collection.tracks.push(value);you want to use bracket notation here and also include your ID. It doesn't know where to go when you are pushing. Luis @zdrifted Apr 18 2016 03:13 @heymark All my tests are failing except one: "Bob", "number" should return "No such contact" Ken Haduch @khaduch Apr 18 2016 03:13 @Rushh - okay, there are a couple thing wrong with your code:  if( contacts[i][firstName] === firstName && contacts[i][prop] !== undefined ) { // point #1 return contacts[i][prop]; } if ( contacts[i].hasOwnProperty(firstName) === false) { // point #2 return "No such contact"; } if( contacts[i].hasOwnProperty(prop) === false ) { // point #3 return "No such property"; } Let's see - you basically have the correct idea with a for loop, since contacts is an array. But your tests are structured incorrectly. For example, where I inserted comments in the code snippet: • point #1 - your test for a match on firstName is correct, but for the second part, you should use the Object method .hasOwnProperty() to check for the existence of the property • point #2 - that test does not really make sense. In fact, the only way that you know that you have "No such contact" is to check for a match of the firstName against all of the contacts - that should be moved outside of the for loop, so that after all possible contacts are exhausted, then you can make that return. • point #3 - you cannot make the return of "No such property" unless you know that there is a match on the firstName, and you don't know that with this condition. It might randomly pass a test, depending on the order that they pass the arguments or test values in. So - there should be some changes. But I'll let you see what you think about those comments first and ask more questions... Jamie Lipschitz @Jlipschitz Apr 18 2016 03:13 same thing for js if (value ==="") { delete value.prop; } Kelvin-penang @Kelvin-penang Apr 18 2016 03:14 @Jlipschitz what do you mean? I thought thats the exact code i typed? Ken Haduch @khaduch Apr 18 2016 03:16 @Kelvin-penang - one thing that I don't see you doing in your code is using the value that is stored in the function arg parameter id to access the collection object. There should be some code references that have collection[id] in them. That's for starters... Jamie Lipschitz @Jlipschitz Apr 18 2016 03:16 i'm not giving you the code but i'm quoting your code in order to point out what needs fixing. you just need to tell it exactly where to change inside the object by using collections[id] @Kelvin-penang Kelvin-penang @Kelvin-penang Apr 18 2016 03:17 @khaduch thanks CamperBot @camperbot Apr 18 2016 03:17 kelvin-penang sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: Kelvin-penang @Kelvin-penang Apr 18 2016 03:17 @Jlipschitz thanks CamperBot @camperbot Apr 18 2016 03:17 :star: 958 | @khaduch | http://www.freecodecamp.com/khaduch Kelvin-penang @Kelvin-penang Apr 18 2016 03:17 @Rushh thanks CamperBot @camperbot Apr 18 2016 03:17 kelvin-penang sends brownie points to @rushh :sparkles: :thumbsup: :sparkles: :star: 207 | @rushh | http://www.freecodecamp.com/rushh Kelvin-penang @Kelvin-penang Apr 18 2016 03:17 // Setup var collection = { 2548: { album: "Slippery When Wet", artist: "Bon Jovi", tracks: [ "Let It Rock", "You Give Love a Bad Name" ] }, 2468: { album: "1999", artist: "Prince", tracks: [ "1999", "Little Red Corvette" ] }, 1245: { artist: "Robert Palmer", tracks: [ ] }, 5439: { album: "ABBA Gold" } }; // Keep a copy of the collection for tests var collectionCopy = JSON.parse(JSON.stringify(collection)); // Only change code below this line function updateRecords(id, prop, value) { if (value !== ""&& prop !== "tracks") { prop = value; } if (prop == "tracks"&& value !=="") { collection[2548].tracks.push(value); } if (value ==="") { delete value.prop; } return collection; } // Alter values below to test your code updateRecords(5439, "artist", "ABBA"); Michael Aubrey @mca62511 Apr 18 2016 03:18 Using this to toggle whether a checkbox is enabled or not $("#strict-mode").prop("disabled", !$("#strict-mode").prop("disabled")); And it works, but when I toggle it to enabled, the styling still remains like its disabled until I click it. What gives? Kelvin-penang @Kelvin-penang Apr 18 2016 03:18 is 2548 the thing you are refering to as ID? Jamie Lipschitz @Jlipschitz Apr 18 2016 03:19 function updateRecords(id, prop, value) you are passing the ID inside this function. So actually use the variable as opposed to the actual number ... so collections[id] Kelvin-penang @Kelvin-penang Apr 18 2016 03:19 // Setup var collection = { 2548: { album: "Slippery When Wet", artist: "Bon Jovi", tracks: [ "Let It Rock", "You Give Love a Bad Name" ] }, 2468: { album: "1999", artist: "Prince", tracks: [ "1999", "Little Red Corvette" ] }, 1245: { artist: "Robert Palmer", tracks: [ ] }, 5439: { album: "ABBA Gold" } }; // Keep a copy of the collection for tests var collectionCopy = JSON.parse(JSON.stringify(collection)); // Only change code below this line function updateRecords(id, prop, value) { if (value !== ""&& prop !== "tracks") { prop = value; } if (prop == "tracks"&& value !=="") { collection[id].tracks.push(value); } if (value ==="") { delete value.prop; } return collection; } // Alter values below to test your code updateRecords(5439, "artist", "ABBA"); Jamie Lipschitz @Jlipschitz Apr 18 2016 03:19 it gets passed in when you actually call the function updateRecords(5439, "artist", "ABBA"); @Kelvin-penang Ken Haduch @khaduch Apr 18 2016 03:20 @Kelvin-penang - yes, check the test records and you can see that they will pass one of those numeric values that are the properties for each item in the collection and that is what you use to access individual entries in the collection. Kelvin-penang @Kelvin-penang Apr 18 2016 03:20 still got 3 of the 4 objectives wrong :P Michael Aubrey @mca62511 Apr 18 2016 03:20 Jamie Lipschitz @Jlipschitz Apr 18 2016 03:20 you never changed your if statement as @khaduch suggested. if (value !== ""&& prop !== "tracks") { prop = value; } you have to again be specific and tell exactly where you want it changed inside the object Ken Haduch @khaduch Apr 18 2016 03:21 @Kelvin-penang - your first check where you are testing if (value !== ""&& prop !== "tracks") { - you need to be setting a property on one of the collection[id] objects, and you'll need to use bracket notation for everything there.... Jamie Lipschitz @Jlipschitz Apr 18 2016 03:21 you are very close! @Kelvin-penang Michael Aubrey @mca62511 Apr 18 2016 03:21 after turning it on, you can click on the strict mode input, but it still looks disabled until you click on it Ken Haduch @khaduch Apr 18 2016 03:23 @mca62511 - your UI design looks really slick! Kelvin-penang @Kelvin-penang Apr 18 2016 03:23 @khaduch Michael Aubrey @mca62511 Apr 18 2016 03:23 @khaduch Thanks, much appreciated :D CamperBot @camperbot Apr 18 2016 03:23 mca62511 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: :warning: mca62511 already gave khaduch points Kelvin-penang @Kelvin-penang Apr 18 2016 03:23 // Setup var collection = { 2548: { album: "Slippery When Wet", artist: "Bon Jovi", tracks: [ "Let It Rock", "You Give Love a Bad Name" ] }, 2468: { album: "1999", artist: "Prince", tracks: [ "1999", "Little Red Corvette" ] }, 1245: { artist: "Robert Palmer", tracks: [ ] }, 5439: { album: "ABBA Gold" } }; // Keep a copy of the collection for tests var collectionCopy = JSON.parse(JSON.stringify(collection)); // Only change code below this line function updateRecords(id, prop, value) { if (value !== ""&& prop !== "tracks") { collection[id].prop = value; } if (prop == "tracks"&& value !=="") { collection[id].tracks.push(value); } if (value ==="") { delete value.prop; } return collection; } // Alter values below to test your code updateRecords(5439, "artist", "ABBA"); I still don't quite get it sorry Norvin Burrus @ndburrus Apr 18 2016 03:25 are there any questions i might be able to assist with? Ken Haduch @khaduch Apr 18 2016 03:26 @Kelvin-penang - that's ok. When you have a property name in a variable, you must use bracket notation to reference the property in the object. So your line of code: collection[id].prop = value; needs to have the .prop replaced with [prop]. That might fix something. Kelvin-penang @Kelvin-penang Apr 18 2016 03:27 @khaduch yes it fixed one more objective :) now there are 2 out of 4 that are still wrong Ken Haduch @khaduch Apr 18 2016 03:29 @Kelvin-penang - if you still have this:  if (value ==="") { delete value.prop; } in your code, that also needs to have collection[id] as part of the reference. And you are deleting a property, so value is only used to test for an empty value. Luis @zdrifted Apr 18 2016 03:29 @khaduch function lookUpProfile(firstName, prop){ // Only change code below this line for (i = 0; i < contacts.length; i++) { if( contacts[i][firstName] === firstName && contacts[i].hasOwnProperty(prop) !== undefined ) { return contacts[i][prop]; } if( contacts[i][firstName] === firstName && contacts[i].hasOwnProperty(prop) === false ) { return "No such property"; } } return "No such contact"; // Only change code above this line } Ken Haduch @khaduch Apr 18 2016 03:30 @Rushh - .hasOwnProperty() returns true or false. So checking it for !== undefined is probably always going to be true. Luis @zdrifted Apr 18 2016 03:30 Oh oops Ken Haduch @khaduch Apr 18 2016 03:30 because it will never be undefined. Jamie Lipschitz @Jlipschitz Apr 18 2016 03:31 This message was deleted no nvm Kelvin-penang @Kelvin-penang Apr 18 2016 03:31 // Setup var collection = { 2548: { album: "Slippery When Wet", artist: "Bon Jovi", tracks: [ "Let It Rock", "You Give Love a Bad Name" ] }, 2468: { album: "1999", artist: "Prince", tracks: [ "1999", "Little Red Corvette" ] }, 1245: { artist: "Robert Palmer", tracks: [ ] }, 5439: { album: "ABBA Gold" } }; // Keep a copy of the collection for tests var collectionCopy = JSON.parse(JSON.stringify(collection)); // Only change code below this line function updateRecords(id, prop, value) { if (value !== ""&& prop !== "tracks") { collection[id][prop] = value; } if (prop == "tracks"&& value !=="") { collection[id].tracks.push(value); } if (value ==="") { delete collection[id][value].prop; } return collection; } // Alter values below to test your code updateRecords(5439, "artist", "ABBA"); @khaduch still doesn't help much Jamie Lipschitz @Jlipschitz Apr 18 2016 03:32 if (value ==="") { delete collection[id][value].prop; } you cannot get to the value without specifying the property first Kelvin-penang @Kelvin-penang Apr 18 2016 03:33 ok. tyring now Ken Haduch @khaduch Apr 18 2016 03:33 @Kelvin-penang - this code:  if (value ==="") { delete collection[id][value].prop; } is almost correct. But as I said - you are trying to delete a property, so the [value] should not be there - it is incorrect. You only need [prop] to delete the property... Luis @zdrifted Apr 18 2016 03:33 Hmm, I already went through all the basics on teamtreehouse. Is there another code school subscription for javascript that would really help me with freecodecamp? Ken Haduch @khaduch Apr 18 2016 03:34 I'm tiring too... going to be shutting down here soon... Rada @Radascript Apr 18 2016 03:34 you guys I finished that date algorythm bonfire how should I celebrate Jamie Lipschitz @Jlipschitz Apr 18 2016 03:34 think he meant trying lol Luis @zdrifted Apr 18 2016 03:35 @Kelvin-penang I'll help you, I need to review the problem first though and I'll be back in a minute Richard Joe @rjoe19 Apr 18 2016 03:35 hi Ken Haduch @khaduch Apr 18 2016 03:35 @Radascript - I don't know how you can celebrate - maybe take an hour off from coding? :) Congratulations!!! Richard Joe @rjoe19 Apr 18 2016 03:35 var Bike = function() { // Only change code below this line. var gear = 5; this.getGear = function(change) { gear += change; }; this.setGear = function() { return gear; }; }; var myCar = new Car(); var myBike = new Bike(); myBike.setGear(4); Kelvin-penang @Kelvin-penang Apr 18 2016 03:36 // Setup var collection = { 2548: { album: "Slippery When Wet", artist: "Bon Jovi", tracks: [ "Let It Rock", "You Give Love a Bad Name" ] }, 2468: { album: "1999", artist: "Prince", tracks: [ "1999", "Little Red Corvette" ] }, 1245: { artist: "Robert Palmer", tracks: [ ] }, 5439: { album: "ABBA Gold" } }; // Keep a copy of the collection for tests var collectionCopy = JSON.parse(JSON.stringify(collection)); // Only change code below this line function updateRecords(id, prop, value) { if (value !== ""&& prop !== "tracks") { collection[id][prop] = value; } if (prop == "tracks"&& value !=="") { collection[id].tracks.push(value); } if (value ==="") { delete collection[id]["artist"].prop; delete collection[id]["tracks"].prop; delete collection[id]["album"].prop; } return collection; } // Alter values below to test your code updateRecords(5439, "artist", "ABBA"); Ken Haduch @khaduch Apr 18 2016 03:36 @Jlipschitz - yup... but I'm tiring... long day and it's late for me. Richard Joe @rjoe19 Apr 18 2016 03:36 get error message "myBike.getGear() should return 4 after calling myBike.setGear(4)." any help here please Kelvin-penang @Kelvin-penang Apr 18 2016 03:36 I think I'm making a bigger mess :P Rada @Radascript Apr 18 2016 03:36 @khaduch thanks Ken! Actually finishing a challenge usually instantly gives me motivation to start the next one CamperBot @camperbot Apr 18 2016 03:36 radascript sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: :star: 959 | @khaduch | http://www.freecodecamp.com/khaduch PK @arcticfries Apr 18 2016 03:37 hi.. Ken Haduch @khaduch Apr 18 2016 03:37 @Kelvin-penang - yes, you have the property to delete in the variable prop. Just use that in place of the contents of that final bracket, and delete two of those three, as well as the .prop... PK @arcticfries Apr 18 2016 03:37 ok I am running into an issue with the following code.. var myStr = "\\ \t \r \n"; Luis @zdrifted Apr 18 2016 03:37 @Radascript Pour yourself 2oz of some ice cold soda PK @arcticfries Apr 18 2016 03:38 This is the error it's giving me: myStr should have the escape sequences for backslash tab tab carriage-return new-line separated by spaces any suggestions? not sure what I am doing wrong Ken Haduch @khaduch Apr 18 2016 03:38 @arcticfries - I think that you are just missing one of the items in your string? Lke your thing says "tab tab", and you only have one tab... Kelvin-penang @Kelvin-penang Apr 18 2016 03:38 @khaduch omg....that worked haha THANKS TO ALL WHO HELPED! Ken Haduch @khaduch Apr 18 2016 03:39 @Kelvin-penang :cake: also @Radascript :cake: :balloon: Kelvin-penang @Kelvin-penang Apr 18 2016 03:40 yes. cake is right PK @arcticfries Apr 18 2016 03:41 @khaduch ohh.. hmmm. let me see.. too many tabs .. lol @khaduch hmm.. that doesn't seem to work Ken Haduch @khaduch Apr 18 2016 03:43 @arcticfries - no, you need backslash tab tab carriage-return new-line separated by spaces, so you need exactly that sequence and that many of the items they list. So I think you needed two tabs, and it looked like you only had one? Please post your code again if that isn't true... PK @arcticfries Apr 18 2016 03:43 @khaduch var myStr = "\\ \t \t \r \n"; I updated to this and still giving me the same error Ken Haduch @khaduch Apr 18 2016 03:43 @arcticfries - let me look at the lesson... PK @arcticfries Apr 18 2016 03:43 var myStr = "\\ \t \t \r \n"; ok thx Michael Aubrey @mca62511 Apr 18 2016 03:44 ugh, this feels terribly hacky, but it works $("#strict-mode").prop("disabled", !$("#strict-mode").prop("disabled"));$('#strict-mode').click().click();

basically just have jQuery quickly click it twice to have the styles set properly >.<

Luis
@zdrifted
Apr 18 2016 03:44
Man I wish I knew someone I could pair program with
PK
@arcticfries
Apr 18 2016 03:46
CamperBot
@camperbot
Apr 18 2016 03:46
arcticfries sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
Apr 18 2016 03:46
@arcticfries - I pasted that line into my editor window and it passed the tests... actually the test. So - is it still failing for you?
Michael Aubrey
@mca62511
Apr 18 2016 03:46
...actually no that doesn't fix things, because when I disable the button it doesn't update the styles either.
PK
@arcticfries
Apr 18 2016 03:47
hmm yup.. it does.. let me try clearing the code and trying again.
Apr 18 2016 03:47
@mca62511 - I'm having trouble looking at your code.
Cameron Swift
@Chromps
Apr 18 2016 03:48
var fact = 1;
function factorialize(num) {
for(i=1; i<=num; i++){
fact= fact*i;

}
return fact;
}
factorialize(5);
hey guys, I am stuck on this challenge. It is asking me to factorialize various numbers and return the result. I am getting the correct results but FCC is not registering that I am. Do you guys see anything wrong with this code?
PK
@arcticfries
Apr 18 2016 03:48
@khaduch just reset the code and put it on there again by pasting it and still does same problem:(
you think it's a bug perhaps?
pasting here again, just in case.. var myStr = "\\ \t \t \r \n";
Michael Aubrey
@mca62511
Apr 18 2016 03:49
Apr 18 2016 03:49
@arcticfries - do you know how to clear your browser cache (temporary files) - there are times when that is necessary to make things work...
not sure if that is the case here, but your code looks like it should work!
PK
@arcticfries
Apr 18 2016 03:49
@khaduch yes.. let me try clearing the cache..
be right back
Apr 18 2016 03:50
@mca62511 - I can see that, but putting the pieces together isn't that easy when you're not familiar with the code...
PK
@arcticfries
Apr 18 2016 03:51
@khaduch ok I cleared.. still same problem:(
Apr 18 2016 03:51
@mca62511 - I'm kind of wondering, if the checkbox is disabled, how can you click on it? Not sure if that is really an issue?
PK
@arcticfries
Apr 18 2016 03:51
so now what do I do?
Michael Aubrey
@mca62511
Apr 18 2016 03:52

@khaduch Ah, right. Sorry. Well, I have all of the non-ui stuff in an object called "simon". I have all the sounds in an object called "soundBank". Everything related to the UI is in seperate functions or in $(document).ready I'm using Google's Material Design Lite framework. Those are all the mdl-element--effect classes. Ken Haduch @khaduch Apr 18 2016 03:52 @arcticfries - try reloading the page again, and if the code is still there, try it, otherwise just enter it in again? I'm not sure how this problem (if it's the browser cache) will manifest itself... PK @arcticfries Apr 18 2016 03:53 @khaduch ok let me try .. Michael Aubrey @mca62511 Apr 18 2016 03:53 @khaduch The problem is that if I do$("#strict-mode").disabled = true, or $("#strict-mode").attr("disabled", "disabled"), or$("#strict-mode").prop("disabled", true), it will disable the checkbox, but it won't change the style to make it look disabled.
PK
@arcticfries
Apr 18 2016 03:55
@khaduch ok back.. still same problem:(.
Michael Aubrey
@mca62511
Apr 18 2016 03:55
@khaduch The same is true for setting it to enabled. The hacky way I tried to get around that was to have jQuery click on the checkbox (since that updates the styles). However, that hack won't work for disabling the button, since you can't click a disabled button
Luis
@zdrifted
Apr 18 2016 03:55
CamperBot
@camperbot
Apr 18 2016 03:55
rushh sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
Luis
@zdrifted
Apr 18 2016 03:55
I finally solved it
@jhonsnake
Apr 18 2016 03:55
// Setup
var collection = {
2548: {
album: "Slippery When Wet",
artist: "Bon Jovi",
tracks: [
"Let It Rock",
"You Give Love a Bad Name"
]
},
2468: {
album: "1999",
artist: "Prince",
tracks: [
"1999",
"Little Red Corvette"
]
},
1245: {
artist: "Robert Palmer",
tracks: [ ]
},
5439: {
album: "ABBA Gold"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
if(value !== "" && prop !== "tracks"){
id[prop] = value;
}else if(prop === "tracks" && value !== ""){
id.tracks.push(value);
}else if(value === ""){
delete id[prop];
}

return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
CamperBot
@camperbot
Apr 18 2016 03:55
Michael Aubrey
@mca62511
Apr 18 2016 03:55
@khaduch I'm guessing it has something to do with MDL and the way that it updates it styles? Maybe?
Apr 18 2016 03:56
@mca62511 - I'm not familiar with MDL... I'm going to try a test on jsfiddle... I'm curious about whether or not you can get a click on a disabled checkbox?
Michael Aubrey
@mca62511
Apr 18 2016 03:56
@khaduch I cannot get a click on a disabled checkbox
Ghost
@ghost~56bd2077e610378809c105cd
Apr 18 2016 03:57
anyone around can help me?
Aiden
@AidenKerr
Apr 18 2016 03:57
How is it? It tests for palindromes.
function palindrome(str) {
var frontStr = str.toLowerCase().replace(/[^A-Za-z0-9]/gi, "");
var backStr = frontStr.split("").reverse().join("");
return frontStr === backStr;
}

palindrome("A man, a plan, a canal. Panama");
PK
@arcticfries
Apr 18 2016 03:59
I am going to call it a night.. let's see if it helps in the morning!:)
Thanks
Luis
@zdrifted
Apr 18 2016 03:59
What are some of the other resources you guys use to solve these challenges? I'm on teamtreehouse also but I'm looking for another site to use
Michael Aubrey
@mca62511
Apr 18 2016 03:59
@khaduch GOT IT! Okay. I was right. MDL adds a "is-disabled" class to the label automatically. If I simply "enable" the button programatically, it still looks disabled because the look of the checkbox is dictated by the label's class, where the function of the checbox is dictacted by the checkbox's disabled prop
@khaduch Thanks for trying to help out again though
CamperBot
@camperbot
Apr 18 2016 03:59
mca62511 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
Apr 18 2016 04:00
@arcticfries - ok - sorry we didn't get that squared away...
Alexander Berezkin
@Leidone
Apr 18 2016 04:00

The firstLetterOfLastName variable should have the value of L.
// Example
var firstLetterOfFirstName = "";

firstLetterOfFirstName = firstName0;

// Setup
var firstLetterOfLastName = L;
var lastName = "Lovelace";

// Only change code below this line
firstLetterOfLastName = lastName[7];

Kevin
@KevinBruland
Apr 18 2016 04:00
im stuck on the record collection, and I can't figure out why its not working
i've looked at solutions after trying it, and I have basically the same thing, but it's giving me an error
Apr 18 2016 04:01
@jhonsnake
Apr 18 2016 04:02
i did it
Kevin
@KevinBruland
Apr 18 2016 04:02
sure, how exactly do people post it in the boxes?
Apr 18 2016 04:02
help format
CamperBot
@camperbot
Apr 18 2016 04:02

## :point_right: code formatting [wiki]

### Multi line Code

js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

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

 ⇦ Type 3 backticks, then press [enter ⏎]

### Single line Code

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

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

Apr 18 2016 04:02
@Benalron ^^^ posting code.
Kevin
@KevinBruland
Apr 18 2016 04:03
function updateRecords(id, prop, value) {
if(value !== "" && prop === "tracks"){
collection.id.tracks.push(value);
}
else if (value !==""){
collection.id.prop = value;
}
else {
delete collection.id.prop;
}

return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
CamperBot
@camperbot
Apr 18 2016 04:03
:bulb: to format code use backticks!  more info
Kevin
@KevinBruland
Apr 18 2016 04:03
ok, I think I have it for the future
Jamie Lipschitz
@Jlipschitz
Apr 18 2016 04:04
you can still edit it @Benalron
@jhonsnake
Apr 18 2016 04:04
@Benalron im just did the same questions and just pass the same level as you we can help each other futher now
Doug
@Spazcool
Apr 18 2016 04:04
Any good online editors to run my JS code in for testing?
Jamie Lipschitz
@Jlipschitz
Apr 18 2016 04:04
Doug
@Spazcool
Apr 18 2016 04:05
@Jlipschitz Oh yeah, codepen. Forgot about that one. Thanks mate.
CamperBot
@camperbot
Apr 18 2016 04:05
spazcool sends brownie points to @jlipschitz :sparkles: :thumbsup: :sparkles:
Kevin
@KevinBruland
Apr 18 2016 04:05
CamperBot
@camperbot
Apr 18 2016 04:05
:star: 124 | @jlipschitz | http://www.freecodecamp.com/jlipschitz
Kevin
@KevinBruland
Apr 18 2016 04:05
only took 4 tries
Ghost
@ghost~56bd2077e610378809c105cd
Apr 18 2016 04:05
$(document).ready(function() { function getFortune() { var fortune = ["A friend asks only for your time not your money.", "If you refuse to accept anything but the best, you very often get it.", "A smile is your passport into the hearts of others."]; var number = ["Lucky Number 1","Lucky NUmber 2", "Lucky NUmber 3", "Lucky NUmber 4", "Lucky Number 5", "Lucky Number 6"]; var newNum = Math.floor((Math.random()*fortune.length)); var newFortune= fortune[newNum]; var newNumber= number[newNum];$(".fortune").text(newFortune);
$(".number").text(newNumber); }$(".btn").on("click", function(){
getFortune();

});
});
Apr 18 2016 04:06
@Benalron - you have multiple problems, but I think they are related. collection is a set of objects, so they are keyed by these id values, which are the numbers that you see. You are being passed the id, and prop in variables, and as the previous lessons taught, in order to reference object properties when they are stored in variables, you must use bracket notation. So any place you have collection.id is incorrect - it has to be using bracket notation, or collection[id]. The same thing is true for the prop variable - any time you have a property name in a variable, you have to use bracket notation to access the object properties.
Ghost
@ghost~56bd2077e610378809c105cd
Apr 18 2016 04:06
im having some t rouble making this work
Jamie Lipschitz
@Jlipschitz
Apr 18 2016 04:06
@Benalron look into using bracket notation when traversing through an object collections[id][prop] for example
Kevin
@KevinBruland
Apr 18 2016 04:06
CamperBot
@camperbot
Apr 18 2016 04:06
benalron sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
Kevin
@KevinBruland
Apr 18 2016 04:06
I must have misread something... I thought you only had to use brackets for things with spaces in it?
Apr 18 2016 04:07
@Benalron - that is one of the situations, but if you look back at the lesson that mentions variables and object properties, you'll see that it is also required there.
Kevin
@KevinBruland
Apr 18 2016 04:08
@jhonsnake
Apr 18 2016 04:08
i got it now thank you all for your help!
Apr 18 2016 04:09
@Rogue00 - where do you have this code - in a CodePen project? It would be easier to look there.
Ghost
@ghost~56bd2077e610378809c105cd
Apr 18 2016 04:09
Kevin
@KevinBruland
Apr 18 2016 04:10
@khaduch solved it, and found my other errors in the process
I will go back and ready up on accessing values
Jamie Lipschitz
@Jlipschitz
Apr 18 2016 04:11
@Rogue00 your button class has a comma in it and is not referring properly in the javascript..btn should be changed to .btn,
Apr 18 2016 04:11
@Rogue00 - I think that the main problem is that you have a comma separating your "btn, btn-default", and that's causing the issue.
@Rogue00 - the comma is incorrect - the classes should be space-separated...
Ghost
@ghost~56bd2077e610378809c105cd
Apr 18 2016 04:13
CamperBot
@camperbot
Apr 18 2016 04:13
rogue00 sends brownie points to @khaduch and @jlipschitz :sparkles: :thumbsup: :sparkles:
:star: 125 | @jlipschitz | http://www.freecodecamp.com/jlipschitz
Ghost
@ghost~56bd2077e610378809c105cd
Apr 18 2016 04:13
i knew it would be something small
Apr 18 2016 04:13
@Benalron - great!! Good luck...
and you're welcome
and @Rogue00 - you're welcome, too...
Jamie Lipschitz
@Jlipschitz
Apr 18 2016 04:13
Ghost
@ghost~56bd2077e610378809c105cd
Apr 18 2016 04:14
khaduch @khaduch - thanks all - good night to everyone, or good day, if you're on the other side of the world...
CamperBot
@camperbot
Apr 18 2016 04:14
sorry khaduch, you can't send brownie points to yourself! :sparkles: :sparkles:
Apr 18 2016 04:14
@camperbot - you're a hoot...
Kelvin-penang
@Kelvin-penang
Apr 18 2016 04:28

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
var array = [ []]
// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
var array = [ []]
// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
can anybody give a hint on what do i write in the var array?
Justin
@daemedeor
Apr 18 2016 04:29
@Kelvin-penang you don't write anything, you want to go through the arr variable and with each element multiply whats there
Kelvin-penang
@Kelvin-penang
Apr 18 2016 04:32
@daemedeor thanks :) but I literally have no idea how to go about it
CamperBot
@camperbot
Apr 18 2016 04:32
kelvin-penang sends brownie points to @daemedeor :sparkles: :thumbsup: :sparkles:
:star: 514 | @daemedeor | http://www.freecodecamp.com/daemedeor
Kelvin-penang
@Kelvin-penang
Apr 18 2016 04:33
as arr is not yet defined?
Justin
@daemedeor
Apr 18 2016 04:33
@Kelvin-penang it is, you're passing it in as a parameter
@InsaneSkull
Apr 18 2016 04:33
help Nesting For Loops
CamperBot
@camperbot
Apr 18 2016 04:33

# Challenge: Nesting For Loops

If you have a multi-dimensional array, you can use the same logic as the prior Challenge to loop through both the array and any sub-arrays. Here is an example:

    var arr = [
[1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
for (var j=0; j < arr[i].length; j++) {
console.log(arr[i][j]);
}
}

This outputs each sub-element in arr one at a time. Note that for the inner loop, we are checking the .length of arr[i], since arr[i] is itself an array.
:pencil: read more about challenge nesting for loops on the FCC Wiki

Elijah
@Elijahhh
Apr 18 2016 04:37
@Kelvin-penang multiplyAll([[1,2],[3,4],[5,6,7]]); your parameters .. Your (arr)
@Kelvin-penang Don't give up. I spent maybe 1 hour or more for that.
Kelvin-penang
@Kelvin-penang
Apr 18 2016 04:40
@Elijahhh thanks. this is hard...
CamperBot
@camperbot
Apr 18 2016 04:40
kelvin-penang sends brownie points to @elijahhh :sparkles: :thumbsup: :sparkles:
:star: 237 | @elijahhh | http://www.freecodecamp.com/elijahhh
Elijah
@Elijahhh
Apr 18 2016 04:45
@Kelvin-penang Please don’t skip that part. If you get what I told you, you will understand coding in a whole new way
Kelvin-penang
@Kelvin-penang
Apr 18 2016 04:50
@Elijahhh , too bad I have been staring at your comment now for some time, still no answer. But I'll give it a try. gtg now, will come back to this problem later
Erin Heard
@ufi16
Apr 18 2016 04:50
am i supposed to use an if/else or a lookup in the the 'Profile Lookup' challenge?
Luis
@zdrifted
Apr 18 2016 04:53
@ufi16 Yes, you can do that. I only used two if statements and the && operator as well
But remember that you'll want to iterate through each item/object in the array (to search the properties and values for a match). You'll need to use a loop for that
Erin Heard
@ufi16
Apr 18 2016 05:02
This message was deleted
This message was deleted
This message was deleted
This message was deleted
Apr 18 2016 05:26
Hello, I am trying to finish the stand in line javascript problem and am running into some issues.
I'm dealing with arrays and .push() and .shift()
could anyone help?
Luis
@zdrifted
Apr 18 2016 05:27
SUre
Apr 18 2016 05:28
@Rushh Thanks! ok. let me send you the problem
CamperBot
@camperbot
Apr 18 2016 05:28
e-badu sends brownie points to @rushh :sparkles: :thumbsup: :sparkles:
:star: 212 | @rushh | http://www.freecodecamp.com/rushh
alive-jekyll
@alive-jekyll
Apr 18 2016 05:29

hi everyone, could use few pointer on solving "Understand String Immutability" -tia
// Setup
var myStr = "Jello World";

// Only change code below this line

myStr[0] = "H"; // Fix Me

I've tried to assign new string to myStr

myStr = "Hello World";

but keep getting error

Have to search for the answer but the solution I've read is assigning new array which I think that's in the next challenge...

CamperBot
@camperbot
Apr 18 2016 05:29

## welcome to FreeCodeCamp @alive-jekyll!

V Arun Kumar
@arunvkumr
Apr 18 2016 05:33
@alive-jekyll try removing the line myStr[0] = "H"
Juwdohr
@Juwdohr
Apr 18 2016 05:37
So I created a website on code pen with a dropdown menu. Dropdown works on codepen.io, and on local machine then uploaded onto a server for school and the dropdown does not work. Any ideas?
V Arun Kumar
@arunvkumr
Apr 18 2016 05:38
@arunkumrv The pen works fine and when I export it and open it works fine. The only difference I did was edited it so the menu takes you to their corresponding pages and uploaded it to the school site.
alive-jekyll
@alive-jekyll
Apr 18 2016 05:42

@alive-jekyll try removing the line myStr[0] = "H"

Commenting that line make the assigning new value acceptable but still why bother to put bracket notation to find first character if only to disable it?

V Arun Kumar
@arunvkumr
Apr 18 2016 05:44
@alive-jekyll that's the challenge, strings are immutable. You can't change a specific character in the string, but you can manipulate the string to get a new string and store it in new variable. However, you can change the same string by reassigning the entire string to new string value.
V Arun Kumar
@arunvkumr
Apr 18 2016 05:52
@Juwdohr the site is blocking the jquery and bootstrap js file.. try removing http: in both the links.
Zach
@Moose1551
Apr 18 2016 05:55
Can someone hold my hand with "Title case a sentence", and give me a small hint? FFS
function titleCase(str) {
var allLower = str.toLowerCase();
return allLower; //turns string to Lower case.
} if (allLower) {
var camelCase = 0;
for (var i = 0; i >= camelCase + 1; i++)
allLower.push(i);
//some kind of a for loop, who knows.
}

titleCase("I'm a little tea pot");
kirbyedy
@kirbyedy
Apr 18 2016 05:56
@Moose1551 well this line does not seem right to me
if (allLower) {
if has to have some condition
V Arun Kumar
@arunvkumr
Apr 18 2016 05:56
@Moose1551 why return allLower after converting string to lowercase?
cannelflow
@cannelflow
Apr 18 2016 05:58
V Arun Kumar
@arunvkumr
Apr 18 2016 05:58
and } before if terminates your function.
@Moose1551
Paul Manning
@paulmanning
Apr 18 2016 05:58
@Moose1551 perhaps break the string into an array using str.split(“ “) and then for each word, take the first letter and make it uppecase
Eldar Tinjić
@EldarT90
Apr 18 2016 06:01
@kirbyedy isnt this TRUE OR statement ? which means it should be correct if first part is correct, regardless of second part ?
(newArr.length !== 10 || (newArr.length !== 12 && newArr[0] !== 1)
 ((newArr.length !== 10) || (newArr.length !== 11 && newArr[0] !== 1))
Apr 18 2016 06:03
hey do you guys know of a good resource for understanding Closure functions? I understand what it means but I'm not quite feeling them if that makes sense.
Eldar Tinjić
@EldarT90
Apr 18 2016 06:05
@Radascript it makes sense, actually couple of people were explaining them to me yday, so i think its one of those common things that is hard to get the grasp quickly
Markus Kiili
@Masd925
Apr 18 2016 06:06
Apr 18 2016 06:07
@Masd925 yes, I did, in my head I see them as a bit of a "function factory" but would like a little more focused practice
Eldar Tinjić
@EldarT90
Apr 18 2016 06:07
@Masd925 could you take a look at my statement from couple of minutes ago? i dont get why second part is turning statement in FALSE when we have OR
it shouldnt influence anything if first part is true, correct?
Apr 18 2016 06:09
@EldarT90 yeah I just watched a Youtube tutorial and they guy spent the first 3 out of 12 minutes talking about how they are actually really simple but it was pretty unhelpful after all lol
Eldar Tinjić
@EldarT90
Apr 18 2016 06:09
@Radascript well , for now i think of them as a sub-function which can take result of "bigger function" as a variable
@Radascript so its function inside a function
Markus Kiili
@Masd925
Apr 18 2016 06:10
@Radascript Simply put, when you return a function in JS, you actually return a closure. The function and the variable environment (scope chain).
JGeis13
@JGeis13
Apr 18 2016 06:12
Can anyone tell me why this won't work? If I manually reference the arguments it works fine, but I can't seem to get it to work when iterating...
function destroyer(arr) {
// Remove all the values
var first = arguments[0];
var args = [];
for(i=1;i<arguments.length; i++){
args.push(arguments[i]);
}

var result = [];

function check(val){
for(i=0; i<args.length; i++){
if(val !== args[i]){
return val;
}
}
}
return first.filter(check);
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
oops - don't mind the 'result' array
Luis
@zdrifted
Apr 18 2016 06:14
This message was deleted
This message was deleted
Markus Kiili
@Masd925
Apr 18 2016 06:15
@Radascript And closure is important because the outer function that returned the closure might finish its execution, and normally the variables would cease to exist. But because the returned function remembers those variables it had access to, the variables don't vanish.
@JGeis13 You should return false if you find a match and return true after the loop.
Marc Schöni
@marcschoeni
Apr 18 2016 06:16
Good morning Campers
JGeis13
@JGeis13
Apr 18 2016 06:18
Ahhh ... so simple! Thanks @Masd925
CamperBot
@camperbot
Apr 18 2016 06:18
jgeis13 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star: 1370 | @masd925 | http://www.freecodecamp.com/masd925
Paul Manning
@paulmanning
Apr 18 2016 06:19
@JGeis13 I think the return of the check function needs to be boolean. If true, then you keep the item in the filter, false, remove it. so your return statement in the check function return false if any of the items in args == val otherwise return false.
or what @Masd925 said already :smile:
JGeis13
@JGeis13
Apr 18 2016 06:20
:)
Zach
@Moose1551
Apr 18 2016 06:21
Gang,
Are we really expected to know how to do this by the time we get to "Title Case a Sentence?"
String.prototype.replaceAt = function(index, character) {
return this.substr(0, index) + character + this.substr(index+character.length);
};

function titleCase(str) {
var newTitle = str.split(' ');
var updatedTitle = [];
for (var st in newTitle) {
updatedTitle[st] = newTitle[st].toLowerCase().replaceAt(0, newTitle[st].charAt(0).toUpperCase());
}
return updatedTitle.join(' ');
}
Eldar Tinjić
@EldarT90
Apr 18 2016 06:22
can some1 tell me why is this statement wrong
 if ((newArr.length !== 10) || (newArr.length !== 11 && newArr[0] !== 1))
it should be TRUE or something, it should always be true if first prat is true
and first part solo is true, but if i add second, it turns to false
which is ilogical
scottmike0
@scottmike0
Apr 18 2016 06:24
i dont get it, why are you checking for a length of 10 and then 11
Eldar Tinjić
@EldarT90
Apr 18 2016 06:24
because it can have both 10 and 11 - phone number
if it has 10, its ok; but if it has 11 - first one must be 1
because its country code for usa
so botha re fine
but with OR
but if it has 9 or 12 ,13 ,etc
it should be false immediately
scottmike0
@scottmike0
Apr 18 2016 06:25
its easier to make it has two seperate conditionals to debug it
Eldar Tinjić
@EldarT90
Apr 18 2016 06:25
but thats not the whole part, i have additional things to add, but this time
scottmike0
@scottmike0
Apr 18 2016 06:25
because there is a chance that the first index can be 0
Eldar Tinjić
@EldarT90
Apr 18 2016 06:26
i want some1 to tell me why
why true OR is turning false
scottmike0
@scottmike0
Apr 18 2016 06:28
the main reason fr what you are checking is if an arrray
's length
is not 10
then you check or is not 11 and the first is not 1 at the length, then do this, which is a conditional, but necessarily what you want
not necessarily what you want*
Eldar Tinjić
@EldarT90
Apr 18 2016 06:29
yes, but why
why the second part matter if i have OR
its not AND
why would it even care abot second part if first is true
thats what i want to know
scottmike0
@scottmike0
Apr 18 2016 06:31
possibly because one of your inputs has a 1 in front of it and it is length 11
Eldar Tinjić
@EldarT90
Apr 18 2016 06:32
im talking about something that has length of 10
aha, i thinki might see the mistake
scottmike0
@scottmike0
Apr 18 2016 06:33
exactly, the conditional will not run if there is an array of length 11 and has a 1 as the index 0
mnashrullah07
@mnashrullah07
Apr 18 2016 06:52
hello everybody
I got stuck on javascript "Returning Boolean Values from Functions"
is there anybody can help me?
@InsaneSkull
Apr 18 2016 06:54
@mnashrullah07 if (a < b) { return true; } else { return false; } inside function
mnashrullah07
@mnashrullah07
Apr 18 2016 06:56
@InsaneSkull Sorry, but the instruction told me that I'm not allowed using if/else statement
@InsaneSkull
Apr 18 2016 06:59
@mnashrullah07 return a < b;
mnashrullah07
@mnashrullah07
Apr 18 2016 07:01
Yeah it's working, thank's very much smile: ) @InsaneSkull
CamperBot
@camperbot
Apr 18 2016 07:01
mnashrullah07 sends brownie points to @insaneskull :sparkles: :thumbsup: :sparkles:
:star: 308 | @insaneskull | http://www.freecodecamp.com/insaneskull
dennis-noah
@dennis-noah
Apr 18 2016 07:18
Hey
Can anyone help me? I am stuck with switch statements
Instructions
Write a switch statement which tests val and sets answer for the following conditions:
1 - "alpha"
2 - "beta"
3 - "gamma"
4 - "delta" this is the task

function caseInSwitch(val) {
// Only change code below this line

case val1 == 1;
break;

// Only change code above this line
}

// Change this value to test
caseInSwitch(1);
what I have so far but it already tells me error for the first case statement

mnashrullah07
@mnashrullah07
Apr 18 2016 07:20
try this bro
case(1):
break;
just repeat it @dennis-noah
Ian Montero
@ianmontero92
Apr 18 2016 07:22
hi everyone
im a bit stuck in this challenge

var result = "";
// Your code below this line

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("cat", "little", "meow", "cute");

dennis-noah
@dennis-noah
Apr 18 2016 07:23
@mnashrullah07 Thanks a lot for helping me. It tells me that it is expecting } because of line 1.. that is so weird because I close this later
CamperBot
@camperbot
Apr 18 2016 07:23
dennis-noah sends brownie points to @mnashrullah07 :sparkles: :thumbsup: :sparkles:
:star: 211 | @mnashrullah07 | http://www.freecodecamp.com/mnashrullah07
Ian Montero
@ianmontero92
Apr 18 2016 07:23
it says wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).
mnashrullah07
@mnashrullah07
Apr 18 2016 07:24
you're wellcome @dennis-noah
dennis-noah
@dennis-noah
Apr 18 2016 07:24
@mnashrullah07 Any idea what could be wrong"
Ian Montero
@ianmontero92
Apr 18 2016 07:24
how can i makke this one work
dennis-noah
@dennis-noah
Apr 18 2016 07:24
@mnashrullah07 "Expected '}' to match '{' from line 1 and instead saw 'case'
"
@mnashrullah07 "Expected an assignment or function call and instead saw an expression" wtf
mnashrullah07
@mnashrullah07
Apr 18 2016 07:25
maybe want to see my whole sollution @dennis-noah

switch (val){
case(1):
break;
case(2):
break;
case(3):
break;
case(4):
break;

}

maybe you forgot to write "{" in the begining @dennis-noah
Dominic Barretto
@Dominicbarretto
Apr 18 2016 07:28
@mnashrullah07 are u sure u need to put brackets after case? ie case(1):
is this not right ... case 1: ?
dennis-noah
@dennis-noah
Apr 18 2016 07:29
something is really wrong.. Why is it telling me "Expected an assignment or function call and instead saw an expression" all the time
Dominic Barretto
@Dominicbarretto
Apr 18 2016 07:29
@dennis-noah try this
switch(val)
mnashrullah07
@mnashrullah07
Apr 18 2016 07:29
@Dominicbarretto it's the same bro, it works
dennis-noah
@dennis-noah
Apr 18 2016 07:30
@Dominicbarretto I am trying it like that it still doesnt work :/
Dominic Barretto
@Dominicbarretto
Apr 18 2016 07:30
@dennis-noah ignore my comment!
mnashrullah07
@mnashrullah07
Apr 18 2016 07:31
@ianmontero92 what is the name of challange? I forgot
Dominic Barretto
@Dominicbarretto
Apr 18 2016 07:32
@dennis-noah can u post ur code here
dennis-noah
@dennis-noah
Apr 18 2016 07:32
Hey guys
I just realized what is wrong

function caseInSwitch(val) {
// Only change code below this line
switch(val) {
case(1):
break;

}

// Only change code above this line
}

// Change this value to test
caseInSwitch(1);

I included a switch in the function which is called caseInSwitch but which is not a switch function
not my first value just worked and I will try the other ones
mnashrullah07
@mnashrullah07
Apr 18 2016 07:34
@dennis-noah Alright, good luck then :)
dennis-noah
@dennis-noah
Apr 18 2016 07:34
It worked :D

function caseInSwitch(val) {
// Only change code below this line
switch(val) {
case(1):
break;
case(2):
break;
case(3):
break;

     case(4):

break;
}

// Only change code above this line
}

// Change this value to test
caseInSwitch(1);

mnashrullah07
@mnashrullah07
Apr 18 2016 07:35
:+1: @dennis-noah
EricOber
@EricOber
Apr 18 2016 07:36
hi everybody
can someone help me with "Access MultiDimensional Arrays With Indexes" challenge?
kirbyedy
@kirbyedy
Apr 18 2016 07:38
EricOber
@EricOber
Apr 18 2016 07:39
hey @kirbyedy thanks... I dont really understand the instructions here, or what it wants me to do.
CamperBot
@camperbot
Apr 18 2016 07:39
am3ricanpaladin sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star: 878 | @kirbyedy | http://www.freecodecamp.com/kirbyedy
EricOber
@EricOber
Apr 18 2016 07:39

One way to think of a multi-dimensional array, is as an array of arrays. When you use brackets to access your array, the first set of bracket refers to the entries in the outer-most array, and each subsequent level of brackets refers to the next level of entries inside.

Example

var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13, 14]
];
arr0; // equals [1,2,3]
arr1; // equals 6
arr31; // equals 11
Instructions
Read from myArray using bracket notation so that myData is equal to 8

Dominic Barretto
@Dominicbarretto
Apr 18 2016 07:39

Hey Guys
i am doing the "Record Collection" challenge

i need to do the following

For the given id in collection:
If value is non-blank (value !== "") and prop is not "tracks" then update or set the value for the prop.

how to set the value for prop?

EricOber
@EricOber
Apr 18 2016 07:40

^those are the instructions.. this is the code that I havent touched. // Setup
var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];

// Only change code below this line.
var myData = myArray0;

kirbyedy
@kirbyedy
Apr 18 2016 07:40
@Am3ricanPaladin arrays are 0 based, which means your counting starts at 0
EricOber
@EricOber
Apr 18 2016 07:40
yes
kirbyedy
@kirbyedy
Apr 18 2016 07:40
so the first bracket with numbers 1,2,3 is number 0
ok so wht is the number of the array where 8 is ?
EricOber
@EricOber
Apr 18 2016 07:40
that entire bracket is 0?
3
CamperBot
@camperbot
Apr 18 2016 07:40

# Get JSON with the jQuery getJSON Method

Application Programming Interfaces - are tools that computers use to communicate with one another.

Most web APIs transfer data in a format called JSON. JSON stands for JavaScript Object Notation. JSON is nothing more than object properties and their current values, sandwiched between a { and a }.

These properties and their values are often referred to as "key-value pairs".

Here is a sample of what it looks like.

$.getJSON("/json/cats.json", function(json) {$(".message").html(JSON.stringify(json));

});
kirbyedy
@kirbyedy
Apr 18 2016 07:41
mmm not really
if first array is 0...
then the next one is...
EricOber
@EricOber
Apr 18 2016 07:41
1
kirbyedy
@kirbyedy
Apr 18 2016 07:41
ok, and the next one
hang on :)
EricOber
@EricOber
Apr 18 2016 07:41
k thx
kirbyedy
@kirbyedy
Apr 18 2016 07:41
1,2,3 = 0
4,5,6 = 1
the next one ?
EricOber
@EricOber
Apr 18 2016 07:42
[7,8,9] = 2
kirbyedy
@kirbyedy
Apr 18 2016 07:42
yes
so my data has to access the second array (2), and the number 8 in it
EricOber
@EricOber
Apr 18 2016 07:43
ooooooooh right i think i see how its done now. let me plug in these numebrs , 2,1 - lets see
kirbyedy
@kirbyedy
Apr 18 2016 07:43
and again if you now watch only that array... 7,8,9
and start from 0
EricOber
@EricOber
Apr 18 2016 07:44
it worked! its like of like a coordinate system
thanks @kirbyedy
CamperBot
@camperbot
Apr 18 2016 07:44
am3ricanpaladin sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
kirbyedy
@kirbyedy
Apr 18 2016 07:44
yes sort of
:thumbsup:
Vincent Matinde
@matinde
Apr 18 2016 08:45
Hello all, I am bit stuck on this Profile lookup. Can someone help out?
function lookUpProfile(firstName, prop){
// Only change code below this line
for(var x=0; x < contacts.length; x++){
if (contacts[x].firstName === firstName){
return contacts[x][prop];
}
I seem to interfere every time I add an "else if" statement on this.
LostInTransistors
@marcosignorello
Apr 18 2016 08:49
is contacts initialized?
Markus Kiili
@Masd925
Apr 18 2016 08:57
@matinde You should make two nested if clauses inside the contact loop. First if for firstname check and the second for property existence. No elses needed, just the returns.
Vincent Matinde
@matinde
Apr 18 2016 09:05
Thanks for that @Masd925 this has worked for me.
CamperBot
@camperbot
Apr 18 2016 09:05
matinde sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star: 1371 | @masd925 | http://www.freecodecamp.com/masd925
Apr 18 2016 09:10
hi! I want to remove duplicates from more arrays, using .filter function with index,self, and element, but if I put it in a for loop, it says don't use functions in a loop. Does anyone have a workaround for this ?
Mooli
@Mooli88
Apr 18 2016 09:13
hi , need help with Pig Latin please.
English is not my first language so i think im stuck because english grammar more than anything else
function translatePigLatin(str) {

var vowels = ['a', 'e', 'i', 'o', 'u'];

var noVowel = true;

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

var strVowel = str.charAt(0).indexOf(vowels[i]);

if(strVowel > -1){

noVowel = false;

str=str+ 'way';

}

}

if(noVowel){
str=str.slice(1) + str.charAt(0) + 'ay';
}

return str;
}

translatePigLatin("consonant");
Markus Kiili
@Masd925
Apr 18 2016 09:17
@mrnemeth Filter method does the looping through the elements automatically.
Apr 18 2016 09:18
yes but I mean I have like 3 or N arrays, and I want to use this function in all of them
so I want to loop in each array and remove their duplicates
Markus Kiili
@Masd925
Apr 18 2016 09:19
@mrnemeth You can declare the callback function separately, and just pass the function name to filter, or you can use .reduce() to loop through the arrays.
vetoCode
@vetoCode
Apr 18 2016 09:21
Apr 18 2016 09:21
@Masd925 what do you mean by declare the callback function separately? can you explain with a bit more details?
'''
var unique = array.filter(function(elem, index, self) {
return index == self.indexOf(elem);
} );
'''
CamperBot
@camperbot
Apr 18 2016 09:21
:bulb: to format code use backticks!  more info
LostInTransistors
@marcosignorello
Apr 18 2016 09:22

callback = function (parameter 1, parameter2) {
do stuff
}

functionThatCallsCallback(parameter , parameter, callback(parameter1, parameter2));

Markus Kiili
@Masd925
Apr 18 2016 09:23
@mrnemeth I mean this:
function callback (elem) {
return elem%2===0;
}

[1,2,3,4].filter(callback); // [ 2, 4 ]
Then there is no function declaration inside filter.
Mahmoud Abdulazim
@aze3ma
Apr 18 2016 09:25
hey there
I got stuck at the first
Bharat
@BharatKalluri
Apr 18 2016 09:28
Hello Guys! Can anybody help me out by telling how to implement the search dropdown functionality in wikipedia viewer
Islam Ibakaev
@dagman
Apr 18 2016 09:29
@Bharat-Kalluri jquery ui autocomplete plugin
Apr 18 2016 09:29
@masd thanks! ahh, got it now! perfect :)
CamperBot
@camperbot
Apr 18 2016 09:29
mrnemeth sends brownie points to @masd :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for masd
Bharat
@BharatKalluri
Apr 18 2016 09:29
@dagman How do I pre populate the array?
Apr 18 2016 09:29
@Masd925 @masd thanks! ahh, got it now! works perfectly :)
CamperBot
@camperbot
Apr 18 2016 09:29
mrnemeth sends brownie points to @masd925 and @masd :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for masd
:star: 1372 | @masd925 | http://www.freecodecamp.com/masd925
Islam Ibakaev
@dagman
Apr 18 2016 09:30
@Bharat-Kalluri you dont need
Bharat
@BharatKalluri
Apr 18 2016 09:31
@dagman Will try it out
Mahmoud Abdulazim
@aze3ma
Apr 18 2016 09:31
anyone here
Ashok Bakthavathsalam
@kgashok
Apr 18 2016 09:32
Mahmoud Abdulazim
@aze3ma
Apr 18 2016 09:32
a shoughl be assigned to b with = does not recognize is this a glitch or I make something wrong ???\
Ashok Bakthavathsalam
@kgashok
Apr 18 2016 09:33
Islam Ibakaev
@dagman
Apr 18 2016 09:33
// Autocomplete is a jquery ui plugin
$("#input").autocomplete({ source: function(request, response) {$.ajax({
url: "http://en.wikipedia.org/w/api.php",
dataType: "jsonp",
data: {
'action': "opensearch",
'format': "json",
'search': request.term
},
success: function(data) {
response(data[1]);
}
});
}
});
Mahmoud Abdulazim
@aze3ma
Apr 18 2016 09:34
// Setup
2
var a;
3
var b = 2;
4

5
// Only change code below this line
6
var a = 7;
7
var b = 7;
8
a = b;
and another Q how can I copy my code like editor !
Ashok Bakthavathsalam
@kgashok
Apr 18 2016 09:35
Use  to start with
and then end with 
which challenge number are you referring to?
Mahmoud Abdulazim
@aze3ma
Apr 18 2016 09:36

''' // Setup
var a;
var b = 2;

// Only change code below this line
var a = 7;
var b = 7;
a = b; '''

CamperBot
@camperbot
Apr 18 2016 09:36
:bulb: to format code use backticks!  more info
Mahmoud Abdulazim
@aze3ma
Apr 18 2016 09:36

 // Setup
var a;
var b = 2;

// Only change code below this line
var a = 7;
var b = 7;
a = b; 

// Setup
var a;
var b = 2;

// Only change code below this line
var a = 7;
var b = 7;
a = b;

Ashok Bakthavathsalam
@kgashok
Apr 18 2016 09:37
 - should be separate on a newline
which FCC challenge number are you on?
Mahmoud Abdulazim
@aze3ma
Apr 18 2016 09:38
// Setup
var a;
var b = 2;

// Only change code below this line
var a = 7;
var b = 7;
a = b;
Ashok Bakthavathsalam
@kgashok
Apr 18 2016 09:38
there you go!
Mahmoud Abdulazim
@aze3ma
Apr 18 2016 09:39
he told me to make a = 7 and b and then a should be assigned to b with =
Ashok Bakthavathsalam
@kgashok
Apr 18 2016 09:39
Remove the var keyword as a and b already defined.
Mahmoud Abdulazim
@aze3ma
Apr 18 2016 09:40
// Setup
var a;
var b = 2;

// Only change code below this line
a = 7;
b = 7;
a = b;
still not working
I thought it a glitch !!!
Ashok Bakthavathsalam
@kgashok
Apr 18 2016 09:40
which challenge number?
Mahmoud Abdulazim
@aze3ma
Apr 18 2016 09:40
141
Islam Ibakaev
@dagman
Apr 18 2016 09:41
@aze3ma u should apply b to a after a = 7
Ashok Bakthavathsalam
@kgashok
Apr 18 2016 09:42
yes... I see it
Islam Ibakaev
@dagman
Apr 18 2016 09:43
@kgashok
a = 7;
// one line here
Mahmoud Abdulazim
@aze3ma
Apr 18 2016 09:44
// Setup
var a;
var b = 2;

// Only change code below this line
a = 7;
a = b;
Ashok Bakthavathsalam
@kgashok
Apr 18 2016 09:44
If you want to assign bigValue to smallValue, the smallValue has to be on the left side of the =
Send me the link of the Challenge...
Mahmoud Abdulazim
@aze3ma
Apr 18 2016 09:45
@kgashok thank you :)
CamperBot
@camperbot
Apr 18 2016 09:45
aze3ma sends brownie points to @kgashok :sparkles: :thumbsup: :sparkles:
:star: 155 | @kgashok | http://www.freecodecamp.com/kgashok
Mahmoud Abdulazim
@aze3ma
Apr 18 2016 09:45
@dagman thank you buddy! (Y)
Ashok Bakthavathsalam
@kgashok
Apr 18 2016 09:45
@aze3ma I got it..don't bother
CamperBot
@camperbot
Apr 18 2016 09:45
aze3ma sends brownie points to @dagman :sparkles: :thumbsup: :sparkles:
:star: 423 | @dagman | http://www.freecodecamp.com/dagman
Islam Ibakaev
@dagman
Apr 18 2016 09:46
@aze3ma yw
Ultras05
@Ultras05
Apr 18 2016 09:51

function chainToSwitch(val) {
// Only change code below this line

switch(val){
case 1 :
break;
case 2 :
break;
case 3:
answer = "There is no #1";
break;
case 4 :
answer = "Missed me by this much!";
break;
case 5 :
break;

}

// Only change code above this line
}

// Change this value to test
chainToSwitch("");

Ashok Bakthavathsalam
@kgashok
Apr 18 2016 09:58
function chainToSwitch(val) {
// Only change code below this line
switch(val){
case 1 :
break;
case 2 :
break;
case 3:
answer = "There is no #1";
break;
case 4 :
answer = "Missed me by this much!";
break;
case 5 :
break;
}
// Only change code above this line
}
// Change this value to test
chainToSwitch("");
Stephen James
@sjames1958gm
Apr 18 2016 09:58
@Ultras05 Reset the code. The case values are not 1,2,3,4,5. Use the values from the original if/else
Dardan Demiri
@dardandemiri
Apr 18 2016 10:00
Why is this not working


function whereAreYou(collection, source) {
// What's in a name?
var arr = [];
// Only change code below this line

for(var i = 0; i < source.length; i++){
for(var j = 0; j < collection.length; j++){

if(collection[j].hasOwnProperty("first") && source[i].hasOwnProperty("last")){

if(collection[j].first == source[i].first){
arr += source[i];
}

}else if(collection[j].hasOwnProperty("last") && source[i].hasOwnProperty("last")){

if(collection[j].last == source[i].last){
arr += source[i];
}
}

}
}

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

whereAreYou([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
Alex
@alexstelmakh
Apr 18 2016 10:02
please somebody tell me what I'm doing wrong. This is what I should get You should use two double quotes (") and four escaped double quotes (\")
Variable myStr should equal to ("I am a "double quoted" string inside "double quotes""). THIS is what I'm typed in-var myStr = "I am a \"double quoted\" string inside \"double quotes\"\""; // Change this line
Dardan Demiri
@dardandemiri
Apr 18 2016 10:03
@alexstelmakh
Markus Kiili
@Masd925
Apr 18 2016 10:03
@dardandemiri You cannot add to an array with +=.
Dardan Demiri
@dardandemiri
Apr 18 2016 10:03
ahhh
.push
kirbyedy
@kirbyedy
Apr 18 2016 10:03
@alexstelmakh this does not look right to me \"\"";
Dardan Demiri
@dardandemiri
Apr 18 2016 10:04
@Masd925 it's still not working
@InsaneSkull
Apr 18 2016 10:04
@alexstelmakh myStr = "I am a \"double quoted\" string inside \"double quotes\"";
Markus Kiili
@Masd925
Apr 18 2016 10:05
@dardandemiri You have hardcoded the source keys. You should loop through the source keys.
Alex
@alexstelmakh
Apr 18 2016 10:05
Markus Kiili
@Masd925
Apr 18 2016 10:05
@dardandemiri Outer loop should be through the collection and inner through source keys. Only push if values are the same for all the source keys.
kirbyedy
@kirbyedy
Apr 18 2016 10:06
@alexstelmakh there it is... @InsaneSkull wrote it for you
mnashrullah07
@mnashrullah07
Apr 18 2016 10:06
Is anybody can help me? I got stuck with "Convert Celsius to Fahrenheit"
Alex
@alexstelmakh
Apr 18 2016 10:07
@InsaneSkull I did it the same way but I thought that in the end should be two "" , because of instruction was :Variable myStr should equal to ("I am a "double quoted" string inside "double quotes"").
Dardan Demiri
@dardandemiri
Apr 18 2016 10:07
@Masd925 can you please explain it more
I don't understand
Alex
@alexstelmakh
Apr 18 2016 10:08
Stephen James
@sjames1958gm
Apr 18 2016 10:08
@dardandemiri Your solution is if it works only solves the first test. You have to read the keys from source to know what to check. You can use "for in" type for loop to loop over the keys in source to check if they exist in collection. I would put the collection loop on the outside.
for(var j = 0; j < collection.length; j++){
for (var prop in source) {
// check if prop is in collection[j]
}
}
@InsaneSkull
Apr 18 2016 10:09
@alexstelmakh you can count no. of quotes started and ended.
mnashrullah07
@mnashrullah07
Apr 18 2016 10:09
i wrote celsius = (celsius * 9/5) + 32; inside the convertToF function
Markus Kiili
@Masd925
Apr 18 2016 10:10
@dardandemiri Another way is to use methods .filter() and .every().
mnashrullah07
@mnashrullah07
Apr 18 2016 10:10
there is no error message so I get confused
cannelflow
@cannelflow
Apr 18 2016 10:13
var fahrenheit = celsius*(9/5)+32; @mnashrullah07
Kevin
@KevinBruland
Apr 18 2016 10:14
im stuck on the factorialize a number problem... and it seemed really simple, but I can't figure out why my solution isnt working
cannelflow
@cannelflow
Apr 18 2016 10:15
@Benalron can you show your code
Kevin
@KevinBruland
Apr 18 2016 10:16
yeah
function factorialize(num) {
var y = 1;
for (var x=num; x === 0; x--){
y *= x;
}
return y;
}
factorialize(5);
priyanka
@priyankasawant12345
Apr 18 2016 10:17
fahrenheit = celsius * 9 / 5 + 32; for fahrenheit problem
Kevin
@KevinBruland
Apr 18 2016 10:18
if it was more complex, I would spend longer trying to figure it out... but it seemed so easy to me
obviously it wasnt lol, I just dont know what else to consider
Ivan Temchur
@ttemcha
Apr 18 2016 10:18
hey folks i need help!
function destroyer(arr) {
// Remove all elements from the initial array that are of the same value as these arguments.
return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Markus Kiili
@Masd925
Apr 18 2016 10:19
@Benalron For loop condition is wrong.
Kevin
@KevinBruland
Apr 18 2016 10:19
thanks, ill look into that
Ivan Temchur
@ttemcha
Apr 18 2016 10:19
where should i start from ?
Markus Kiili
@Masd925
Apr 18 2016 10:19
@ttemcha The arguments object and perhaps .filter().
Kate Fedorenko
@katie-codes
Apr 18 2016 10:19
@Benalron I was stuck on this one for a while using for loops. Look into recursion!
I had no idea what it was before the factorial challenge, but you will need it
cannelflow
@cannelflow
Apr 18 2016 10:20
as @katie-codes said try recursion @Benalron
Kevin
@KevinBruland
Apr 18 2016 10:20
thanks for the tips, I will pursue that
priyanka
@priyankasawant12345
Apr 18 2016 10:20
anybody solved world-blanks problem. i stuck there
Kevin
@KevinBruland
Apr 18 2016 10:21
thanks @katie-codes
CamperBot
@camperbot
Apr 18 2016 10:21
benalron sends brownie points to @katie-codes :sparkles: :thumbsup: :sparkles:
:star: 262 | @katie-codes | http://www.freecodecamp.com/katie-codes
Stephen James
@sjames1958gm
Apr 18 2016 10:22
@priyankasawant12345 Do you have any code so far?
Kevin
@KevinBruland
Apr 18 2016 10:22
I beat it, thanks guys
but im definitely going to read up more on recursion
Kate Fedorenko
@katie-codes
Apr 18 2016 10:23
well done!!!
@Benalron now you've done the challenge, read this (helped me understand the code I actually wrote!): http://www.programmerinterview.com/index.php/recursion/explanation-of-recursion/
priyanka
@priyankasawant12345
Apr 18 2016 10:24

var result = "";
// Your code below this line
result = "cat,little,hit,slowly";
// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog" , "big" , "ran" , "quickly");
here is my code but not working

Kevin
@KevinBruland
Apr 18 2016 10:24
ah awesome, thanks @katie-codes
CamperBot
@camperbot
Apr 18 2016 10:24
benalron sends brownie points to @katie-codes :sparkles: :thumbsup: :sparkles:
:warning: benalron already gave katie-codes points
Stephen James
@sjames1958gm
Apr 18 2016 10:25
@priyankasawant12345 You will need to use string operators to build a new string,
priyanka
@priyankasawant12345
Apr 18 2016 10:25
is it for result variable?
Stephen James
@sjames1958gm
Apr 18 2016 10:26
@priyankasawant12345 The string operator it is looking for is how to put to strings together to make one.
@priyankasawant12345 yes for the result variable - Use your input parameters myNoun, etc.
mnashrullah07
@mnashrullah07
Apr 18 2016 10:27
@cannelflow thanks buddy, very helfull
CamperBot
@camperbot
Apr 18 2016 10:27
mnashrullah07 sends brownie points to @cannelflow :sparkles: :thumbsup: :sparkles:
:star: 1082 | @cannelflow | http://www.freecodecamp.com/cannelflow
cannelflow
@cannelflow
Apr 18 2016 10:28
@mnashrullah07 :+1:
@ydeepk
Apr 18 2016 10:30

help guy's

// title case achallange
function titleCase(str) {
var strtolower = str.toLowerCase();
var strSplit = strtolower.split(/\s/);

for(var a = 0; a < strSplit.length; a++) {
var upperFirst = strSplit[a][0].toUpperCase();
}

}

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

note:- only thing remains my array is I , A, L ,P. Only want to make my first letter of word capital.

CamperBot
@camperbot
Apr 18 2016 10:30
no wiki entry for: guys title case achallange function titlecasestr var strtolower strtolowercase var strsplit strtolowersplits forvar a 0 a strsplitlength a var upperfirst strsplita0touppercase titlecaseim a little potnote- only thing remains my array is i a l p only want to make my first letter of word capital
priyanka
@priyankasawant12345
Apr 18 2016 10:30
@sjames1958gm not working
cannelflow
@cannelflow
Apr 18 2016 10:31
@priyankasawant12345 can you paste your code
@ydeepk
Apr 18 2016 10:31
@camperbot wiki?
Stephen James
@sjames1958gm
Apr 18 2016 10:31
@priyankasawant12345 what did you do
@ydeepk
Apr 18 2016 10:31
@priyankasawant12345 hey !
priyanka
@priyankasawant12345
Apr 18 2016 10:32

var result = "";
// Your code below this line
// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog" , "big" , "ran" , "quickly");

Stephen James
@sjames1958gm
Apr 18 2016 10:32
@priyankasawant12345 "," is not how you combine strings, also you are supposed to put a " " inbetween words
@sjames1958gm Not sure if they have shown this "this" + " " + "that => "this that"
cannelflow
@cannelflow
Apr 18 2016 10:34
function(A,B,C,D){
so if you want to make a sentence using A,B,C,C then do like
result = A+" "+B+" "+C" "+D
}
@priyankasawant12345
Stephen James
@sjames1958gm
Apr 18 2016 10:34
@ydeepk strSplita.toUpperCase(); this returns the first word upper case, now you combine it with the rest of strSplit[a] using a string function that returns only part of a string.
@ydeepk
Apr 18 2016 10:35
@priyankasawant12345 you have to make a fill in the blanks sentence, in result variable
Alex
@alexstelmakh
Apr 18 2016 10:35
Please help. What should I do with this: myStr should have the escape sequences for backslash tab tab carriage-return new-line separated by spaces var myStr = 'backslash tab tab carriage-return new-line'; // Change this line
@ydeepk
Apr 18 2016 10:36
@priyankasawant12345 you have to make a fill in the blanks sentence , in result variable, remember about strings and variables ?
Stephen James
@sjames1958gm
Apr 18 2016 10:37
@alexstelmakh Use the table on the left to replace the words in the string with the escape sequences
@ydeepk
Apr 18 2016 10:37
@sjames1958gm let me try it.
Stephen James
@sjames1958gm
Apr 18 2016 10:38
@ydeepk
Apr 18 2016 10:38
@priyankasawant12345 are you there?
priyanka
@priyankasawant12345
Apr 18 2016 10:38
yes

var result = "";
// Your code below this line
result = "cat"+" "+"little"+" "+"hit"+" "+"slowly";
// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog" , "big" , "ran" , "quickly");

still not working
cannelflow
@cannelflow
Apr 18 2016 10:39
@alexstelmakh you can see the instruction like tab is \t something
Alex
@alexstelmakh
Apr 18 2016 10:39

myStr should have the escape sequences for backslash tab tab carriage-return new-line separated by spaces

var myStr = 'backslash tab tab carriage-return new-line'; // Change this line

Stephen James
@sjames1958gm
Apr 18 2016 10:39
@priyankasawant12345 You didn't use the variables
cannelflow
@cannelflow
Apr 18 2016 10:39
@priyankasawant12345 you are passing myNoun, myAdjective, myVerb,myAdverb to function so use these variable
@ydeepk
Apr 18 2016 10:40
@priyankasawant12345 do want ans directly??
Stephen James
@sjames1958gm
Apr 18 2016 10:40
@alexstelmakh See the table on the left
priyanka
@priyankasawant12345
Apr 18 2016 10:40
yes
cannelflow
@cannelflow
Apr 18 2016 10:40
@alexstelmakh as @sjames1958gm said see the table
Stephen James
@sjames1958gm
Apr 18 2016 10:40
@alexstelmakh Use output column to replace the words in string with code column
@ydeepk
Apr 18 2016 10:40

@priyankasawant12345
var result = "";
// Your code below this line
result= "I'm a "+myNoun+",I'm very "+myAdjective+" like to "+myVerb+" my "+myAdverb+" everyday.";
// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("cat", "little", "hit", "slowly");

Stephen James
@sjames1958gm
Apr 18 2016 10:41
@sjames1958gm For example replace tab with \t
cannelflow
@cannelflow
Apr 18 2016 10:42
pls pasting answer won't help anyone here
@alexstelmakh for newline \n
everything is there at left @alexstelmakh
priyanka
@priyankasawant12345
Apr 18 2016 10:43
@ydeepk Thanks deepak !!!
CamperBot
@camperbot
Apr 18 2016 10:43
priyankasawant12345 sends brownie points to @ydeepk :sparkles: :thumbsup: :sparkles:
:star: 264 | @ydeepk | http://www.freecodecamp.com/ydeepk
Alex
@alexstelmakh
Apr 18 2016 10:44
This message was deleted
@ydeepk
Apr 18 2016 10:44
@priyankasawant12345 you R Welcome.
Alex
@alexstelmakh
Apr 18 2016 10:46
I don't understand what is wrong
I typed this : var myStr = 'backslash \t tab \t tab \t carriage-return \t new-line';
and nothing((
@ydeepk
Apr 18 2016 10:46
@alexstelmakh try putting it between double quotes. ""
cannelflow
@cannelflow
Apr 18 2016 10:47
suppose it is newline newline tab tab
then you do like
var myStr = '\n \n \t \t'
@alexstelmakh
Brendan Kinahan
@BKinahan
Apr 18 2016 10:48
@cannelflow that ain't no string :P
cannelflow
@cannelflow
Apr 18 2016 10:49
@BKinahan oops :p
@ydeepk
Apr 18 2016 10:49
@BKinahan agreed.
@cannelflow a string is something between "".
Son Dang
@viiiprock
Apr 18 2016 10:50
@alexstelmakh remove all text with escape sign
@ydeepk
Apr 18 2016 10:50
@cannelflow good you realised your mistake.
cannelflow
@cannelflow
Apr 18 2016 10:50
@ydeepk tax @BKinahan
CamperBot
@camperbot
Apr 18 2016 10:50
cannelflow sends brownie points to @ydeepk and @bkinahan :sparkles: :thumbsup: :sparkles:
:star: 1327 | @bkinahan | http://www.freecodecamp.com/bkinahan
:star: 265 | @ydeepk | http://www.freecodecamp.com/ydeepk
cannelflow
@cannelflow
Apr 18 2016 10:50
@ydeepk after all we are here to learn
Stephen James
@sjames1958gm
Apr 18 2016 10:52
@alexstelmakh Remove the words
Alex
@alexstelmakh
Apr 18 2016 10:55
@sjames1958gm What the words?
Stephen James
@sjames1958gm
Apr 18 2016 10:55
@alexstelmakh backspace tab new-line carriage-return
Uğur
@UgurKurt
Apr 18 2016 10:56
Hi guys ,i looked everywhere but couldnt find a solution ,in find palindromes challenge ,my code doesnt work and i have no idea why .
How can i post my code here ?
cannelflow
@cannelflow
Apr 18 2016 10:56
wiki format
CamperBot
@camperbot
Apr 18 2016 10:56

## :point_right: code formatting [wiki]

### Multi line Code

js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

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

 ⇦ Type 3 backticks, then press [enter ⏎]

### Single line Code

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

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

cannelflow
@cannelflow
Apr 18 2016 10:56
:point_up: April 18, 2016 4:26 PM @UgurKurt
Alex
@alexstelmakh
Apr 18 2016 10:57
@sjames1958gm f*k/. my english is bad, I understand nothing((
Stephen James
@sjames1958gm
Apr 18 2016 10:57
@alexstelmakh "tab" ==> "\t"
Abdoulaye Niang
@abesn
Apr 18 2016 11:01
Hi All...
Today's my second day - Need Help with this:
function convertToF(celsius) { // Only change code below this line var celcius; var fahrenheit = celcius*(9/5)+32; // Only change code above this line return fahrenheit; } // Change the inputs below to test your code convertToF(0); convertToF(-30); convertToF(-10); convertToF(-0); convertToF(20); convertToF(30);
Stephen James
@sjames1958gm
Apr 18 2016 11:01
@abesn why define celcius with var celcius when it is a parameter
Uğur
@UgurKurt
Apr 18 2016 11:02
function palindrome(str) {

var clean = str.replace(/\s+|\\/g,"");
var lowerCase = clean.toLowerCase();
var reversed = lowerCase.split("").reverse().join("");

if(reversed==str)
return true;
else
return false;

}
why this doesnt work ?
i did other regex things too
greg
@wearenotgroot
Apr 18 2016 11:03
@UgurKurt compare the clean and the reversed, also try other regex
Uğur
@UgurKurt
Apr 18 2016 11:03
Ill try that
now everything returns true
Abdoulaye Niang
@abesn
Apr 18 2016 11:05
Thanks @sjames1958gm
I sthere anything else I need to change? Still not working...
CamperBot
@camperbot
Apr 18 2016 11:05
abesn sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star: 689 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
greg
@wearenotgroot
Apr 18 2016 11:05
@UgurKurt yeah you need to redo the regex
Uğur
@UgurKurt
Apr 18 2016 11:05
how ?
V Arun Kumar
@arunvkumr
Apr 18 2016 11:05
@UgurKurt you are just removing spaces and \, you need to remove all special chars.. including _.
greg
@wearenotgroot
Apr 18 2016 11:05
@UgurKurt you can replace special characters and only let alphanummeric characters remain
Rustem Garaev
@fuko4
Apr 18 2016 11:06
Hello! how to insert the code here ?
V Arun Kumar
@arunvkumr
Apr 18 2016 11:06
wiki format
CamperBot
@camperbot
Apr 18 2016 11:06

## :point_right: code formatting [wiki]

### Multi line Code

js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

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

 ⇦ Type 3 backticks, then press [enter ⏎]

### Single line Code

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

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

Uğur
@UgurKurt
Apr 18 2016 11:06
function palindrome(str) {

var clean = str.replace(/\s+|,|.|(|)|:|_|-|\/|\\/g,"");
var lowerCase = clean.toLowerCase();
var reversed = lowerCase.split("").reverse().join("");

if(reversed==clean)
return true;
else
return false;

}

palindrome("eye");
did it
still not working
Rustem Garaev
@fuko4
Apr 18 2016 11:06
Thank you!
greg
@wearenotgroot
Apr 18 2016 11:07
@UgurKurt try https://regex101.com/ and check out \W. remember _(underscore) is an alphanummeric character so you need to filter it out as well
Stephen James
@sjames1958gm
Apr 18 2016 11:07
@UgurKurt Try /\W|_/g
Uğur
@UgurKurt
Apr 18 2016 11:07
thanks man
Stephen James
@sjames1958gm
Apr 18 2016 11:07
@UgurKurt Also you should compare reversed to lowerCase not clean
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:07

// Setup
var a;
var b = 2;

// Only change code below this line
var a = 7;
var b = 7;
a = b;

Uğur
@UgurKurt
Apr 18 2016 11:07
/\W|_/g worked
Thank you a lot
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:08
What am doing wrong?
Alex
@alexstelmakh
Apr 18 2016 11:08
@sjames1958gm it's not a programming it's hell knows what. Can somebody give me a prepared string of code? I need to solve this : 
myStr should have the escape sequences for backslash tab tab carriage-return new-line separated by spaces
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:08
What am I doing wrong?

// Setup
var a;
var b = 2;

// Only change code below this line
var a = 7;
var b = 7;
a = b;

Uğur
@UgurKurt
Apr 18 2016 11:08
does that mean replace all the non-alphanumerics ?
Stephen James
@sjames1958gm
Apr 18 2016 11:08
@UgurKurt Yes
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:08
The "level" is called Storing Values with the Assignment Operator
Rustem Garaev
@fuko4
Apr 18 2016 11:08
console.log("hello world");
V Arun Kumar
@arunvkumr
Apr 18 2016 11:09
@AlbinKarlsson99 don't declare a and b again.. you don't need var asecond time just aawould do.
greg
@wearenotgroot
Apr 18 2016 11:09
@AlbinKarlsson99 propbably need to assign a to b
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:09
How do i do that @wearenotgroot ?
greg
@wearenotgroot
Apr 18 2016 11:09
@AlbinKarlsson99 right now you are assigning b to a
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:10
Yea
greg
@wearenotgroot
Apr 18 2016 11:10
@AlbinKarlsson99 do the opposite then?
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:10
Do not change code above the line
a should have a value of 7
b should have a value of 7
a should be assigned to b with =
What do you mean, I dont understand ;D
greg
@wearenotgroot
Apr 18 2016 11:10
@AlbinKarlsson99 b = a not a = b
:smile:
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:10
Oh
Haha thanks bro
greg
@wearenotgroot
Apr 18 2016 11:11
@AlbinKarlsson99 np
Stephen James
@sjames1958gm
Apr 18 2016 11:11
@AlbinKarlsson99 b is 7 because of b = a
Alex
@alexstelmakh
Apr 18 2016 11:11
it's not a programming it's hell knows what. Can somebody give me a prepared string of code? I need to solve this : 
myStr should have the escape sequences for backslash tab tab carriage-return new-line separated by spaces
Stephen James
@sjames1958gm
Apr 18 2016 11:12
var myStr = "\\ \t \t \r \n";
Rustem Garaev
@fuko4
Apr 18 2016 11:13
Help! Checks only the first object in the array . Then he writes that the contact can not be found .

CamperBot
@camperbot
Apr 18 2016 11:13
no wiki entry for: checks only the first object in the array then he writes that the contact can not be found
Stephen James
@sjames1958gm
Apr 18 2016 11:13
@alexstelmakh It is programming, it is understanding how javascript works
Rustem Garaev
@fuko4
Apr 18 2016 11:13
Help! Checks only the first object in the array . Then he writes that the contact can not be found .
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];

function lookUpProfile(firstName, prop){
// Only change code below this line

for(var i = 0; i < contacts.length; i++){
if(contacts[i].firstName === firstName){

if(contacts[i][prop] === undefined){
return "No such property";
}
else{
return contacts[i][prop];
}

}
else{
return "No such contact";
}
}
// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Harry", "lastName");
CamperBot
@camperbot
Apr 18 2016 11:13
no wiki entry for: checks only the first object in the array then he writes that the contact can not be found setupvar contacts firstname akira lastname laine number 0543236543 likes pizza coding brownie points firstname harry lastname potter number 0994372684 likes hogwarts magic hagrid firstname sherlock lastname holmes number 0487345643 likes intriguing cases violin firstname kristian lastname vos number unknown likes javascript gaming foxes function lookupprofilefirstname prop only change code below this line forvar i 0 i contactslength i ifcontactsifirstname firstname ifcontactsiprop undefined return no such property else return contactsiprop else return no such contact only change code above this line change these values to test your functionlookupprofileharry lastname
greg
@wearenotgroot
Apr 18 2016 11:14
Abdoulaye Niang
@abesn
Apr 18 2016 11:15
function convertToF(celsius) {
// Only change code below this line
var fahrenheit = celcius*(9/5)+32;
// Only change code above this line
return fahrenheit;
}
// Change the inputs below to test your code
convertToF(0);
convertToF(-30);
convertToF(-10);
convertToF(-0);
convertToF(20);
convertToF(30);
Any help..?
Rustem Garaev
@fuko4
Apr 18 2016 11:15
@wearenotgroot 1st or 2nd?
greg
@wearenotgroot
Apr 18 2016 11:15
@fuko4 remember you have .hasOwnProperty(arg) available to check if a property exist in an object
@fuko4 second one
Alex
@alexstelmakh
Apr 18 2016 11:15
@sjames1958gm I copied and pasted this : 
var myStr = "\ \t \t \r \n" and it doesnt work
V Arun Kumar
@arunvkumr
Apr 18 2016 11:15
@fuko4 just remove the else part of no such contact and return no such contact out of loop. that should do it.
greg
@wearenotgroot
Apr 18 2016 11:16
@fuko4 also consider what happens to the else on the other if statement
Stephen James
@sjames1958gm
Apr 18 2016 11:16
@alexstelmakh var myStr = "\\ \t \t \r \n";
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:16

Need some help again :D What am i doing wrong now? :( // Declarations
var StUdLyCapVaR;
var properCamelCase;
var TitleCaseOver;

// Assignments
STUDLYCAPVAR = 10;
PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;

Understanding Case Sensitivity in Variables
Stephen James
@sjames1958gm
Apr 18 2016 11:16
@abesn Make sure your variables are all the same spelling
Alex
@alexstelmakh
Apr 18 2016 11:17
@sjames1958gm it doesn't work
Abdoulaye Niang
@abesn
Apr 18 2016 11:17
@sjames1958gm
Thanks again, Man!!
Only took me 1/2 hour ..
CamperBot
@camperbot
Apr 18 2016 11:17
abesn sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: abesn already gave sjames1958gm points
greg
@wearenotgroot
Apr 18 2016 11:17
Alex
@alexstelmakh
Apr 18 2016 11:18
@sjames1958gm sorry it works
greg
@wearenotgroot
Apr 18 2016 11:18
@AlbinKarlsson99 were you supposed to do camelcase on everything?
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:19
I think so
greg
@wearenotgroot
Apr 18 2016 11:19
@AlbinKarlsson99 do you know how to do it?
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:19
I dont
Stephen James
@sjames1958gm
Apr 18 2016 11:19
@AlbinKarlsson99 Where you supposed to make the assignment names match the ones above?
cannelflow
@cannelflow
Apr 18 2016 11:19
@AlbinKarlsson99 you need to make camelCase in both Declarations and Assignments
greg
@wearenotgroot
Apr 18 2016 11:19
@AlbinKarlsson99 so you have a string which is composite of different word
@AlbinKarlsson99 the first letter of each word should be capitalized except for the very first letter of the entire string
@AlbinKarlsson99 like this one
var properCamelCase;
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:20
Oh
Stephen James
@sjames1958gm
Apr 18 2016 11:20
@abesn Pro-tip - open your devtools (F12 on chrome) - sometimes it will show an error that will help.
Ultras05
@Ultras05
Apr 18 2016 11:21

function abTest(a, b) {
// Only change code below this line

// Only change code above this line

return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b),2));

}

// Change values below to test your code
abTest(2,-16);

help plz
CamperBot
@camperbot
Apr 18 2016 11:21
no wiki entry for: plz
cannelflow
@cannelflow
Apr 18 2016 11:21
@Ultras05 which exercise
Rustem Garaev
@fuko4
Apr 18 2016 11:21

Here error . Checks only the first element . Why?
function lookUpProfile(firstName, prop){
// Only change code below this line

for(var i = 0; i < contacts.length; i++){
if(contacts[i].firstName === firstName){
...
}

Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:21
Nothing changes @wearenotgroot , still the same
Rustem Garaev
@fuko4
Apr 18 2016 11:21

Here error . Checks only the first element . Why?
function lookUpProfile(firstName, prop){
// Only change code below this line

for(var i = 0; i < contacts.length; i++){
if(contacts[i].firstName === firstName){
...
}


greg
@wearenotgroot
Apr 18 2016 11:22
@AlbinKarlsson99 post updated code
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:22

// Declarations
var studlyCapVar;
var properCamelCase;
var titleCaseOver;

// Assignments
STUDLYCAPVAR = 10;
PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;

Ultras05
@Ultras05
Apr 18 2016 11:22
@cannelflow Return Early Pattern for Functions
Stephen James
@sjames1958gm
Apr 18 2016 11:22
@fuko4 Press shift-return after  to get code formatting
Matthew Brener
@akkatracker
Apr 18 2016 11:22
Hey guys, how come my palindrome function is always returning true?
function palindrome(str) {
// Good luck!
var nowhitespace = str.replace(/\s+/g,"");
nowhitespace = nowhitespace.toLowerCase();
var splitString = nowhitespace.split();
var reversed = splitString;
reversed.reverse();
if(splitString == reversed){
return true;
}else{
return false;
}
}
Stephen James
@sjames1958gm
Apr 18 2016 11:22
@AlbinKarlsson99 Make the assignments match
V Arun Kumar
@arunvkumr
Apr 18 2016 11:22
@fuko4 your code was fine.. only thing you had to do was to move the no such contact outside the loop.
Stephen James
@sjames1958gm
Apr 18 2016 11:23
@akkatracker reverse doesn't modify the array it returns a reversed array
cannelflow
@cannelflow
Apr 18 2016 11:23
@Ultras05 if(a is less then 0 or b is less then 0) return undefined
Stephen James
@sjames1958gm
Apr 18 2016 11:24
@akkatracker But you can call it on splitString to return the reversed array
Matthew Brener
@akkatracker
Apr 18 2016 11:24
@sjames1958gm thanks but it still doesn't work:
function palindrome(str) {
// Good luck!
var nowhitespace = str.replace(/\s+/g,"");
nowhitespace = nowhitespace.toLowerCase();
var splitString = nowhitespace.split();
var reversed = splitString.reverse();
if(splitString == reversed){
return true;
}else{
return false;
}
}

palindrome("eye");
CamperBot
@camperbot
Apr 18 2016 11:24
akkatracker sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star: 690 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
Albin Karlsson
@AlbinKarlsson99
Apr 18 2016 11:24
Oh thanks @sjames1958gm and @wearenotgroot
CamperBot
@camperbot
Apr 18 2016 11:24
albinkarlsson99 sends brownie points to @sjames1958gm and @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star: 1021 | @wearenotgroot | http://www.freecodecamp.com/wearenotgroot
:star: 691 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
V Arun Kumar
@arunvkumr
Apr 18 2016 11:24
@fuko4 paste your code again.. with formating
Stephen James
@sjames1958gm
Apr 18 2016 11:25
@akkatracker Where is it not working - use console.log and devtools console to see the various values
Ultras05
@Ultras05
Apr 18 2016 11:25
@cannelflow it doesnt work
Rustem Garaev
@fuko4
Apr 18 2016 11:25
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];

function lookUpProfile(firstName, prop){
// Only change code below this line

for(var i = 0; i < contacts.length; i++){
if(contacts[i].firstName === firstName){

if(contacts[i].hasOwnProperty(prop)){
return contacts[i][prop];
}
else{

return "No such property";
}

}
else{
return "No such contact";
}
}
// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Harry", "lastName");
GowthamReddyAmbati
@GowthamReddyAmbati
Apr 18 2016 11:25

~ function findLongestWord(str) {
var longestword=[];
var splitstr=[];
splitstr= str.split(' ');
var lensplitstr=splitstr.length;

for(var i=0;i<=lensplitstr; i++)
{

 longestword[i] = splitstr[i].length;

}

return Math.max.apply(longestword,math);
}

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

cannelflow
@cannelflow
Apr 18 2016 11:25