29th
Apr 2016
Wiktor
@Wkredz1
Apr 29 2016 00:02
0Convert the assignments for a, b, and c to use the *= operator.
b should equal 36
c should equal 46
var b = 12;
var c = 4.6;
help
CamperBot
@camperbot
Apr 29 2016 00:02

### Basic Commands:

• find TOPIC find all entries about topic. ex: find js
• wiki TOPIC show contents of topic page
• thanks @username send brownie points to another user
• about @username shows info on that user
• Algorithm BONFIRENAME info on a Algorithm

:speech_balloon: meet CamperBot in this room!

Ozan Araz
@haraldur12
Apr 29 2016 00:03
var c *= 10
it means you are multiplying the same variable you have with the number
Victoria
@vperr007
Apr 29 2016 00:03
var b *=3
Wiktor
@Wkredz1
Apr 29 2016 00:04
i cant change the variables
only b = 3 b;
c = c 10;
Ozan Araz
@haraldur12
Apr 29 2016 00:04
how come ?
Wiktor
@Wkredz1
Apr 29 2016 00:04
those are the instructions
Ozan Araz
@haraldur12
Apr 29 2016 00:05
return c *= 10;
This message was deleted
which one is that can you tell me the title so that i can help you precisely?
Wiktor
@Wkredz1
Apr 29 2016 00:05
Compound Assignment With Augmented Multiplication
Victoria
@vperr007
Apr 29 2016 00:06
I wish they had this for Ruby or Python
Wiktor
@Wkredz1
Apr 29 2016 00:06
python at least
Ozan Araz
@haraldur12
Apr 29 2016 00:06
@Wkredz1 Okay so variables are already defined right ? so you have to get the variable name and multiply it with it self
Joey Deeds
@joeydeeds
Apr 29 2016 00:06
Ozan Araz
@haraldur12
Apr 29 2016 00:07
example *= number;
so what do you have to multiply 4.6 to get 46 and 12 to 36 ?
Josue Godoy Lechuga
@josue1080
Apr 29 2016 00:11
help Testing Objects for Properties
CamperBot
@camperbot
Apr 29 2016 00:11

# Challenge: Testing Objects for Properties

Sometimes it is useful to check if the property of a given object exists or not. We can use the .hasOwnProperty([propname]) method of objects to determine if that object has the given property name. .hasOwnProperty() returns true or false if the property is found or not.

## Example

var myObj = {
top: "hat",
bottom: "pants"
};
myObj.hasOwnProperty("top");    // true
myObj.hasOwnProperty("middle");
Jorge
@liberaltech
Apr 29 2016 00:12
how do i post to twitter using my own created submit button?
Joseph
@revisualize
Apr 29 2016 00:13
Anything else that I should link?
A little self promotion?
DamianMitchell
@DamianMitchell
Apr 29 2016 00:17
Can I get some help here!!!!
Joseph
@revisualize
Apr 29 2016 00:18
Jon
@Antiphilous
Apr 29 2016 00:18
Hey wondering if someone can help me out with the record collection challenge in Javascript
Joseph
@revisualize
Apr 29 2016 00:18
I'm certain that one of the amazing individuals in this lovely room will be able to assist you with anything that is related to the FreeCodeCamp.com basic JavaScript and Algorithms Challenges.
@Antiphilous I can.
DamianMitchell
@DamianMitchell
Apr 29 2016 00:19
Can I get some help here!!!!if the var is global and the local var value is returning over the global then what could be wrong
Joseph
@revisualize
Apr 29 2016 00:19
@Antiphilous Here is the best help that I can give..
Wiktor
@Wkredz1
Apr 29 2016 00:19
Convert the assignments for a, b, and c to use the *= operator.
Joseph
@revisualize
Apr 29 2016 00:19

@Antiphilous I took the instructions from the challenge and turned it into pseudo-code and commented it out.

// Write a function which takes:
//  an id, a property (prop), and a value.
function updateRecords(id, prop, value) {
// 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.
return collection;
}

If you read the instructions and my text you should see how they line up.

Wiktor
@Wkredz1
Apr 29 2016 00:19
b should equal 36
c should equal 46
a = a 1;
b = 3 b;
c = c 10;
help
CamperBot
@camperbot
Apr 29 2016 00:19

### Basic Commands:

• find TOPIC find all entries about topic. ex: find js
• wiki TOPIC show contents of topic page
• thanks @username send brownie points to another user
• about @username shows info on that user
• Algorithm BONFIRENAME info on a Algorithm

:speech_balloon: meet CamperBot in this room!

Wiktor
@Wkredz1
Apr 29 2016 00:20
cant change variable #
Joseph
@revisualize
Apr 29 2016 00:20
@Antiphilous Good luck. I gotta go!
:v:
DamianMitchell
@DamianMitchell
Apr 29 2016 00:20
no can't change the global or return var
Wiktor
@Wkredz1
Apr 29 2016 00:21
?
Jon
@Antiphilous
Apr 29 2016 00:21
collection[id][prop]= collection[id][prop].push(value);
DamianMitchell
@DamianMitchell
Apr 29 2016 00:22
@Wkredz1

here's the code// Setup
var outerWear = "T-Shirt";

function myFunction() {
// Only change code below this line
var myOutfit = "sweater";

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

myFunction();

Wiktor
@Wkredz1
Apr 29 2016 00:24
huh
Jon
@Antiphilous
Apr 29 2016 00:24
what are you looking for help for with Damian?
I can probably give you a hand while I try to figure out how to .push to an array inside an object
DamianMitchell
@DamianMitchell
Apr 29 2016 00:24
var myOutfit = "sweater";
is suppose to be the return because it's local right, yet, I don't get the local return, I get the global return
Jon
@Antiphilous
Apr 29 2016 00:26
ahh
I see what you have done
@DamianMitchell I just went back to review the challenge
the function itself is defined as "myOutfit"
DamianMitchell
@DamianMitchell
Apr 29 2016 00:27
@Antiphilous
Jon
@Antiphilous
Apr 29 2016 00:27
What it is asking you to do is define another variable with the name outerWear so that you can see which variable takes priority
DamianMitchell
@DamianMitchell
Apr 29 2016 00:28
so you don't have to create the local variable?
Jon
@Antiphilous
Apr 29 2016 00:29
@DamianMitchell No you will need to

var outerWear = "T-Shirt";

function myOutfit() {
// Only change code below this line

var outerWear = "sweater"

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

myOutfit();

DamianMitchell
@DamianMitchell
Apr 29 2016 00:29
@Antiphilous thank you
CamperBot
@camperbot
Apr 29 2016 00:29
damianmitchell sends brownie points to @antiphilous :sparkles: :thumbsup: :sparkles:
:star: 228 | @antiphilous | http://www.freecodecamp.com/antiphilous
Jon
@Antiphilous
Apr 29 2016 00:30

var outerWear = "T-Shirt"; <----- Global Variable

function myOutfit() {
// Only change code below this line

var outerWear = "sweater" <---- Local Varibale

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

myOutfit();

Wiktor
@Wkredz1
Apr 29 2016 00:31
this is stupid. variable variable 12 has to equal 36 how is this possible
Joey Deeds
@joeydeeds
Apr 29 2016 00:31
use multiplication :) @Wkredz1
Wiktor
@Wkredz1
Apr 29 2016 00:31
...
12 1 12 = 144
thats the minimum value
Joey Deeds
@joeydeeds
Apr 29 2016 00:32
12 * 3
Wiktor
@Wkredz1
Apr 29 2016 00:32
12 times 3 times 12 is 432, not 36
I understand how to access the different properties of the object I am just having trouble with pushing another track into the object
Matthew Fricker
@mattfricker
Apr 29 2016 00:34
@Antiphilous Paste the code into here and I will take a look
Leo Berlin
@leober
Apr 29 2016 00:34
hi
Matthew Fricker
@mattfricker
Apr 29 2016 00:35
help format
CamperBot
@camperbot
Apr 29 2016 00:35

## :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

Sam Bitzelberger
@sambitz
Apr 29 2016 00:35
@Wkredz1 for that exercise would it be b *= 3
Leo Berlin
@leober
Apr 29 2016 00:35
I am stuck here
wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).
Sam Bitzelberger
@sambitz
Apr 29 2016 00:36
@Wkredz1 since b = 12, if you use the operand, b*= 3 would equal to the required 36
Leo Berlin
@leober
Apr 29 2016 00:36
I didin't understand how to passed words separated by non-wprd characters
Jon
@Antiphilous
Apr 29 2016 00:36
@mattfricker thanks
CamperBot
@camperbot
Apr 29 2016 00:36
antiphilous sends brownie points to @mattfricker :sparkles: :thumbsup: :sparkles:
:star: 137 | @mattfricker | http://www.freecodecamp.com/mattfricker
Jon
@Antiphilous
Apr 29 2016 00:36
just one moment

@mattfricker function updateRecords(id, prop, value) {

if(collection[id][value] !== "" && collection[id][prop] !== "tracks"){

collection[id][prop] = value;

} else if(collection[id][value] !== "" && collection[id][prop] === "tracks"){

collection[id][prop].push(value);  

} else if (collection[id][value] === ""){

delete collection[id][prop];
}

return collection;

}

Leo Berlin
@leober
Apr 29 2016 00:37
Hi Ivan
Jon
@Antiphilous
Apr 29 2016 00:37

function updateRecords(id, prop, value) {

if(collection[id][value] !== "" && collection[id][prop] !== "tracks"){

collection[id][prop] = value;

} else if(collection[id][value] !== "" && collection[id][prop] === "tracks"){

collection[id][prop].push(value);  

} else if (collection[id][value] === ""){

delete collection[id][prop];
}

return collection;

}


Matthew Fricker
@mattfricker
Apr 29 2016 00:39
@Antiphilous after the three tildes, can you add 'js' without the single quotes and then add a line break? Will look at your code and try to see where the issue lies
Shanae
@Shanae2009
Apr 29 2016 00:39
could some help please? I've gotten stuck
Matthew Fricker
@mattfricker
Apr 29 2016 00:39
@Antiphilous Where are you trying to add an object?
Joseph
@revisualize
Apr 29 2016 00:40
@Antiphilous per the instructions... youre doing your if evaluations incorrectly.
@Antiphilous they come from the function not the object.
Jon
@Antiphilous
Apr 29 2016 00:40
@revisualize yes
Matthew Fricker
@mattfricker
Apr 29 2016 00:41

@Antiphilous I see


collection[id][prop].push(value);

.push is a method present on arrays - is collection[id][prop] an array? Or is it some value within an array?

Jon
@Antiphilous
Apr 29 2016 00:41
// 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(collection[id][value] !== "" && collection[id][prop] !== "tracks"){

collection[id][prop] = value;

} else if(collection[id][value] !== "" && collection[id][prop] === "tracks"){

collection[id][prop].push(value);

} else if (collection[id][value] === ""){

delete collection[id][prop];
}

return collection;

}
@mattfricker Tracks is an array within the object
So no I suppose collection[id][prop] would not be defining an array?
Matthew Fricker
@mattfricker
Apr 29 2016 00:43
@Antiphilous Instead of those conditionals, you could use collection[id].hasOwnProperty(prop)
snow8261
@snow8261
Apr 29 2016 00:43
what is the meaning of smallest common multiple why [5,1] will result 60 ?
Carly
@cbogsin
Apr 29 2016 00:43

 function updateRecords(id, prop, value) {

if (value !== "") {
collection[id][prop] = value;
}
else {
delete collection[id][prop];
}

return collection;
}



I'm sorry
This isn't working as I expect
Matthew Fricker
@mattfricker
Apr 29 2016 00:44
@Antiphilous Now that I see the entire code, pushing onto that would work in the situation you are planning on it to work
Jon
@Antiphilous
Apr 29 2016 00:44
it doesnt seem to though
Carly
@cbogsin
Apr 29 2016 00:44
function updateRecords(id, prop, value) {

if (value !== "") {
collection[id][prop] = value;
}
else {
delete collection[id][prop];
}

return collection;
}
Jon
@Antiphilous
Apr 29 2016 00:44
it simply replaces whatever tracks were there before
Matthew Fricker
@mattfricker
Apr 29 2016 00:45
@Antiphilous I don't think the issue is with what you are trying to do - I think the issue is that the conditionals are causing the code to run when it should not
Jon
@Antiphilous
Apr 29 2016 00:45
ok
Matthew Fricker
@mattfricker
Apr 29 2016 00:47
@Antiphilous Maybe @revisualize can help you further. I actually have to run now but I would definitely suggesting looking up Object.hasOwnProperty() because it might really help with your conditionals.
Jon
@Antiphilous
Apr 29 2016 00:48
@mattfricker Ok thank you for your help
CamperBot
@camperbot
Apr 29 2016 00:48
antiphilous sends brownie points to @mattfricker :sparkles: :thumbsup: :sparkles:
:warning: antiphilous already gave mattfricker points
Stas
@mastas3
Apr 29 2016 00:48
maybe try this:

function updateRecords(id, prop, value) {

if(value !== '' && prop != 'tracks')
{
collection[id][prop] = value;
}
if(value !== '' && prop == 'tracks')
{
collection[id][prop].push(value);
}
if(value === '')
{
delete collection[id][prop];
}

return collection;
}

Joseph
@revisualize
Apr 29 2016 00:48
Jon
@Antiphilous
Apr 29 2016 00:48
@revisualize I did I think I need to go back and review a bit perhaps
kleahey
@kleahey
Apr 29 2016 00:49
Does anyone know why "null" isn't being removed from the bouncer array?
function bouncer(arr) {

var invalidEntries = 0;

function filterByID(value) {
return value !== false &&
value !== "" &&
value !== null &&
value !== 0 &&
value !== undefined &&
value !== NaN;
}

var filtered = arr.filter(filterByID);

return filtered;
}

