9th
Jan 2016
Phillip Stolić
Jan 09 2016 00:00
Does anyone else need any coding help? :)
Fiona
@Foathome
Jan 09 2016 00:01
@Deadmano Hi, and thanks for the advice, but I thought "row" or "col-xs-6" was the this affected by the div class?
CamperBot
@camperbot
Jan 09 2016 00:01
foathome sends brownie points to @deadmano :sparkles: :thumbsup: :sparkles:
dorkybelle
@dorkybelle
Jan 09 2016 00:01
@johnlovespi @wearenotgroot @wearenotgroot You rock. I was stuck on this problem just now!
Phillip Stolić
Jan 09 2016 00:01
@Foathome no worries. :) Anything between the opening and closing of the DIV tag will be affected by the class the DIV has.
Class or ID, or multiple classes or ID's if there are any.
supasheva
@supasheva
Jan 09 2016 00:02
// 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 update(id, prop, value) {

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

}

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

}

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

}

return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");
greg
@wearenotgroot
Jan 09 2016 00:02
@dorkybelle Hodor
supasheva
@supasheva
Jan 09 2016 00:02
still getting bugs
not bugs but error
Phillip Stolić
Jan 09 2016 00:02
@Foathome col-xs-6 is just a random name given to the CSS class. Then you assign that class to any tag that supports it and boom; formatting!
greg
@wearenotgroot
Jan 09 2016 00:03
@supasheva the order of test matter. #itmatters
Brian Giles
@briangiles
Jan 09 2016 00:07
Ok, I’m regoing through the Push exercise...
So what’s going on here..
var ourArray = ["Stimpson", "J", ["cat"]];

ourArray.pop(); // ourArray now equals ["Stimpson", "J"]

ourArray.push(["happy", "joy"]); // ourArray now equals ["Stimpson", "J", ["happy", "joy"]]

var myArray = ["John", 23, ["cat", 2]];

myArray.pop();

// Only change code below this line.

myArray.push(["dog", 3]);

// Only change code above this line.

(function(z){return 'myArray = ' + JSON.stringify(z);})(myArray);
Phillip Stolić
Jan 09 2016 00:07
@briangiles it isn't so much as the push as it is the shift you're getting stuck on.
@briangiles oh you moved on from the last one you were working on?
Brian Giles
@briangiles
Jan 09 2016 00:08
@Deadmano I moved backwards.. I noticed that this one now wasn’t green lite and passed.
Fiona
@Foathome
Jan 09 2016 00:08
@Deadmano Thank you thank you thank you - It works (now I have assigned it properly) it works! Great advice!
CamperBot
@camperbot
Jan 09 2016 00:08
foathome sends brownie points to @deadmano :sparkles: :thumbsup: :sparkles:
Brian Giles
@briangiles
Jan 09 2016 00:08
Phillip Stolić
Jan 09 2016 00:08
@briangiles may be a browser issue. 1) submit it again or 2) refresh the page.
scottmike0
@scottmike0
Jan 09 2016 00:08
@briangiles what exercise
is that
Phillip Stolić
Jan 09 2016 00:08
@Foathome you are so very welcome; and I am so proud of you for understanding it too!! ^^ All of the best going forward! :)
Brian Giles
@briangiles
Jan 09 2016 00:09
@Deadmano and it should equal [["John", 23], ["cat", 2], ["dog", 3]]. right?
@Deadmano Map: 43.Waypoint: Manipulate Arrays With push()
Phillip Stolić
Jan 09 2016 00:10
@briangiles been a while since I did that I think! You had to have passed it though, weird. It must been a previous answer?
Brian Giles
@briangiles
Jan 09 2016 00:10
@Deadmano I had it passed, but I went back to it and its doesn’t show as passed now
scottmike0
@scottmike0
Jan 09 2016 00:10
@briangiles clear your code, and just put the code below line
Brian Giles
@briangiles
Jan 09 2016 00:10
Instructions
Push ["dog", 3] onto the end of the myArray variable.
Emerson Silva
@Emerson093
Jan 09 2016 00:11
i need help with Waypoint: Nest an Anchor Element within a Paragraph
greg
@wearenotgroot
Jan 09 2016 00:11
@briangiles why did you pop()?
Emerson Silva
@Emerson093
Jan 09 2016 00:11
Brian Giles
@briangiles
Jan 09 2016 00:11
aaaahhh
scottmike0
@scottmike0
Jan 09 2016 00:11

@briangiles 
// Example
var ourArray = ["Stimpson", "J", "cat"];
ourArray.push(["happy", "joy"]);
// ourArray now equals ["Stimpson", "J", "cat", ["happy", "joy"]]

// Setup
var myArray = [["John", 23], ["cat", 2]];

// Only change code below this line.

myArray.push(["dog",3]);


Brian Giles
@briangiles
Jan 09 2016 00:11
@wearenotgroot I must have been messing around with that before...
@wearenotgroot thanks!
CamperBot
@camperbot
Jan 09 2016 00:12
briangiles sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:warning: briangiles already gave wearenotgroot points
greg
@wearenotgroot
Jan 09 2016 00:12
@briangiles if you gonna pop() , you should also lock() XD
Brian Giles
@briangiles
Jan 09 2016 00:12
@wearenotgroot I must have been just tinkering after I finished it
Emerson Silva
@Emerson093
Jan 09 2016 00:12
my code is correct but asked me "view more " with space
i dont know
Phillip Stolić
Jan 09 2016 00:12
@briangiles ready to tackle the shift one? :P
Emerson Silva
@Emerson093
Jan 09 2016 00:12
someone help me
Brian Giles
@briangiles
Jan 09 2016 00:12
hahaha
@Deadmano Yes, I’m just going through one by one the previous 5 examples...
@Deadmano just making sure I’m sharp
Phillip Stolić
Jan 09 2016 00:13
@briangiles you want to focus on the shift() one's. Possibly also on return then you'll be sorted.
@Emerson093 paste some code of what you have or what you're stuck on? And paste the description?
greg
@wearenotgroot
Jan 09 2016 00:14
@Emerson093 post what you got
Emerson Silva
@Emerson093
Jan 09 2016 00:15
so i make correct
@wearenotgroot but asked for me insert "view more " with space
Phillip Stolić
Jan 09 2016 00:15
?
Emerson Silva
@Emerson093
Jan 09 2016 00:15
@wearenotgroot but i dont know make it
Waypoint: Nest an Anchor Element within a Paragraph
greg
@wearenotgroot
Jan 09 2016 00:16
@Emerson093 instruction said nest the paragraph and the anchor
Phillip Stolić
Jan 09 2016 00:16
If you want an anchor, that is just <a>view more</a>
That makes a "fake" link. Is that what you want?
greg
@wearenotgroot
Jan 09 2016 00:16
@Emerson093 look at the example
Emerson Silva
@Emerson093
Jan 09 2016 00:16
i try it
ask me this "Your p element should have the text "View more " (with a space after it)."
greg
@wearenotgroot
Jan 09 2016 00:17
@Emerson093 did you put the href="..." somthing?
Phillip Stolić
Jan 09 2016 00:18
@Emerson093 do you know what a paragraph tag is? Give me an example.
Fiona
@Foathome
Jan 09 2016 00:18
@Deadmano Yes I am so glad it finally clicked - I have a feeling I may be calling on you for advice again though! Thanks again!
Emerson Silva
@Emerson093
Jan 09 2016 00:18
asks to create the p tag with space
CamperBot
@camperbot
Jan 09 2016 00:18
foathome sends brownie points to @deadmano :sparkles: :thumbsup: :sparkles:
Emerson Silva
@Emerson093
Jan 09 2016 00:19
Phillip Stolić
Jan 09 2016 00:19
@Foathome my private message box is open for you anytime! :) Do you know how to PM?
greg
@wearenotgroot
Jan 09 2016 00:19
yes and then nest an anchor
Phillip Stolić
Jan 09 2016 00:19
@Emerson093 I'm asking you if you know what a p tag is and how to make one? I guess not?
@Emerson093 <p> is the start of a paragraph tag.
greg
@wearenotgroot
Jan 09 2016 00:19
show us the p tag
Phillip Stolić
Jan 09 2016 00:20
Does that make sense? @Emerson093? Can you give me an example of a full open and close tag with text in it?
Fiona
@Foathome
Jan 09 2016 00:20
@Deadmano Yup, I can do that. Thanks for the offer - expect a PM soon, I am on a seriously steep learning curve here!
CamperBot
@camperbot
Jan 09 2016 00:20
foathome sends brownie points to @deadmano :sparkles: :thumbsup: :sparkles:
Phillip Stolić
Jan 09 2016 00:21
@Foathome once you start, you will see how fun and easy it is! Just takes a bit of getting used to and understanding, and I find it is easiest learning from someone who can guide you, so please don't hesitate. ;)
Emerson Silva
@Emerson093
Jan 09 2016 00:21
@Deadmano yes, i know what tag p
CarrKeys
@CarrKeys
Jan 09 2016 00:21
What does it mean when I get 'RangeError: Maximum call stack size exceeded' from the console log?
Phillip Stolić
Jan 09 2016 00:21
@Emerson093 OK, so they are asking you to create a paragraph, with a space in it? Yes? Paste the full description of what we need to do.
greg
@wearenotgroot
Jan 09 2016 00:21
@Emerson093 ok then show us how to nest a p tag with a-tag
Phillip Stolić
Jan 09 2016 00:22
Emerson Silva
@Emerson093
Jan 09 2016 00:22

it is example Here's an example:

<p>Here's a <a href="http://freecodecamp.com"> link to Free Code Camp</a> for you to follow.</p>

Nesting just means putting one element inside of another element.

Now nest your existing a element within a new p element (just after the existing h2 element) so that the surrounding paragraph says "View more cat photos", but where only "cat photos" is a link, and the rest of the text is plain text.

Phillip Stolić
Jan 09 2016 00:22
@Emerson093 nesting is putting something in something else...
<div>
<p>Example</p>
</div>
greg
@wearenotgroot
Jan 09 2016 00:22
@CarrKeys you have reach max memory stack for that function call
Brian Giles
@briangiles
Jan 09 2016 00:22
// Example
var ourArray = ["Stimpson", "J", ["cat"]];
removedFromOurArray = ourArray.shift();
// removedFromOurArray now equals "Stimpson" and ourArray now equals ["J", ["cat"]].

// Setup
var myArray = [["John", 23], ["dog", 3]];

// Only change code below this line.
var removedFromMyArray = myArray.shift(1);
So I got this right, but the first time I did it, it would not work. Why won’t the example below work, but the example above does?
// Example
var ourArray = ["Stimpson", "J", ["cat"]];
removedFromOurArray = ourArray.shift();
// removedFromOurArray now equals "Stimpson" and ourArray now equals ["J", ["cat"]].

// Setup
var myArray = [["John", 23], ["dog", 3]];

// Only change code below this line.
var removedFromMyArray;
myArray.shift(1) = removedFromMyArray;
CarrKeys
@CarrKeys
Jan 09 2016 00:23
Ohh hey the console log works now! Thanks @wearenotgroot .
CamperBot
@camperbot
Jan 09 2016 00:23
carrkeys sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star: 304 | @wearenotgroot | http://www.freecodecamp.com/wearenotgroot
Phillip Stolić
Jan 09 2016 00:23
@briangiles last 2 lines. Second last line is doing nothing.
greg
@wearenotgroot
Jan 09 2016 00:23
CamperBot
@camperbot
Jan 09 2016 00:23
wearenotgroot sends brownie points to @deadmano :sparkles: :thumbsup: :sparkles:
Phillip Stolić
Jan 09 2016 00:24
@wearenotgroot we are a team! I am fat on brownies as is!
Brian Giles
@briangiles
Jan 09 2016 00:24
can you do this too?
myArray.shift(1) = var removedFromMyArray;
CarrKeys
@CarrKeys
Jan 09 2016 00:24
Oh my! Sorry! Thought it was the other, haha. Should have sent to both.
Phillip Stolić
Jan 09 2016 00:24
@briangiles no, you can't. JavaScript reads right to left.
Brian Giles
@briangiles
Jan 09 2016 00:24
Emerson Silva
@Emerson093
Jan 09 2016 00:25
Phillip Stolić
Jan 09 2016 00:25
@Emerson093 because my code was an example. :D
Emerson Silva
@Emerson093
Jan 09 2016 00:26
i know
greg
@wearenotgroot
Jan 09 2016 00:26
@Emerson093 also see the check marks on the left and what is missing
Phillip Stolić
Jan 09 2016 00:26
@Emerson093 I can give you the answer but it isn't really learning then, is it? Let me know how I can help though... I gave you an example of what nesting is...
@Emerson093 think about it... You start with a paragraph tag, yes? Then BEFORE you close that paragraph tag inside it should be your anchor (<a>) tag...
Emerson Silva
@Emerson093
Jan 09 2016 00:27
so i need to create tag p nest in tag a
greg
@wearenotgroot
Jan 09 2016 00:27
:clap:
Phillip Stolić
Jan 09 2016 00:27
Generally speaking, HTML always has an opening and closing tag, but can be omitted in some cases. Like <br /> and <li> etc.
A nested a (anchor) inside your p (paragraph)?
Ashley
@Ashtheyogi
Jan 09 2016 00:28
can anyone tell me why my buttons are not placing side by side?
<div class="row>">
<button class="btn btn-block btn-primary col-xs-4">Like</button>
<button class="btn btn-block btn-info col-xs-4">Info</button>
<button class="btn btn-block btn-danger col-xs-4">Delete</button>
</div>
Emerson Silva
@Emerson093
Jan 09 2016 00:28
Phillip Stolić
Jan 09 2016 00:28
@Ashtheyogi do you have to do it a specific way? <span> will line things up next to each other.
Emerson Silva
@Emerson093
Jan 09 2016 00:28
but ask space inside "view more "
greg
@wearenotgroot
Jan 09 2016 00:28
@Ashtheyogi maybe they are shy?
Phillip Stolić
Jan 09 2016 00:29
If you don't use span, or CSS formatting, then each instance of a tag will be underneath.
Emerson Silva
@Emerson093
Jan 09 2016 00:29
but i dont know make it
Phillip Stolić
Jan 09 2016 00:29
@Emerson093 "view more" is just the text you put inside the tag...
<p>This is my text inside a paragraph tag.</p>
Ashley
@Ashtheyogi
Jan 09 2016 00:29
@Deadmano I am working on the waypoint :Use the Bootstrap Grid to Put Elements Side By Side
greg
@wearenotgroot
Jan 09 2016 00:29
@Ashtheyogi what exercise is that?
Phillip Stolić
Jan 09 2016 00:30
@Ashtheyogi either use CSS to format (if you have that understanding) or use a <span>. What do they ask you?
Ashley
@Ashtheyogi
Jan 09 2016 00:30
Use the Bootstrap Grid to Put Elements Side By Side @wearenotgroot
Phillip Stolić
Jan 09 2016 00:30
Oh? The grid? It must be referring to a CSS class.
Ashley
@Ashtheyogi
Jan 09 2016 00:30