bouncer([1, null, NaN, 2, undefined]);
bitgrower
@bitgrower
Apr 29 2016 00:49
yeah, when folks are having trouble with the more advanced object challenges, I heavily encourage them to review ... review each object challenge until you REALLY understand it ...
Carly
@cbogsin
Apr 29 2016 00:49
Looks like my problem is similar to the one already being talked about above but I'm having trouble following along because that person's code is different
Jon
@Antiphilous
Apr 29 2016 00:49
@revisualize I appreciate the help really I do something just isn't clicking with me right now
Joseph
@revisualize
Apr 29 2016 00:50
Words are meant to be read.
bitgrower
@bitgrower
Apr 29 2016 00:50
@Antiphilous -- it can be hard to get your mind around it at first -- but it's REALLY worthwhile ...
Chase Webb
@jerrybaggin
Apr 29 2016 00:51
in the factorialize a number challenge. Do i need to set num to another variable before starting my loop?
Jon
@Antiphilous
Apr 29 2016 00:51
@bitgrower Cool be back in a bit after going over the past few challenges
bitgrower
@bitgrower
Apr 29 2016 00:52
@Antiphilous -- it can be hard to get your mind around it at first -- but it's REALLY worthwhile ...
...and the more you can learn how to find the answers on your own, the faster your learning will be, too ... not that you shouldn't ask questions ... but, really really work hard to find answers before doing so ... (you will also gain the respect of the people helping you, too)
Joseph
@revisualize
Apr 29 2016 00:54
... @bitgrower speaks TRUTH.
though Seek and Destroy kicked my arse.
bitgrower
@bitgrower
Apr 29 2016 00:54
it's like there are little puzzle pieces and you have to fit them together -- and, just like when you fit them together, you get a whole new picture, that happens when you fit these puzzle pieces together, too ...
Chase Webb
@jerrybaggin
Apr 29 2016 00:55
thats what im doing currently, going back and redoing those puzzles.
bitgrower
@bitgrower
Apr 29 2016 00:56
LOL @revisualize -- Seek and Destroy got me, too -- in fact, when I did finally break down and ask about it -- no one could tell me ... I finally threw it into pythontutor and said ... how can arr be equal to just [1,2,3,1,2,3] -- and then I kinda put various pieces together (like the fact that js functions can take a variable number of parameters ... Since then S&D has been one of my fav algos ... just because I learned so much from it ...
...also ... thinking i've solved something, and then realizing by failing some of the test cases that I didn't read the problem requirements carefully enough ... another BIG lesson ...
Joseph
@revisualize
Apr 29 2016 00:58

@cbogsin// Write a function which takes:
// an id, a property (prop), and a value.
function updateRecords(id, prop, value) {
// 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.
return collection;
}

@cbogsin i cant format that on my phone.
drew
@drewcodes
Apr 29 2016 00:58
hey guys, can anyone point me in the right direction on how to create a search bar using jquery? I'm working on the wikipedia viewer and I'm having a little trouble with it
Joseph
@revisualize
Apr 29 2016 00:59
Most of it is written for you in the instructions.
@skoolboi try the HelpFrontEnd room.
Help rooms
CamperBot
@camperbot
Apr 29 2016 00:59

# FreeCodeCamp Chat Rooms

### Help Rooms

Chat Room Description Chat Room
HTML/CSS/Bootstrap FreeCodeCamp/Help
JavaScript/Algorithms FreeCodeCamp/HelpJavaScript
Front End FreeCodeCamp/HelpFrontEnd
Data Visualization FreeCodeCamp/HelpDataViz
Back End FreeCodeCamp/HelpBackEnd

Choose the right room for your questions!

back to top

Joseph
@revisualize
Apr 29 2016 00:59
Cbot
CamperBot
@camperbot
Apr 29 2016 00:59
you called?
Joseph
@revisualize
Apr 29 2016 01:00
?
bitgrower
@bitgrower
Apr 29 2016 01:00
oh nice ... I didn't know there was a shortcut !
hi cbot!
Joseph
@revisualize
Apr 29 2016 01:00
Test?
bitgrower
@bitgrower
Apr 29 2016 01:00
Hi Cbot
cbot
CamperBot
@camperbot
Apr 29 2016 01:00
you called?
Joseph
@revisualize
Apr 29 2016 01:00
help rooms
CamperBot
@camperbot
Apr 29 2016 01:00

# FreeCodeCamp Chat Rooms

### Help Rooms

Chat Room Description Chat Room
HTML/CSS/Bootstrap FreeCodeCamp/Help
JavaScript/Algorithms FreeCodeCamp/HelpJavaScript
Front End FreeCodeCamp/HelpFrontEnd
Data Visualization FreeCodeCamp/HelpDataViz
Back End FreeCodeCamp/HelpBackEnd

Choose the right room for your questions!

back to top

Joseph
@revisualize
Apr 29 2016 01:00
Frak!!!!
rphares
@rphares
Apr 29 2016 01:01
what are you looking for, @revisualize ?
bitgrower
@bitgrower
Apr 29 2016 01:01
LOL, whatcha trying to do, @revisualize ?
rphares
@rphares
Apr 29 2016 01:01
(hey, @bitgrower ! :blush: )
bitgrower
@bitgrower
Apr 29 2016 01:01
hey @rphares !
Chase Webb
@jerrybaggin
Apr 29 2016 01:01
n the factorialize a number challenge. Do i need to set num to another variable before starting my loop?
bitgrower
@bitgrower
Apr 29 2016 01:01
@jerrybaggin ... post your code ?
Joseph
@revisualize
Apr 29 2016 01:01
Im trying to direct that person the HelpFrontEnd room!
Chase Webb
@jerrybaggin
Apr 29 2016 01:01

Joseph
@revisualize
Apr 29 2016 01:01
Im on my phone.
rphares
@rphares
Apr 29 2016 01:01
its in that list, you already did...?
bitgrower
@bitgrower
Apr 29 2016 01:01
well -- it has the frontend room in that list, @revisualize
Joseph
@revisualize
Apr 29 2016 01:02
I dont see campbot
Chase Webb
@jerrybaggin
Apr 29 2016 01:02
function factorialize(num) {

for(var i = 0;i< num; i++){
num *= num[i];
}

return num;
}

factorialize(5);
rphares
@rphares
Apr 29 2016 01:02
oh, he's posting, @revisualize ~ Must be a phone thing? lag or something?
Joseph
@revisualize
Apr 29 2016 01:02
Odd maybe it is me.
Oh! ... oops.... my bad. Sorry for the cbot spam.
rphares
@rphares
Apr 29 2016 01:03
lol, no worries~
rphares @rphares runs away again :blush:
bitgrower @bitgrower subtracts brownie points ... j/k!!!
bitgrower
@bitgrower
Apr 29 2016 01:03
oh dang, just when I was going to ask her about mongo ...
Joseph
@revisualize
Apr 29 2016 01:03
NOOOOOOOOOOOOO
bitgrower
@bitgrower
Apr 29 2016 01:03
LOL ... hardwon, ain't they ? :)
rphares
@rphares
Apr 29 2016 01:03
shhhh, @bitgrower :blush:
Joseph
@revisualize
Apr 29 2016 01:04
CamperBot
@camperbot
Apr 29 2016 01:04
:star: 1028 | @revisualize | http://www.freecodecamp.com/revisualize
Rudolf Carl Pablico
@rudolfpablico
Apr 29 2016 01:04
@jerrybaggin i think your loop will run infinitely
Joseph
@revisualize
Apr 29 2016 01:04
I see that!!!!
rphares
@rphares
Apr 29 2016 01:04
Very likely won't pass-- have had interviews pretty stacked up the last two weeks, had to skip some lessons to prep for the actual job-relevant stuff,
have one i really care about this week and its finals, so.... if i feel prepped, ill continue, if not,ill take it again when it starts again : /
Joseph
@revisualize
Apr 29 2016 01:06
@jerrybaggin what is 0 times anything?
@jerrybaggin OH#!!!! num keeps growing!
Therefore the evaluation never stops.
Shafeek B
@sbakhach
Apr 29 2016 01:09
Gah, this Nesting for Loops challenge is confusing me
Joseph
@revisualize
Apr 29 2016 01:10
Quite loopy.
Zaw Ye Htut
@yeyezaw
Apr 29 2016 01:13
var count = 0;

function cc(card) {
// Only change code below this line
if(card%2 === 0){
count++;
return "5 Bet";
}else if(card <= 0) {

return "0 Hold";
}

// Only change code above this line
}

// Note: Only the last will display
cc(2); cc(3); cc(4); cc(5); cc(6);
Shafeek B
@sbakhach
Apr 29 2016 01:14
is that the counting cards challenge @yeyezaw ?
Zaw Ye Htut
@yeyezaw
Apr 29 2016 01:14
yes it is
Shafeek B
@sbakhach
Apr 29 2016 01:16
You have to use a switch for that one @yeyezaw
Zaw Ye Htut
@yeyezaw
Apr 29 2016 01:16
Okay. Let me try with switch. @sbakhach
Joseph
@revisualize
Apr 29 2016 01:17
@yeyezaw I used a large-ish switch.
Zaw Ye Htut
@yeyezaw
Apr 29 2016 01:20
Hmm... yeah? I will try with switch. Then why not with if/else statements? @revisualize
Joseph
@revisualize
Apr 29 2016 01:20
Lesrning process and less code.
Learning*
Shafeek B
@sbakhach
Apr 29 2016 01:22
way less code
Zaw Ye Htut
@yeyezaw
Apr 29 2016 01:23
I usually rather to use with if/else and rarely to use with switch. yeah it's less code.
Brian
@BrianCodes33
Apr 29 2016 01:24
var x = 0;
while (x < 7) {
text(x, x, 10);
text(x+50, x+50, 10);
text(x+100, x+100, 10);
text(x+150, x+150, 10);
text(x+200, x+200, 10);
text(x+250, x+250, 10);
text(x+300, x+300, 10);
text(x+350, x+350, 10);
x += text;

}
what am i doing wrong?
Joseph
@revisualize
Apr 29 2016 01:24
No idea what youre doing.. so there is that.
Coy Sanders
@coymeetsworld
Apr 29 2016 01:25
what is the text function?
and the text variable?
Joseph
@revisualize
Apr 29 2016 01:25
Yeah.. where is the rest of the code?
Nicolas May
@hynso
Apr 29 2016 01:25
The Simon game zipline is proving to be a challenge when it comes to collecting the user's turn sequence... using a bunch of setTimeouts isn't working... what approach should I be taking?
Joseph
@revisualize
Apr 29 2016 01:25
@hynso HelpFrontEnd
Brian
@BrianCodes33
Apr 29 2016 01:25
processing JS library. text(text, x, y)
Coy Sanders
@coymeetsworld
Apr 29 2016 01:26
then what is text the variable at the bottom when you do x += text?
Brian
@BrianCodes33
Apr 29 2016 01:27
ahh
so i do x += 1? how do i get while loop working correctly
Coy Sanders
@coymeetsworld
Apr 29 2016 01:28
if you want it to execute 7 times, yes
but better to do a for loop in that case
Brian
@BrianCodes33
Apr 29 2016 01:28
yea its just one of these challenges on khan academy
Coy Sanders
@coymeetsworld
Apr 29 2016 01:28
if you're just incrementing a variable, code is more consise
Brian
@BrianCodes33
Apr 29 2016 01:28
won't let me pass
Coy Sanders
@coymeetsworld
Apr 29 2016 01:28
because it doesn't know what text is probably
Brian
@BrianCodes33
Apr 29 2016 01:29
i changed it to x+= 1
Coy Sanders
@coymeetsworld
Apr 29 2016 01:29
im not familiar w/ khan academy challenges so idk any further what to do lol sorry
never worked with that framework/library or whatever either
Joseph
@revisualize
Apr 29 2016 01:34
In the FreeCodeCamp gitter chat for the JavaScipt challenges asking for assistance with Khan Academy.
Chris Lacaille
@ChrisL108
Apr 29 2016 01:34
is using the underscore like this_functionName() just to specify not to change it?
just as a best practice?
Joseph
@revisualize
Apr 29 2016 01:35
Chase Webb
@jerrybaggin
Apr 29 2016 01:36
function palindrome(str) {
// Good luck! Thanks!!!

var strippedString = str.replace('/\w|_g').toLowerCase();
var reversedString = strippedString.split('').reverse();

if(strippedString == reversedString){
return true;
}else{
return false;
}

}

palindrome("eye");
could anyone tell me why im getting false?
Coy Sanders
@coymeetsworld
Apr 29 2016 01:37
should it be \W not \w?
Wiktor
@Wkredz1
Apr 29 2016 01:37
Can someone help
Joseph
@revisualize
Apr 29 2016 01:37
@jerrybaggin big W not little w
Chase Webb
@jerrybaggin
Apr 29 2016 01:38
just gave that a try and nothing changed.
Coy Sanders
@coymeetsworld
Apr 29 2016 01:38
also split creates an array, you need to make back to a string
with a join
Chase Webb
@jerrybaggin
Apr 29 2016 01:39
ahh
Zaw Ye Htut
@yeyezaw
Apr 29 2016 01:42
I got it and pass ! Thanks @sbakhach and @revisualize
CamperBot
@camperbot
Apr 29 2016 01:42
yeyezaw sends brownie points to @sbakhach and @revisualize :sparkles: :thumbsup: :sparkles:
:star: 1029 | @revisualize | http://www.freecodecamp.com/revisualize
:star: 234 | @sbakhach | http://www.freecodecamp.com/sbakhach
Chase Webb
@jerrybaggin
Apr 29 2016 01:44
I should be using a equality operator correct? the === ?
Joseph
@revisualize
Apr 29 2016 01:44
Brownies!!!!!
Coy Sanders
@coymeetsworld
Apr 29 2016 01:45
== is fine
Chau Tung Lam Nguyen
@nctl144
Apr 29 2016 02:14
hey guys im stuck with this challenge can anyone help me ?
Srinivasan
@kksrini89
Apr 29 2016 02:17
Hi guys can anyone help me to resolve "Seek and Destroy" challenge...?
I tried this way , but now worked out. Looking for help...
function destroyer(arr) {
// Remove all the values
for(var i = 0; i < 1; i++){
if(i !== 0){
var position = arr.indexOf(arguments[i]);
if(position > -1)
arr = arr.splice(position,1);
}
}

//arr=arr.filter(function(val){
//return (val!=arguments[1] || val!=arguments[2]);
//});
return arr;
}
buckshot307
@buckshot307
Apr 29 2016 02:19
while (changeReq > 0 && totalCid > 0) {
if (changeReq > 20.00 && amount.twenty > 0) {
change[7][1] += 20.00;
changeReq -= 20.00;
amount.twenty -= 1;
totalCid -= 20.00;
} else if (changeReq > 10.00 && amount.ten > 0) {
change[6][1] += 10.00;
changeReq -= 10.00;
amount.ten -= 1;
totalCid -= 10.00;
} else if (changeReq > 5.00 && amount.five > 0) {
change[5][1] += 5.00;
changeReq -= 5.00;
amount.five -= 1;
totalCid -= 5.00;
} else if (changeReq > 1.00 && amount.one > 0) {
change[4][1] += 1.00;
changeReq -= 1.00;
amount.one -= 1;
totalCid -= 1.00;
} else if (changeReq > 0.25 && amount.quarter > 0) {
change[3][1] += 0.25;
changeReq -= 0.25;
amount.quarter -= 1;
totalCid -= 0.25;
} else if (changeReq > 0.10 && amount.dime > 0) {
change[2][1] += 0.10;
changeReq -= 0.10;
amount.dime -= 1;
totalCid -= 0.10;
} else if (changeReq > 0.05 && amount.nickel > 0) {
change[1][1] += 0.05;
changeReq -= 0.05;
amount.nickel -= 1;
totalCid -= 0.05;
} else if (changeReq > 0.01 && amount.penny > 0) {
change[0][1] += 0.01;
changeReq -= 0.01;
amount.penny -= 1;
totalCid -= 0.01;
}
}
How is this an infinite loop?
lcassettai
@lcassettai
Apr 29 2016 02:20
@kksrini89 can you send the exercise?
Diego Mayer
@Chrono79
Apr 29 2016 02:22
@buckshot307 try adding an else break; line
javascript has some troubles working with decimals and the maths aren't as you expect them to be
Coy Sanders
@coymeetsworld
Apr 29 2016 02:25
what happens when changeReq == 0.01
Chris Cullen
@123xylem
Apr 29 2016 02:25
help Return Largest Numbers in Arrays
CamperBot
@camperbot
Apr 29 2016 02:25

## :point_right: algorithm return largest numbers in arrays [wiki]

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :memo:

# :checkered_flag: Problem Explanation:

You will get an array that contains sub arrays of numbers and you need to return an array with the largest number from each of the sub arrays.

Coy Sanders
@coymeetsworld
Apr 29 2016 02:25
or actually any change? i.e. you have exact change in drawer @buckshot307
you need a nickel and you have exactly one nickel in the drawer, or need a penny and you only have one penny in the drawer
buckshot307
@buckshot307
Apr 29 2016 02:27
@Chrono79 ah thanks that fixed it!
CamperBot
@camperbot
Apr 29 2016 02:27
buckshot307 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star: 553 | @chrono79 | http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Apr 29 2016 02:27
@buckshot307 also check what @coymeetsworld told you
Srinivasan
@kksrini89
Apr 29 2016 02:28
@nctl144 try this
function updateRecords(id, prop, value) {
if(value!==""){
if(prop!="tracks")
collection[id][prop]=value;
else
collection[id].tracks.push(value);
}
else{
delete collection[id][prop];
}

return collection;
}
buckshot307
@buckshot307
Apr 29 2016 02:29
@coymeetsworld I'll check that now, whole function still isn't working really but I'm not getting the infinite loop message anymore.
Coy Sanders
@coymeetsworld
Apr 29 2016 02:29
test an edge case where you have exact change
Chau Tung Lam Nguyen
@nctl144
Apr 29 2016 02:30
it doesnt work man
buckshot307
@buckshot307
Apr 29 2016 02:30
@coymeetsworld actually it's just stopping after adding one penny to change.
Coy Sanders
@coymeetsworld
Apr 29 2016 02:30
try putting debug statements in your code to see what its doing
see what happens after every loop
i.e. console.log
Diego Mayer
@Chrono79
Apr 29 2016 02:32
Chris Cullen
@123xylem
Apr 29 2016 02:33
DOes any1 have a good tool FOr LEARNING to code? Like a console that explains stuff or a goodvideo series?
Are there any online tools that make coding a bit easier?
Bobby McDonald
@BobbyMcWho
Apr 29 2016 02:33
That's what freecode camp is for?
Rudolf Carl Pablico
@rudolfpablico
Apr 29 2016 02:34

hi guys need help on title case a sentence 
function titleCase(str) {
var strarray = [];
var strupper = [];
var strlower = str.toLowerCase(); // make str all lowercase
strarray = strlower.split(" "); // split str into an array element

for (var i = 0; i < strarray.length; i++) { //access all the elements in strarray

  strupper = strarray[i][0].toUpperCase; 

}

return strupper;
// return strarray;
}

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


buckshot307
@buckshot307
Apr 29 2016 02:34
@coymeetsworld ah I bet it's something to do with have $100 bill in the drawer even though I'm not using those for change. Rudolf Carl Pablico @rudolfpablico Apr 29 2016 02:34 is there something wrong with my code? the console log hangs when i run the test tried to reload the page and still occurs Chau Tung Lam Nguyen @nctl144 Apr 29 2016 02:35 Coy Sanders @coymeetsworld Apr 29 2016 02:35 hmm maybe? Chau Tung Lam Nguyen @nctl144 Apr 29 2016 02:35 can anyone check this for me? im stuck with it elminsterrr @elminsterrr Apr 29 2016 02:35 Hello, what does passed mean in English in programming in general? Like in this example: The filter method is used to iterate through an array and filter out elements where a given condition is not true. filter is passed a callback function which takes the current value (we've called that val) as an argument. buckshot307 @buckshot307 Apr 29 2016 02:36 or running out of change before I can finish counting it out. bitgrower @bitgrower Apr 29 2016 02:36 @elminsterrr -- passed == "handed to" Srinivasan @kksrini89 Apr 29 2016 02:36 @nctl144 it's working I tried at my end bitgrower @bitgrower Apr 29 2016 02:36 as a parameter ... Srinivasan @kksrini89 Apr 29 2016 02:37 @nctl144 function updateRecords(id, prop, value) { if(value!==""){ if(prop!=="tracks"){ collection[id][prop]=value; } else collection[id].tracks.push(value); } else{ delete collection[id][prop]; } return collection; } elminsterrr @elminsterrr Apr 29 2016 02:37 @bitgrower thanks CamperBot @camperbot Apr 29 2016 02:37 elminsterrr sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles: :star: 1020 | @bitgrower | http://www.freecodecamp.com/bitgrower ali @ahamidizadeh Apr 29 2016 02:37 can someone help me with java script? trying to code a cash register... having trouble defining void... Mark Howard @iheartkode Apr 29 2016 02:37 @ahamidizadeh show some code we will give it a try Katheravan A @kexykathe Apr 29 2016 02:37 @ahamidizadeh code and where are you stuck bitgrower @bitgrower Apr 29 2016 02:37 we talk about passing parameters to functions ... Chau Tung Lam Nguyen @nctl144 Apr 29 2016 02:37 @kksrini89 thank you so much CamperBot @camperbot Apr 29 2016 02:37 nctl144 sends brownie points to @kksrini89 :sparkles: :thumbsup: :sparkles: :star: 286 | @kksrini89 | http://www.freecodecamp.com/kksrini89 Srinivasan @kksrini89 Apr 29 2016 02:38 @nctl144 you're welcome Coy Sanders @coymeetsworld Apr 29 2016 02:39 :/ ali @ahamidizadeh Apr 29 2016 02:40 @kexykathe @iheartkode var cashRegister = { total:0, lastTransactionAmount: // idont know what to put here add: function(itemCost) { this.total += itemCost; }, scan: function(item,quantity) { switch (item) { case "eggs": this.add(0.98 * quantity); break; case "milk": this.add(1.23 * quantity); break; case "magazine": this.add(4.99 * quantity); break; case "chocolate": this.add(0.45 * quantity); break; } return true; }, voidLastTransaction: function() { // donnt know what to put here } }; Mark Howard @iheartkode Apr 29 2016 02:41 @ahamidizadeh which waypoint is this? ali @ahamidizadeh Apr 29 2016 02:42 whats waypoint? Mark Howard @iheartkode Apr 29 2016 02:43 @ahamidizadeh from the fcc curriculum ? Chris Cullen @123xylem Apr 29 2016 02:43 function largestOfFour(arr) { var newArr=[]; var count=0; for(i=0;i<arr.length;i++){ // iterate through array for(j=0;j<=arr[i].length;j++){ // iterate through sub arrays count += arr[i][j]; // count stores prev value of the elements in sub array if(count + arr[i][j] >= +arr[i][j]){ // if prev value of sub array is more than current value : return it as newArr newArr = arr[i][j];}} } return newArr; } largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]); Im making a small mistake in this that for some reason returns 3... Any idea why it isnt producing the largest of the 4 sub arrays? ali @ahamidizadeh Apr 29 2016 02:44 i dont get what you are saying? oh no its not from free code camp Mark Howard @iheartkode Apr 29 2016 02:44 @ahamidizadeh oh ok ali @ahamidizadeh Apr 29 2016 02:45 its from code acadamy? Mark Howard @iheartkode Apr 29 2016 02:45 @ahamidizadeh what part are you stuck on ali @ahamidizadeh Apr 29 2016 02:45 bleep bleep bitgrower @bitgrower Apr 29 2016 02:45 @xylem -- you need to create an array of the largest member of each sub-array, not add them together ... Mark Howard @iheartkode Apr 29 2016 02:45 voidLastTransaction Karan Bhandari @karanbhandari Apr 29 2016 02:46 @ahamidizadeh Do you need help about the last Transaction thing? Mark Howard @iheartkode Apr 29 2016 02:46 @ahamidizadeh to remember a last transaction you would need to store each transaction in an array.. array.push bitgrower @bitgrower Apr 29 2016 02:47 oops ... @123xylem -- you need to create an array of the large member of each subarray, not add them together ... Karan Bhandari @karanbhandari Apr 29 2016 02:47 or you can have an array of just one item if you want it that way!, You can pop the previous item and push the new item every time you are done with scanning @ahamidizadeh Chris Cullen @123xylem Apr 29 2016 02:48 @bitgrower I thought count added the prev value to 0 so that i Could compare it to the current value to see which is bigger bitgrower @bitgrower Apr 29 2016 02:49 @123xylem -- I don't think you need to add anything to anything in that challenge (as in using the '+' sign) ... you need to "add" elements to an array, but that's not done using the '+' operator ali @ahamidizadeh Apr 29 2016 02:49 thats hard Chris Cullen @123xylem Apr 29 2016 02:50 @bitgrower @mutantspore I think the .math function is the way to go bitgrower @bitgrower Apr 29 2016 02:50 eh... @ahamidizadeh -- not so hard really, in the greater scheme of things ... pretty typical programming practice ... @123xylem -- I def think a math function could be used here, yep! Walter Augustine @Walter-0 Apr 29 2016 02:54 hi, I’m stuck on Title Case a Sentence. I can make the correct letters uppercase, but the letters aren’t being set on the old array. https://repl.it/CLIM the console.logs are helpful, so run the code first. I’m so close khaduch @khaduch - howdy folks! Sounds like a lot of fun going on here... :) Javier @sh1g Apr 29 2016 02:56 can anyone guide me in the next step here. I split my mind two ways and unsure which way too go on the convert to Romans function convertToRoman(num) { var roman = ["M", "CM", "DCCC", "DCC", "DC", "D", "CD", "CCC", "CC", "C", "XC", "LXXX", "LXX", "LX", "L", "XL", "XXX", "XX", "X", "IX", "VIII", "VII", "VI", "V", "IV", "III", "II", "I"]; var arabic = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]; var thousands = 0; var hundreds = 0; var tens = 0; var ones = 0; while(num >=1000){ num = num - 1000; thousands++; } while(num >=100){ num = num - 100; hundreds++; } while (num >=10){ num = num - 10; tens++; } while (num >= 1){ num = num - 1; ones++; } } convertToRoman(3259); Chris Cullen @123xylem Apr 29 2016 02:57 function largestOfFour(arr) { var newArr=[]; var count=0; for(i=0;i<arr.length;i++){ // iterate through array for(j=0;j<=arr[i].length;j++){ // iterate through sub arrays newArr = Math.max(...arr[i][j]); // newArray = max of subarrays } } return newArr; } largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]); THis is telling me ( Math.max(...arr[i][j]); ) is only compatible in ES6 and function largestOfFour(arr) { var newArr=[]; var count=0; for(i=0;i<arr.length;i++){ // iterate through array for(j=0;j<=arr[i].length;j++){ // iterate through sub arrays newArr = Math.max(...arr[i][j]); // newArray = max of subarrays } } return newArr; } largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]); Javier @sh1g Apr 29 2016 02:57 I don't know if to do if else or switch my logic Chris Cullen @123xylem Apr 29 2016 02:58 Sorry and its saying TypeError: (var)[Symbol.iterator] is not a function Walter Augustine @Walter-0 Apr 29 2016 02:58 @123xylem you can’t call math.max on an array Ken Haduch @khaduch Apr 29 2016 02:59 @Walter-0 - remember that strings are immutable. You have to take your first letter that is uppercased and then merge it with the remainder of the string Diego Mayer @Chrono79 Apr 29 2016 03:00 @123xylem why don't you put 'esversion: 6'; at the top then? Walter Augustine @Walter-0 Apr 29 2016 03:01 @123xylem if you use es2015 Bobby McDonald @BobbyMcWho Apr 29 2016 03:01 I am pulling my hair out with brackets text editor Chris Cullen @123xylem Apr 29 2016 03:01 @Chrono79 ah I can do that I didnt know.. How do I do that? Diego Mayer @Chrono79 Apr 29 2016 03:02 @123xylem exactly as I told you, write that at the first line of your code Here it's the ES5 version of that problematic line: return Math.max.apply(null, val); //instead of return Math.max(...val); buckshot307 @buckshot307 Apr 29 2016 03:02 @Chrono79 is there a workaround for the decimal problem? Like if I needed to add 0.01 but it says I need to add 0.009999997777 Diego Mayer @Chrono79 Apr 29 2016 03:03 @buckshot307 using only natural numbers or toFixed(2) are 2 workarounds, maybe you have to refactor your code buckshot307 @buckshot307 Apr 29 2016 03:04 okay thanks, will do some reading on it. Diego Mayer @Chrono79 Apr 29 2016 03:06 @123xylem check your code, I don't think it'll work, Math.max(...value), value should be an array I guess Mary @mapruter Apr 29 2016 03:07 can anyone recommend any more reading on how to do queue? I'm trying to do the stand in line chapter, but i don't know where to begin Walter Augustine @Walter-0 Apr 29 2016 03:08 @khaduch I’m not sure how to merge the first letter with the rest of the string. putting .charAt() on the left side throws a reference error Diego Mayer @Chrono79 Apr 29 2016 03:09 it's very easy, you have to add a value to an array at the end, and the remove another form the beginning, look mdn for push, pop, shift and unshift Ken Haduch @khaduch Apr 29 2016 03:09 @Walter-0 - something like this: var lcString = "hallo"; var capString = lcString[0].toUpperCase() + lcString.slice(1); // output should be "Hallo" You have to store the string in another place, or even in the same place, but you have to overwrite the entire string... Diego Mayer @Chrono79 Apr 29 2016 03:09 @mapruter Mary @mapruter Apr 29 2016 03:10 mdn? @Chrono79 Diego Mayer @Chrono79 Apr 29 2016 03:11 @mapruter mozilla developer network, if you google javascript array and the methods I told you, the first results are usually MDN and w3school Mary @mapruter Apr 29 2016 03:11 ok cool thanks. i'll try that out @Chrono79 CamperBot @camperbot Apr 29 2016 03:11 mapruter sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles: Ken Haduch @khaduch Apr 29 2016 03:11 @mapruter - Mozilla Developer's Network - google MDN Array and you'll get the documentation on the Array object CamperBot @camperbot Apr 29 2016 03:11 :star: 554 | @chrono79 | http://www.freecodecamp.com/chrono79 Chau Tung Lam Nguyen @nctl144 Apr 29 2016 03:12 can anyone help me with this Walter Augustine @Walter-0 Apr 29 2016 03:12 @khaduch thanks it worked :+1: CamperBot @camperbot Apr 29 2016 03:12 walter-0 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: :star: 1024 | @khaduch | http://www.freecodecamp.com/khaduch Asheed @TakeMeToTheLeftCoast Apr 29 2016 03:16 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); help plz CamperBot @camperbot Apr 29 2016 03:16 no wiki entry for: plz Chau Tung Lam Nguyen @nctl144 Apr 29 2016 03:17 fahrenheit = celcius * 1.8 +32; that is it @TakeMeToTheLeftCoast Diego Mayer @Chrono79 Apr 29 2016 03:18 @nctl144 it's celsius Chau Tung Lam Nguyen @nctl144 Apr 29 2016 03:18 yeah i type it wrong everytime lol Asheed @TakeMeToTheLeftCoast Apr 29 2016 03:19 it says the Celsius in not defined @nctl144 Chau Tung Lam Nguyen @nctl144 Apr 29 2016 03:20 yeah celcius can anyone help me with that Ken Haduch @khaduch Apr 29 2016 03:20 @nctl144 - the first thing to do is look at the contact structure - it is enclosed in square brackets, contacts = [ ... ];, so it is an Array. The items within the array are objects. My suggestion is to write some code in there that will print the first name firstName property of each contact out to the console.log(). That gives you a start on what you need to do to search the contact list. Once you know how to access the first names of each contact, you can then apply that to the problem solution. Chau Tung Lam Nguyen @nctl144 Apr 29 2016 03:20 okay ill try @TakeMeToTheLeftCoast you have to fix it to Celcius my bad Micah Bales @micahbales Apr 29 2016 03:21 Hello! I'm working on Smallest Common Multiplier, and I'm feeling a little overwhelmed. I'd welcome any feedback on my code below. How can I take the next step on this problem? function smallestCommons(arr) { var high = arr[1] > arr[0] ? arr[1] : arr[0]; var low = arr[0] < arr[1] ? arr[0] : arr[1]; var range = []; var multiples = []; for (i = low; i <= high; i += 1) { range.push(i); } range.reverse(); //something happens here { high *= high; for (j = 0; j < range.length; j += 1) { // roll through all values in num and compare to the latest multiple of "high" var curNum = range[j]; while (curNum < high) { curNum *= curNum; } if (curNum === high) { multiples.push(curNum); } } //} return multiples; } smallestCommons([1,5]); // take the highest number and find next multiple (target multiple) // run each lower number until you either hit the target multiple, or pass it // if all of the numbers hit it (and none pass), then return the target multiple // otherwise, continue to next multiple of highest number Chris Cullen @123xylem Apr 29 2016 03:21 js  function largestOfFour(arr) { var newArr=[]; var count=0; for(i=0;i<arr.length;i++){ // iterate through array for(j=0;j<=arr[i].length;j++){ // iterate through sub arrays return Math.max.apply(null, arr[i][j]); // newArray = max of subarrays } } } largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]); Is my math.max syntax right?. Rudolf Carl Pablico @rudolfpablico Apr 29 2016 03:23 Need help on this guys function largestOfFour(arr) { // You can do this! var largestnumarray = []; var largestnum = 0; var i = 0; for(; i < arr.length; i++) { for(var j = 0; j < arr[i].length; j++) { if(arr[i][j] > largestnum) { largestnum = arr[i][j]; largestnumarray[i] = largestnum; } else{ //largestnumarray[i] = arr[i][j]; } } } return largestnumarray; } largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]); Diego Mayer @Chrono79 Apr 29 2016 03:23 @123xylem don't think so Rudolf Carl Pablico @rudolfpablico Apr 29 2016 03:23 [27, null,39,1001] Chris Cullen @123xylem Apr 29 2016 03:24 @rudolfpablico llol same Rudolf Carl Pablico @rudolfpablico Apr 29 2016 03:24 it results like that on the second requirement but all the other is good Chris Cullen @123xylem Apr 29 2016 03:24 your for loop is missing i Rudolf Carl Pablico @rudolfpablico Apr 29 2016 03:25 @123xylem in which part? @123xylem whoa your code looks complicated to me Diego Mayer @Chrono79 Apr 29 2016 03:26 @micahbales At this hour of the night I don't understand your code, feel free to take a look at mine Chau Tung Lam Nguyen @nctl144 Apr 29 2016 03:26 Chris Cullen @123xylem Apr 29 2016 03:26 @rudolfpablico the start of ur forloop is a ; Micah Bales @micahbales Apr 29 2016 03:26 @Chrono79 That makes two of us! :D Chau Tung Lam Nguyen @nctl144 Apr 29 2016 03:26 @khaduch hey i did this but it still does not work i need help with that Rudolf Carl Pablico @rudolfpablico Apr 29 2016 03:27 function largestOfFour(arr) { // You can do this! var largestnumarray = []; var largestnum = 0; for(var i = 0; i < arr.length; i++) { for(var j = 0; j < arr[i].length; j++) { if(arr[i][j] > largestnum) { largestnum = arr[i][j]; largestnumarray[i] = largestnum; } else{ //largestnumarray[i] = arr[i][j]; } } } return largestnumarray; } largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]); Diego Mayer @Chrono79 Apr 29 2016 03:27 @nctl144 only return No such contact outside of your loop, that means you've compared it with all your contacts Rudolf Carl Pablico @rudolfpablico Apr 29 2016 03:27 @123xylem still fails Diego Mayer @Chrono79 Apr 29 2016 03:28 @123xylem try array.map, or only 1 for loop Chris Cullen @123xylem Apr 29 2016 03:28 @rudolfpablico im in the same boat.. I tried something similar to that... btw can I ask... Have u found most of these challenges hard? Chau Tung Lam Nguyen @nctl144 Apr 29 2016 03:29 @Chrono79 what do you mean Brandon Lee @brandonlee781 Apr 29 2016 03:29 @123xylem Math.max (if I'm reading it right, I've never used that function) requires all the numbers you want to be evaluated to be passed as arguments. So the way you have it set up now it's going to return every single value of arr[i][j]. It's not going to compare them. Diego Mayer @Chrono79 Apr 29 2016 03:30 @nctl144 look at your code, you're returning no such contact if (some condition that's wrong) isn't true Rudolf Carl Pablico @rudolfpablico Apr 29 2016 03:31 @123xylem well actually, ithink everything is hard hahaha Ken Haduch @khaduch Apr 29 2016 03:31 @nctl144 - well, it's looking like you're on the right track now. It's hard working with the code as an image, but there are a couple problems - you now have a for loop to access each contact, and you're looking at them with contacts[i], which is good. But the problem is that you are writing code like this: contacts[i].firstName.hasOwnProperty(firstName) === true), and that is not correct. You are supposed to compare the incoming parameter firstName, with the firstName property of the object. Using .hasOwnProperty() is a method of an object, not an object's property. So you have to correct that test. It should be contacts[i].firstName === firstName... that's the first thing. Chris Cullen @123xylem Apr 29 2016 03:32 @rudolfpablico good im the same... :) I dont normally struuggle while learning things but every new challenge Im struggling :) Diego Mayer @Chrono79 Apr 29 2016 03:32 good night people Ken Haduch @khaduch Apr 29 2016 03:32 @nctl144 - then you are going to either have a match with the firstName or not have a match. If you do not have a match, then you need to check the next contact, and the next, until you either find a matching name, or you run out of contacts. If you run out of contacts, then you return No such contact. But you have to make sure that you can look at every contact until you know you have a match, or run out of them. Bruce Young @mutantspore Apr 29 2016 03:34 @123xylem you need to look at each array.. the 4 of them in turn, and find the biggest nuber in each, using the Math.max() and push that number into a new array . .. then return that array Bobby McDonald @BobbyMcWho Apr 29 2016 03:34 How do I see messages where people mentioned me? Joseph @revisualize Apr 29 2016 03:35 refresh Ken Haduch @khaduch Apr 29 2016 03:35 @nctl144 - then your nested if is pretty close. You didn't spell contacts the same way, but that is the proper use of .hasOwnProperty() - and then if that check passes, you can return the property. But there you have another slight error - you want to return the property from the contact that you are currently examining - so you need to have contacts[i] in there again! Be careful & consistent! Bruce Young @mutantspore Apr 29 2016 03:36 @123xylem I can PM you a fairly simple one liner using .map and the Math.max you are already using if you like… when you are ready Mary @mapruter Apr 29 2016 03:36 i don't understand at all what i'm suppose to be doing for the Stand in Line queue. i don't think i even understand what it's asking me. i went through all the lessons before it again and redid the code, but i for whatever reason can't put it together. am i suppose to be using .pop and .shift? Joseph @revisualize Apr 29 2016 03:36 No. Yes. Chau Tung Lam Nguyen @nctl144 Apr 29 2016 03:37 @khaduch thank you so much I will try and follow what you said CamperBot @camperbot Apr 29 2016 03:37 nctl144 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: :star: 1025 | @khaduch | http://www.freecodecamp.com/khaduch Joseph @revisualize Apr 29 2016 03:37 @mapruter How do you append an item to the end of an array? Mary @mapruter Apr 29 2016 03:37 .pop Joseph @revisualize Apr 29 2016 03:37 No. Mary @mapruter Apr 29 2016 03:37 shit Bruce Young @mutantspore Apr 29 2016 03:37 .shift Joseph @revisualize Apr 29 2016 03:37 No. Mary @mapruter Apr 29 2016 03:38 .push Joseph @revisualize Apr 29 2016 03:38 Yes. Ken Haduch @khaduch Apr 29 2016 03:39 @nctl144 - you're welcome... I have to sign off for now, but there are others who will help you if you still have a problem. Good luck! khaduch @khaduch - good night all.. happy coding! Rudolf Carl Pablico @rudolfpablico Apr 29 2016 03:39 @123xylem did your code runs fine now? Joseph @revisualize Apr 29 2016 03:40 @mapruter Still need help? Mary @mapruter Apr 29 2016 03:40 probably. i'm looking at it now to see if what you just asked me helps D.Mills @millsdee74 Apr 29 2016 03:42 @thelittleblacksmith thanks for solutions to.....Introducing JavaScript Object Notation JSON Jan 05, 2016 View solution Accessing Nested Objects in JSON Jan 05, 2016 View solution Accessing Nested Arrays in JSON Jan 05, 2016 View solution CamperBot @camperbot Apr 29 2016 03:42 millsdee74 sends brownie points to @thelittleblacksmith :sparkles: :thumbsup: :sparkles: :star: 349 | @thelittleblacksmith | http://www.freecodecamp.com/thelittleblacksmith Chris Cullen @123xylem Apr 29 2016 03:42 @rudolfpablico not yet im gonna retry doing it the long way Joseph @revisualize Apr 29 2016 03:42 // Write a function nextInLine which takes an // array (arr) and a number (item) as arguments. function nextInLine(arr, item) { // 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. return item; // Change this line } @mapruter cannelflow @cannelflow Apr 29 2016 03:44 nice explanation @revisualize Joseph @revisualize Apr 29 2016 03:44 @cannelflow :D @cannelflow I just took the instructions and put it in comments. I do the same thing for Record Collection. Chau Tung Lam Nguyen @nctl144 Apr 29 2016 03:45 cannelflow @cannelflow Apr 29 2016 03:46 @revisualize :+1: Karan Bhandari @karanbhandari Apr 29 2016 03:46 function reverse(new_arr){ var len = new_arr.length(); for (var i = 0; i < (len/2); ++i){ var temp = new_arr[i]; new_arr[i] = new_arr[len - i]; new_arr[len - i] = temp; } function reverseString(str) { var new_arr = str.split(); console.log(new_arr[0]); var rev_arr = reverse(new_arr); } str = rev_arr.toString(); return str; } reverseString("hello"); Can someone help me in finding the bug here in this reverse function Chau Tung Lam Nguyen @nctl144 Apr 29 2016 03:46 can anyone help me and explain why my loop does not run from contact 1 to 4 to find firstName? Joseph @revisualize Apr 29 2016 03:46 @cannelflow // Write a function which takes // an id, a property (prop), and a value. function updateRecords(id, prop, value) { // 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. return collection; } D.Mills @millsdee74 Apr 29 2016 03:47 thanks @leftynaut for your help with Checkpoint: Record Collection CamperBot @camperbot Apr 29 2016 03:47 millsdee74 sends brownie points to @leftynaut :sparkles: :thumbsup: :sparkles: :star: 497 | @leftynaut | http://www.freecodecamp.com/leftynaut Joseph @revisualize Apr 29 2016 03:47 @nctl144 May I recommend taking your code to http://www.pythontutor.com/javascript.html#mode=edit and you'll see why your for loop only loops once. Ken Haduch @khaduch Apr 29 2016 03:48 @nctl144 - I was just about to sign out - you have to make sure that you do not exit the for loop before you have a chance to examine all of the contacts - your return "No such contact" is within the for loop, hence, if the first contact does not match, you immediately return (ending your processing within the for loop...) that's all... good night! Chau Tung Lam Nguyen @nctl144 Apr 29 2016 03:49 thank you so much good night Joseph @revisualize Apr 29 2016 03:49 @khaduch Too much explanation. :P Ali Hammad @alihammad-gist Apr 29 2016 03:49 does requirejs modules be accessed globally? how come I can access this requirejs module (built using webpack) https://cdn.rawgit.com/reactjs/react-autocomplete/master/dist/react-autocomplete.js with window.ReactAutocomplete Chau Tung Lam Nguyen @nctl144 Apr 29 2016 03:52 @khaduch i made it thank you so much CamperBot @camperbot Apr 29 2016 03:52 nctl144 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: :warning: nctl144 already gave khaduch points Mary @mapruter Apr 29 2016 03:52 @revisualize i don't get it. i'm going to paste my code here. can you let me know if i'm at least on the right track anywhere. function nextInLine(arr, item) { // Your code here testArr.push([],1); var nextInLine = testArr.shift(); return nextInLine(); // 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)); i know it's wrong bc i tested it in fcc i think it stars with me not understanding what it means by arr and item. does the first one reference hat array and the next the item i want to add to the array? Coryphaeus @cvdeby Apr 29 2016 03:57 @mapruter Do you understand, how does your function work? Mary @mapruter Apr 29 2016 03:57 i use to think so. but now i don't Joseph @revisualize Apr 29 2016 03:59 @mapruter arr @mapruter Think about your function as an isolated ... object. With no other code. Coryphaeus @cvdeby Apr 29 2016 04:00 @mapruter Your task is 1. push into the end given item. 2. shift from the given arr first value 3. return value you got on step 2. @mapruter But now, you used recursion, and pushed wrong value into the array. Joseph @revisualize Apr 29 2016 04:01 Coryphaeus @cvdeby Apr 29 2016 04:02 @revisualize Ou, I wrote it to make it explicit) @mapruter your return nextInLine() won't work like Array.shift() method. You'll call the function, you already created - function nextInLIne(arr, item){} buckshot307 @buckshot307 Apr 29 2016 04:04 for (var j = 0; j < change.length; j++) { if (change[j][1] === 0) { change.splice(j, 1); } } so when I use this loop it's still returning [["PENNY", 0.05], ["DIME", 0.20], ["TWENTY", 0], ["ONE HUNDRED", 0]] Any idea why? Chris Cullen @123xylem Apr 29 2016 04:05 function largestOfFour(arr) { var newArr=[]; //Var to store new arr for(i=0;i<arr.length; i++){ //iterate through array (in this case 4 times) var maxN=0; //var to store maxNumber.. Made in this scope so it only works on each sub array(not all subarrays) for(s=0;s<arr[i].length; s++){ //iterate through sub arrats if (arr[i][s] > maxN){ //If element of subArray is bigger than last max N maxN = arr[i][s];}} // then that element is the new Max Number (of that sub array) newArr[i] =maxN; //New array position[i] will contain that max Number. } return newArr; } largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]); Hi could someone correct my notes Or tell me if Ive noted it correctly/ D.Mills @millsdee74 Apr 29 2016 04:06 @storbeck thanks for Iterate with JavaScript For Loops CamperBot @camperbot Apr 29 2016 04:06 millsdee74 sends brownie points to @storbeck :sparkles: :thumbsup: :sparkles: :star: 1596 | @storbeck | http://www.freecodecamp.com/storbeck buckshot307 @buckshot307 Apr 29 2016 04:08 @123xylem Notes are whatever you want them to be. They are usually so if you come back later to change the code or clean it up you know which part does what. Mary @mapruter Apr 29 2016 04:10 yeah this pretty much feels hopeless. should i go back and redo some lessons? and can you recommend where to start the redo at it because i feel like an idiot right now bc i don't at all understand what i'm supposed to do Robin D @goosenoose Apr 29 2016 04:11 on first dot operator lesson... could someone point me in the right direction on how to think this through? // Setup var testObj = { "hat": "ballcap", "shirt": "jersey", "shoes": "cleats" }; // Only change code below this line var hatValue = testObj."hat.ballcap"; // Change this line var shirtValue = testObj."shirt"; // Change this line objective is to use dot operators at bottom two lines to assign ballcap and jersey to those vars Mary @mapruter Apr 29 2016 04:13 i got this // Write a function nextInLine which takes an // array (arr) and a number (item) as arguments. function nextInLine(arr, item) { testArr.push(6);// Add the number to the end of the array, testArr.shift();// then remove the first element of array. // The nextInLine function should then return // the element that was removed. 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)); Joseph @revisualize Apr 29 2016 04:13 @mapruter You're close. @mapruter Shouldn't you be adding item to the end of the arr? Robin D @goosenoose Apr 29 2016 04:14 you're higher up the ladder than me, hang in there @mapruter :) Chris Cullen @123xylem Apr 29 2016 04:17 @buckshot307 Yea I just wanted to see if my notes were technnically correct or if I didnt understand what I did Mary @mapruter Apr 29 2016 04:20 @revisualize i'mnot sure what that means buonarfcc @buonarfcc Apr 29 2016 04:21 Good evening every ones ? if you could spare your precious time to give me a little hint on the logic or codes errors , I would surely appreciated! Many thanks . : function mutation(arr) { var word1 = arr.indexOf(0); var word2 = arr.indexOf(1); if ( word1 === word2){return true;} return false; } mutation(["hello", "hey"]); the first and the last output responses I got Red Xes! Joseph @revisualize Apr 29 2016 04:21 @mapruter Let's say... Coryphaeus @cvdeby Apr 29 2016 04:21 @mapruter You need to push item, not just a number. Karan Bhandari @karanbhandari Apr 29 2016 04:22  function palindrome(str) { var new_arr = str.split(""); //splits the string var len = str.length; //calculates the length of string for(var i = 0; i < (len/2); ++i){ //checks for palindrome until midway if (new_arr[i] == new_arr[len - 1 - i]){ return true; } else { return false; } } //return true; } palindrome("eye"); Can someone help in bug finding Joseph @revisualize Apr 29 2016 04:22 @mapruter I have var val = 6; Now val could constantly change. How do I push val to the end of myArr var myArr = [2,3,4,5]; Coryphaeus @cvdeby Apr 29 2016 04:24 @karanbhandari Interesting solution) Karan Bhandari @karanbhandari Apr 29 2016 04:24 Lol thanks @cvdeby CamperBot @camperbot Apr 29 2016 04:24 karanbhandari sends brownie points to @cvdeby :sparkles: :thumbsup: :sparkles: :star: 386 | @cvdeby | http://www.freecodecamp.com/cvdeby RJsauce @RJsauce Apr 29 2016 04:25 I'm on the Stand in Line JavaScript Lesson. I have no idea how to do it, can you guys help? function nextInLine(arr, item) { // Your code here 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)); Mary @mapruter Apr 29 2016 04:25 is it this: myArr.push(val); @revisualize Joseph @revisualize Apr 29 2016 04:25 @mapruter PERFECT! @mapruter Can you take that Idea back to your issue? @RJsauce // Write a function nextInLine which takes an // array (arr) and a number (item) as arguments. function nextInLine(arr, item) { // 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. return item; // Change this line } Coryphaeus @cvdeby Apr 29 2016 04:26 @karanbhandari If you want to compare first half with second, I think you can compare full first half with full second Reversed half, sorry for messy English) Karan Bhandari @karanbhandari Apr 29 2016 04:26 That'll be ,messy It runs for the palindrome function Just the casse with space dont run Eg: "ey e" Mary @mapruter Apr 29 2016 04:27 // Write a function nextInLine which takes an // array (arr) and a number (item) as arguments. function nextInLine(arr, item) { testArr.push(item);// Add the number to the end of the array, testArr.shift();// then remove the first element of array. // The nextInLine function should then return // the element that was removed. 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)); Joseph @revisualize Apr 29 2016 04:28 @mapruter Change testArr. to arr. Karan Bhandari @karanbhandari Apr 29 2016 04:28 So, my solution is to make another arr without the spaces in it and then work on the resulting array Joseph @revisualize Apr 29 2016 04:28 @mapruter But, you're supposed to return the shift. not just shift. Coryphaeus @cvdeby Apr 29 2016 04:29 @karanbhandari For example str = 'abcdcba' var half = Math.floor(str.length/2); str.substr(0, half) === str.substr(str.length, half*-1); I don't know does that works or not, but I think you understand, what that mean) Joseph @revisualize Apr 29 2016 04:30 @mapruter Do you still need assistance? Karan Bhandari @karanbhandari Apr 29 2016 04:30 I till wont run Spaces would be a messy part I guess, won't they @cvdeby ?? vivekraj @vivekraj-kr Apr 29 2016 04:31 Hi Jorge @liberaltech Apr 29 2016 04:31 https://codepen.io/liberaltech/pen/WwadYG?editors=1111 need help updating the quote on twitter post Coryphaeus @cvdeby Apr 29 2016 04:31 @karanbhandari If you want to clear your string of special chars, spaces or something yet, you can to use regex, which works good. Mary @mapruter Apr 29 2016 04:32 ok so i'm suppose to do arr.push(item) for that first line? @revisualize Karan Bhandari @karanbhandari Apr 29 2016 04:32 I am not sure what that is! Regex @cvdeby Mary @mapruter Apr 29 2016 04:32 how do i know that i push .arr? is it because it's the first line in the () of the function? Coryphaeus @cvdeby Apr 29 2016 04:32 @karanbhandari I forgot do you need to clear your string of spaces or not. Joseph @revisualize Apr 29 2016 04:32 @liberaltech https://gitter.im/FreeCodeCamp/HelpFrontEnd Get help on our Front End Development projects. Karan Bhandari @karanbhandari Apr 29 2016 04:32 yes, and for that i have to make a new function Joseph @revisualize Apr 29 2016 04:32 @mapruter Do you have skype? Would you be willing to skype me really quick? Mary @mapruter Apr 29 2016 04:33 yeah let me figure out what my sn is Coryphaeus @cvdeby Apr 29 2016 04:33 @karanbhandari Check it in your code str.replace(/\W/gi, ""); Karan Bhandari @karanbhandari Apr 29 2016 04:33 I'll share it here if you wanna take a look Joseph @revisualize Apr 29 2016 04:33 @mapruter mine is revisualize Mary @mapruter Apr 29 2016 04:33 i may need to download it. i don't think i ever installed it on this comp sogive me a few Joseph @revisualize Apr 29 2016 04:33 I have it on my phone. Jorge @liberaltech Apr 29 2016 04:33 @revisualize the issue im having has to do with the backend Coryphaeus @cvdeby Apr 29 2016 04:34 @karanbhandari str - is the variable which contains your string. Joseph @revisualize Apr 29 2016 04:34 @mapruter Or I could try to plug in my webcam and microphone. Coryphaeus @cvdeby Apr 29 2016 04:35 @karanbhandari If you're not familiar with regex, you can try this one small course. It was very useful for me - http://regexone.com Joseph @revisualize Apr 29 2016 04:36 Regexone.com is an AMAZING resource. Robin D @goosenoose Apr 29 2016 04:37 any tips with dot operators and arrays? i'm trying to call a string in an array with a dot operator and it's not working so well // Setup var testObj = { "hat": "ballcap", "shirt": "jersey", "shoes": "cleats" }; // Only change code below this line var hatValue = testObj; // Change this line var shirtValue = testObj."shirt"; // Change this line Karan Bhandari @karanbhandari Apr 29 2016 04:37 cool @cvdeby acgillette @acgillette Apr 29 2016 04:39 @goosenoose you don't use "" when accessing the property so instead of testObj."shirt" do testObj.shirt Joseph @revisualize Apr 29 2016 04:41 @mapruter You there? Coryphaeus @cvdeby Apr 29 2016 04:41 @goosenoose Where is your array? Robin D @goosenoose Apr 29 2016 04:41 -_-;... 96street @96street Apr 29 2016 04:41 This message was deleted Robin D @goosenoose Apr 29 2016 04:41 thanks @acgillette @cvdeby CamperBot @camperbot Apr 29 2016 04:41 goosenoose sends brownie points to @acgillette and @cvdeby :sparkles: :thumbsup: :sparkles: :star: 267 | @acgillette | http://www.freecodecamp.com/acgillette :star: 387 | @cvdeby | http://www.freecodecamp.com/cvdeby Joseph @revisualize Apr 29 2016 04:41 @mapruter I PM'd you. 96street @96street Apr 29 2016 04:41 confused with delegate(); can someone explain it in simple terms? Robin D @goosenoose Apr 29 2016 04:41 thank you. it didn't make sense that you could reference a string through dot notation without identifying those were strings acgillette @acgillette Apr 29 2016 04:42 np :) Coryphaeus @cvdeby Apr 29 2016 04:43 @goosenoose You are restricted with dot notation, if you wanna call property from string, use bracket notation instead testObj['shirt']. Drew Stonebraker @drstonebraker Apr 29 2016 04:44 I am having trouble understanding closures. I understand that using a closure here: var add = (function () { var counter = 0; return function () {return counter += 1;} })(); add(); add(); add(); // the counter is now 3 allows the counter to be incremented from outside of the function without making counter a global variable. But what is the point of being able to do that if you still can't read the value of counter outside the function? Or can you? Coryphaeus @cvdeby Apr 29 2016 04:47 @Stoney229 Your closure can see counter variable outside, but not you. It means, that only code inside that closure can see counter and you cannot change that code, because closure binded with the scope, where that closure was defined. Eldar Tinjić @EldarT90 Apr 29 2016 04:49 @cvdeby are you busy mate to check few of my bugs Coryphaeus @cvdeby Apr 29 2016 04:49 @EldarT90 Just put in your code :smile: Eldar Tinjić @EldarT90 Apr 29 2016 04:49 @cvdeby https://codepen.io/EldarT/pen/YqjJBx - under 500px it stops following responsive rules Drew Stonebraker @drstonebraker Apr 29 2016 04:49 @cvdeby "Your closure can see counter variable outside" can you give me an example of what this means? in the example above, what purpose can be served by my ability to increment counter? Coryphaeus @cvdeby Apr 29 2016 04:52 @Stoney229 var func = function () { var counter = 0; return function(){return counter++;}; } func()(); func()(); func()(); // I meant, that closure looks into the scope, where it was defined, but don't see another scopes. Drew Stonebraker @drstonebraker Apr 29 2016 04:56 @EldarT90 you have a defined width on your calculator. is that what you're referring to being not responsive? what are you wanting it to do? move further to the left on a smaller screen? Coryphaeus @cvdeby Apr 29 2016 04:56 @EldarT90 It happens because you put max-width and min-width Eldar Tinjić @EldarT90 Apr 29 2016 04:56 @Stoney229 keep being in the middle @cvdeby i used it on different projects also and i didnt keep objects from being centered hmm Coryphaeus @cvdeby Apr 29 2016 05:00 @EldarT90 For centering blocks I used simple wrapper without or within of .row>.col-md-12 class Drew Stonebraker @drstonebraker Apr 29 2016 05:01 @EldarT90 I'm not very familiar with using bootstrap. I think you could put the calculator in a flex-box (instead of jumbotron) for fluid response keeping the calculator centered. Javier @sh1g Apr 29 2016 05:02 is there a way to keep FCC code synced among different computers Drew Stonebraker @drstonebraker Apr 29 2016 05:02 @EldarT90 I found this tutorial helpful for flex-box https://youtu.be/G7EIAgfkhmg rphares @rphares Apr 29 2016 05:03 and, flex tut on egghead.io is (temporarily) free, did it today~ not sure when it goes back to paid... @EldarT90 Erik Maurer @MauPow Apr 29 2016 05:04 http://codepen.io/MauPow/pen/mPzLPa?editors=0010 Anyone have some guidance on how to get this displaying the streams? To my eyes it should work but obviously it doesn't. It returns an object in the console but I don't think I'm calling the api right. Coryphaeus @cvdeby Apr 29 2016 05:04 @EldarT90 It is an old way, but it works <style> .block-wrapper { width: 100vw; overflow: hidden; } .block { width: 500px; margin: 0 auto; } @media only screen (max-width: 500px) { .block { width: 100%; } } </style> <div class="block-wrapper"> <div class="block"> // your code </div> </div> Drew Stonebraker @drstonebraker Apr 29 2016 05:05 @cvdeby I'm sorry, I still don't understand. what is func()(); doing there, and how would I utilize that ability to increment the counter? Coryphaeus @cvdeby Apr 29 2016 05:06 func() - will return closure and func()() will execute closure. That code only example. Eldar Tinjić @EldarT90 Apr 29 2016 05:09 @Stoney229 @cvdeby ok tnx folks i ll check it out CamperBot @camperbot Apr 29 2016 05:09 eldart90 sends brownie points to @stoney229 and @cvdeby :sparkles: :thumbsup: :sparkles: :star: 388 | @cvdeby | http://www.freecodecamp.com/cvdeby :star: 285 | @stoney229 | http://www.freecodecamp.com/stoney229 Coryphaeus @cvdeby Apr 29 2016 05:14 @Stoney229 Imagine that you are at home now and with things in your home you can to do anything you want, but If you'll got to one another home, in there you don't have that permissions. And here is a closures 'magic' - If you're now in another one home you can to do anything you want in your home - remotely. In this case you're a closure. :smile: Drew Stonebraker @drstonebraker Apr 29 2016 05:15 hmm. still trying to understand why that would be helpful. what practical use does it have? Coryphaeus @cvdeby Apr 29 2016 05:15 @Stoney229 So closure function see only the scope(environment) where it was defined. @Stoney229 Try to do this one challenge - https://www.freecodecamp.com/challenges/arguments-optional Drew Stonebraker @drstonebraker Apr 29 2016 05:17 @cvdeby okay, I will do that. Thanks! CamperBot @camperbot Apr 29 2016 05:17 stoney229 sends brownie points to @cvdeby :sparkles: :thumbsup: :sparkles: :star: 389 | @cvdeby | http://www.freecodecamp.com/cvdeby henrywashere @henrywashere Apr 29 2016 05:22 need help with this exercise: Instructions Write a switch statement to set answer for the following ranges: 1-3 - "Low" 4-6 - "Mid" 7-9 - "High" Note You will need to have a case statement for each number in the range.  switch (val) { case 1: case 2: case 3: answer = "1, 2, 3"; break; } Erik Maurer @MauPow Apr 29 2016 05:22 $(document).ready(function() {

var sArray = ["loriipops", "streamerhouse", "insomniacgamers12345", "medrybw"];

for (var i = 0; i < sArray.length; i++) {
var streamURL = 'https://api.twitch.tv/kraken/streams/' + sArray[i] + '?callback=?';

$.getJSON(streamURL, function(data) {$("#results").html("<ul id='resultsList'></ul>");

for (var i = 0; i < data.length; i++) {
var name = data["name"];
var logo = data["logo"];
var url = data["url"];
var status = data["status"];

$("resultsList").append("<a href ='" + url + "' class='link'><li class='streamItem'><img src='" + logo + "'><h3 class='streamName'>" + name + "</h3><p class='streamStatus'>" + status + "</p></li></a>"); }; }); }; }); What is wrong with this? :( henrywashere @henrywashere Apr 29 2016 05:22 didnt go through Eldar Tinjić @EldarT90 Apr 29 2016 05:24 @Stoney229 it just creates more chaos, point is something stops bootstrap from working on 766 which is small resolution and im using xs which counts up to extra small so i dont get it Robin D @goosenoose Apr 29 2016 05:27 // Example var ourDog = { "name": "Camper", "legs": 4, "tails": 1, "friends": ["everything!"] }; ourDog.name = "Happy Camper"; // Setup var myDog = { "name": "Coder", "legs": 4, "tails": 1, "friends": ["Free Code Camp Campers"] }; // Only change code below this line. // myDog.name = "Happy Coder"; myDog["name"] = "Happy Coder"; the IDE here has a comment saying that the line myDog["name"] = "happy coder"; is written better in dot notation. Is there a reason why that is? Markus Kiili @Masd925 Apr 29 2016 05:34 @goosenoose You can always use bracket notation, but some prefer doing property access with dot, because it makes object access differ from array access. So you can see from code when you are accessing arrays and plain objects. 96street @96street Apr 29 2016 05:34 what's the difference between find('#box') and$('#box') ?
lorenzopieri
@lorenzopieri
Apr 29 2016 05:36
anyone that can help me with the "Record Collection" in javascript?

'''
function updateRecords(id, prop, value) {
if(collection[id][prop] !== "" && prop !== "tracks"){
collection[id][prop] = value;
}
else if(prop == "tracks" && value !== ""){
collection[id]["tracks"].push(value);
}
else if(value == "") {
delete collection[id][prop];
}

return collection;
}
'''

CamperBot
@camperbot
Apr 29 2016 05:37
:bulb: to format code use backticks!  more info
lorenzopieri
@lorenzopieri
Apr 29 2016 05:38
function updateRecords(id, prop, value) {
if(collection[id][prop] !== "" && prop !== "tracks"){
collection[id][prop] = value;
}
else if(prop == "tracks" && value !== ""){
collection[id]["tracks"].push(value);
}
else if(value == "") {
delete collection[id][prop];
}

return collection;
}
it doesn't actually delete the prop
Markus Kiili
@Masd925
Apr 29 2016 05:39
@96street .find() is a method on current set of matched elements. $(..) wraps elements matching the selector. Coryphaeus @cvdeby Apr 29 2016 05:39 @96street If you're using jquery$("#box") will return that element. But if you wanna find element within another one element - you need to use $(".element-contains-box").find(".box"); - returns '.box' element if that element was found inside of .element-contains-box element. Markus Kiili @Masd925 Apr 29 2016 05:40 @lorenzopieri Your if's should be checking prop and value. On if blocks, you should do things to collection. Coryphaeus @cvdeby Apr 29 2016 05:41 @96street I think you don't need to use that method with ids @Masd925 Hi) Markus Kiili @Masd925 Apr 29 2016 05:42 @cvdeby Hello. 96street @96street Apr 29 2016 05:42 Makes sense now, thanks @cvdeby @Masd925 CamperBot @camperbot Apr 29 2016 05:42 96street sends brownie points to @cvdeby and @masd925 :sparkles: :thumbsup: :sparkles: :star: 1430 | @masd925 | http://www.freecodecamp.com/masd925 :star: 390 | @cvdeby | http://www.freecodecamp.com/cvdeby EricOber @EricOber Apr 29 2016 05:44 Hi can someone help me with this challenge? I have been on it for 2 days and dont understand // Setup function phoneticLookup(val) { var result = ""; // Only change code below this line var lookup = { Adams: "Alpha", bravo: "Bosto", charlie: "Chicago", delta: "Denver", echo: "Easy", foxtrot: "Frank" }; // Only change code above this line return result; } // Change this value to test phoneticLookup("charlie"); Bobby McDonald @BobbyMcWho Apr 29 2016 05:44 What about it is troubling you? Drew Stonebraker @drstonebraker Apr 29 2016 05:44 @Am3ricanPaladin what is the chal number? EricOber @EricOber Apr 29 2016 05:44 it is the "Using Objects for Lookups" chanllenge codes not working Markus Kiili @Masd925 Apr 29 2016 05:45 @Am3ricanPaladin Access object with syntax obj[key] and assign it to result variable. Figure out what is the object and what is the key. EricOber @EricOber Apr 29 2016 05:45 put it where rphares @rphares Apr 29 2016 05:45 (there arent numbers, @Am3ricanPaladin ... those are your points :blush: they do have names, though :) ) EricOber @EricOber Apr 29 2016 05:46 youre going to have to break it down barney style for me lol Markus Kiili @Masd925 Apr 29 2016 05:46 Good morning, @rphares EricOber @EricOber Apr 29 2016 05:46 // Setup function phoneticLookup(val) { var result = ""; // Only change code below this line var lookup = { Adams: "Alpha", bravo: "Bosto", charlie: "Chicago", delta: "Denver", echo: "Easy", foxtrot: "Frank" }; obj[key] // Only change code above this line return result; } // Change this value to test phoneticLookup("charlie"); rphares @rphares Apr 29 2016 05:46 :point_up: April 28, 2016 10:45 PM put it in 'result' after the table, @Am3ricanPaladin right spot, EricOber @EricOber Apr 29 2016 05:46 ok rphares @rphares Apr 29 2016 05:46 but you must return result in this challenge, so you need to make sure that you put what you want in result before you return :blush: Drew Stonebraker @drstonebraker Apr 29 2016 05:46 @rphares lol oh my thank you for correcting me! CamperBot @camperbot Apr 29 2016 05:46 stoney229 sends brownie points to @rphares :sparkles: :thumbsup: :sparkles: :star: 4215 | @rphares | http://www.freecodecamp.com/rphares EricOber @EricOber Apr 29 2016 05:46 return result is below the place I am able to change code rphares @rphares Apr 29 2016 05:47 no worries-- just figured it'll be helpful for you in the future, as if you ask for help on 331, people won't know what you re talking about :blush: @Stoney229 ! right-- so the line you have atm, obj[key] you need to store that in result Markus Kiili @Masd925 Apr 29 2016 05:47 @Am3ricanPaladin Assing the value from object access to result with assignment operator =. EricOber @EricOber Apr 29 2016 05:48 // Setup function phoneticLookup(val) { var result = ""; // Only change code below this line var lookup = { Adams: "Alpha", bravo: "Bosto", charlie: "Chicago", delta: "Denver", echo: "Easy", foxtrot: "Frank" }; result = obj[key]; // Only change code above this line return result; } // Change this value to test phoneticLookup("charlie"); rphares @rphares Apr 29 2016 05:48 (and use the object name and key name that you want, those are just the names for the things you are looking for :blush: ) yep EricOber @EricOber Apr 29 2016 05:48 it says obj is not defined rphares @rphares Apr 29 2016 05:48 look at the directions one more time-- 'use the object lookup to find val and return the associated string', or something like that EricOber @EricOber Apr 29 2016 05:49 oooh wait, something is clicking Markus Kiili @Masd925 Apr 29 2016 05:49 @Am3ricanPaladin There is one object defined there you need to access. EricOber @EricOber Apr 29 2016 05:49 the object is lookup Markus Kiili @Masd925 Apr 29 2016 05:49 @Am3ricanPaladin Correct! rphares @rphares Apr 29 2016 05:50 :) :) EricOber @EricOber Apr 29 2016 05:50 i thought it was a variable though Katheravan A @kexykathe Apr 29 2016 05:50 Guys! I need help brainstorming a name relating to Partying+Wallet-less+Stylish Markus Kiili @Masd925 Apr 29 2016 05:50 @Am3ricanPaladin It is a variable that holds the object (reference). rphares @rphares Apr 29 2016 05:50 variables can have different stuff in them, @Am3ricanPaladin Markus Kiili @Masd925 Apr 29 2016 05:50 @Am3ricanPaladin The key is still hiding somewhere. EricOber @EricOber Apr 29 2016 05:50 it is is the key ""? rphares @rphares Apr 29 2016 05:51 actually, ill butt out now, @Masd925 is good at the technical term stuff, i sound a bit silly most of the time, heh :blush: But, the line of directions i posted has a big clue ;) @Am3ricanPaladin Markus Kiili @Masd925 Apr 29 2016 05:51 @Am3ricanPaladin The key is passed to the function, so use the function parameter as the key. EricOber @EricOber Apr 29 2016 05:51 val Ada323 @Ada323 Apr 29 2016 05:52 Hi guys. I'm working on the Profile Lookup challenge and I'm not sure what's wrong with my code... please help! EricOber @EricOber Apr 29 2016 05:52 // Setup function phoneticLookup(val) { var result = ""; // Only change code below this line var lookup = { adams: "Alpha", bravo: "Boston", charlie: "Chicago", delta: "Denver", echo: "Easy", foxtrot: "Frank" }; result = lookup[val]; // Only change code above this line return result; } // Change this value to test phoneticLookup("charlie"); whoops got to switch up alpha and adams, but other than that i think i got it Markus Kiili @Masd925 Apr 29 2016 05:53 @Am3ricanPaladin Now when you pass a key to the function, it returns the property value from lookup object. EricOber @EricOber Apr 29 2016 05:54 thank you @rphares and @Masd925 CamperBot @camperbot Apr 29 2016 05:54 am3ricanpaladin sends brownie points to @rphares and @masd925 :sparkles: :thumbsup: :sparkles: :star: 4216 | @rphares | http://www.freecodecamp.com/rphares :star: 1431 | @masd925 | http://www.freecodecamp.com/masd925 EricOber @EricOber Apr 29 2016 05:54 whats that mean technically? to pass a key to the function? Markus Kiili @Masd925 Apr 29 2016 05:54 @Am3ricanPaladin phoneticLookup("charlie"); // returns 'Chicago' EricOber @EricOber Apr 29 2016 05:55 so you are passing charlie to phoneticLookup rphares @rphares Apr 29 2016 05:56 Anytime! And, keep this lesson in mind-- i think it the first time we use something more abstract, like a key, in FCC. Really relevant to the next lesson-- note that you didnt say result = lookup["alpha"]... @Masd925 is better at explaining, but in the next challenge, you will also not use the literal string, so this one is very important :) EricOber @EricOber Apr 29 2016 05:56 yes i noted the other day that this is where the bellcurve starts Mr.Jois @Sumanthjois Apr 29 2016 05:58 can someone help me out with 197 in javascript it's about === function testStrict(val) { valu = 7; if (val===valu) { // Change this line return "Equal"; } return "Not Equal"; } // Change this value to test test = 7; testStrict(test); lorenzopieri @lorenzopieri Apr 29 2016 05:59 ask u wrote "valu" and not "val" Mr.Jois @Sumanthjois Apr 29 2016 05:59 this is my code but still i have an error saying === not used i dont thats the problem lorenzopieri @lorenzopieri Apr 29 2016 06:00 function testStrict(val) { if (val === 7) { // Change this line return "Equal"; } return "Not Equal"; } dont use the variable, it's not a mistake, it just doesn't accept that. also remember to put the keyword "var" before variables that are localized in the function's scope, otherwise you'd be creating a whole lot of global variables but that's just an addendum backtick function updateRecords(id, prop, value) { if(collection[id][prop] !== "" && prop !== "tracks"){ collection[id][prop] = value; } else if(prop === "tracks" && value !== ""){ collection[id].tracks.push(value); } else if(value === "") { delete collection[id][prop]; } return collection; } Someone who can tell me why the deletion does not happen as intended? lorenzopieri @lorenzopieri Apr 29 2016 06:08 No one? XD Markus Kiili @Masd925 Apr 29 2016 06:08 @lorenzopieri You should be testing value and prop. Not collection[id][prop]. lorenzopieri @lorenzopieri Apr 29 2016 06:09 you're right, thanks Zach @Moose1551 Apr 29 2016 06:18 As silly as it sounds, I'm having a hard time understanding how to activate the final "else" statement in "if" statements. For example, I can pass everything that needs to passed "true" as "true," but I can't return "false" values. The bonfire challenge is "Mutations." function mutation(arr) { if (arr[1].indexOf(arr[2] >= 0)) { return true; } } mutation(["hello", "hey"]); Markus Kiili @Masd925 Apr 29 2016 06:20 @Moose1551 You should lowercase the strings and then make a loop through the second string characters, and then check with indexOf if the character is in the first string. @Moose1551 Return false if the character is not found and after the loop return true. Mr.Jois @Sumanthjois Apr 29 2016 06:21 I am stuck once again function testElse(val) { var result = ""; // Only change code below this line if (val >= 6) { result = "Bigger than 5"; } else{ result = "5 or smaller"; } // Only change code above this line return result; } // Change this value to test testElse(5); this is my code and it returns 5 or smaller for 5 and 4 Zach @Moose1551 Apr 29 2016 06:22 @Masd925 , Nice! Thanks! Awesome advice. But, if I were outside the scope of this challenge, would everything else pass as "false"? CamperBot @camperbot Apr 29 2016 06:22 moose1551 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles: :star: 1433 | @masd925 | http://www.freecodecamp.com/masd925 DamianMitchell @DamianMitchell Apr 29 2016 06:22 anyone alive?????I need a look at this code????If anyone's out there.function nextInLine(arr, item) { nextInLine([2], 1); arr.push(item); var removed = arr.shift(); return removed; // 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)); Mr.Jois @Sumanthjois Apr 29 2016 06:22 but still it error please help Markus Kiili @Masd925 Apr 29 2016 06:23 @Moose1551 I don't understand the question. Mr.Jois @Sumanthjois Apr 29 2016 06:23 ok wait when i run my code it works fine but still i get the error saying testElse(4) should return 5 or smaller same for 5 function testElse(val) { var result = ""; // Only change code below this line if (val >= 6) { result = "Bigger than 5"; } else{ result = "5 or smaller"; } // Only change code above this line return result; } // Change this value to test testElse(5); help please CamperBot @camperbot Apr 29 2016 06:25 ## :point_right: algorithm no repeats please [wiki] # Problem Explanation: • This task requires us to look at each possible permutation of a string. This is best done using a recursion function. Being able to build a function which collects all permutations of a string is a common interview question, so there is no shortage of tutorials out there on how to do this, in many different code languages. • This task can still be daunting even after watching a tutorial. You will want to send each new use of the function 3 inputs: 1. a new string (or character array) that is being built, 2. a position in your new string that's going to be filled next, and 3. an idea of what characters (more specifically positions) from the original string have yet to be used. The pseudo code will look something like this:  var str = ???; perm(current position in original string, what's been used in original string, current string build thus far){ if(current string is finished) { print current string; }else{ for(var i = 0; i < str.length; i++) { if(str[i] has not been used) { put str[i] into the current position; mark str[i] as used perm(current position in original string, what's been used in original string, current string build thus far) unmark str[i] as used because another branch in the tree for i + 1 will still likely use it; } Nick Woelk @UnluckyNick Apr 29 2016 06:26 I'm drawing a blank on the Stand in Line lesson. function nextInLine(arr, item) { // Your code here 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)); Zach @Moose1551 Apr 29 2016 06:26 This is an example of one of the tests that need to be completed in the chapter: mutation(["hello", "hey"]) should return false. This is an example of one of the tests that should return "true": mutation(["Mary", "Aarmy"]) should return true. I can return all of the true statements, so why wouldn't the tests that that need to pass as false do so with this else statement? } else { return false; @Masd925 , haha Marian Menschig @mmenschig Apr 29 2016 06:28 Hey All, I'm gonna need some help with "why is my codepen JS functioning as expected" but my local machine/github hosted code isn't working at all Who has a minute or two? :) Zach @Moose1551 Apr 29 2016 06:28 I understand the case-sensitivity aspect, but neither "hello" , nor "hey" have capital letters, so why wouldn't the provided test pass as "false"? lcassettai @lcassettai Apr 29 2016 06:28 @Sumanthjois i think your code work fine EricOber @EricOber Apr 29 2016 06:28 hey all im back :) need help again Markus Kiili @Masd925 Apr 29 2016 06:29 @UnluckyNick Find out array methods for inserting an item to end of an array, and for removing the first array element. Then use them on arr and item. EricOber @EricOber Apr 29 2016 06:29 // Setup var myObj = { gift: "pony", pet: "kitten", bed: "sleigh" }; function checkObj(checkProp) { checkObj.hasOwnProperty(); return checkObj(checkProp); } // Test your code by modifying these values checkObj("gift"); does this make sense to anyone? Markus Kiili @Masd925 Apr 29 2016 06:29 @Am3ricanPaladin No. EricOber @EricOber Apr 29 2016 06:29 lol didnt think so lcassettai @lcassettai Apr 29 2016 06:29 hah no EricOber @EricOber Apr 29 2016 06:29 im on "Testing Objects for Properties" Marian Menschig @mmenschig Apr 29 2016 06:30 @Am3ricanPaladin that's not gonnna work like that.... Nick Woelk @UnluckyNick Apr 29 2016 06:30 Never mind, I figured out my problem. I'd forgotten the push and shift functions. EricOber @EricOber Apr 29 2016 06:30 Instructions are to: Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found". lcassettai @lcassettai Apr 29 2016 06:30 hasOwnProperty ("here you have to pass the preperty"); you call you function inside your funcion i think that will bee a infinitve loop EricOber @EricOber Apr 29 2016 06:31 // Setup var myObj = { gift: "pony", pet: "kitten", bed: "sleigh" }; function checkObj(checkProp) { hasOwnProperty(checkObj); return ; } // Test your code by modifying these values checkObj("gift"); Marian Menschig @mmenschig Apr 29 2016 06:32 @Am3ricanPaladin don't call hasOwnPropertyon the function....call it on the argument that you call the function with......which one is the argument ? :) EricOber @EricOber Apr 29 2016 06:34 checkProp is argument? lcassettai @lcassettai Apr 29 2016 06:34 function checkObj(checkProp) { return myObj.hasOwnProperty(checkProp);; } Marian Menschig @mmenschig Apr 29 2016 06:34 I can neither confirm nor deny that :P EricOber @EricOber Apr 29 2016 06:34 ooooh Marian Menschig @mmenschig Apr 29 2016 06:34 @lcassettai don't give him the entire solution... EricOber @EricOber Apr 29 2016 06:35 well im actually glad he did, because I will show you lcassettai @lcassettai Apr 29 2016 06:35 my bad :-1: EricOber @EricOber Apr 29 2016 06:35 here is the initial code im presented with // Setup var myObj = { gift: "pony", pet: "kitten", bed: "sleigh" }; function checkObj(checkProp) { // Your Code Here return "Change Me!"; } // Test your code by modifying these values checkObj("gift"); you can see // Your Code Here.... so thats where I was putting it. I didnt think to tinker with whats after, return, yet. AaronCs @AaronCs Apr 29 2016 06:36 Hi guys, so my weather api project isn't working. Can someone give me a tip as to why it's unable to retrieve any data? https://gist.github.com/AaronCs/2566acd8e8c61b49851f6521ff3ff2a0 lcassettai @lcassettai Apr 29 2016 06:37 haha but he is right, if i give the answr you dont think... its like pass the answer at an exam... @mmenschig is the teacher hah EricOber @EricOber Apr 29 2016 06:38 thank you @lcassettai and @mmenschig are you two stalking out the chat to get points, or are there people here on the regular payroll to help out etc? or are you doing this for credit, like its a challenge? CamperBot @camperbot Apr 29 2016 06:38 am3ricanpaladin sends brownie points to @lcassettai and @mmenschig :sparkles: :thumbsup: :sparkles: :star: 289 | @mmenschig | http://www.freecodecamp.com/mmenschig :star: 133 | @lcassettai | http://www.freecodecamp.com/lcassettai DamianMitchell @DamianMitchell Apr 29 2016 06:39 @UnluckyNick did you figure it out yet? Marian Menschig @mmenschig Apr 29 2016 06:39 I'm just on here because I need help with my JS file lol EricOber @EricOber Apr 29 2016 06:39 oh! are you new too? Elbert Cortez @trip16661 Apr 29 2016 06:39 help No repeats please CamperBot @camperbot Apr 29 2016 06:39 ## :point_right: algorithm no repeats please [wiki] # Problem Explanation: • This task requires us to look at each possible permutation of a string. This is best done using a recursion function. Being able to build a function which collects all permutations of a string is a common interview question, so there is no shortage of tutorials out there on how to do this, in many different code languages. • This task can still be daunting even after watching a tutorial. You will want to send each new use of the function 3 inputs: 1. a new string (or character array) that is being built, 2. a position in your new string that's going to be filled next, and 3. an idea of what characters (more specifically positions) from the original string have yet to be used. The pseudo code will look something like this:  var str = ???; perm(current position in original string, what's been used in original string, current string build thus far){ if(current string is finished) { print current string; }else{ for(var i = 0; i < str.length; i++) { if(str[i] has not been used) { put str[i] into the current position; mark str[i] as used perm(current position in original string, what's been used in original string, current string build thus far) unmark str[i] as used because another branch in the tree for i + 1 will still likely use it; } Karthik-B-15 @Karthik-B-15 Apr 29 2016 06:39 how to implement keyboard accessibility in a website? Any useful links?? lcassettai @lcassettai Apr 29 2016 06:40 @Am3ricanPaladin mm in my case i im borring and when i tried to help other i learn more, in your case for example i really don't have idea what checkprop does hah EricOber @EricOber Apr 29 2016 06:40 lol lcassettai @lcassettai Apr 29 2016 06:42 but i search and i learn alot so ... i think is not a waste of time haha and u? are new? @Am3ricanPaladin EricOber @EricOber Apr 29 2016 06:42 im very new lcassettai @lcassettai Apr 29 2016 06:42 me too! EricOber @EricOber Apr 29 2016 06:42 its hard, but i hear the jobs for it are great lcassettai @lcassettai Apr 29 2016 06:43 i hope so... or i will kill somebody hah EricOber @EricOber Apr 29 2016 06:43 LOL Marian Menschig @mmenschig Apr 29 2016 06:44 @lcassettai @Am3ricanPaladin all I can tell you guys is: code a bit everyday, or read code, or stick with the matter. even when you guys are totally thinking "maybe coding isn't for me" EricOber @EricOber Apr 29 2016 06:44 i want to learn powershell but need the basics first lcassettai @lcassettai Apr 29 2016 06:45 yes! that's true... thanks for the advice @mmenschig ! i really have like 2 years coding, but not with web, i use java and c# CamperBot @camperbot Apr 29 2016 06:45 lcassettai sends brownie points to @mmenschig :sparkles: :thumbsup: :sparkles: :star: 290 | @mmenschig | http://www.freecodecamp.com/mmenschig Marian Menschig @mmenschig Apr 29 2016 06:45 @Am3ricanPaladin what for? @lcassettai yeah i have a Python/SQL/VBA background EricOber @EricOber Apr 29 2016 06:46 its 1337 Marian Menschig @mmenschig Apr 29 2016 06:47 @Am3ricanPaladin you should learn Bash EricOber @EricOber Apr 29 2016 06:47 bash? Marian Menschig @mmenschig Apr 29 2016 06:47 EricOber @EricOber Apr 29 2016 06:48 yeah i want to learn all the stuff the defcon people use EricOber @EricOber Apr 29 2016 06:56 // Setup var myObj = { gift: "pony", pet: "kitten", bed: "sleigh" }; function checkObj(checkProp) { // Your Code Here return myObj.hasOwnProperty(checkProp); } // Test your code by modifying these values checkObj("gift"); still not working Instructions Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found". buiphuking @buiphuking Apr 29 2016 06:59 you should if .... else lcassettai @lcassettai Apr 29 2016 07:00 haha sory i thout that you must return true if exist... ok so this myObj.hasOwnProperty(checkProp); return true or false if property exist... so you must use little logic here with if else and boila! :D @Am3ricanPaladin EricOber @EricOber Apr 29 2016 07:01 ok hmm how do i use if else here? buiphuking @buiphuking Apr 29 2016 07:02 if(myObj.hasOwnProperty(checkProp)){return ......} else{return .....} EricOber @EricOber Apr 29 2016 07:03 @buiphuking thanks CamperBot @camperbot Apr 29 2016 07:03 am3ricanpaladin sends brownie points to @buiphuking :sparkles: :thumbsup: :sparkles: :warning: could not find receiver for buiphuking Mr.Jois @Sumanthjois Apr 29 2016 07:29 need help with 221 js how to access playernumber i mean how to asssign number var testObj = { 12: "Namath", 16: "Montana", 19: "Unitas" }; // Only change code below this line; var playerNumbe ; // Change this Line var player = testObj["16"]; // Change this Line this is the code Markus Kiili @Masd925 Apr 29 2016 07:31 @Sumanthjois Use the variable instead of "16" as the property key to access. Mr.Jois @Sumanthjois Apr 29 2016 07:32 noo player is fine! playernumber should be a number how do i do it? Markus Kiili @Masd925 Apr 29 2016 07:33 @Sumanthjois You should assign 16 to the variable and use the variable when you access the property of testObj. fearlessinc @fearlessinc Apr 29 2016 07:35  function CountingMinutesI(str) { var times = str.split('-'); var from = times[0]; var to = times[1]; // var hrs = from.split(':'); // var min = hrs[1].slice(0,2); // var ampm = hrs[1].slice(2); function timer(num){ return num*5; } timer(10); } trying to call timer function why is it giving undefined instead of 50 thanks! Markus Kiili @Masd925 Apr 29 2016 07:38 @fearlessinc timer(10) returns 50, but you don't do anything with the return value. Mr.Jois @Sumanthjois Apr 29 2016 07:39 @Masd925 can please show me with code? Markus Kiili @Masd925 Apr 29 2016 07:40 @Sumanthjois What is the name of the challenge? Challenge number doesn't help too much. fearlessinc @fearlessinc Apr 29 2016 07:40 @Masd925 how do I call the timer function Mr.Jois @Sumanthjois Apr 29 2016 07:40 Accessing Objects Properties with Variables @Masd925 js Markus Kiili @Masd925 Apr 29 2016 07:41 @Sumanthjois First assign 16 to playerNumber variable. Mr.Jois @Sumanthjois Apr 29 2016 07:42 ok then Markus Kiili @Masd925 Apr 29 2016 07:42 @Sumanthjois Then access testObj with bracket notation using playerNumber as the key, and assign the returned value to player variable. @fearlessinc timer(10); calls timer function and returns 50. What do you need to do with it? Mr.Jois @Sumanthjois Apr 29 2016 07:44 @Masd925 tHANKS a lot CamperBot @camperbot Apr 29 2016 07:44 sumanthjois sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles: :star: 1434 | @masd925 | http://www.freecodecamp.com/masd925 Mr.Jois @Sumanthjois Apr 29 2016 07:46 what are brownie point?s fearlessinc @fearlessinc Apr 29 2016 07:47 it is not working for me . I was trying to pass other values from the timer function let me post the updated code @Masd925 function CountingMinutesI(str) { var times = str.split('-'); var from = times[0]; var to = times[1]; function timer(num){ var hrs = num.split(':'); var min = hrs[1].slice(0,2); var ampm = hrs[1].slice(2); } timer(from); } // keep this function call here CountingMinutesI(12:30pm-12:00am); Elbert Cortez @trip16661 Apr 29 2016 07:54 I'm so looooooooooooooooost xDDD I'm so screwed >.< Hitesh Nair @hyperhitesh Apr 29 2016 07:55 giammsbond @giammsbond Apr 29 2016 08:10 Hi campers! Can someone help me with this exercise (Stand in Line)? I can't understand really well what I have to do: function nextInLine(arr, item) { // Your code here 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, 5)); // Modify this line to test console.log("After: " + JSON.stringify(testArr)); Exercise description:In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue. 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. plotterbaboom @plotterbaboom Apr 29 2016 08:13 You have to add the item parameter to the end of the arr parameter That should be your first step Then your next line of code can finish the last two requirements for the function by modifying the 'return item;' line chalermlit @chalermlit Apr 29 2016 08:19 function convertToF(celsius) { // Only change code below this line var celsius = 0; var fahrenheit = celsius * 9/5 +32; // Only change code above this line return fahrenheit; } // Change the inputs below to test your code convertToF(0); is my code is correct ? pls any one help advice me Rudolf Carl Pablico @rudolfpablico Apr 29 2016 08:20 @chalermlit what is the result of your code? chalermlit @chalermlit Apr 29 2016 08:23 when i put convertToF(20) the answer should be return 68 but instead it returned 32 I'm not sure what did i do wrong ..try to followed the instruction Rudolf Carl Pablico @rudolfpablico Apr 29 2016 08:24 @chalermlit try to put parenthesis. @chalermlit or you could just edit 9/5 into 1.8, making it direct chalermlit @chalermlit Apr 29 2016 08:27 ok @rudolfpablico let me try giammsbond @giammsbond Apr 29 2016 08:27 @plotterbaboom Thank you...but I really got stucked! I can't understand the process and the requirements...i tried with this but nope... function nextInLine(arr, item) { console.log([1,2,3], 1); // Your code here return arr + 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, 5)); // Modify this line to test console.log("After: " + JSON.stringify(testArr)); CamperBot @camperbot Apr 29 2016 08:27 giammsbond sends brownie points to @plotterbaboom :sparkles: :thumbsup: :sparkles: :star: 195 | @plotterbaboom | http://www.freecodecamp.com/plotterbaboom Boyce @Yijianc Apr 29 2016 08:29 help Sum All Odd Fibonacci Numbers CamperBot @camperbot Apr 29 2016 08:29 ## :point_right: algorithm sum all odd fibonacci numbers [wiki] # Explanation: You will need to gather all the Fibonacci numbers and then check for the odd ones. Once you get the odd ones then you will add them all. The last number should be the number given as a parameter if it actually happens to be an off Fibonacci number. giammsbond @giammsbond Apr 29 2016 08:33 @plotterbaboom Finally I got it! thamk u Claudio Restifo @Marmiz Apr 29 2016 08:36 Hello mighty coders! I'd like some help with the interaction between a button and a function. Specifically I am working on my weather app, and trying to create a SINGLE button that, once clicked change the value from F° to C°. I got my two var stored correctly, so how can I fill the pseudo-code below? $('#btn').on("click" , function () {
if (/* value is C°*/){
$.('#temp').html(far + " F°") } else if (/* value is F° */) {$.('#temp').html(temp + " C°")
}
}
buiphuking
@buiphuking
Apr 29 2016 08:38
help Friendly Date Ranges
CamperBot
@camperbot
Apr 29 2016 08:38