@Deadmano Put the Like, Info and Delete buttons side-by-side by nesting all three of them within one <div class="row"> element, then each of them within a <div class="col-xs-4"> element.

The row class is applied to a div, and the buttons themselves can be nested within it.

greg
@wearenotgroot
Jan 09 2016 00:30
@Ashtheyogi the col-xs-4 is the culprit
Ashley
@Ashtheyogi
Jan 09 2016 00:31
how so? @wearenotgroot ?
greg
@wearenotgroot
Jan 09 2016 00:31
@Ashtheyogi instructions said ?:)
Ashley
@Ashtheyogi
Jan 09 2016 00:31
am I putting that class in the wrong element? I put them in the <div> one first
Phillip Stolić
Jan 09 2016 00:31
@Ashtheyogi ashley, each in a DIV, not as a button class.
Ashley
@Ashtheyogi
Jan 09 2016 00:31
@wearenotgroot :Put the Like, Info and Delete buttons side-by-side by nesting all three of them within one <div class="row"> element, then each of them within a <div class="col-xs-4"> element.
The row class is applied to a div, and the buttons themselves can be nested within it.
greg
@wearenotgroot
Jan 09 2016 00:31
@Ashtheyogi yes
Phillip Stolić
Jan 09 2016 00:32
@Emerson093 any progress?
Ashley
@Ashtheyogi
Jan 09 2016 00:32
so I separate each button element by a div? @Deadmano
Phillip Stolić
Jan 09 2016 00:32
@Ashtheyogi exactly.
greg
@wearenotgroot
Jan 09 2016 00:32
:+1:
Phillip Stolić
Jan 09 2016 00:32
@Ashtheyogi but I would have made it as part of the button style as you did, such a waste of space and characters. LOL. But do as the course says.
Ashley
@Ashtheyogi
Jan 09 2016 00:33
so for each do I do <div class="row"?
Phillip Stolić
Jan 09 2016 00:33
Remember to remove the class declaration from each button, specifically to col-xs-4.
No.
Re-read what they said. It is right there. ^^
Ashley
@Ashtheyogi
Jan 09 2016 00:33
greg
@wearenotgroot
Jan 09 2016 00:33
@Ashtheyogi 1 row multiple columns
Ashley
@Ashtheyogi
Jan 09 2016 00:33
okay let me try it brb
Phillip Stolić
Jan 09 2016 00:33
then each of them within a <div class="col-xs-4"> element.
Think of a DIV as a container. :) It houses what you put inside it.
Though, having said that, many other tags are containers. :P
But yeah, anyway... I am sure you got it now. :)
Emerson Silva
@Emerson093
Jan 09 2016 00:35
CamperBot
@camperbot
Jan 09 2016 00:35
emerson093 sends brownie points to @deadmano and @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star: 305 | @wearenotgroot | http://www.freecodecamp.com/wearenotgroot
Phillip Stolić
Jan 09 2016 00:35
@Emerson093 well, that is one way of doing it, haha, I hope you learned from it... I could have given you the answer. :)
Ashley
@Ashtheyogi
Jan 09 2016 00:35
CamperBot
@camperbot
Jan 09 2016 00:35
ashtheyogi sends brownie points to @deadmano and @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star: 306 | @wearenotgroot | http://www.freecodecamp.com/wearenotgroot
Edward Danilyuk
@EdwardGoomba
Jan 09 2016 00:35
can someone help me with checkpoint word blanks on js
Phillip Stolić
Jan 09 2016 00:36
@Ashtheyogi no worries, let us know how you go.
@EdwardGoomba go for it, post what you have and what you're stuck on. :)
Fiona
@Foathome
Jan 09 2016 00:36
@Deadmano I am on day 6, so its still all really challenging. But I am enjoying it. Thanks for the support.
CamperBot
@camperbot
Jan 09 2016 00:36
foathome sends brownie points to @deadmano :sparkles: :thumbsup: :sparkles:
Aprophecy
@Aprophecy
Jan 09 2016 00:36
Can someone help me with a git/fcc issue?
CamperBot
@camperbot
Jan 09 2016 00:36
Aprophecy
@Aprophecy
Jan 09 2016 00:36
A pm would be noce
Nice*
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:36
does anyone have time to help me with Waypoint: Using Objects for Lookups?
Emerson Silva
@Emerson093
Jan 09 2016 00:36
Nicole F.
@gitasong
Jan 09 2016 00:37
Has there been a @SaintPeter sighting around here recently? :)
Phillip Stolić
Jan 09 2016 00:37
@Foathome wow, you're making great progress; keep it up!! :) Trust me, it becomes easier as you work on it more and more and do practical work. :) Take some time each day to use what you have learnt in a real scenario for yourself.
@Emerson093 no problem, glad you got through it! Please feel free to ask if there is anything else. :)
@SarahMarie73 post your code/what you're stuck on. :)
Emerson Silva
@Emerson093
Jan 09 2016 00:38
CamperBot
@camperbot
Jan 09 2016 00:38
emerson093 sends brownie points to @deadmano :sparkles: :thumbsup: :sparkles:
Nicole F.
@gitasong
Jan 09 2016 00:38
@SarahMarie73 I'm pretty much at that one; we can work through it together, if you like. :)
greg
@wearenotgroot
Jan 09 2016 00:38
@SarahMarie73 post what you have so far
Phillip Stolić
Jan 09 2016 00:38
@gitasong @SarahMarie73 if either of you need help, standing by with @wearenotgroot and whoever else is active! :D
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:38
// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
lookup = {

"bravo":result = "Boston",

"charlie":result = "Chicago",

"delta":result = "Denver",

"echo":result = "Easy",

"foxtrot":result = "Frank"
};

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

// Change this value to test
phoneticLookup("charlie");
Edward Danilyuk
@EdwardGoomba
Jan 09 2016 00:39
@Deadmano well it starts with var result = ""; then code below the comment line? do i then redefine result with my string?
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:39
I started with 'var lookup'
Phillip Stolić
Jan 09 2016 00:39
@SarahMarie73 first off, you're not assigning the property for each object correctly.
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:39
I'm not sure how to assign them...I've tried everything
Phillip Stolić
Jan 09 2016 00:39
@SarahMarie73 usually a JS object will have the lock and key method. property: "value" or "property": "value".
Does that make sense? :)
So try removing the assigning result variable there, it won't work and only cause errors.
result = this.
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:41
I tried that already before and it was no go...which is why i added the result =
Nicole F.
@gitasong
Jan 09 2016 00:41
@Deadmano I think I'll be fine; I was just offering to pair program with @SarahMarie73 , if she wants. :)
Phillip Stolić
Jan 09 2016 00:41
@SarahMarie73 let's go through it slowly. :) Paste your updated code when it is done.
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:41
// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {

bravo:"Boston",

charlie:"Chicago",

delta: "Denver",

echo:"Easy",

foxtrot:"Frank"
};

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

// Change this value to test
phoneticLookup("charlie");
Phillip Stolić
Jan 09 2016 00:41
@EdwardGoomba you must start from where it says "only change code...".
@SarahMarie73 that is looking better, well done! :) Now, look at the last line...
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:42
ok\
Phillip Stolić
Jan 09 2016 00:42
@SarahMarie73 phoneticLookup is a function. You are passing a parameter to it, do you understand that?
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:42
sort of...the whole concept of passing parameters is still a bit confusing to me
Phillip Stolić
Jan 09 2016 00:42
OK. Look at line 2.
greg
@wearenotgroot
Jan 09 2016 00:42
@SarahMarie73 here some reading materials http://www.w3schools.com/js/js_arrays.asp
Emerson Silva
@Emerson093
Jan 09 2016 00:42
Phillip Stolić
Jan 09 2016 00:43
phoneticLookup is the name of the function, yes?
Anything in the brackets are parameters, separated by a comma. They can be any name, they are a placeholder variable.
Does that make sense, @SarahMarie73?
Edward Danilyuk
@EdwardGoomba
Jan 09 2016 00:44
@Deadmano would i redefine result since it is an empty string right now?
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:44
yes
Nicole F.
@gitasong
Jan 09 2016 00:44
Nope; I'm stuck also. Where does val come in in the new object?
Jeremy Blanchard
@jlblanch
Jan 09 2016 00:44
@SarahMarie73 one other thing.. the key alpha is a string, therefore needs to be in quotations
Phillip Stolić
Jan 09 2016 00:44
@EdwardGoomba it has to stay the same, see the above example code for the same exercise. :)
Nicole F.
@gitasong
Jan 09 2016 00:44
Phillip Stolić
Jan 09 2016 00:45
@SarahMarie73 awesome, so now look at what you passed to phoneticLookup. You passed "charlie"... What is holding it? What is the parameter name given to our function?
greg
@wearenotgroot
Jan 09 2016 00:45
@EdwardGoomba later you should figure out how to get the value you are after from lookup
Phillip Stolić
Jan 09 2016 00:45
@jlblanch was getting to that, hahaha. Thanks. :)
CamperBot
@camperbot
Jan 09 2016 00:45
deadmano sends brownie points to @jlblanch :sparkles: :thumbsup: :sparkles:
:star: 266 | @jlblanch | http://www.freecodecamp.com/jlblanch
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:45
Jeremy Blanchard
@jlblanch
Jan 09 2016 00:45
:+1:
Phillip Stolić
Jan 09 2016 00:46
@SarahMarie73 no no, what variable is your search query being temporarily stored in? When passed to the function?
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:46
Phillip Stolić
Jan 09 2016 00:46
The function only has one parameter (variable)... ;)
Every parameter is also a variable in its function.
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:46
val
Phillip Stolić
Jan 09 2016 00:46
CORRECT!
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:47
ok
Phillip Stolić
Jan 09 2016 00:47
So before we move on, as @jlblanch reminded us. You need to fix each property to have quotes, as they are strings. :)
So "alpha" etc. When you're done re-post your code.
You were converting from the switch statement, so everything when it came to the data had to remain untouched.
greg
@wearenotgroot
Jan 09 2016 00:48
phoneticLookup("charlie"); ---> phoneticLooup(val) --> val equal the key --> lookup contains the value pair with the key
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:48
// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {

"bravo": "Boston",

"charlie": "Chicago",

"delta": "Denver",

"echo": "Easy",

"foxtrot": "Frank"
};

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

// Change this value to test
phoneticLookup("charlie");
Phillip Stolić
Jan 09 2016 00:48
That looks great!
Jeremy Blanchard
@jlblanch
Jan 09 2016 00:48
wonderful!
Phillip Stolić
Jan 09 2016 00:48
So now, we need to somehow set result to contain the right information for our lookup...
Do you know how we could do that, @SarahMarie73 ?
@SarahMarie73 look at the 3rd line, you already initialized the result variable... How can we edit an existing variable?
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:50
var lookup = result
?
Im so confused
Phillip Stolić
Jan 09 2016 00:50
Almost! But you want to edit the result variable.
I will go over everything again to make it clearer. ^^ But you're close!
So look at return result we are telling our function to give us the result of what we put into it, yes?
But we have nothing in result yet... That is why we need to put something into it...
Nicole F.
@gitasong
Jan 09 2016 00:52
@Deadmano : We want to use the parameters in the object to access the values, correct? So why doesn't something like return lookup.val work?
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:52
I don't remember how to do that
Phillip Stolić
Jan 09 2016 00:52
So we need to edit the result variable... Don't usevar as we already initialized it. Instead call it directly...
result = lookup
@gitasong because there is no val property.
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:52
// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {

"bravo": "Boston",

"charlie": "Chicago",

"delta": "Denver",

"echo": "Easy",

"foxtrot": "Frank"
};

// Only change code above this line
return result;
}
result =  lookup;
// Change this value to test
phoneticLookup("charlie");
aellig
@aellig
Jan 09 2016 00:52
so close...
Phillip Stolić
Jan 09 2016 00:53
@SarahMarie73 so you had it... result = lookup right?
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:53
This message was deleted
Phillip Stolić
Jan 09 2016 00:53
But there is one more thing we need to pass to our LOOKUP... What is that?
What is the little secret that holds our answer? ;)
You said it earlier. We spoke about parameters.
Nicole F.
@gitasong
Jan 09 2016 00:53
So, @Deadmano , what is the relationship between the val parameter in the phoneticLookup function and the lookup object?
Phillip Stolić
Jan 09 2016 00:54
@gitasong we are getting there, pay attention with the next post. :D
greg
@wearenotgroot
Jan 09 2016 00:54
drum rolls
Nicole F.
@gitasong
Jan 09 2016 00:54
(This is the part that always gets me—the unstated, implicit relationship between parameter and argument.)
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:54
I am so stumped I have no idea
Phillip Stolić
Jan 09 2016 00:54
Remember our friend val?
Nicole F.
@gitasong
Jan 09 2016 00:54
It's got to be result = lookup.val, yes?
aellig
@aellig
Jan 09 2016 00:54
in your code "charlie" at the bottom is the same as what?
Phillip Stolić
Jan 09 2016 00:55
Who stores the info we put into it with our query?
@gitasong almost!
Nicole F.
@gitasong
Jan 09 2016 00:55
sigh
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:55
i tried result = lookup(val);
Phillip Stolić
Jan 09 2016 00:55
The problem is, val is not a property of lookup.
How does one access an array?
Jeremy Blanchard
@jlblanch
Jan 09 2016 00:55
@SarahMarie73
Phillip Stolić
Jan 09 2016 00:55
You are SO CLOSE @SarahMarie73!
Edward Danilyuk
@EdwardGoomba
Jan 09 2016 00:55
@Deadmano i finally got it they just wanted to add the new info to result
Brian Giles
@briangiles
Jan 09 2016 00:55

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

function queue(arr, item) {

myArr.shift(arr);
myArr.push(item); // Change this line
}

// Display Code
console.log("Before: " + JSON.stringify(myArr));
console.log(queue(myArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(myArr));

I’m I going down the right path? here.

Jeremy Blanchard
@jlblanch
Jan 09 2016 00:55
@SarahMarie73 very close
Brian Giles
@briangiles
Jan 09 2016 00:55
Am I*
Nicole F.
@gitasong
Jan 09 2016 00:56
Right. But it is the parameter that corresponds to the input, @Deadmano .
greg
@wearenotgroot
Jan 09 2016 00:56
@briangiles yes
Phillip Stolić
Jan 09 2016 00:56
@briangiles read the description. ;) Push first.
Brian Giles
@briangiles
Jan 09 2016 00:56
Gotcha
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:56
// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {

"bravo": "Boston",

"charlie": "Chicago",

"delta": "Denver",

"echo": "Easy",

"foxtrot": "Frank"
};
result = lookup[0];
// Only change code above this line
return result;
}

// Change this value to test
phoneticLookup("charlie");
Phillip Stolić
Jan 09 2016 00:56
@gitasong that's right, yes, but we need to pass that parameter to result... How?
greg
@wearenotgroot
Jan 09 2016 00:56
@briangiles you need to return something
Nicole F.
@gitasong
Jan 09 2016 00:56
I don't get how to secure the connection between the two, other than what I suggested, @Deadmano . Unless—bracket notation?
Without quotes?
Phillip Stolić
Jan 09 2016 00:56
@SarahMarie73 almost, though 0 doesn't hold the info. What var does? ;)
@gitasong I don't want to ruin the answer, hence trying to make you guys solve it. ;)
Nicole F.
@gitasong
Jan 09 2016 00:57
result = lookup[val]?
Phillip Stolić
Jan 09 2016 00:57
Try and see. ;)
Nicole F.
@gitasong
Jan 09 2016 00:57
I understand.
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:57
omg
finally
Phillip Stolić
Jan 09 2016 00:57
:D
aellig
@aellig
Jan 09 2016 00:57
[val]
Jeremy Blanchard
@jlblanch
Jan 09 2016 00:57
:clap:
Edward Danilyuk
@EdwardGoomba
Jan 09 2016 00:57
greg
@wearenotgroot
Jan 09 2016 00:57
:clap:
Phillip Stolić
Jan 09 2016 00:57
Now I will add you both to a private room to explain. :)
Brian Giles
@briangiles
Jan 09 2016 00:57
@wearenotgroot ok, let me do that.
Phillip Stolić
Jan 09 2016 00:57
@EdwardGoomba indeed, but give many hints and motivation. :P
Sarah Schlueter
@SarahMarie73
Jan 09 2016 00:57
Phillip Stolić
Jan 09 2016 00:58
@gitasong do you want an explanation as well? :)
greg
@wearenotgroot
Jan 09 2016 00:58
@briangiles also look at the function parameters
Nicole F.
@gitasong
Jan 09 2016 00:58
Oh! That passed! Yes, @Deadmano —I'd like an explanation. But I think I sort of have it.
At least, intuitively, if I can't explain it verbally.
Phillip Stolić
Jan 09 2016 00:59
@gitasong well done! :)
Nicole F.
@gitasong
Jan 09 2016 00:59
The issue is that we need to be able to access any parameter in the object, not just a specific one. So we need to refer to it as a variable.
greg
@wearenotgroot
Jan 09 2016 00:59
@SarahMarie73 here read up a bit more on arrays and objects http://www.w3schools.com/js/js_arrays.asp
Phillip Stolić
Jan 09 2016 01:00
@gitasong a parameter IS a variable. ;)
Sarah Schlueter
@SarahMarie73
Jan 09 2016 01:00
CamperBot
@camperbot
Jan 09 2016 01:00
sarahmarie73 sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star: 307 | @wearenotgroot | http://www.freecodecamp.com/wearenotgroot
greg
@wearenotgroot
Jan 09 2016 01:00
@SarahMarie73 :)
Phillip Stolić
Jan 09 2016 01:00
But a parameter is part of a function, so the variable is only accessible WITHIN the function hence why we need to return the value outside of it.
aellig
@aellig
Jan 09 2016 01:00
anyone know how to use .map to change arrays?
Phillip Stolić
Jan 09 2016 01:00
@SarahMarie73 check your PM, tabs on the left. ;)
aellig
@aellig
Jan 09 2016 01:00
var oldArray = [1,2,3,4,5];
var newArray = [];

// Only change code below this line.

newArray = oldArray;

var timesFour =
oldArray.map(function(val){

return (val + 3);

});
Nicole F.
@gitasong
Jan 09 2016 01:01
Hmmm... Sorry; I meant any property in the object. The keys in the key-value pairs.
So we need a variable that refers to all of them. @Deadmano , @SarahMarie73 .
Phillip Stolić
Jan 09 2016 01:02
@gitasong you are thinking of accessing them such as Object.property which would have been right with dot notation, but in this case we had to use yet another step to get our variable.
Nicole F.
@gitasong
Jan 09 2016 01:02
Right; exactly.
Phillip Stolić
Jan 09 2016 01:02
So think of the [val] as being that .property.
DevPoetsSociety
@DevPoetsSociety
Jan 09 2016 01:02
Anyone manage to fix an infinite loop?
Nicole F.
@gitasong
Jan 09 2016 01:03
And the only variable that's connected to properties here is val.
Phillip Stolić
Jan 09 2016 01:03
Except it is NOT a property of our lookup function.
Nicole F.
@gitasong
Jan 09 2016 01:03
Right. So how does it get connected? Implicitly, as an algorithm to the overall function?
(This part is terribly confusing.)
greg
@wearenotgroot
Jan 09 2016 01:03

@DevPoetsSociety

while(true)
{
break;
}

you mean like this?

Nicole F.
@gitasong
Jan 09 2016 01:03
DevPoetsSociety
@DevPoetsSociety
Jan 09 2016 01:04
@wearenotgroot Yeah, only I can't access the project page because of it...
Phillip Stolić
Jan 09 2016 01:05
@gitasong yes, if I am understanding you correctly? As all that is part of the same function.
Nicole F.
@gitasong
Jan 09 2016 01:05
Or rather, the properties of the object are the algorithms to the parameter of the overall function. That's how they're connected, @Deadmano , @SarahMarie73 .
Phillip Stolić
Jan 09 2016 01:05
Don't get confused by the object you created called lookup. It has nothing to do with anything, other than to hold data.
You needed to pass it a value and it needed to search its "database" to return a value.
Nicole F.
@gitasong
Jan 09 2016 01:05
It's just confusing how the properties are connected to the variable through a third, completely unrelated statement. It's so unlike math. :p @Deadmano
Okay...
Phillip Stolić
Jan 09 2016 01:06
@gitasong yes, a terrible example, I would never code like that. :P But this is what they required.
greg
@wearenotgroot
Jan 09 2016 01:06
@DevPoetsSociety can you access the debugger?
Nicole F.
@gitasong
Jan 09 2016 01:06
I'm gonna get on @SaintPeter about some of these Waypoints... ;)
He's a dear, and super-smart, but he needs some advising in the didactic department. :)
How would you write the Waypoint to be clearer, @Deadmano ?
DevPoetsSociety
@DevPoetsSociety
Jan 09 2016 01:07
@wearenotgroot You mean my browser's debugger? Probably, but I don't think that'll fix the page
I'll try it
greg
@wearenotgroot
Jan 09 2016 01:08
@DevPoetsSociety can't you just kill the page?
Phillip Stolić
Jan 09 2016 01:08
@gitasong in all honesty I am not in the best mindset to answer, it is 3am my side. :P But it does work, and a good example of getting you to think and using parameters to enhance objects. ;)
Nicole F.
@gitasong
Jan 09 2016 01:08
Oh. Okay. Maybe when you're fresher, then. :)
Brian Giles
@briangiles
Jan 09 2016 01:09
// Setup
var myArr = [1,2,3,4,5];