# Problem Explanation:

• Create a program that will take two dates and convert them into a more easy to understand date such as January 1st, 2017. It will also check the difference between them, and handles cases with no difference, more than a day, more than a month, more than a year, and more than a month and less than a year respectively.
:pencil: read more about algorithm friendly date ranges on the FCC Wiki
Brendan Kinahan
@BKinahan
Apr 29 2016 08:39
@Marmiz so you basically want a function that toggles which temp format you're using, and updates the html after the switch. you can probably say something like 'if format == "C", format = "F", else format = "C", then update html with correct value'
Samuel Cupidon
@Zerazera
Apr 29 2016 08:40
$('#btn').on('click',function() { if (//value is fahrenheit) { //convert to celsius } else { //convert to fahrenheit } } Claudio Restifo @Marmiz Apr 29 2016 08:40 @BKinahan had some formatting problem, i have updated my question so it's more clear :) Brendan Kinahan @BKinahan Apr 29 2016 08:41 ah @Marmiz then I'd probably advise using a variable to keep track of which is currently displayed, or you can check the html directly if you like Claudio Restifo @Marmiz Apr 29 2016 08:43 @BKinahan mmmh, key... but how do I keep a variable to know which one is displayed? :smile: assuming that i already have two variables that store the two values: var temp = //temperature in C var far = //temperature in F Brendan Kinahan @BKinahan Apr 29 2016 08:44 @Marmiz alternatively jquery has a 'contains' selector so you could look for an element with "C" or "F" that matches the #temp ID, like $('#temp'):contains("C") http://api.jquery.com/contains-selector/
@Marmiz could be anything, like current = "F" by default, then use that in your code like
$('#btn').on("click" , function () { if (current == 'C'){ current = 'F';$.('#temp').html(far + " F°")
} else {
current = 'C';
$.('#temp').html(temp + " C°") } } @Marmiz note that it doesn't need an else if since there are only two possibilities fearlessinc @fearlessinc Apr 29 2016 08:49 This message was deleted Rudolf Carl Pablico @rudolfpablico Apr 29 2016 08:50 help chunky monkey CamperBot @camperbot Apr 29 2016 08:50 ## :point_right: algorithm chunky monkey [wiki] # Explanation Our goal for this Algorithm is to split arr (first argument) into smaller chunks of arrays with the length provided by size (second argument). There are 4 green checks (objectives) our code needs to pass in order to complete this Algorithm: 1. (['a', 'b', 'c', 'd'], 2) is expected to be [['a', 'b'], ['c', 'd']] 2. ([0, 1, 2, 3, 4, 5], 3) is expected to be [[0, 1, 2], [3, 4, 5]] 3. ([0, 1, 2, 3, 4, 5], 2) is expected to be [[0, 1], [2, 3], [4, 5]] 4. ([0, 1, 2, 3, 4, 5], 4) is expected to be [[0, 1, 2, 3], [4, 5]] Click More information under the Algorithm title and read the helpful links if you haven't yet. fearlessinc @fearlessinc Apr 29 2016 08:50 I am trying to find difference in time. For e.g "12:30pm-12:00am" using CountingMinutesI. This code is not working, any pointers would be appreciated. function CountingMinutesI(str) { var times = str.split('-'); var from = times[0]; var to = times1; function timer(num){ var hrs = num.split(':'); var min = hrs1.slice(0,2); var ampm = hrs1.slice(2); var totalMins = 0;  var pmMins = if (ampm === 'pm'){ return 720; }else return 0; var totalMins = hrs*60 + mins + pmMins ; return totalMins; } var diff = timer(from) - timer(to); return diff; } // keep this function call here CountingMinutesI(12:30pm-12:00am);  Claudio Restifo @Marmiz Apr 29 2016 08:53 @BKinahan Unfortunately this fails to work $('#btn').on("click" , function () {

if (current == 'C') {
current == 'F';
$('#temp').html(far + " F°") } else { current == 'C';$('#temp').html(temp + " C°")
}

})

Could be that it won't read it in my html; that looks like this:

<span id="temp"></span>
Brendan Kinahan
@BKinahan
Apr 29 2016 08:53
@Marmiz you're checking for equality with ==, not assigning
@Marmiz and don't forget to declare var current = 'F'; (or 'C') outside of the function so there is a starting value and it can be stored.
Claudio Restifo
@Marmiz
Apr 29 2016 08:55
@BKinahan It worked with the containsSelector tho.
contains()
thanks a lot for your help.. and the precious resource :) :)
Brendan Kinahan
@BKinahan
Apr 29 2016 08:55
@Marmiz great :D
Claudio Restifo
@Marmiz
Apr 29 2016 08:56
@BKinahan thanks.
Camperbot, do your job and give this man his well deserved brownie-points
CamperBot
@camperbot
Apr 29 2016 08:56
marmiz sends brownie points to @bkinahan :sparkles: :thumbsup: :sparkles:
:star: 1402 | @bkinahan | http://www.freecodecamp.com/bkinahan
Brendan Kinahan
@BKinahan
Apr 29 2016 08:57
haha thanks for the brownies :P
happy to help
Claudio Restifo
@Marmiz
Apr 29 2016 08:57
@BKinahan <3 love the community here
Hitesh Nair
@hyperhitesh
Apr 29 2016 09:00
Brendan Kinahan
@BKinahan
Apr 29 2016 09:01
Armend
@ArmendBerisha
Apr 29 2016 09:03
Hi guys, I'm having some trouble using the twitter button APIs
Brendan Kinahan
@BKinahan
Apr 29 2016 09:03
oh, it's XML? Why not use a json-providing API?
@ArmendBerisha are you doing the random quote generator challenge?
Armend
@ArmendBerisha
Apr 29 2016 09:04
@BKinahan yes
I'm having some trouble with the data-text property
Brendan Kinahan
@BKinahan
Apr 29 2016 09:05
@ArmendBerisha the easiest way is probably the tweet intents feature: https://dev.twitter.com/web/intents#tweet-intent
you basically only need to form a URL with the tweet text, and apply it to the href attribute of the button
Armend
@ArmendBerisha
Apr 29 2016 09:07
I'll try this now because i was working with this one
the first one
Brendan Kinahan
@BKinahan
Apr 29 2016 09:10
that's more powerful, but maybe a little bit of overkill for this use :)
faraz
@silentarrowz
Apr 29 2016 09:10
trying to build the wikipedia viewer. dont know why it's not working. - http://codepen.io/silentarrowz/pen/yOEGjE
could any of you guys help??
bvb437
@bvb437
Apr 29 2016 09:16
Guys, can you help me with testing objects for properties challenge? :)
this is my script
if (myObj.hasOwnProperty("checkProp")===true)
return myObj.checkprop;
if (myObj.hasOwnProperty("checkProp")===false)
oh found it
needed to remove the " " from checkprop :)
and i made it with if/else and removed true and false and it works
wololo, I need to drink more coffe
Rudolf Carl Pablico
@rudolfpablico
Apr 29 2016 09:21
guys need help on mutations exercise
function mutation(arr) {
var n =0;

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

n = arr[0].indexOf(arr[1][i]);

}
// return arr[1][i];
if(n !== -1) {
return true;
}
else {
return false;
}
}

mutation(["hello", "neo"]);
only fails on this condition
mutation(["hello", "neo"]) should return false.
Brendan Kinahan
@BKinahan
Apr 29 2016 09:25
@rudolfpablico you only check the last letter of the word since you reassign n in each step of the loop, and check it at the end
@rudolfpablico so n progresses through the values 0,-1,1,4
and then returns true because you check it when it's 4
Rudolf Carl Pablico
@rudolfpablico
Apr 29 2016 09:28
@BKinahan how can i check the value of n every time it loops?
Brendan Kinahan
@BKinahan
Apr 29 2016 09:29
@rudolfpablico put the check inside the loop :P but you can't return true inside the loop because it'll stop as soon as it matches a correct letter.
Rudolf Carl Pablico
@rudolfpablico
Apr 29 2016 09:30
@BKinahan yea, that's why i put if/else statement outside the loop
Armend
@ArmendBerisha
Apr 29 2016 09:35
@BKinahan now is working, thank you! :+1:
CamperBot
@camperbot
Apr 29 2016 09:35
armendberisha sends brownie points to @bkinahan :sparkles: :thumbsup: :sparkles:
:star: 1404 | @bkinahan | http://www.freecodecamp.com/bkinahan
Armend
@ArmendBerisha
Apr 29 2016 09:37
I was confused by the %20 and I was splitting the quote in array of word and adding %20 before every word ahahhah
Rudolf Carl Pablico
@rudolfpablico
Apr 29 2016 09:47
Mr.Jois
@Sumanthjois
Apr 29 2016 10:10
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};
var gloveBoxContents = myStorage.car.["inside"].["glove box"];
how to access glove box?
Mateusz Szymański
@matszym
Apr 29 2016 10:11