function queue(arr, item) {
myArr.push(item);
myArr.shift(arr);
return item;  // Change this line
}
Ok, I’m kind of lost at what to do next
DevPoetsSociety
@DevPoetsSociety
Jan 09 2016 01:09
@wearenotgroot I want to finish the challenge
Manish Giri
@Manish-Giri
Jan 09 2016 01:10
@briangiles first note that you're passed in an array called arr, you have to use that
greg
@wearenotgroot
Jan 09 2016 01:10
@DevPoetsSociety welp if you cant access the page. wont help :)
Nicole F.
@gitasong
Jan 09 2016 01:10
But basically, this more or less answers the question that I was banging my head against a wall about last night, @Deadmano : Why use a variable to access a property in an object? Why the extra step? Why can't you simply do object.value = property or object["value] = property? Answer: Because objects don't work that way!
Manish Giri
@Manish-Giri
Jan 09 2016 01:10
@briangiles so, modify your push to be arr.push(item) and instead of the next line, you can directly modify the last line(return item) to be return arr.shift();
greg
@wearenotgroot
Jan 09 2016 01:10
@DevPoetsSociety try and open a new tab then shift + ESC and find kill the page if you want to
Phillip Stolić
Jan 09 2016 01:11
@gitasong because then it is static and NOT dynamic. If you give it a FIXED value, how is it supposed to change based on what you input to the function?
Brian Giles
@briangiles
Jan 09 2016 01:11
@Manish-Giri hmmmm
DevPoetsSociety
@DevPoetsSociety
Jan 09 2016 01:12
@wearenotgroot Yah, Safari will kill the page after three tries. I just want to reset so I can complete it.
Phillip Stolić
Jan 09 2016 01:12
Usually when you set a property to an object it is static. Unless we start using this.property = property in which case, a whole other story. But we're not.
Nicole F.
@gitasong
Jan 09 2016 01:12
Yes, exactly, @Deadmano . You can access an object's value through its property, if you know the exact property name, but what if you don't? or what if you have to access a whole bunch of values, or have to access a property?
greg
@wearenotgroot
Jan 09 2016 01:13
@DevPoetsSociety tricky
Nicole F.
@gitasong
Jan 09 2016 01:13
Answer: You need a variable to stand in for the properties or the values, depending on what you're starting with. :) @Deadmano
Phillip Stolić
Jan 09 2016 01:13
@gitasong well, sure, but this is how it was designed to show you how powerful functions can be. Also, how are you going to access lookup outside of the function? ;)
That's what you're missing. :P
Nicole F.
@gitasong
Jan 09 2016 01:14
No idea. I'm not there yet. :)
Phillip Stolić
Jan 09 2016 01:14
You can't.
Nicole F.
@gitasong
Jan 09 2016 01:14
I'm just at the basics of learning how to access parts of an object.
Phillip Stolić
Jan 09 2016 01:14
Anything inside a function STAYS inside a function.
You can't access the data within.
Not unless you use methods such as return.
Hence why we needed to return the value of result.
Nicole F.
@gitasong
Jan 09 2016 01:15
Right. Ahhh—hence the need for vairables, that can be accessed outisde a function. :)
Phillip Stolić
Jan 09 2016 01:15
YES!
// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {
"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");
Nicole F.
@gitasong
Jan 09 2016 01:15
(Sorry; sloppy typing. My computer's old and slow.)
Phillip Stolić
Jan 09 2016 01:15
Look at the top and bottom parentheses.
Jeremy Blanchard
@jlblanch
Jan 09 2016 01:16
@briangiles you are sending the array and the item to push to the array into the function. When you use arr.shift() , it automatically removes the first item in the array and returns its value
greg
@wearenotgroot
Jan 09 2016 01:16
@gitasong is it so old it's lastname is asaurous?
Phillip Stolić
Jan 09 2016 01:16
You will see everything is part of the same function. It is locked up. We access it from the outside using phoneticLookup to call the function and we pass the parameter value "charlie" which then gets looked up in our Object and the result finally passed back to the variable result.
Nicole F.
@gitasong
Jan 09 2016 01:16
Yep—they map to one another, @Deadmano .
Jan 09 2016 01:16
How resolve the Waypoint: Create a Form Element?
Nicole F.
@gitasong
Jan 09 2016 01:17
Yes, exactly, @wearenotgroot !
YI JIANG
@jennytech
Jan 09 2016 01:17

// Setup
var testObj = {
"hat": "ballcap",
"shirt": "jersey",
"shoes": "cleats"
};

// Only change code below this line

var hatValue = "ballcap"; // Change this line
var shirtValue = "jersey"; // Change this line

Phillip Stolić
Jan 09 2016 01:17
So hopefully that nulls any confusion? I am sure I would explain better if I had just woken up or it weren't 3AM. :P Sorry for any extra confusion!
YI JIANG
@jennytech
Jan 09 2016 01:17
it say I should use dot notation twice
I used twice
Phillip Stolić
Jan 09 2016 01:17
@jennytech you're manually setting the values...
Nicole F.
@gitasong
Jan 09 2016 01:17
But I'm grateful to have it since my computer died several months ago, @wearenotgroot . :)
Phillip Stolić
Jan 09 2016 01:17
@jennytech how will you get the same values, but using dot notation?
YI JIANG
@jennytech
Jan 09 2016 01:17
did I use twice?
Phillip Stolić
Jan 09 2016 01:18
@jennytech look at your object, testObj it has properties... To access an object you would usually do object.Property.
Jan 09 2016 01:18

Idk what I am doing wrong, can anyone help? function myTest(val) {
// Only change code below this line
switch (val) {
case a:
break;
case b:
break;
case c:
break;

default:

}

// Only change code above this line
}

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

Nicole F.
@gitasong
Jan 09 2016 01:18
You were great, @Deadmano . You're going to go down on my list of patient, clear helpers. But I still have to puzzle this out more. FCC jumps too easily over the basics and starts throwing hard stuff at us without working up to it.
greg
@wearenotgroot
Jan 09 2016 01:18
@gitasong 01010010 01001001 01010000
Phillip Stolić
Jan 09 2016 01:18
@gitasong awww, that's very sweet, thanks! If you ever need help I am only a PM away.
CamperBot
@camperbot
Jan 09 2016 01:18
deadmano sends brownie points to @gitasong :sparkles: :thumbsup: :sparkles:
:star: 299 | @gitasong | http://www.freecodecamp.com/gitasong
Jeremy Blanchard
@jlblanch
Jan 09 2016 01:19
scottmike0
@scottmike0
Jan 09 2016 01:19
YI JIANG
@jennytech
Jan 09 2016 01:19

// Setup
var testObj = {
"hat": "ballcap",
"shirt": "jersey",
"shoes": "cleats"
};

// Only change code below this line

var hatValue = "ballcap"; // Change this line
testObj.hat;
var shirtValue = "jersey"; // Change this line
testObj.shirt;

Phillip Stolić
Jan 09 2016 01:19
@jennytech good! But you now duplicated it all, haha!! Remove the values that you set. ;)
var hatValue = has to be equal to its value using what you just discovered.
Nicole F.
@gitasong
Jan 09 2016 01:19
LOL @wearenotgroot 0010001111000 001100011 !!! ;)
Jan 09 2016 01:20
I refreshed and nothing, I'm not sure which statement
Jeremy Blanchard
@jlblanch
Jan 09 2016 01:20
@TGHeadle1371 look at your other case statements, what is missing from default?
scottmike0
@scottmike0
Jan 09 2016 01:20
Jan 09 2016 01:21
the break;
scottmike0
@scottmike0
Jan 09 2016 01:21
@jlblanch you dont add break for default:
Nicole F.
@gitasong
Jan 09 2016 01:21
@Deadmano Gonna open up a PM and stick you in it, for later. :) But I have to say, there are a lot of intermediate steps between just having introduced objects, and then using them in functions and accessing them through variables. That's something like 8 chapters later in the awesome JS/JQuery books with all the diagrams. :)
scottmike0
@scottmike0
Jan 09 2016 01:22
@TGHeadle1371 is using the wrong variable for the switch and therfore not getting it returned
Phillip Stolić
Jan 09 2016 01:22
@gitasong agreed. If I had to take a guess as to what the problem is, it is due to most of these being written from the point of someone who has mastered Javascript, so skipping out steps which beginners may think is basic happens.
Nicole F.
@gitasong
Jan 09 2016 01:22
Well, exactly.
Believe, me, I'm on them for this. I've got the ear of @SaintPeter . ;)
Phillip Stolić
Jan 09 2016 01:23
That's always a good thing, can really help! As otherwise it is quite the deep end, trust me, I was there too...
Brian Giles
@briangiles
Jan 09 2016 01:24
// Setup
var myArr = [1,2,3,4,5];

function queue(arr, item) {
arr.push(item);
return arr.shift();  // Change this line
}

// Display Code
console.log("Before: " + JSON.stringify(myArr));
console.log(queue(myArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(myArr));
Ok, so now what do I just need to write the funcion to be executed?
queue([2], 1)
;
queue([2], 1);
Nicole F.
@gitasong
Jan 09 2016 01:24
Yep, @Deadmano —I totally get you. I try to help out the newbies as much as possible. And believe me, I'm patient and know how to explain things. :)
scottmike0
@scottmike0
Jan 09 2016 01:24

case "a":
break;
case "b":
break;
case "c":
break;

default:
}

Phillip Stolić
Jan 09 2016 01:25
@gitasong I hope I gave a decent go at it, hahaha! Trust me, I am way better when rested. ;) But I can't deny help no matter my fatigue level.
Jan 09 2016 01:25
@scottmike0 Can't believe I missed that
Phillip Stolić
Jan 09 2016 01:26
@briangiles the code is already being executed.
scottmike0
@scottmike0
Jan 09 2016 01:26
@TGHeadle1371 did ya figure out what you were missing?
Jan 09 2016 01:26
just ""
scottmike0
@scottmike0
Jan 09 2016 01:26
@TGHeadle1371 ah good, i did not see it until you said it :D
Manish Giri
@Manish-Giri
Jan 09 2016 01:26
@briangiles did you click on "run tests"
Nicole F.
@gitasong
Jan 09 2016 01:26
I hear you on that, @Deadmano ! But you really should get some sleep soon. Believe me, it'll catch up with you. If not now, then when you're older (ask me how I know :p ).
Phillip Stolić
Jan 09 2016 01:27
@gitasong 10 years like this. I worked 5 years as head of IT. This is nothing new to me. I wake up anywhere between 10am and 4PM. :P
scottmike0
@scottmike0
Jan 09 2016 01:28
@Deadmano sounds like me when i am on winter break and summer break o.o
Phillip Stolić
Jan 09 2016 01:28
@briangiles you are missing a step though... Did it not ask you to remove something? ;)
Nicole F.
@gitasong
Jan 09 2016 01:28
Oy. Well, wait until you're in your 40s (if a woman) or 50s/60s (if male), @Deadmano .
It catches up with a vengeance then!
Phillip Stolić
Jan 09 2016 01:28
@gitasong am I going to be constantly exhausted with chronic fatigue? If so, I already have that. :(
No matter how much I sleep; always tired. Though somewhat Apnea related/allergies.
Brian Giles
@briangiles
Jan 09 2016 01:29
@Manish-Giri Yes. this is what outputs to the console.
RangeError: Maximum call stack size exceeded
Phillip Stolić
Jan 09 2016 01:29
Nicole F.
@gitasong
Jan 09 2016 01:29
Yep—but it gets worse, too. If you're still vertical and ambulatory, believe me, it can get much, much worse, @Deadmano .
You don't want to go there; trust me.
Anyhoo, now I'm going to head back to that earlier Waypoint that I skipped—the one about accessing the properties of an object with a variable. Now it makes sense, more or less, LOL! @Deadmano
Phillip Stolić
Jan 09 2016 01:30
@gitasong luckily for you (and me!) I have made myself a New Year's resolution to head to bed at 11PM latest, starting errrr, sometime soon... Haha. I PROMISE! So I can get back into waking my usual 7am. :)
@SaintPeter
Jan 09 2016 01:30
@gitasong LOL
Nicole F.
@gitasong
Jan 09 2016 01:31
I'm poking you, @SaintPeter . ;)
Brian Giles
@briangiles
Jan 09 2016 01:31
@Deadmano thanks! that cleared it. @Manish-Giri Thanks!
CamperBot
@camperbot
Jan 09 2016 01:31
briangiles sends brownie points to @deadmano and @manish-giri :sparkles: :thumbsup: :sparkles:
@SaintPeter
Jan 09 2016 01:31
@gitasong Wait, is this like, as in you're dragging me around by my ear?
CamperBot
@camperbot
Jan 09 2016 01:31
:star: 581 | @manish-giri | http://www.freecodecamp.com/manish-giri
@SaintPeter
Jan 09 2016 01:31
@gitasong I noticed.
Brian Giles
@briangiles
Jan 09 2016 01:31
@Deadmano What’s going on with that?
Nicole F.
@gitasong
Jan 09 2016 01:31
I'll be on your case until doomsday. ;)
SaintPeter @SaintPeter makes a squeeking noise
Phillip Stolić
Jan 09 2016 01:31
It all helps if you have structure in your life. I work for myself now, handle clients in my own time, so that freedom can get carried away. Before I was forced to 8am-8pm hours. ;) With 24H stand-by.
Nicole F.
@gitasong
Jan 09 2016 01:31
LOL!
@SaintPeter
Jan 09 2016 01:31
@gitasong Your well reasoned and clearly explained issues will continue to be the highlight of my day then . . .
Phillip Stolić
Jan 09 2016 01:31
@briangiles you're welcome, take care and keep well! :)
Nicole F.
@gitasong
Jan 09 2016 01:31
Totally, @Deadmano . That's what I'm working on, too (both sleep and structure/self-employment). :)
Good, good, @SaintPeter ! I've got your work cut out for you, then. ;)
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:32
// Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {

myObj.hasOwnProperty([]);

return checkProp;
}

// Test your code by modifying these values
Any help here?
@SaintPeter
Jan 09 2016 01:32
@gitasong Or, as I am font of saying: Don' thraw me in dat brair patch
Phillip Stolić
Jan 09 2016 01:32
@gitasong I think we're doing a great job, so far! And if coding teaches us anything it is how important the (little things) structure is! :P That and cAsE-senSitiVity.
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:32
Oh hey @gitasong , @SaintPeter
Nicole F.
@gitasong
Jan 09 2016 01:32
Yep!
SaintPeter @SaintPeter waves
Nicole F.
@gitasong
Jan 09 2016 01:32
Hey, @ricsanm ! Nice little reunion here! :)
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:33
LOL again. Only cuken missing.
Nicole F.
@gitasong
Jan 09 2016 01:33
@SaintPeter How do you do the purple text thing?
Right!!
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:33
gita, can you check my code please?
Phillip Stolić
Jan 09 2016 01:33
@ricsanm your first myObj.hasOwnProperty what are you trying to pass there? ;)
Nicole F.
@gitasong
Jan 09 2016 01:33
Oh, and what-his-name? @gitPhunky . His book recommendation was awesome, btw.
I can try, @ricsanm .
@SaintPeter
Jan 09 2016 01:33
@gitasong Do /me does a thing
SaintPeter @SaintPeter does a thing
SaintPeter Look, I can do purple text without my name!
Nicole F.
@gitasong
Jan 09 2016 01:34
Wait so—
Phillip Stolić
Jan 09 2016 01:34
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:34
Phillip Stolić
Jan 09 2016 01:34
*parameter
Nicole F.
@gitasong
Jan 09 2016 01:34
Ah!! Looky!
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:34
LOL
Nicole F.
@gitasong
Jan 09 2016 01:34
How you do dat latter, @SaintPeter ?
Phillip Stolić
Jan 09 2016 01:35
@ricsanm function checkObj(checkProp) { what is the parameter name? :)
Nicole F.
@gitasong
Jan 09 2016 01:35
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:35
I dont know >_< the example only gets me so far.
@SaintPeter
Jan 09 2016 01:35
@gitasong Make a /me comment, then edit it and remove your name ;)
Nicole F.
@gitasong
Jan 09 2016 01:35
Ohhh!! Okey.
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:35
Right?
Phillip Stolić
Jan 09 2016 01:35
Right!!! :D
gitasong does as told, then deletes the evidence.
Phillip Stolić
Jan 09 2016 01:36
So then... myObj.hasOwnProperty([]); what do we pass to check? :)
@SaintPeter
Jan 09 2016 01:36
I am also magic because I can give brownies to @gitasong $\phantom{thanks}$
CamperBot
@camperbot
Jan 09 2016 01:36
saintpeter sends brownie points to @gitasong :sparkles: :thumbsup: :sparkles:
:star: 300 | @gitasong | http://www.freecodecamp.com/gitasong
Nicole F.
@gitasong
Jan 09 2016 01:36
Aw, no fair! ;)
(But I like brownie points! ;) )
(Can you give brownies, too, @SaintPeter ? ;) )
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:36
myObj.hasOwnProperty([checkProp])?
@SaintPeter
Jan 09 2016 01:37
@gitasong Haha, you must know the magic codes
Phillip Stolić
Jan 09 2016 01:37
@ricsanm sure, but why the brackets? :P
Nicole F.
@gitasong
Jan 09 2016 01:37
CamperBot
@camperbot
Jan 09 2016 01:37
gitasong sends brownie points to @deadmano :sparkles: :thumbsup: :sparkles:
Nicole F.
@gitasong
Jan 09 2016 01:37
Tell me, tell me! /me rubs hands excitedly.
Oops—it didn't work that time. :p
Phillip Stolić
Jan 09 2016 01:37
hasOwnProperty()<--- value.
Nicole F.
@gitasong
Jan 09 2016 01:38
Because it was part of a sentence?
Phillip Stolić
Jan 09 2016 01:38
Thou shalt never know.
@SaintPeter
Jan 09 2016 01:38
@gitasong You can't even believe what I had to go through to get the secret. I'm going to hold it in trust until you're particularly awesome.
Nicole F.
@gitasong
Jan 09 2016 01:38
You talkin' to me, @Deadmano ? Those're fighting words! ;)
gitasong @gitasong harrumphs out of the room.
Phillip Stolić
Jan 09 2016 01:39
@SaintPeter after today, @gitasong is certainly somewhat more awesome. ;)
Nicole F.
@gitasong
Jan 09 2016 01:39
LOL.
Phillip Stolić
Jan 09 2016 01:39
@ricsanm where'd you run off to?! :P
Nicole F.
@gitasong
Jan 09 2016 01:39
A few brownie points, give or take. ;)
Phillip Stolić
Jan 09 2016 01:40
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"); // false

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".
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:40
@Deadmano I'm here, trying to figure it out. Maybe my return is wrong too?
Oh wow, that's nice. Let me read it,
Phillip Stolić
Jan 09 2016 01:40
So @ricsanm you should have done the first part now, to check the property.
Nicole F.
@gitasong
Jan 09 2016 01:40
So anyhoo, @SaintPeter , I need to chew your ear off about something—although after my little discussion with @Deadmano here, there will be less ear chewed off than if you had showed up earlier. ;)
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:41
// Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {

myObj.hasOwnProperty(checkProp);

return checkProp;
}

// Test your code by modifying these values
@SaintPeter
Jan 09 2016 01:41
@gitasong Heh
Nicole F.
@gitasong
Jan 09 2016 01:41
;)
Phillip Stolić
Jan 09 2016 01:41
You're not done just yet, @ricsanm.
If the property is found, return that property's value.
Let's work on that.
Sounds like we need to do some if work don't you think? ;)
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:42
I was about to type a switch haha
But idk how to go on about that
So lets try with If then
Phillip Stolić
Jan 09 2016 01:42
Below what you have...
Let's make an if statement.
if (whatDoWePutHere?) {
Look at what they are asking. :)
We usually want to check for false statement first. If all is clear, we proceed to the truth...
We know that hasOwnProperty() will return a true or false value, yes?
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:44
// Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {

myObj.hasOwnProperty(checkProp);

return checkProp;
}

// Test your code by modifying these values
Fail HAHAHAHA
Phillip Stolić
Jan 09 2016 01:44
OK, first off, you are assigning a value with =.
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:44
Oh right
Its ==
or ===
Phillip Stolić
Jan 09 2016 01:45
Do you remember the correct equals operator?
Yes. :)
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:45
In this case it's ===
Phillip Stolić
Jan 09 2016 01:45
Correct!
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:45
Because it has to be exactly false
Phillip Stolić
Jan 09 2016 01:45
Well done!
But we now have an issue.
myObj.hasOwnProperty there is no parameter being passed, is there?
Look at your code directly above. :)
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:47
// Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {

myObj.hasOwnProperty(checkProp);

return checkProp;
}

else if (myObj.hasOwnProperty() === true) {return checkProp;}

// Test your code by modifying these values
AgoraCoder
@AgoraCoder
Jan 09 2016 01:47
Do I just jump in and ask for help??
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:47
Or... Something along the lines
Yep @AgoraCoder
Phillip Stolić
Jan 09 2016 01:47
@ricsanm you already have your return above, no need for the else if. ;)
@AgoraCoder go for it!
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:47
Oh
Phillip Stolić
Jan 09 2016 01:48
@ricsanm both work, though you may way to do the false first, and by default if the if is not true it will execute anything outside of it.
@ricsanm and once again you're missing the parameter being passed to hasownProperty(). See your first line of code you did. :P
Otherwise you are not checking any property of myObj.
AgoraCoder
@AgoraCoder
Jan 09 2016 01:49
For the Javascript checkpoint "Stand in Line", I have no idea how to approach it... I tried using push and shift, but that didn't work.
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:49

myObj.hasOwnProperty(checkProp);

return checkProp;
}

if (myObj.hasOwnProperty(checkProp) === true) {return checkProp;}

// Test your code by modifying these values
Phillip Stolić
Jan 09 2016 01:49
@AgoraCoder both are correct and required. Mind posting your code?
AgoraCoder
@AgoraCoder
Jan 09 2016 01:50
Do you guys have these challenges memorized? or are screencaps preferred?
Phillip Stolić
Jan 09 2016 01:50
@ricsanm look at your first line... You are already checking for a property... If that evaluates to true it will return. ;) Else it moves on...
@AgoraCoder I had helped several people with it today, so yes; you do remember I guess. :P
@ricsanm but remember, without there being an if statement that return will fire nonetheless. How can we fix that?
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:52
@Deadmano I am ashamed to say I dont know, but it's not the first time I've read about jumping returns or something
Phillip Stolić
Jan 09 2016 01:52
@ricsanm don't be! :) We all start somewhere, small steps!
AgoraCoder
@AgoraCoder
Jan 09 2016 01:52
lol. how do I make my screen cap bigger?
Phillip Stolić
Jan 09 2016 01:53
@ricsanm think about your placement. What if you moved that return statement AFTER your if statement? ;)
Jill
@ghjal
Jan 09 2016 01:53
Is there a way to stop an infinite loop so I can fix the code?
Phillip Stolić
Jan 09 2016 01:53
@AgoraCoder firstly, you're trying to return the array "myArr" as is, without any changes...
Secondly, was there no request for removed anywhere? :)
AKA, you need to return the SHIFTED (removed) value.
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:54
Which of the three returns?
Phillip Stolić
Jan 09 2016 01:54
shift() already stores that item. We need to return it.
@ricsanm

myObj.hasOwnProperty(checkProp);

return checkProp; // <--- This one.
}
Ricardo Sanchez
@ricsanm
Jan 09 2016 01:56
// Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {

myObj.hasOwnProperty(checkProp);

}

if (myObj.hasOwnProperty(checkProp) === true) {return checkProp;}

return checkProp;

// Test your code by modifying these values
Phillip Stolić
Jan 09 2016 01:56
@AgoraCoder also think about what you're doing with arr.push(item). That is an action in and of itself, why are you storing it in a variable?

@ricsanm making progress!! :)

if (myObj.hasOwnProperty(checkProp) === true) {return checkProp;}

return checkProp;

All need to be inside of the function to start.

Elliott McNary
@bighitbiker3
Jan 09 2016 01:57
Can anyone give me tips on the Symmetric difference bonfire? I have the array flattened, but can’t figure out how to pull the unique values...
Phillip Stolić
Jan 09 2016 01:57
As in, within the }.
AgoraCoder
@AgoraCoder
Jan 09 2016 01:57
still not working
Phillip Stolić
Jan 09 2016 01:57
Secondly, why the second if statement? As we said, we know if myObj.hasOwnProperty(checkProp); evaluates to true it will perform the return below otherwise we have the false check before.
@AgoraCoder did you see my comment on the push usage? :)
You are trying to modify an array. Not set a new value for it by assigning its variable.
cannelflow
@cannelflow
Jan 09 2016 01:58
@ricsanm use [] method
@ricsanm no need for if
Phillip Stolić
Jan 09 2016 01:59
@cannelflow think of a beginner and how this is easier to understand/interpret. ;)
AgoraCoder
@AgoraCoder
Jan 09 2016 01:59
the example they gave showed the new array, but I see now that the instructions aren't concerned with the new array, just the shifted variable... Got it.
Phillip Stolić
Jan 09 2016 01:59
And if you're going to give a possible answer, at least throw in an example with it.
Jan 09 2016 01:59
cannelflow
@cannelflow
Jan 09 2016 02:00
Jan 09 2016 02:00
Need help with "using objects for Lookups"
Phillip Stolić
Jan 09 2016 02:00
@AgoraCoder exactly!! :) Try again, paste your new code and lets see what happens (if you're still stuck).
@jlinkenauger firstly you declared val twice...
@jlinkenauger secondly, did they not tell you what to call your new object? :)
@ricsanm where are you now? :)
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:02
@Deadmano What do you mean when you say use bracket method instead of if?
Phillip Stolić
Jan 09 2016 02:02
@ricsanm I didn't, hence why you are now confused when other's tell you do try something else without an example. :P
@ricsanm paste your code again. Let's try small steps.
AgoraCoder
@AgoraCoder
Jan 09 2016 02:02
I got it figured out. Thank you.
Phillip Stolić
Jan 09 2016 02:03
@AgoraCoder glad to hear it, and well done!! That was indeed a challenge and you passed it beautifully! :D
@jlinkenauger how are you coming along? :)
AgoraCoder
@AgoraCoder
Jan 09 2016 02:03
How do I give you points? Change tip? Where are my fellow bitcoiners at?
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:03
// Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {

myObj.hasOwnProperty(checkProp);

(myObj.hasOwnProperty(checkProp) === true) {return checkProp;}

return checkProp;
}
// Test your code by modifying these values
Phillip Stolić
Jan 09 2016 02:04
@ricsanm how about we remove (myObj.hasOwnProperty(checkProp) === true) {return checkProp;} as it is not needed due to the first line we wrote down. ;)
Matt Leonard
@matty22
Jan 09 2016 02:04
@AgoraCoder You just say "thanks" and @thatpersonsname
CamperBot
@camperbot
Jan 09 2016 02:04
matty22 sends brownie points to @agoracoder and @thatpersonsname :sparkles: :thumbsup: :sparkles:
:star: 183 | @agoracoder | http://www.freecodecamp.com/agoracoder
:warning: could not find receiver for thatpersonsname
Phillip Stolić
Jan 09 2016 02:04
If myObj.hasOwnProperty(checkProp); works, as in if there is a property we pass to it that exists, it will be true by default. :)
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:04
The problem is, as I was telling @SaintPeter , the jump between holding your hands and just typing delete etc, and having you type a whole equation without previous specific examples on the notation, is not exactly noob-friendly, to word it like that.
Not saying that in a bad way
Just saying there should be some steps in-between
Phillip Stolić
Jan 09 2016 02:05
@ricsanm well I have asked you three times now to think about why you would use that line. ;)
And gave you the reason too.
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:05
Phillip Stolić
Jan 09 2016 02:05
If myObj.hasOwnProperty(checkProp); works, as in if there is a property we pass to it that exists, it will be true by default. :)
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:05
// Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {

myObj.hasOwnProperty(checkProp);

return checkProp;
}
// Test your code by modifying these values
@SaintPeter
Jan 09 2016 02:05
@ricsanm I am discussing this very thing with gitasong as we speak ;)
Phillip Stolić
Jan 09 2016 02:05
Just thought you were getting frustrated and wanted me to move on, haha.
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:06
@SaintPeter That's amazing, sorry if I come across rude, not meaning to at all!
@SaintPeter
Jan 09 2016 02:06
@ricsanm Not at all.
@ricsanm I will be the first to admit my limitations :D
cannelflow
@cannelflow
Jan 09 2016 02:06
@jlinkenauger Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string. so not var val it should be lookup
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:06
@Deadmano Not at all, I'd rather understand everything perfectly.
Phillip Stolić
Jan 09 2016 02:06
@ricsanm awesome!! :) What happens when you try to run that code as is? :)
AgoraCoder
@AgoraCoder
Jan 09 2016 02:06
Chris
@Aoxom
Jan 09 2016 02:06
nono, you are all supposed to get mad and yell at each other! wheres my drama?
CamperBot
@camperbot
Jan 09 2016 02:06
agoracoder sends brownie points to @deadmano :sparkles: :thumbsup: :sparkles:
@SaintPeter
Jan 09 2016 02:06
@ricsanm I think what we have now is better than what we had, but it's still not done.
CamperBot
@camperbot
Jan 09 2016 02:06
YI JIANG
@jennytech
Jan 09 2016 02:06

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var val = {

"bravo":"Boston",

"charlie": "Chicago",

"delta": "Denver",

"echo": "Easy",

"foxtrot":"Frank",

"":undefied

};

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

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