var gloveBoxContents = myStorage.car["inside"]["glove box"];

eiter dot, or bracket notation .['inside'] wont work

Romain Mondon-Cancel
@skasch
Apr 29 2016 10:11
@Sumanthjois myStorage.car.inside["glove box"] should work =)
bvb437
@bvb437
Apr 29 2016 10:11
hei
what's wrong with my code
if(value!=="" && prop!=="tracks"){collection[id].tracks.push(value);}
else if (value !==""){collection[id][prop]=value;}
else if (value ===""){delete collection[id][prop];}
Mateusz Szymański
@matszym
Apr 29 2016 10:13
@bvb437 what is the problem?
Romain Mondon-Cancel
@skasch
Apr 29 2016 10:13
@bvb437 There's something weird:
if(value!=="" && prop!=="tracks"){collection[id].tracks.push(value);}
else if (value !==""){collection[id][prop]=value;} // here, prop === 'tracks', is it intended?
else if (value ===""){delete collection[id][prop];}
bvb437
@bvb437
Apr 29 2016 10:14
oh
just needed to remove the ! from the first if statement
i forgot it there :D
Romain Mondon-Cancel
@skasch
Apr 29 2016 10:16
=)
svexas
@svexas
Apr 29 2016 10:17
hey guys, what i may be missing here?
DamianMitchell
@DamianMitchell
Apr 29 2016 10:17
anybody here????
svexas
@svexas
Apr 29 2016 10:17
This message was deleted
Romain Mondon-Cancel
@skasch
Apr 29 2016 10:18
@svexas You're not changing the value of result =)
svexas
@svexas
Apr 29 2016 10:18
well, i do, because the whole code runs and changes value to frank...
bvb437
@bvb437
Apr 29 2016 10:19
there are a some poor-explained challenges
svexas
@svexas
Apr 29 2016 10:19
but how to hit specific return?
bvb437
@bvb437
Apr 29 2016 10:19
and i think i'm a little stupid :(
is it that normal?
Romain Mondon-Cancel
@skasch
Apr 29 2016 10:19
@svexas You have to use a switch
svexas
@svexas
Apr 29 2016 10:19
one of things i shouldn't use is switch
it would be easy otherwise
Romain Mondon-Cancel
@skasch
Apr 29 2016 10:20
Oh, that's right ^^ then you should define a lookup object to reference the matching values =)
svexas
@svexas
Apr 29 2016 10:20
@bvb437 same here, but just practice more and you will be better
bvb437
@bvb437
Apr 29 2016 10:21
i won't give up, but i don't know :D
svexas
@svexas
Apr 29 2016 10:21
@skasch and how do i do it?
Mateusz Szymański
@matszym
Apr 29 2016 10:21
@svexas return lookup[val]
bvb437
@bvb437
Apr 29 2016 10:21
i'm feeling a little "stuck" sometimes
Romain Mondon-Cancel
@skasch
Apr 29 2016 10:21
for example:
var myVar = 'foo'
var referenceObject = {'foo': 'bar'}
var result = referenceObject[myVar] // result === 'bar'
@bvb437 The challenges push you to find the answers a lot by searching on the web, on code documentations, on sites like stackoverflow =) that's the best way to learn how to code, by trial and error!
svexas
@svexas
Apr 29 2016 10:23
@skasch thanks, it works at last
CamperBot
@camperbot
Apr 29 2016 10:23
svexas sends brownie points to @skasch :sparkles: :thumbsup: :sparkles:
:star: 206 | @skasch | http://www.freecodecamp.com/skasch
Romain Mondon-Cancel
@skasch
Apr 29 2016 10:24
@svexas Awesome, congrats =)
svexas
@svexas
Apr 29 2016 10:24
tried to use rray at wrong places :D
plus for future: how to post there just a coding space?
Romain Mondon-Cancel
@skasch
Apr 29 2016 10:25
help format
CamperBot
@camperbot
Apr 29 2016 10:25