plz help
Waypoint: Using Objects for Lookups
greg
@wearenotgroot
Jan 09 2016 02:07
@jennytech what you thinking?
Jenni
@BookSprite
Jan 09 2016 02:07
This looks right to me; <a href= Add URLS > Add logo titles </a>-->
Phillip Stolić
Jan 09 2016 02:07
@Aoxom WHAT IS YOUR PROBLEM?! I can't even and I am getting UNDEFINED everywhere?!
@BookSprite does it? :D
cannelflow
@cannelflow
Jan 09 2016 02:07
@jlinkenauger use first assign value to return
YI JIANG
@jennytech
Jan 09 2016 02:08
I don't know where is wrong
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:08
Jenni
@BookSprite
Jan 09 2016 02:08
<p> View more <a href="http://www.freecatphotoapp.com">cat photos</a> </p>
YI JIANG
@jennytech
Jan 09 2016 02:08
whati think?
Chris
@Aoxom
Jan 09 2016 02:08
Jenni
@BookSprite
Jan 09 2016 02:08
srty that was a little note to self for later
cannelflow
@cannelflow
Jan 09 2016 02:08
@jennytech not var val it says Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string.
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:08
I.E. doesn't return pony, cat, etc
kitten*
YI JIANG
@jennytech
Jan 09 2016 02:09
var lookup = {
greg
@wearenotgroot
Jan 09 2016 02:09
@jennytech you are on the right track
YI JIANG
@jennytech
Jan 09 2016 02:09
but not working
Chris
@Aoxom
Jan 09 2016 02:09
@jennytech ni shi zhong guo ren ma?
YI JIANG
@jennytech
Jan 09 2016 02:09
yes
Jan 09 2016 02:09
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank",
"":"undefined"
};

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

// Change this value to test
phoneticLookup(" ");
Phillip Stolić
Jan 09 2016 02:09
@ricsanm that's to be expected! ;) Now look at the line return checkProp; that you have...
Do you know how to access the property of an object, using dot notation?
YI JIANG
@jennytech
Jan 09 2016 02:09
jiao jiao wo?
Chris
@Aoxom
Jan 09 2016 02:10
i would but i dont really speak chinese :)
greg
@wearenotgroot
Jan 09 2016 02:10
@jennytech remove the "":"undefined" for starters
Chris
@Aoxom
Jan 09 2016 02:10
ke shi wo zhi dao yi dian
Phillip Stolić
Jan 09 2016 02:10
@wearenotgroot maybe tell her why as well. :P
greg
@wearenotgroot
Jan 09 2016 02:11
@jennytech how it got there anyways :)
YI JIANG
@jennytech
Jan 09 2016 02:11
not working too
i removed
Phillip Stolić
Jan 09 2016 02:11
No, it won't, not yet; there is still a bit of work to do.
YI JIANG
@jennytech
Jan 09 2016 02:11

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {

"bravo":"Boston",

"charlie": "Chicago",

"delta": "Denver",

"echo": "Easy",

"foxtrot":"Frank"

};

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

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

Mukul Patel
@Mukul215
Jan 09 2016 02:11
@jlinkenauger notice how it says only change code above this line, well I think it may be a typo. Your objective is to return the lookup val
cannelflow
@cannelflow
Jan 09 2016 02:11
@jlinkenauger assign value to the result then return by calling lookup object
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:11
@Deadmano Supossedly, but how do I return whichever is assigned to the property? .
Phillip Stolić
Jan 09 2016 02:12
We know we must return a property from myObj right?
YI JIANG
@jennytech
Jan 09 2016 02:12
return lookup?
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:12
cannelflow
@cannelflow
Jan 09 2016 02:12
@jennytech assign value to the result then return by calling lookup object
Phillip Stolić
Jan 09 2016 02:12
We can't use . notation here, so we have to use our trust brackets...
@ricsanm so we would have myObj[] but what goes inside it?
Julian Herrmann
@jrherrm
Jan 09 2016 02:13

// Setup
var myPlants = [
{
type: "flowers",
list: [
"rose",
"tulip",
"dandelion"
]
},
{
type: "trees",
list: [
"fir",
"pine",
"birch"
]
}
];

// Only change code below this line

var secondTree = myPlants.list[1]; // Change this line

Phillip Stolić
Jan 09 2016 02:13
Think what parameter we pass to checkObj. What is its name? :)
Julian Herrmann
@jrherrm
Jan 09 2016 02:13
anyone know why this doesn't work?
YI JIANG
@jennytech
Jan 09 2016 02:13
@cannelflow what is the value?
var result = "undefied";?
not right
Julian Herrmann
@jrherrm
Jan 09 2016 02:14
says type error:undefined is not an object
Mukul Patel
@Mukul215
Jan 09 2016 02:14
@jrherrm what is the output suppose to be?
Phillip Stolić
Jan 09 2016 02:15
@jrherrm look carefully... The first is myPlants as the object yes?
cannelflow
@cannelflow
Jan 09 2016 02:15
@jennytech result=lookup[val]; then return result
Phillip Stolić
Jan 09 2016 02:15
@jrherrm it has 2 arrays. We know arrays a zero-indexed...
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:15
Jesus, I feel retarded -_- @Deadmano
Chris
@Aoxom
Jan 09 2016 02:15
@jennytech you need to set result equal to the value in lookup, and return that
Julian Herrmann
@jrherrm
Jan 09 2016 02:15
pine @Mukul215
Phillip Stolić
Jan 09 2016 02:15
@jrherrm so how do we access the 2nd array? :)
greg
@wearenotgroot
Jan 09 2016 02:15
@cannelflow dont tell it straight up
Krista Prenesti
@kprenesti
Jan 09 2016 02:15
Hi all. I have a question for the JSON waypoints. The code they recommend using in the callback function is JSON.stringify(json), but the file they're GETting is a .json file. Wouldn't you need to use JSON.parse?
Julian Herrmann
@jrherrm
Jan 09 2016 02:15
Phillip Stolić
Jan 09 2016 02:15
@ricsanm please don't. :) It is always frustrating and makes ZERO sense until you figure it out; then it is easy. ;)
@jrherrm good. Now moving on... What is the next thing once we have that?
There is a list array, no?
cannelflow
@cannelflow
Jan 09 2016 02:16
@wearenotgroot correct
Julian Herrmann
@jrherrm
Jan 09 2016 02:16
list then 1 again yea
YI JIANG
@jennytech
Jan 09 2016 02:16
it's not working still
Phillip Stolić
Jan 09 2016 02:16
Yeah!
How does that work for you, @jrherrm? :)
YI JIANG
@jennytech
Jan 09 2016 02:16

// Setup
function phoneticLookup(val) {
var result = lookup[val];

// Only change code below this line
var lookup = {

"bravo":"Boston",

"charlie": "Chicago",

"delta": "Denver",

"echo": "Easy",

"foxtrot":"Frank"

};

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

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

Julian Herrmann
@jrherrm
Jan 09 2016 02:16
sweet!
Phillip Stolić
Jan 09 2016 02:16
Yay! Well done! :D
Julian Herrmann
@jrherrm
Jan 09 2016 02:17
CamperBot
@camperbot
Jan 09 2016 02:17
jrherrm sends brownie points to @deadmano :sparkles: :thumbsup: :sparkles:
Phillip Stolić
Jan 09 2016 02:17
@jennytech small steps... Put back "charlie" back into your phoneticLookup.
Chris
@Aoxom
Jan 09 2016 02:17
@jennytech dont change var result; at the top, add a line below(outside of) your lookup object
Phillip Stolić
Jan 09 2016 02:18
@jennytech now think carefully... phoneticLookup is a FUNCTION. It has one parameter. In a function, a parameter is variable. What is the parameter or variable called?
greg
@wearenotgroot
Jan 09 2016 02:18
see this line
// Only change code below this line
.
.
.
// Only change code above this line
cannelflow
@cannelflow
Jan 09 2016 02:18
@jennytech put that before return and keep that var result as it is
YI JIANG
@jennytech
Jan 09 2016 02:18
val
Phillip Stolić
Jan 09 2016 02:18
@jennytech wait you had it, hahaha. Just put the return inside of your parentheses closing bracket }.
@jennytech var result = lookup[val]; is correct. BUT, return it to its default value var result = "";.
@jennytech now how do you edit an existing initialized variable? You don't use the var...
Jan 09 2016 02:20
@Mukul215 it's still not working.
function phoneticLookup(val) {
var result = val;

// Only change code below this line
var lookup = {
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank",
"":"undefined"
};

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

// Change this value to test
phoneticLookup("bravo");
Phillip Stolić
Jan 09 2016 02:20
@jennytech so result = lookup[val]; as you had it, but just under "foxtrot":"Frank" your return line must be directly below. the };
greg
@wearenotgroot
Jan 09 2016 02:21
see this line
// Only change code below this line
.
.
.
// Only change code above this line
Chris
@Aoxom
Jan 09 2016 02:21
@jlinkenauger your code will always return lookup;, so its not doing anything with the val passed in
greg
@wearenotgroot
Jan 09 2016 02:21
@jlinkenauger only edit what inside it :)
cannelflow
@cannelflow
Jan 09 2016 02:22
@jlinkenauger keep top var result as it is
@jlinkenauger and return result after assigning the value // Only change code above this line
Phillip Stolić
Jan 09 2016 02:23
@jennytech we need a new update. :D
Jan 09 2016 02:23
@Aoxom ok changed it back
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank",
"":"undefined"
};

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

// Change this value to test
phoneticLookup("charlie");
greg
@wearenotgroot
Jan 09 2016 02:23
should stay
function phoneticLookup(val) {
var result = "";
Phillip Stolić
Jan 09 2016 02:23
@jlinkenauger "":"undefined" why is that there? :P
YI JIANG
@jennytech
Jan 09 2016 02:24

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {

"bravo": "Boston",

"charlie": "Chicago",

"delta":"Denver",

"echo": "Easy",

"foxtrot": "Frank"

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

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

Jan 09 2016 02:24
YI JIANG
@jennytech
Jan 09 2016 02:24
hi guys
never worked
dabmen87
@dabmen87
Jan 09 2016 02:24
I need hep with Waypoint: Set the ID of an Element- thats exercise 38 from the HTML & CSS tutorial....anybody did that?
YI JIANG
@jennytech
Jan 09 2016 02:24
I did only change the code in middle
Phillip Stolić
Jan 09 2016 02:24
@jennytech put back your result = lookup[val]; that has to be before the }; you had it. :)
dabmen87
@dabmen87
Jan 09 2016 02:24
I need hep with Waypoint: Set the ID of an Element- thats exercise 38 from the HTML & CSS tutorial....anybody did that?
Matt Leonard
@matty22
Jan 09 2016 02:24
@dabmen87 What's the issue?
Chris
@Aoxom
Jan 09 2016 02:25
@jlinkenauger so you see the function is going to return result;, so you need to somehow connect the val passed into the function to your var lookup object, and return it as result
cannelflow
@cannelflow
Jan 09 2016 02:25
@jennytech assign result value first by calling lookup object
dabmen87
@dabmen87
Jan 09 2016 02:25
@matty22 its asking me to give my form element the id cat-form-photo... but it doesnt seem to work
Matt Leonard
@matty22
Jan 09 2016 02:26
@dabmen87 Can you show me your code?
cannelflow
@cannelflow
Jan 09 2016 02:26
@dabmen87 can you show the code
YI JIANG
@jennytech
Jan 09 2016 02:26

// Setup
function phoneticLookup(val) {
var result = "lookup[val]";

// Only change code below this line
var lookup = {

"bravo": "Boston",

"charlie": "Chicago",

"delta":"Denver",

"echo": "Easy",

"foxtrot": "Frank"

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

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

Phillip Stolić
Jan 09 2016 02:26
@dabmen87 what element? <p> is an element and so is <img>. Adding the ID is like: <img src="URL" ID="idHere">.
YI JIANG
@jennytech
Jan 09 2016 02:26
OK I did
not working
FarionLord
@FarionLord
Jan 09 2016 02:26

why does it make the whole text (<p>) blue even though it says h2 and is not complete? "<h2 style="color: blue"CatPhotoApp

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
"

Phillip Stolić
Jan 09 2016 02:27
@jennytech you misunderstood me. Undo what you JUST did now.
YI JIANG
@jennytech
Jan 09 2016 02:27
i remove result
also no wokring
Matt Leonard
@matty22
Jan 09 2016 02:27
@FarionLord You didn't close the <h2>. You'd want <h2 style="color: blue;">
Phillip Stolić
Jan 09 2016 02:27
You are supposed to put result = lookup[val]; to just under "foxtrot": "Frank" and before the };. You had it earlier but you also changed the top variable.
Matt Leonard
@matty22
Jan 09 2016 02:28
@FarionLord ACtually it's probably <h2 style="color: blue;">CatPhotoApp</h2>
FarionLord
@FarionLord
Jan 09 2016 02:29
I know what i am suppose to do but why does it affect the <p> element?
Phillip Stolić
Jan 09 2016 02:29
@matty22 or a CSS class or ID. :P
cannelflow
@cannelflow
Jan 09 2016 02:29
@jennytech result = lookup[val]; then retun keep var result as it is
Phillip Stolić
Jan 09 2016 02:29
@cannelflow now hopefully she doesn't do the top result again!!!
Matt Leonard
@matty22
Jan 09 2016 02:29
Because you didn't close the <h2>. Since it's open it thinks the entire thing has color: blue
dabmen87
@dabmen87
Jan 09 2016 02:29

<style>
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}

.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
}

.smaller-image {
width: 100px;
}
.gray-background {
background-color: gray;
}
#cat-form-photo{
border-color: green;
border-width: 10px;
border-style: solid;
}
</style>

<h2 class="red-text">CatPhotoApp</h2>

<a href="#"><img class="smaller-image thick-green-border" alt="A cute orange cat lying on its back" src="https://bit.ly/fcc-relaxing-cat"></a>

<div class="gray-background">
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
</div>

<form action="/submit-cat-photo" id="cat-form-photo">
<label><input type="checkbox" name="personality" checked> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Energetic</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>

FarionLord
@FarionLord
Jan 09 2016 02:29
okay thanks @matty22
CamperBot
@camperbot
Jan 09 2016 02:29
farionlord sends brownie points to @matty22 :sparkles: :thumbsup: :sparkles:
:star: 350 | @matty22 | http://www.freecodecamp.com/matty22
cannelflow
@cannelflow
Jan 09 2016 02:30
@Deadmano chat is passing so fast difficult to see detail at begining
YI JIANG
@jennytech
Jan 09 2016 02:30
I did that
FarionLord
@FarionLord
Jan 09 2016 02:30
Hope you like your brownie points.
YI JIANG
@jennytech
Jan 09 2016 02:30
but not working
Phillip Stolić
Jan 09 2016 02:30
WAIT.
@jennytech .
cannelflow
@cannelflow
Jan 09 2016 02:30
@jennytech paste code again
YI JIANG
@jennytech
Jan 09 2016 02:30

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {

"bravo": "Boston",

"charlie": "Chicago",

"delta":"Denver",

"echo": "Easy",

"foxtrot": "Frank"

var result = lookup[val];

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

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

Phillip Stolić
Jan 09 2016 02:30
Nevermind.
Jan 09 2016 02:30
thank you!! I got it! @wearenotgroot @Deadmano @cannelflow
CamperBot
@camperbot
Jan 09 2016 02:30
jlinkenauger sends brownie points to @wearenotgroot and @deadmano and @cannelflow :sparkles: :thumbsup: :sparkles:
:star: 309 | @wearenotgroot | http://www.freecodecamp.com/wearenotgroot
:star: 370 | @cannelflow | http://www.freecodecamp.com/cannelflow
cannelflow
@cannelflow
Jan 09 2016 02:31
@jennytech you can put everything in 
Chris
@Aoxom
Jan 09 2016 02:31
@jennytech just remove the var from the second var result = lookup[val]; and you should be fine
FarionLord
@FarionLord
Jan 09 2016 02:31
@dabmen87 pretty sure some cats hate dogs.
Phillip Stolić
Jan 09 2016 02:31
@jennytech he meant you can put  in chat.
YI JIANG
@jennytech
Jan 09 2016 02:31
yes
i removed now
Phillip Stolić
Jan 09 2016 02:31
@jennytech at the bottom put phoneticLookup("charlie"); what does it do?
YI JIANG
@jennytech
Jan 09 2016 02:31
why ?
not me
Chris
@Aoxom
Jan 09 2016 02:32
you only use var once, to initialize the variable
DJ
@qualitymanifest
Jan 09 2016 02:32
@dabmen87 what's the problem?
YI JIANG
@jennytech
Jan 09 2016 02:32
I removed,but never give me pass?
cannelflow
@cannelflow
Jan 09 2016 02:32
@jennytech put these var result = lookup[val]; before return result
Phillip Stolić
Jan 09 2016 02:32
@jennytech just remove the var at the second part.
Don't do what @cannelflow says, it is before already. Hahaha.
YI JIANG
@jennytech
Jan 09 2016 02:33
"foxtrot": "Frank"
result = lookup[val];
};
// Only change code above this line
return result;
}
// Change this value to test
phoneticLookup("");
Chris
@Aoxom
Jan 09 2016 02:33
oh yeah, it needs to be outside the scope of lookup too
YI JIANG
@jennytech
Jan 09 2016 02:33
it's not right
Phillip Stolić
Jan 09 2016 02:33
@cannelflow it is before the return, do you see it?
You mean outside the object, yes?
YI JIANG
@jennytech
Jan 09 2016 02:33
plz give me your correct code?
Phillip Stolić
Jan 09 2016 02:34
@jennytech you are almost there, keep at it. ;)
YI JIANG
@jennytech
Jan 09 2016 02:34
I did what u say
but non works
haha
Phillip Stolić
Jan 09 2016 02:34
@jennytech you need to assign your result OUTSIDE of your object that is FINDING that result.
Does that make sense?
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:34
Phillip Stolić
Jan 09 2016 02:34
var lookup = {
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank"
};
cannelflow
@cannelflow
Jan 09 2016 02:34
@Deadmano it should be out side i think
Phillip Stolić
Jan 09 2016 02:34
Put your result line OUTSIDE that.
cannelflow
@cannelflow
Jan 09 2016 02:35
Majlind
@majlind
Jan 09 2016 02:35
wp Nested For Loops
Phillip Stolić
Jan 09 2016 02:35
It is hard to help when there are many mixed answers. :P
YI JIANG
@jennytech
Jan 09 2016 02:35
@cannelflow u are right
It never work inside
finally pass it
Phillip Stolić
Jan 09 2016 02:35
No, because you can't access it.
Same as you can't access the function variables outside the function. Hence why you used return.
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:35
// Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {

myObj.hasOwnProperty(checkProp);

return checkProp[];
}
// Test your code by modifying these values
Phillip Stolić
Jan 09 2016 02:35
Well done!
YI JIANG
@jennytech
Jan 09 2016 02:36

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {

"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("");

working now
Matt Leonard
@matty22
Jan 09 2016 02:36
@dabmen87 Are you sure that's the right id name? Read the instructions again carefully!
Majlind
@majlind
Jan 09 2016 02:36
function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i=0; i < arr.length; i++){                // i defined
for (var j=0; j < arr[i].length; j++){           // j defined
product = arr[j] * arr[i]; // <-- not a good statement...

// any clues towards choosing a statement

}
}

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Chris
@Aoxom
Jan 09 2016 02:36
@jennytech up the oil! lol. whats that saying? i forget
Phillip Stolić
Jan 09 2016 02:36
@ricsanm you didn't put anything inside the brackets... return checkProp[]; What parameter must it check for? ;)
cannelflow
@cannelflow
Jan 09 2016 02:37
@jennytech gr8
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:37
Phillip Stolić
Jan 09 2016 02:37
@ricsanm that would be the start, yes.
@ricsanm but then what parameter do we pass into the brackets? ;) You used it earlier.
cannelflow
@cannelflow
Jan 09 2016 02:37
@ricsanm since checkProp is A Variable use [] method
YI JIANG
@jennytech
Jan 09 2016 02:37
I'm sick now
greg
@wearenotgroot
Jan 09 2016 02:37
haha
Phillip Stolić
Jan 09 2016 02:37
@ricsanm what property of myObj do we want to check?
@Mahin2k
Jan 09 2016 02:38
hello people ,I need help with the checkpoint counting cards
here is my code
var count = 0;

function cc(card) {
// Only change code below this line
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count = 1;
return "Bet";
case 7:
case 8:
case 9:
count = 0;
return "Hold";
case 10:
case "J":
case "Q":
case "K":
case "A":
count = -1;
return "Hold";
}

return "Change Me";
// Only change code above this line
}

// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Phillip Stolić
Jan 09 2016 02:38
@Mahin2k count = 1; this is not how you increment. :) Remember count++? :)
greg
@wearenotgroot
Jan 09 2016 02:38
@Mahin2k welp! wat ya thinking?
Phillip Stolić
Jan 09 2016 02:39
@Mahin2k and it has a negative counterpart as well. :P
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:39
We want to check for any of the 3 myObj properties
But I dont know how to adress that
Phillip Stolić
Jan 09 2016 02:39
@ricsanm no we want to pass in a variable to check that property for.
@Mahin2k
Jan 09 2016 02:39
Phillip Stolić
Jan 09 2016 02:39
@ricsanm what variable are we trying to pass to it? :) That we call?
@Mahin2k
Jan 09 2016 02:39
like this?
var count = 0;

function cc(card) {
// Only change code below this line
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
return "Bet";
case 7:
case 8:
case 9:
count++;
return "Hold";
case 10:
case "J":
case "Q":
case "K":
case "A":
count++;
return "Hold";
}

return "Change Me";
// Only change code above this line
}

// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Phillip Stolić
Jan 09 2016 02:40
@ricsanm function checkObj(checkProp) { what is the parameter name there? :)
cannelflow
@cannelflow
Jan 09 2016 02:40
@Mahin2k remove return because return inside your code means it stops execution there and when card is 2,3,4,5 you have to count it to +1
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:40
checkprop?
..what?
Phillip Stolić
Jan 09 2016 02:40
@Mahin2k why are you incrementing for each case now? Read the description. :) Some must increment, others must deincrement, and then the rest must do nothing.
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:40
I should erase my account and begin all over again haha
YI JIANG
@jennytech
Jan 09 2016 02:40
remove count++ just return "Bet"
Phillip Stolić
Jan 09 2016 02:40
Yes, @ricsanm !
@ricsanm you had it. :) Once you figure it out you do it again till you truly get it.
So we need to pass checkProp to our empty [].
Put that inside, what do we get?
greg
@wearenotgroot
Jan 09 2016 02:41
@ricsanm checkProp is the argument passed to the function checkObj(checkProp)
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:42
return checkProp[checkProp];
xD
Phillip Stolić
Jan 09 2016 02:42
@ricsanm what happened to myObj?
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:42
return checkProp[myObj.checkProp];
Phillip Stolić
Jan 09 2016 02:42
You want to check myObj for anything that has checkProp where checkProp is a variable that contains the string you passed at checkObj("gift");.
So we want to do myObj["gift"] in essence.
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:43
THAT's what I don't know, it's been the whole point since I entered Javascript :(
Phillip Stolić
Jan 09 2016 02:43
Without the brackets as it is a variable. :)
Pass the variable, you had it now. :)
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:43
How to access not a specific value, but all of them to test them when you test the function
Phillip Stolić
Jan 09 2016 02:43
It is right in front of you.
You can do it! :D
I believe in you. ^^
You are SO CLOSE!
function checkObj(checkProp) { what is the parameter which is also a variable of that function called?
greg
@wearenotgroot
Jan 09 2016 02:44
the answer is 42 groot hodor
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:45
checkProp
Phillip Stolić
Jan 09 2016 02:45
YES!
Without the quotes as it is a variable.
^
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:46
myObj[checkProp]? I'm not sure I understand why.
Phillip Stolić
Jan 09 2016 02:47
Let me explain.
Look at line 20.
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:47
....It worked.... Wat.
Phillip Stolić
Jan 09 2016 02:47
checkObj is the name of the function you're calling, think of it as a phone number.
But this phone number needs you to prompt in a special code to know where you want to go.
That is called a parameter.
So when we do checkObj("gift"); we are telling it to tell checkObj to use "gift"...
Now if you look at what our function does...
myObj.hasOwnProperty(checkProp); <--- this line is checking to see if myObj has a property called checkProp where checkProp is actually the parameter we passed, that being "gift".
In this case, it DOES find "gift" and therefore it will evaluate to "true". Hence why it will return with myObj[checkProp]; which is actually the property "gift".
greg
@wearenotgroot
Jan 09 2016 02:49
Majlind
@majlind
Jan 09 2016 02:50

Hey guys anyone finished waypoint Nesting For Loops?



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

var arr = [
[1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
for (var j=0; j < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
This outputs each sub-element in arr one at a time. Note that for the inner loop, we are checking the .length of arr[i], since arr[i] is itself an array.

Instructions
Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr
Phillip Stolić
Jan 09 2016 02:50
And your last part, since it was NOT true, it will simply return the "Not Found" message. :) Does that make a bit more sense, @ricsanm? :)
Obviously the last part only happens when it can't find a property, such as "house".
FarionLord
@FarionLord
Jan 09 2016 02:51
how do I send you a picture of my problem? ^^
Majlind
@majlind
Jan 09 2016 02:51
explain format
CamperBot
@camperbot
Jan 09 2016 02:51

## :point_right: code formatting [wiki]

### Inline code

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

### Code Block

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

then press [shift + enter ⏎]

 ⇦ Type 3 backticks, then press [enter ⏎]

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

greg
@wearenotgroot
Jan 09 2016 02:52
@majlind accumulate the multiplied value and put it in a variable
Majlind
@majlind
Jan 09 2016 02:52
thanks @wearenotgroot I can't wait for the next season of Curb too
CamperBot
@camperbot
Jan 09 2016 02:52
majlind sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star: 310 | @wearenotgroot | http://www.freecodecamp.com/wearenotgroot
Majlind
@majlind
Jan 09 2016 02:53

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i=0; i < arr.length; i++){                // i defined
for (var j=0; j < arr[i].length; j++){           // j defined
product = arr[j] * arr[i];                          // problem is with this statement here

}
}

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:54
@Deadmano I commented my code with your awesome teachings, for further analysis. Thanks a lot! You have been the most wonderful, patient and friendly teacher.
CamperBot
@camperbot
Jan 09 2016 02:54
ricsanm sends brownie points to @deadmano :sparkles: :thumbsup: :sparkles:
Majlind
@majlind
Jan 09 2016 02:54
product = airr[j] * arr[i]

but that's the Linear algebra habit...
Ricardo Sanchez
@ricsanm
Jan 09 2016 02:54
And GOD when I mean patient I really mean it
Mike W.
@micwill007
Jan 09 2016 02:54
This message was deleted
greg
@wearenotgroot
Jan 09 2016 02:54
@majlind close
Majlind
@majlind
Jan 09 2016 02:54
CamperBot
@camperbot
Jan 09 2016 02:54
majlind sends brownie points to @deadmano :sparkles: :thumbsup: :sparkles:
greg
@wearenotgroot
Jan 09 2016 02:55
@majlind should be arr[i][j]
Mike W.
@micwill007
Jan 09 2016 02:56
// 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 update(id, prop, value) {

//For given id in collection..?

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

return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");

Write a function which takes an id, a property (prop), and a value.

For the given id in collection:

If value is non-blank (value !== ""), 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.

Says collections is undefined
Phillip Stolić
Jan 09 2016 02:56
@ricsanm high praise, thank you!!! :) If it brings you any joy at all; I only just finished that lesson today myself. Only been doing JavaScript for about a month on and off. :) If you ever need anything please do feel free to PM me! :)
CamperBot
@camperbot
Jan 09 2016 02:56
deadmano sends brownie points to @ricsanm :sparkles: :thumbsup: :sparkles:
:star: 216 | @ricsanm | http://www.freecodecamp.com/ricsanm
Mike W.
@micwill007
Jan 09 2016 02:56
How can I update the properties in collections without passing in the object itself
Majlind
@majlind
Jan 09 2016 02:56