## :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

nsloc22
@nsloc22
Apr 29 2016 10:26

@rudolfpablico break your for loop if n === -1

 if(n === -1) break;

and check indexOf on lower case strings

n = arr[0].toLowerCase().indexOf(arr[1][i].toLowerCase());
svexas
@svexas
Apr 29 2016 10:27
test test
again thank you :)
Romain Mondon-Cancel
@skasch
Apr 29 2016 10:27
@svexas You're very welcome!
Ankur sharma
@ankur1163
Apr 29 2016 11:07
can someone explain whats happening in for loop here
function titleCase(str) {

var myLoweredString = str.toLowerCase();
var mySplitString = myLoweredString.split(" ");
var myNewArray = [];
for (i= 0; i < mySplitString.length; i++) {
var myFirstLetter = mySplitString[i].charAt(0).toUpperCase(); //isolates the first character in each array and makes it upper case.
var myRestofSentence = mySplitString[i].slice(1); //isolates everything past (and including) the second character in each array (it's already lower case)
var myProperCaseWord = myFirstLetter + myRestofSentence;  //concatenates the uppercase first character and the lower case rest of the sentence
myNewArray.push(myProperCaseWord);
}
return (myNewArray.join(" "));
}

titleCase("I'm a little tea pot");
result is I'm A Little Tea Pot
lets suppose , it takes i'm ( as we have made it to lower case initially)
when this code runs
var myFirstLetter = mySplitString[i].charAt(0).toUpperCase();
result is I'm
or only I
Stephen James
@sjames1958gm
Apr 29 2016 11:10
@ankur1163 The loop is taking each word in the array and making the first letter upper case and building a string from that char. and the rest of the word and putting it in a new array.
@ankur1163 var myRestOfSentence is not a good name it should be myRestOfWord
Ankur sharma
@ankur1163
Apr 29 2016 11:12
so first line of code var myFirstLetter = mySplitString[i].charAt(0).toUpperCase();
returns I only
fulcherben
@fulcherben
Apr 29 2016 11:12
function caseInSwitch(val) {
// Only change code below this line
case "1":
"alpha";
break;
case "2":
"beta";
break;
case "3":
break;
case "4":
"delta";
break;

// Only change code above this line
}

// Change this value to test
caseInSwitch(1);
Im having a problem with the case excersise
Stephen James
@sjames1958gm
Apr 29 2016 11:13
@ankur1163 Yes and myRestofSentence = mySplitString[i].slice(1); returns 'm
Ankur sharma
@ankur1163
Apr 29 2016 11:13
got it
Stephen James
@sjames1958gm
Apr 29 2016 11:13
:+1:
Ankur sharma
@ankur1163
Apr 29 2016 11:14
so, first line isolate first character. Second line isolate rest of the characters from word (thats why slice(1) , we use 1 )
Stephen James
@sjames1958gm
Apr 29 2016 11:14
@fulcherben Thefunction is case in switch you don't have a switch around all your cases
Ankur sharma
@ankur1163
Apr 29 2016 11:14
and then we join
Thanks @sjames1958gm
CamperBot
@camperbot
Apr 29 2016 11:14
:star: 841 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
ankur1163 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
Stephen James
@sjames1958gm
Apr 29 2016 11:14
@fulcherben It is switch (val) { cases }
fulcherben
@fulcherben
Apr 29 2016 11:15
so am I missing the brackets because the problem had the functions brackets already in there
Rudolf Carl Pablico
@rudolfpablico
Apr 29 2016 11:17
need help on falsy bouncer challanges
function bouncer(arr) {
// Don't show a false ID to this bouncer.
var newarr;
for(var i = 0; i < arr.length; i++){
if(arr[i] === ""|| arr[i] === null || arr[i]=== 0 ||arr[i] === false || arr[i] === undefined || isNaN(arr[i]) ) {
newarr = arr.slice(arr[i]);
}
}

return newarr;

}

bouncer([7, "ate", "", false, 9]);`
what could be wrong in my code?
Stephen James
@sjames1958gm
Apr 29 2016 11:21
@fulcherben The switch goes inside the function brackets.
@rudolfpablico Are you failing specific tests?
Rudolf Carl Pablico
@rudolfpablico
Apr 29 2016 11:21
@sjames1958gm this one only passes
bouncer(["a", "b", "c"]) should return ["a", "b", "c"].