@wearenotgroot

product = arr[i][j];

greg
@wearenotgroot
Jan 09 2016 02:57
@majlind yes but you need to multiply them
Phillip Stolić
Jan 09 2016 02:57
Things always seem their hardest, until you overcome the challenge and understand them. Nothing is impossible, but if you're unwilling to learn then you won't. Simple as that. :P
greg
@wearenotgroot
Jan 09 2016 02:57
@majlind and how would one do that
Phillip Stolić
Jan 09 2016 02:57
But it really does help to have someone break things down for you, as admittedly some of the requirements weren't written with beginners in mind.
Majlind
@majlind
Jan 09 2016 02:58
@wearenotgroot Just got success with the *= operator, thank you for the guidance!
CamperBot
@camperbot
Jan 09 2016 02:58
majlind sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:warning: majlind already gave wearenotgroot points
greg
@wearenotgroot
Jan 09 2016 02:59
explain rocketsurgery
CamperBot
@camperbot
Jan 09 2016 02:59
no wiki entry for: rocketsurgery
greg
@wearenotgroot
Jan 09 2016 02:59
haha nothing came up
Mike W.
@micwill007
Jan 09 2016 02:59
anyone have an idea for ^
Phillip Stolić
Jan 09 2016 03:00
explain groot
CamperBot
@camperbot
Jan 09 2016 03:00
no wiki entry for: groot
Phillip Stolić
Jan 09 2016 03:00
Awww. :(
Well, I think I am done for the night. 5am on the head.
greg
@wearenotgroot
Jan 09 2016 03:00
explain Hodor
CamperBot
@camperbot
Jan 09 2016 03:00
no wiki entry for: hodor
Phillip Stolić
Jan 09 2016 03:01
Goodnight/Morning everyone! Off to waste time lying on my various bodily parts in order to regenerate some more cells for the coding ahead tomorrow!
greg
@wearenotgroot
Jan 09 2016 03:01
Dan
@dan4505
Jan 09 2016 03:01
question regarding: http://www.freecodecamp.com/challenges/waypoint-introducing-javascript-object-notation-json instructions are to add a new album. but, it doesn't show how to add it. it's just very vague in introducing a new concept.. or maybe I'm just tired and missing something obvious
Justin Watson
@fallrisk
Jan 09 2016 03:01
What service are people using for the Image Search Abstraction basejump?
Phillip Stolić
Jan 09 2016 03:01
Goodnight @wearenotgroot great working alongside you! Had quite some fun. :D
greg
@wearenotgroot
Jan 09 2016 03:02
Julian Herrmann
@jrherrm
Jan 09 2016 03:02
stuck on the same thing @micwill007
greg
@wearenotgroot
Jan 09 2016 03:03
@dan4505 start by reading this http://www.w3schools.com/js/js_arrays.asp
Justin Watson
@fallrisk
Jan 09 2016 03:03
I looked at Google and DuckDuckGo. Google was way to involved. I didn't want to do all that they wanted. DuckDuckGo didn't seem to have the image URLs.
Julian Herrmann
@jrherrm
Jan 09 2016 03:03
i think the problem is in the first if statement @micwill007
greg
@wearenotgroot
Jan 09 2016 03:03
@dan4505 read it all the way
Mike W.
@micwill007
Jan 09 2016 03:03
@jrherrm Driving me nuts.
Julian Herrmann
@jrherrm
Jan 09 2016 03:04
same @micwill007
we have to add artist to that ID somehow
Mike W.
@micwill007
Jan 09 2016 03:06
The error I get is: Cannot set property 'prop' of undefined, which means that the function isn't seeing the collections object
or.. something
x.x
Julian Herrmann
@jrherrm
Jan 09 2016 03:07
i get that it cannot assign to readonly property
i think meaning that there isn't an artists property in that id
which i think is the same as what you said
Dan
@dan4505
Jan 09 2016 03:09
CamperBot
@camperbot
Jan 09 2016 03:09
dan4505 sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star: 311 | @wearenotgroot | http://www.freecodecamp.com/wearenotgroot
Mike W.
@micwill007
Jan 09 2016 03:09
hmm im pretty sure you can create properties using dot notation though
so even if it wasn't there originally, it would create it
Dan
@dan4505
Jan 09 2016 03:09
not sure how to apply it specifically to that waypoint, though
Colin
@cuken
Jan 09 2016 03:09
@micwill007 Can you post your code
Mike W.
@micwill007
Jan 09 2016 03:10
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 update(id, prop, value) {

//For given id in collection..?

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

return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");
crud
Colin
@cuken
Jan 09 2016 03:10
you can edit it
move //setup to its own line
Mike W.
@micwill007
Jan 09 2016 03:11

For the given id in collection:

If value is non-blank (value !== ""), 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.

Colin
@cuken
Jan 09 2016 03:11
Okay
Mike W.
@micwill007
Jan 09 2016 03:11
It says for given id in collection... does that mean a foreach?
Colin
@cuken
Jan 09 2016 03:11
No, see how they are calling update(5439
that's the ID they are referencing
Mike W.
@micwill007
Jan 09 2016 03:11
mhm
Colin
@cuken
Jan 09 2016 03:12
so first things first
you have 2 big issues
#1 you can't use dot notation for variable calls
you have to use bracket nottation
Mike W.
@micwill007
Jan 09 2016 03:12
ahhhhhhhhhhhhhh
Colin
@cuken
Jan 09 2016 03:12
notation*
#2
Your code still isn't going to work
because you're going to change the value of the tracks from type array to type string because of your first if statement
if (value !== '') { collection.id.prop = value;
Mike W.
@micwill007
Jan 09 2016 03:13
Ok, i'm following you
Colin
@cuken
Jan 09 2016 03:14
so you should first evaluate the "tracks" condition before any other
then and only if it wasn't tracks, check to make sure the variable isn't null
hint, use else if
CamperBot
@camperbot
Jan 09 2016 03:14
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Colin
@cuken
Jan 09 2016 03:16
does that help @micwill007
Mike W.
@micwill007
Jan 09 2016 03:17
Working through it :P I think so
Got it
@cuken Thank you!
CamperBot
@camperbot
Jan 09 2016 03:19
micwill007 sends brownie points to @cuken :sparkles: :thumbsup: :sparkles:
:star: 279 | @cuken | http://www.freecodecamp.com/cuken
Mike W.
@micwill007
Jan 09 2016 03:20
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 update(id, prop, value) {

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

return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");
This was the end result
Colin
@cuken
Jan 09 2016 03:21
beautiful
Alexander Køpke
@alexanderkopke
Jan 09 2016 03:22
I concur
Mike W.
@micwill007
Jan 09 2016 03:26
Easier with a good teacher to explain my ignorance
Julian Herrmann
@jrherrm
Jan 09 2016 03:27
got through that first hint, but don't fully understand why the order of that one is so important
Colin
@cuken
Jan 09 2016 03:28
Because your changing the data type
And .push dosn't work on a string
Julian Herrmann
@jrherrm
Jan 09 2016 03:29
i see
Colin
@cuken
Jan 09 2016 03:29
its' really bad for tracks because you would be deleting all of the other records
has a lot of implication on how to handle real world data
great example
Julian Herrmann
@jrherrm
Jan 09 2016 03:30
haha
@alubarsky
Jan 09 2016 03:36
Hey! Why does my second attempt at styling light up pink and does not change?
Hugo Morais
@hugodmorais
Jan 09 2016 03:37

You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unique id number and has several properties. Not all albums have complete information.

Write a function which takes an id, a property (prop), and a value.

For the given id in collection:

If value is non-blank (value !== ""), 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.

Colin
@cuken
Jan 09 2016 03:37
DFC302
@DFC302
Jan 09 2016 03:37

how do you nest a div element inside another div? It says "Your buttons should all be nested within the same div element with the class row.
Each of your Bootstrap buttons should be nested within its own div element with the class col-xs-4."

can anyone help?

Mike W.
@micwill007
Jan 09 2016 03:37
It looks like you're also inside of .cr with your .green
and this isn't SASS, just plain CSS it looks like
Hugo Morais
@hugodmorais
Jan 09 2016 03:37

// 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 update(id, prop, value) {

return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");

@alubarsky
Jan 09 2016 03:37
Thanks! that all helped
Colin
@cuken
Jan 09 2016 03:38
@DFC302
<div>
<div>
</div>
</div>
@SaintPeter
Jan 09 2016 03:38
@alubarsky You have your .green definition INSIDE your .cr definition. The curly braces are the extent, so you need to close them above your .green. note however, that you are specifically instructed to apply the red-text class.
Colin
@cuken
Jan 09 2016 03:38
wave @SaintPeter Heya
SaintPeter @SaintPeter waves back at @cuken
SaintPeter @SaintPeter will try not to take ALL of @cuken's richly deserved brownies
Mike W.
@micwill007
Jan 09 2016 03:39
@hugodmorais I was just stuck on that one :p
Colin
@cuken
Jan 09 2016 03:39
@SaintPeter SOMEONE took away something like 99.7k stars from me
DFC302
@DFC302
Jan 09 2016 03:40

@cuken I tried that but this causes an error.

<div class="row">
<div class=col-xs-4">
<button class="btn btn-block btn-primary">Like</button>
<button class="btn btn-block btn-info">Info</button>
<button class="btn btn-block btn-danger">Delete</button>
</div>
</div>

Even if I take out the second "/div" it doesnt fix it

@SaintPeter
Jan 09 2016 03:40
:P
Hugo Morais
@hugodmorais
Jan 09 2016 03:40
@micwill007 It´s hard
Colin
@cuken
Jan 09 2016 03:40
@DFC302 Really close, you need to give each button it's own div
Jenni
@BookSprite
Jan 09 2016 03:40
In these two lists the 'Collection' doesn't register as to go to a link - of course the whole thing is going to have to be revamped - but I'll figure I'll fix little quirks as they arise, at least than I will understand them better. =”#”>
<ul>
<li>Exhibit Highlights</li>
<li>How Tos</li>
</ul>
<h3>Library Services</h3>
<a href=”#”>
<ul>
<li>Digital Archiving Services</li>
<li>Loan Requesting</li>
<li>Cloud Services</li>
<li>PDF Viewing</li>
</ul>
<h3>Research Tools </h3>
Mike W.
@micwill007
Jan 09 2016 03:40
@hugodmorais Yes
Jenni
@BookSprite
Jan 09 2016 03:41
<h3>Collection</h3><a href=”#”>
<ul>
<li>Exhibit Highlights</li>
<li>How Tos</li>
</ul>
<h3>Library Services</h3>
puru22
@puru22
Jan 09 2016 03:41
helllo
Colin
@cuken
Jan 09 2016 03:41
<div class="row">
<div class=col-xs-4">
<button class="btn btn-block btn-primary">Like</button>
</div>
<div class="col-xs-4">
<button ......>
</div>
@DFC302 you're also missing some qoutes
DFC302
@DFC302
Jan 09 2016 03:41
ok awesome let me try that thankyou @cuken
Colin
@cuken
Jan 09 2016 03:41