These are chat archives for FreeCodeCamp/Help

12th
Jan 2016
Evans Ibok
@evansibok
Jan 12 2016 00:00

Waypoint: Concatenating Strings with the Plus Equals Operator

Ah! Concatenation!!!

Help please:

var myStr += " This is the first sentence. ", "This is the second sentence. ";
Enraemichele
@Enraemichele
Jan 12 2016 00:01

Hello again. On the Waypoint: Concatenating Strings with Plus Operator, I've got all of the checks checked besides one, but it's confusing. My output says

var myStr = "This is the start." + "This is the end."

The only check that hasn't been done is the one that says "myStr should have a value of "This is the start. This is the end." But that's exactly what my output says. Bug, or am I missing something?

Evans Ibok
@evansibok
Jan 12 2016 00:02
@Enraemichele End your instruction with ;
tommy
@tommygebru
Jan 12 2016 00:02
@Enraemichele add a space inside of the string
Nima Mohseni
@nmohseni
Jan 12 2016 00:03
@evansibok did you fix your issue or are you still stuck?
tommy
@tommygebru
Jan 12 2016 00:03
@evansibok :+1:
Julie
@robojukie
Jan 12 2016 00:03
@piyalidey do you still need help with profile lookup?
Evans Ibok
@evansibok
Jan 12 2016 00:03
@Enraemichele Add a space after the "start" word too
tommy
@tommygebru
Jan 12 2016 00:03
@evansibok remove +
Enraemichele
@Enraemichele
Jan 12 2016 00:03
The space worked, thanks.
Evans Ibok
@evansibok
Jan 12 2016 00:03
@tommygebru still stuck.
Charles C. Wu
@charleswusf
Jan 12 2016 00:03
Finally got the Checkpoint: Profile Lookup! Pretty ugly code (not my best effort). But it's done! Thanks for all the help guys...
Enraemichele
@Enraemichele
Jan 12 2016 00:04
This message was deleted
Maciej Bembenista
@macbem
Jan 12 2016 00:04
function lookUp(firstName, prop){
// Only change code below this line
  for (i=0; i<contacts.length; i++)

    {

      if(contacts[i].firstName == firstName)

          { 

            if(contacts[i].hasOwnProperty(prop))

                {

                  return contacts[i][prop];

                }

             else 

                {

                    return "No such property";

                }

          }

    } 

  return "No such contact";

// Only change code above this line
}
if anyone needs the solution... :P
tommy
@tommygebru
Jan 12 2016 00:04
@evansibok change += to = and remove the , and add +
Enraemichele
@Enraemichele
Jan 12 2016 00:04
How does one give brownie points?
tommy
@tommygebru
Jan 12 2016 00:05
@Enraemichele thanks
CamperBot
@camperbot
Jan 12 2016 00:05
tommygebru sends brownie points to @enraemichele :sparkles: :thumbsup: :sparkles:
:star: 157 | @enraemichele | http://www.freecodecamp.com/enraemichele
Rick Moffat
@rmoffat
Jan 12 2016 00:05
+= browniePoints
Nima Mohseni
@nmohseni
Jan 12 2016 00:05
@Enraemichele say "Thanks [name]"
CamperBot
@camperbot
Jan 12 2016 00:05
nmohseni sends brownie points to @enraemichele :sparkles: :thumbsup: :sparkles:
:star: 158 | @enraemichele | http://www.freecodecamp.com/enraemichele
Enraemichele
@Enraemichele
Jan 12 2016 00:05
@tommygebru thanks
CamperBot
@camperbot
Jan 12 2016 00:05
enraemichele sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 249 | @tommygebru | http://www.freecodecamp.com/tommygebru
Maciej Bembenista
@macbem
Jan 12 2016 00:05
wiki brownie points
CamperBot
@camperbot
Jan 12 2016 00:05

:point_right: brownie points [wiki]

The number beside your picture on Free Code Camp tells you how many Brownie Points you have.

A user profile picture next to a with Brownie Points score

There are three ways you can get Brownie Points:

  1. Complete challenges - you get one point per challenge you complete
  2. Post relevant links on Camper News - you get 1 point for posting a link, and another point for each upvote your link gets
  3. Help other campers in chat - each time you help another camper and they thank you (by typing "thanks @yourname"), you will get a point

Brownie Points help you look like the kind of person who codes a lot, shares relevant links, and helps people.

They also add to your Streak.
:pencil: read more about brownie points on the FCC Wiki

Enraemichele
@Enraemichele
Jan 12 2016 00:05
Aha! Thanks.
Nima Mohseni
@nmohseni
Jan 12 2016 00:06
@evansibok there should be two lines of code
the first line defines the variable then the second line uses the += operator
CompGeekGirl
@LisaRamos
Jan 12 2016 00:08
@marhyorh I'm here. That kind of freaked me out.
Evans Ibok
@evansibok
Jan 12 2016 00:08
@tommygebru @nmohseni thanks! Got it
CamperBot
@camperbot
Jan 12 2016 00:08
evansibok sends brownie points to @tommygebru and @nmohseni :sparkles: :thumbsup: :sparkles:
:warning: evansibok already gave tommygebru points
:star: 165 | @nmohseni | http://www.freecodecamp.com/nmohseni
tommy
@tommygebru
Jan 12 2016 00:09
@evanisbok sorry I didnt realize the different waypoint...
var myString ="String1";
myString += " string2.";//returns "String1 string2."
karenkomine
@karenkomine
Jan 12 2016 00:09
This is my code so far for Checkpoint: Profile Lookup
for (var i = 0; i < contacts.length; i++) {
if (contacts[i].firstName === firstName) {
if (contacts[i].hasOwnProperty(prop)) {
return contacts[i][prop];
}
}
else {
return "No such property";
}
}
return "No such contact";
Can anyone help me out with figuring out where I'm going wrong?
Tim Myers
@denvercoder
Jan 12 2016 00:09
anyone get further on the Profile Lookupchallenge?
karenkomine
@karenkomine
Jan 12 2016 00:10
That's where I'm at ^^
I'm kind of stuck
Tim Myers
@denvercoder
Jan 12 2016 00:10
me too, still
I am almost there
Evans Ibok
@evansibok
Jan 12 2016 00:10

Waypoint: Concatenating Strings with the Plus Equals Operator

For those who are stuck:


var myStr = "This is the first sentence. ";
myStr += "This is the second sentence.";
Julie
@robojukie
Jan 12 2016 00:10
@timmyers1978 @karenkomine my solution works. agoracoder is very close, i responded to his code with fixes if you want to look at that
tommy
@tommygebru
Jan 12 2016 00:11
@timmyers1978 I'll be there soon :smile:
DevPoetsSociety
@DevPoetsSociety
Jan 12 2016 00:11
Oh, that's a brand new checkpoint
Evans Ibok
@evansibok
Jan 12 2016 00:11
@tommygebru Its cool
CompGeekGirl
@LisaRamos
Jan 12 2016 00:11

Okay, so I'm still struggling with Waypoint: Logical Order in If Else Statements. I'm still having difficulty getting everything to work. http://www.freecodecamp.com/challenges/waypoint-logical-order-in-if-else-statements
function myTest(val) {
if(val < 10) {
return "Less than 10";
} else if(val < 5) {
return "Less than 5";
} else {
return "Greater than or equal to 10";
}
}

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

karenkomine
@karenkomine
Jan 12 2016 00:12
@robojukie What was your solution? Can you walk me through it?
tommy
@tommygebru
Jan 12 2016 00:12
@LisaRamos you only need to rearrange the numbers or the arguments conditions
Right now the first if overrides the second ....
Julie
@robojukie
Jan 12 2016 00:13
@karenkomine yes, examining yours right now, it's close but you're off by bracket/statement order
Evans Ibok
@evansibok
Jan 12 2016 00:13
commands
CamperBot
@camperbot
Jan 12 2016 00:13

commands:

  • isCommand
  • cbot
  • echo
  • echojson
  • botversion
  • botstatus
  • botenv
  • archive
  • init
  • tooNoisy
  • help
  • menu
  • rooms
  • find
  • commands
  • music
  • announce
  • rollem
  • camperCount
  • welcome
  • hello
  • bob
  • wikiFooter
  • wikiUsage
  • wikiCantFind
  • wiki
  • messages
  • thanks
  • about
  • showInfoCallback
  • update
  • bonfire
  • checkBonfireCommands
  • searchBonfire
  • checkHasBonfire
  • inBonfireRoom
  • hint
  • bf
  • explain
  • bot
  • hi
  • index
  • thank
  • log
  • archives
Maciej Bembenista
@macbem
Jan 12 2016 00:13
@timmyers1978 i got through it
karenkomine
@karenkomine
Jan 12 2016 00:13
@robojukie Really? Ok, let me work through it one more time...
Evans Ibok
@evansibok
Jan 12 2016 00:13
wiki deleting chats
CamperBot
@camperbot
Jan 12 2016 00:13
no wiki entry for: deleting chats
Evans Ibok
@evansibok
Jan 12 2016 00:14
wiki comments
CamperBot
@camperbot
Jan 12 2016 00:14

:point_right: waypoint use comments to clarify code [wiki]

Use Comments to Clarify Code

When we start using jQuery, we will modify HTML elements without needing to actually change them in HTML.

This is a great way to make websites with a particular structure. Remember that you can start a comment with <!-- and end a comment with -->

```
<!--You shouldn't need to modify code below this line -->

<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="col-xs-6">
<h4>#left-well</h4>
<div class="well" id="left-well">
<button class="btn btn-default target" id="target1">#target1</button>
<button class="btn btn-default target" id="target2">#target2</button>
<button class="btn btn-default target" id="target3">#target3</button>
</div>
</div>
<div class="col-xs-6">
<h4>#right-well</h4>
:pencil: read more about waypoint use comments to clarify code on the FCC Wiki

tommy
@tommygebru
Jan 12 2016 00:14
@evansibok EDIT: you can edit
DevPoetsSociety
@DevPoetsSociety
Jan 12 2016 00:15
@karenkomine You don't need to loop through contacts. You can call the variable
Evans Ibok
@evansibok
Jan 12 2016 00:15
How do I delete a typo ?
Typo chat
Nicolaica Catalin Mircea
@ncatalin
Jan 12 2016 00:15

anyone got idea's what is wrong here (record collection)

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

the single problem is : After update(1245, "tracks", "Addicted to Love"), tracks should have a length of 1

Maciej Bembenista
@macbem
Jan 12 2016 00:15
@DevPoetsSociety it's not like looping through is a bad thing :P
Tim Myers
@denvercoder
Jan 12 2016 00:15
@evansibok press the up arrow
Evans Ibok
@evansibok
Jan 12 2016 00:16
Testing
Ryan Thomas
@Placid7
Jan 12 2016 00:16
hi i have a question about escape sequences in strings. They are asking me to encode backslash tab tab carriage-return new-line. Are they asking for var myStr = \ \t \t \r \n;
Evans Ibok
@evansibok
Jan 12 2016 00:16
@timmyers1978 No up arrow here
CompGeekGirl
@LisaRamos
Jan 12 2016 00:16
@tommygebru I've tried doing that and it still wouldn't go through. Is there a solution?
Tim Myers
@denvercoder
Jan 12 2016 00:16
@evansibok On your keyboard
Maciej Bembenista
@macbem
Jan 12 2016 00:16
@Placid7 why don't you check if this code works? :P
Julie
@robojukie
Jan 12 2016 00:17
@karenkomine ok so what your code does:
Checks first name, if true, if it has property, then returns the correct value. If the first name did not match it automatically returns "no such property.
You want it to return "no such property if name matched and property did not.
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:17
@Placid7 I think so
Ryan Thomas
@Placid7
Jan 12 2016 00:17
weird I get var myStr = \ \t \t \r \n; // Change this line
ignore last
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:17
you need two \ to represent backslash
karenkomine
@karenkomine
Jan 12 2016 00:17
This is my code now:
for (var i = 0; i < contacts.length; i++) {
if (contacts[i].firstName === firstName) {
if (contacts[i].hasOwnProperty(prop)) {
return contacts[i][prop];
}
}
else if (contacts[i].firstName !== firstName) {
return "No such contact";
}
else {
return "No such property";
}
}
So now "No such contact" is working, but "No such property" won't..
tommy
@tommygebru
Jan 12 2016 00:18
@LisaRamos try posting the code & see what we have
karenkomine
@karenkomine
Jan 12 2016 00:18
I can feel it getting closer though...
CompGeekGirl
@LisaRamos
Jan 12 2016 00:18

@tommygebru Here it is.

function myTest(val) {
if(val < 10) {
return "Less than 10";
} else if(val < 5) {
return "Less than 5";
} else {
return "Greater than or equal to 10";
}
}

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

Evans Ibok
@evansibok
Jan 12 2016 00:18
@Placid7 myStr = "\\ \t \t \r \n";
tommy
@tommygebru
Jan 12 2016 00:18
@Placid7 also needs to be a string :smile:
Maciej Bembenista
@macbem
Jan 12 2016 00:19
@karenkomine use x.hasOwnProperty(property) :)
AgoraCoder
@AgoraCoder
Jan 12 2016 00:19
Man... I was so close lol. Thanks @everyone. lol
CamperBot
@camperbot
Jan 12 2016 00:19
agoracoder sends brownie points to @everyone :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for everyone
Maciej Bembenista
@macbem
Jan 12 2016 00:19
thanks @*
karenkomine
@karenkomine
Jan 12 2016 00:19
I did use it, I think my brackets are all wrong...
Maciej Bembenista
@macbem
Jan 12 2016 00:19
function lookUp(firstName, prop){
// Only change code below this line
  for (i=0; i<contacts.length; i++)

    {

      if(contacts[i].firstName == firstName)

          { 

            if(contacts[i].hasOwnProperty(prop))

                {

                  return contacts[i][prop];

                }

             else 

                {

                    return "No such property";

                }

          }

    } 

  return "No such contact";
Ryan Thomas
@Placid7
Jan 12 2016 00:19
@evansibok @tommygebru @Nyarlat-hotep thx
CamperBot
@camperbot
Jan 12 2016 00:19
placid7 sends brownie points to @evansibok and @tommygebru and @nyarlat-hotep :sparkles: :thumbsup: :sparkles:
:star: 250 | @tommygebru | http://www.freecodecamp.com/tommygebru
:star: 91 | @nyarlat-hotep | http://www.freecodecamp.com/nyarlat-hotep
:star: 158 | @evansibok | http://www.freecodecamp.com/evansibok
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:19

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

// Only change code below this line
var lookup = {
"alpha": "Adams",
"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");

tommy
@tommygebru
Jan 12 2016 00:19
@LisaRamos right now the else if is overwritten or ignored rearrange the content so that it is not ignored
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:20
anyone know how I finish this problem?
Julie
@robojukie
Jan 12 2016 00:20
@karenkomine Stick with your original code. You just need to move your else statement! For your edited code, that else if statement doesn't really change anything from what your original code did
CompGeekGirl
@LisaRamos
Jan 12 2016 00:20
@tommygebru How do I do that?
karenkomine
@karenkomine
Jan 12 2016 00:21
I got it @robojukie!!
tommy
@tommygebru
Jan 12 2016 00:21
@LisaRamos since 10>5 the else if is ignored therfore put 5 on top and 10 on bottom both are read if the argument is 7
karenkomine
@karenkomine
Jan 12 2016 00:21
Thank you @robojukie & @noczesc :)
CamperBot
@camperbot
Jan 12 2016 00:21
karenkomine sends brownie points to @robojukie and @noczesc :sparkles: :thumbsup: :sparkles:
:star: 298 | @noczesc | http://www.freecodecamp.com/noczesc
:star: 256 | @robojukie | http://www.freecodecamp.com/robojukie
Maciej Bembenista
@macbem
Jan 12 2016 00:21
you're welcome :P
Julie
@robojukie
Jan 12 2016 00:22
@karenkomine Hooray! Glad to have been helpful!
Maciej Bembenista
@macbem
Jan 12 2016 00:22
help me out with my zipline now, lol
CamperBot
@camperbot
Jan 12 2016 00:22
no wiki entry for: me out with my zipline now lol
Maciej Bembenista
@macbem
Jan 12 2016 00:22
:D
CompGeekGirl
@LisaRamos
Jan 12 2016 00:22
@tommygebru I got it. Thanks.
CamperBot
@camperbot
Jan 12 2016 00:22
lisaramos sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 251 | @tommygebru | http://www.freecodecamp.com/tommygebru
tommy
@tommygebru
Jan 12 2016 00:23
@LisaRamos :+1:
Tom
@logik2010
Jan 12 2016 00:23

Hello all - having issues understanding how to complete JS Waypoint: Using Objects for Lookups.

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

// Only change code below this line
var lookup = {
"alpha": "Adams",
"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");```

dorkybelle
@dorkybelle
Jan 12 2016 00:23
This message was deleted
Tom
@logik2010
Jan 12 2016 00:23
well that didnt work out as intended =/
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:23
@logik2010 same here
tommy
@tommygebru
Jan 12 2016 00:23
@noczesc there are separate rooms for different challenges...
Tom
@logik2010
Jan 12 2016 00:24
I understand how to access the names inside of the object just not how to access them within a function
from outside the function
Rahul Roy
@Roy1990
Jan 12 2016 00:24
@tgturner when ur usin a variable you use [...].. And if u know the exact key value of an object... Lets say "tree" we use myObj.tree hope i made myself clear... :)
Maciej Bembenista
@macbem
Jan 12 2016 00:24
@tommygebru chill out, I'm just joking :) Have a nice day!
tommy
@tommygebru
Jan 12 2016 00:25
@noczesc no worries :+1:
@logik2010 First the challenge asks to create an object from all of the data
dorkybelle
@dorkybelle
Jan 12 2016 00:27
This message was deleted
Tom
@logik2010
Jan 12 2016 00:27
@tommygebru i didn't do that?
rbeach94
@rbeach94
Jan 12 2016 00:27
I swear checkpoint golf codes is bugged!

else if (strokes == par) {
return "Par";

This returns par! it is saying incorrect and i have refreshed

tommy
@tommygebru
Jan 12 2016 00:29
@logik2010 idk I havent seen any of your code....
secondly the challenge asks to access the object to get to a property or value
Tom
@logik2010
Jan 12 2016 00:29

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

// Only change code below this line
var lookup = {
"alpha": "Adams",
"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");

Maciej Bembenista
@macbem
Jan 12 2016 00:30
@rbeach94 it's not :)
dorkybelle
@dorkybelle
Jan 12 2016 00:30
Hi all! I'm stuck on this checkpoint if someone could help that would be greatly appreciated!
http://www.freecodecamp.com/challenges/checkpoint-word-blanks
darkstrolm
@darkstrolm
Jan 12 2016 00:30
Need some help with Checkpoint: Profile Lookup. Anyone familiar with this exercise? It's new
tommy
@tommygebru
Jan 12 2016 00:30
@rbeach94 ? is it the capitalization
rbeach94
@rbeach94
Jan 12 2016 00:30
@tommygebru Nope, strokes has no capital and Par does have one
what am i meant to do now to pass?
tommy
@tommygebru
Jan 12 2016 00:31
@logik2010 looks good so far
rbeach94
@rbeach94
Jan 12 2016 00:31
I even checked it against the wiki, had the same code, even copied it too and it wont pass tests
tommy
@tommygebru
Jan 12 2016 00:32
@rbeach94 it looks fine post your entire code to look at the big picture...
darkstrolm
@darkstrolm
Jan 12 2016 00:32
@rbeach94 what browser are you using?
rbeach94
@rbeach94
Jan 12 2016 00:32
chrome
darkstrolm
@darkstrolm
Jan 12 2016 00:32
Try firefox
Tom
@logik2010
Jan 12 2016 00:32
i cannot go beyond that because I don't understand how to access the lookup table from outside of the function
@tommygebru
rbeach94
@rbeach94
Jan 12 2016 00:32
function golfScore(par, strokes) {
  // Only change code below this line
  if (strokes == 1) {
    return "Hole-in-one!";
  } else if (strokes <= par - 2) {
    return "Eagle";
  } else if (par, par--) {
    return "Birdie";
  } else if (strokes == par) {
    return "Par";
  } else if (strokes == par +1) {
    return "Bogey";
  } else if (strokes == par +2) {
    return "Double Bogey";
  } else {
    return "Go Home!";
```
tommy
@tommygebru
Jan 12 2016 00:33
@logik2010 so your object needs to be accessed by the only thing that can pass through calling a function
the parameter!
function(parameter);//this function is being called
darkstrolm
@darkstrolm
Jan 12 2016 00:34
@rbeach94 could try
else if (strokes >= par + 3) {
    return "Go Home!";
rbeach94
@rbeach94
Jan 12 2016 00:35
@darkstrolm just tried firefox, no success.
tommy
@tommygebru
Jan 12 2016 00:35
@rbeach94 fix third if statement
Tom
@logik2010
Jan 12 2016 00:35

@tommygebru it's currently phoneticLookup(val)

how do I point the parameter to lookup.whatever in the area i'm instructed to work in?

rbeach94
@rbeach94
Jan 12 2016 00:35
@rbeach94 it is failing from par onwards
mbthorne
@mbthorne
Jan 12 2016 00:36
So, reading this thread so far I can see that my question is far behind where everyone else seems to have trouble. However, I am stumped nonetheless and any help would be appreciated!
Charles Stoy
@charst46
Jan 12 2016 00:36
Working targeting the parent of an element using jQuery. Looked at several sources for an answer. My code that used to work no longer does so. Here is my code:$(document).ready(function() {
$("#target1").class("color", "red");
$("#target1").prop("disabled", true);
$("#target4").remove();
$("#target").appendTo("#right-well");
$("#target5").clone().appendTo("#left-well");
$("#target1").parent().css("background-color","red");
}); what am I missing/doing wrong?
darkstrolm
@darkstrolm
Jan 12 2016 00:37
@rbeach94 maybe this?
else if (strokes == par - 1) {
    return "Birdie";
rbeach94
@rbeach94
Jan 12 2016 00:37
@tommygebru thanks, it had passed the test so didn't notice!
@darkstrolm sorted now thank you it was the third if statement
CamperBot
@camperbot
Jan 12 2016 00:37
rbeach94 sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 253 | @tommygebru | http://www.freecodecamp.com/tommygebru
rbeach94 sends brownie points to @darkstrolm :sparkles: :thumbsup: :sparkles:
:star: 260 | @darkstrolm | http://www.freecodecamp.com/darkstrolm
darkstrolm
@darkstrolm
Jan 12 2016 00:38
@rbeach94 cheers :smile:
rbeach94
@rbeach94
Jan 12 2016 00:38
@mbthorne what's up?
Jasmine W
@jnwright
Jan 12 2016 00:38

Hi everyone, I'm having trouble with the Profile Lookup checkpoint. Can anyone help me figure out why my code isn't working?

for (var i=0; i<contacts.length; i++) {
  if (contacts[i].firstName === firstName && contacts[i].hasOwnProperty(prop)) {
  return contacts[i][prop];
}
  else if (contacts[i].firstName === firstName && !contacts[i].hasOwnProperty(prop)) {
    return "No such property";
  }
    else if (contacts[i].firstName !== firstName) {
    return "No such contact";
  }
// Only change code above this line
}

it returns everything fine for the first level of arrays, but doesn't work after that

Patricks2k
@Patricks2k
Jan 12 2016 00:38
This message was deleted
tommy
@tommygebru
Jan 12 2016 00:39
@logik2010
result=lookup[val]
smk319
@smk319
Jan 12 2016 00:40
could someone help me with the waypoint: assignment with a returned value?
I've reviewed the other things I've done with variables/functions in js and have no clue where to go from this starting point:
```
// Setup
var processed = 0;

function process(num) {
  return (num + 3) / 5;
}

// Only change code below this line
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:42
thanks @tommygebru. knew it was simple af
Charles C. Wu
@charleswusf
Jan 12 2016 00:42
@jnwright I think the major issue is that when you "return" you drop out of the function. This means that you will never get past the first array.
CamperBot
@camperbot
Jan 12 2016 00:42
nyarlat-hotep sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 254 | @tommygebru | http://www.freecodecamp.com/tommygebru
tommy
@tommygebru
Jan 12 2016 00:42
@Nyarlat-hotep was it Lookup?
mbthorne
@mbthorne
Jan 12 2016 00:42
@rbeach94 well I sent that before I could even attach my screenshot of the problem -_- I am on "Waypoint: Use a CSS Class to Style an Element" and I can't figure out what I'm doing wrong. I have changed the text to red but don't have 'red-text' declared in the style sheet so it's not letting me move ahead. Also, trying to figure out how to insert my screen shot here. Clearly very very new to this! Thank you so much for the response.
CamperBot
@camperbot
Jan 12 2016 00:42
:star: 199 | @rbeach94 | http://www.freecodecamp.com/rbeach94
mbthorne sends brownie points to @rbeach94 :sparkles: :thumbsup: :sparkles:
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:43
@smk319 I think you need to specify a value for num when you call your function
tommy
@tommygebru
Jan 12 2016 00:43
@smk319 remember an assignment is merely =
in this challenge we are assigning one variable to another
Tom
@logik2010
Jan 12 2016 00:43
I know that would work well but i'm not supposed to modify any code above or below my hash table - i assume that is in error @tommygebru
Farzaneh
@FarzanehNezarati
Jan 12 2016 00:44
hi
Encode the following sequence, separated by spaces:
backslash tab tab carriage-return new-line and assign it to myStr
how i should do this?
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:44
@tommygebru it was what you had said. result = lookup[val];
@logik2010 you don't have to modify anything outside of the //s
tommy
@tommygebru
Jan 12 2016 00:45
@Nyarlat-hotep :+1:
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:45

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

// Only change code below this line
var lookup = {
"alpha": "Adams",
"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");

Tom
@logik2010
Jan 12 2016 00:45
thankyou @tommygebru
nvm
tommy
@tommygebru
Jan 12 2016 00:46
@logik2010 whats a hash table?
Tom
@logik2010
Jan 12 2016 00:46
thanks @tommygebru
neuromeda
@neuromeda
Jan 12 2016 00:47
anyone stuck on JS record collection? no idea where to even begin
Crazypkr1099
@Crazypkr1099
Jan 12 2016 00:47
Im having a problem with Waypoint: Target the same element with multiple jQuery Selectors
Only add one class with each of your three selectors.
what does that mean?
darkstrolm
@darkstrolm
Jan 12 2016 00:47
Does anyone know how to solve for "If firstName does not correspond to any contacts then return "No such contact""
Tom
@logik2010
Jan 12 2016 00:47
i should've said lookup tables - PHP coming out
tommy
@tommygebru
Jan 12 2016 00:47
@FarzanehNezarati the symbols are to your left place them in a string dont forget to space :smile:
smk319
@smk319
Jan 12 2016 00:48
thanks @tommygebru I still need to try to write the code but your explanation was a lot more succinct than what I've looked up elsewhere
CamperBot
@camperbot
Jan 12 2016 00:48
logik2010 sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
smk319 sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 255 | @tommygebru | http://www.freecodecamp.com/tommygebru
:star: 255 | @tommygebru | http://www.freecodecamp.com/tommygebru
darkstrolm
@darkstrolm
Jan 12 2016 00:48
I am having trouble with this because contacts[i].firstName != firstName ends up being true even if firstName belongs to one of the objects inside the array
Using a for loop to check inside all the objects
cooper-t
@cooper-t
Jan 12 2016 00:49
Can someone please help me with the Counting Cards Checkpoint
dorkybelle
@dorkybelle
Jan 12 2016 00:50

@mbthorne <style>

.red-text {color:red;}

</style>

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

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

darkstrolm
@darkstrolm
Jan 12 2016 00:50
So it runs contacts.length times and ends up with one true and some falses for when firstName actually belongs to one of the objects inside the array, or all falses when firstName is arbitrary
tommy
@tommygebru
Jan 12 2016 00:50
@dorkybelle close your first heading2 tag
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:51
@cooper-t I did that recently. What are you stuck on?
cooper-t
@cooper-t
Jan 12 2016 00:51

var count = 0;

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

break;

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

break;

}

if (count > 0) {
return count + "Bet" ;
} else {
return count + "Hold" ;
}

// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(4); cc(5); cc(6);

Farzaneh
@FarzanehNezarati
Jan 12 2016 00:51
@tommygebru its not working :(
cooper-t
@cooper-t
Jan 12 2016 00:51
I dont know where I'm doing wrong
Jasmine W
@jnwright
Jan 12 2016 00:52
@charleswusf even if it can't return anything? shouldn't it keep going until it can return something?
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:52
@cooper-t you need to be using if/else statements not switch
mbthorne
@mbthorne
Jan 12 2016 00:53
@dorkybelle Thank you so much!!! The trouble I was having is that I was leaving h2 inside of the style sheet. I had everything right except for that. Such a relief, thank you for your help!
CamperBot
@camperbot
Jan 12 2016 00:53
mbthorne sends brownie points to @dorkybelle :sparkles: :thumbsup: :sparkles:
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:53
@cooper-t Here's the first if to get you started. if (card >= 2 && card <= 6) {
count++;
return count + " Bet";
CamperBot
@camperbot
Jan 12 2016 00:53
:star: 164 | @dorkybelle | http://www.freecodecamp.com/dorkybelle
darkstrolm
@darkstrolm
Jan 12 2016 00:53
@Nyarlat-hotep you can do counting cards with switch as well @cooper-t
dorkybelle
@dorkybelle
Jan 12 2016 00:53
@mbthorne glad I was able to help :) !
cooper-t
@cooper-t
Jan 12 2016 00:54
I'll give it a shot thanks @Nyarlat-hotep
CamperBot
@camperbot
Jan 12 2016 00:54
cooper-t sends brownie points to @nyarlat-hotep :sparkles: :thumbsup: :sparkles:
:star: 93 | @nyarlat-hotep | http://www.freecodecamp.com/nyarlat-hotep
tommy
@tommygebru
Jan 12 2016 00:54
@FarzanehNezarati
var variable = "item1 item2 ";// no commas
dorkybelle
@dorkybelle
Jan 12 2016 00:54

@tommygebru function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line

// Your code above this line

return result;
}

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

Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:54
@cooper-t no problem, that was the easiest way I could figure it out
darkstrolm
@darkstrolm
Jan 12 2016 00:55
@cooper-t if you add case 7, case 8, case 9 to your switch and set it to add 0 to the count, it might work. Currently your switch does not address what happens when the card is 7, 8 or 9.
dorkybelle
@dorkybelle
Jan 12 2016 00:55
This message was deleted
CamperBot
@camperbot
Jan 12 2016 00:55
sorry dorkybelle, you can't send brownie points to yourself! :sparkles: :sparkles:
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 00:55
lol
tommy
@tommygebru
Jan 12 2016 00:55
@dorkybelle The challenge is asking you to create a sentence form strings, concatenate the given strings, but also add your own words to it :smile:
dorkybelle
@dorkybelle
Jan 12 2016 00:57
@tommygebru Hmmm. I'll go through the lessons one more time because I guess the lessons didn't stick. Thanks for the advice.
CamperBot
@camperbot
Jan 12 2016 00:57
dorkybelle sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 256 | @tommygebru | http://www.freecodecamp.com/tommygebru
tommy
@tommygebru
Jan 12 2016 00:57
@LisaRamos a default is basically an else within an if statement
darkstrolm
@darkstrolm
Jan 12 2016 00:57
Anyone know how to do "If firstName does not correspond to any contacts then return "No such contact"" in Checkpoint: Profile Lookup?
Please help.
tommy
@tommygebru
Jan 12 2016 00:59
@dorkybelle sure, also post the link or Waypoint challenge name :smile:
And it says "Note that in most cases, img elements are self-closing" but self-closing tags were never previously introduced.
tommy
@tommygebru
Jan 12 2016 00:59
@PritchardAlexander true
some examples of html self-closing tags
img, input, br, hr, meta, etc.
http://blog.teamtreehouse.com/to-close-or-not-to-close-tags-in-html5
PritchardAlexander
@PritchardAlexander
Jan 12 2016 01:00
I would strongly suggest adding something like, ", which means they only have one tag, which begins with the element name and ends in a />"
How would I formally make this suggestion or submit a modification?
Farzaneh
@FarzanehNezarati
Jan 12 2016 01:01
@tommygebru var myStr =' \ \t \t \r \n '; ???
tommy
@tommygebru
Jan 12 2016 01:02
@FarzanehNezarati var myString= double backslash and spaces dont forget spaces
var myStr="\\ \t \t \r \n";
dorkybelle
@dorkybelle
Jan 12 2016 01:04
tommy
@tommygebru
Jan 12 2016 01:04
@PritchardAlexander team@freecodecamp.com or github or reddit
Farzaneh
@FarzanehNezarati
Jan 12 2016 01:05
@tommygebru thank you :)
CamperBot
@camperbot
Jan 12 2016 01:05
farzanehnezarati sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 257 | @tommygebru | http://www.freecodecamp.com/tommygebru
tommy
@tommygebru
Jan 12 2016 01:05
@FarzanehNezarati :smile:
@dorkybelle show what you have
result="Words " + " Words " +" Words.";
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:08
This message was deleted
so screenshotting? haha
dorkybelle
@dorkybelle
Jan 12 2016 01:09
I will give that a try! Thanks @tommygebru
CamperBot
@camperbot
Jan 12 2016 01:09
dorkybelle sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:warning: dorkybelle already gave tommygebru points
Erland Lami
@Texber
Jan 12 2016 01:09
// Setup
function abTest(a, b) {
  // Only change code below this line
  if(a, b < 0) {
    return "undefined";
  }
Please help...Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined.
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:10
if(a < 0 || b < 0) { maybe?
@Texber
David Rivera
@dvriv
Jan 12 2016 01:10
any idea what i'm doing wrong?
This should be something really stupid but i dont see what is wrong.
It is returning undefined when it should be returning true.
What im trying is to subtract 2 to n until 0 or 1 using Recursion.
function x(n) {
    if (n == 0) 
        return true;

    else if (n == 1) 
        return false; 

    else 
        x(n - 2);   
}

console.log(x(6));
tommy
@tommygebru
Jan 12 2016 01:11
@Dav1605 is output 4?
Erland Lami
@Texber
Jan 12 2016 01:12
@Nyarlat-hotep that didn't work but I appreciate it
David Rivera
@dvriv
Jan 12 2016 01:12
@tommygebru undefined
Erland Lami
@Texber
Jan 12 2016 01:12
I'm not sure how to correct this
Evans Ibok
@evansibok
Jan 12 2016 01:12
Checkpoint: Word Blanks. What am I expected to do there. Confuses me..
Erland Lami
@Texber
Jan 12 2016 01:13
// Setup
function abTest(a, b) {
  // Only change code below this line
  if(a < 0 || b < 0) {
    return "undefined";
  }


  // Only change code above this line

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

// Change values below to test your code
abTest(2,2);
I made these changes but no luck
Bill
@kirah1314
Jan 12 2016 01:13
@Texber remove the quotes from undefined, it shouldn't be a string
Eina
@thelittleblacksmith
Jan 12 2016 01:13
@Texber don't put quotes around 'undefined'
tommy
@tommygebru
Jan 12 2016 01:13
@Dav1605
function x(n) {
    if (n == 0) 
       { return true;}

    else if (n == 1) 
       { return false; }

    else {return n-2;}
}
Erland Lami
@Texber
Jan 12 2016 01:14
@kirah1314 @thelittleblacksmith Yes! Thanks so much
CamperBot
@camperbot
Jan 12 2016 01:14
texber sends brownie points to @kirah1314 and @thelittleblacksmith :sparkles: :thumbsup: :sparkles:
:star: 796 | @kirah1314 | http://www.freecodecamp.com/kirah1314
:star: 253 | @thelittleblacksmith | http://www.freecodecamp.com/thelittleblacksmith
Holly Williford
@hollyhascode
Jan 12 2016 01:14
can someone help me with waypoint testing objects for properties
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:14
@Texber how are you screenshotting?
Erland Lami
@Texber
Jan 12 2016 01:14
I put this

code formatting
Jasmine W
@jnwright
Jan 12 2016 01:15
can anyone help?
for (var i=0; i<contacts.length; i++) {
  if (contacts[i].firstName === firstName && contacts[i].hasOwnProperty(prop)) {
  return contacts[i][prop];
}
  else if (contacts[i].firstName === firstName && !contacts[i].hasOwnProperty(prop)) {
    return "No such property";
  }
    else if (contacts[i].firstName !== firstName) {
    return "No such contact";
  }
// Only change code above this line
}
it's only going through the first array and won't go on to any other levels
Erland Lami
@Texber
Jan 12 2016 01:15
@Nyarlat-hotep hit the button under the escape key 3 times, paste your code inside it
John Cerpa
@johncerpa
Jan 12 2016 01:15
// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};

// Only change code below this line;

var playerNumber = testObj[Montana];      // Change this Line
var player = testObj[16];   // Change this Line
playerNumber should be a number
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:16

```// Setup
function myTest(val) {
// Only Change Code Below this Line

if (val !== 17) {

// Only Change Code Above this Line

return "Not Equal";

}
return "Equal";
}

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

Holly Williford
@hollyhascode
Jan 12 2016 01:16
johncerpa I think both parameters need to be 16 if I remember correctly
John Cerpa
@johncerpa
Jan 12 2016 01:16
Use the playerNumber variable to lookup player 16 in testObj using bracket notation.
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:16

```// Setup
function myTest(val) {
// Only Change Code Below this Line

if (val !== 17) {

// Only Change Code Above this Line

return "Not Equal";

}
return "Equal";
}

// Change this value to test
myTest(10);
```

Erland Lami
@Texber
Jan 12 2016 01:16
@Nyarlat-hotep correction. Hit that button 3 times, press shift + enter, and paste the code inside it
John Cerpa
@johncerpa
Jan 12 2016 01:17
// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};

// Only change code below this line;

var playerNumber = 16;      // Change this Line
var player = testObj[16];   // Change this Line
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:17
// Setup
function myTest(val) {
  // Only Change Code Below this Line

  if (val !== 17) {

  // Only Change Code Above this Line

    return "Not Equal";
  }
  return "Equal";
}

// Change this value to test
myTest(10);
David Rivera
@dvriv
Jan 12 2016 01:17
@tommygebru ok thank you!! :D
I dont get why i need to return it
CamperBot
@camperbot
Jan 12 2016 01:17
dav1605 sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:17
nice! thanks @Texber
CamperBot
@camperbot
Jan 12 2016 01:17
:star: 258 | @tommygebru | http://www.freecodecamp.com/tommygebru
Chris Durden
@PatchRhythm
Jan 12 2016 01:17
can someone help with Checkpoint: Word Blanks?
John Cerpa
@johncerpa
Jan 12 2016 01:17
help
CamperBot
@camperbot
Jan 12 2016 01:17

Hi, I'm CamperBot! I can help you in this chatroom :smile:

Basic Commands:

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

:speech_balloon: meet CamperBot in this room!

:pencil: read more about camperbot on the FCC Wiki

John Cerpa
@johncerpa
Jan 12 2016 01:18
// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};

// Only change code below this line;

var playerNumber = 16;      // Change this Line
var player = testObj[16];   // Change this Line
can anyone help
alexandragrace
@alexandragrace
Jan 12 2016 01:18
<form action="/submit-cat-photo"<input type="text" placeholder="cat photo URL"></form>
David Rivera
@dvriv
Jan 12 2016 01:19
@tommygebru oh nvm that isnt working
alexandragrace
@alexandragrace
Jan 12 2016 01:19
I am really lost... my text input element is supposed to be nested within my form, but I think I've already done that??

Confused

Eina
@thelittleblacksmith
Jan 12 2016 01:19
@johncerpa you need to call playerNumber instead of 16 in player
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:20
This message was deleted
John Cerpa
@johncerpa
Jan 12 2016 01:20
what should go in playerNumber
ohh
thanks man
Eina
@thelittleblacksmith
Jan 12 2016 01:20
:+1:
David Rivera
@dvriv
Jan 12 2016 01:20
@tommygebru what you did made it return 4 when it should return true or false (it should keep substracting 2 until 0 or 1)
tommy
@tommygebru
Jan 12 2016 01:21
@Dav1605 maybe a loop is needed?
alexandragrace
@alexandragrace
Jan 12 2016 01:22
@Nyarlat-hotep - that didn't change anything, but thank you for the input!
CamperBot
@camperbot
Jan 12 2016 01:22
alexandragrace sends brownie points to @nyarlat-hotep :sparkles: :thumbsup: :sparkles:
:star: 94 | @nyarlat-hotep | http://www.freecodecamp.com/nyarlat-hotep
tommy
@tommygebru
Jan 12 2016 01:22
@hollyhascode are you still stuck ?
David Rivera
@dvriv
Jan 12 2016 01:22
@tommygebru i can do it with a loop. I am testing recursion.
dorkybelle
@dorkybelle
Jan 12 2016 01:22
@alexandragrace what is the lesson called
tommy
@tommygebru
Jan 12 2016 01:23
@Dav1605 idk what recursion is...
alexandragrace
@alexandragrace
Jan 12 2016 01:23
create a form element
Holly Williford
@hollyhascode
Jan 12 2016 01:23
yes
is it an if else problem
should I be integrating the myObj.hasOwnProperty with if else?
David Rivera
@dvriv
Jan 12 2016 01:24
@tommygebru the function call itselft until the first o second if are true
alexandragrace
@alexandragrace
Jan 12 2016 01:25
figured it out, thanks all
Jasmine W
@jnwright
Jan 12 2016 01:25
has anyone completed the profile lookup waypoint? i'm having trouble with it
cooper-t
@cooper-t
Jan 12 2016 01:25
@PatchRhythm do you still need help
David Rivera
@dvriv
Jan 12 2016 01:25
any idea what i am doing wrong?
This should be something really stupid but i dont see what is wrong.
It is returning undefined when it should be returning true.
What im trying is to subtract 2 to n until 0 or 1 using Recursion.
function x(n) {
    if (n == 0) 
        return true;

    else if (n == 1) 
        return false; 

    else 
        x(n - 2);   
}

console.log(x(6));
nesac
@nesac
Jan 12 2016 01:25
i am stuck on the uncomment HTML..HELP
tommy
@tommygebru
Jan 12 2016 01:27
@Dav1605 maybe remove second x?
Billboz
@Billboz
Jan 12 2016 01:27
Hey Peeps… I have been stuck on this for a couple hours now. I keep getting close but can’t get the whole thing to work. Waypoint: Testing Objects for Properties. This code is not passing the first and second test but is passing the third.
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};
function checkObj(checkProp) {
  // Your Code Here
  if (myObj.hasOwnProperty === true) {
    return myObj([checkProp]);
  } else {
  return "Not Found";
  }
}
// Test your code by modifying these values
checkObj("bed”);
any help is appreciated
Evans Ibok
@evansibok
Jan 12 2016 01:27

Need help with Checkpoint : Word Blanks

Not sure what I'm supposed to do here:


function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
    var result = "";
    // Your code below this line


    // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
Holly Williford
@hollyhascode
Jan 12 2016 01:27
me too Billboz
tommy
@tommygebru
Jan 12 2016 01:28
@hollyhascode yes you should create an if statement!
Billboz
@Billboz
Jan 12 2016 01:28
@hollyhascode I am sure our peeps can help
tommy
@tommygebru
Jan 12 2016 01:28
@evansibok create a string for result and create a sentence using the given words also add your own words to it
preetamac
@preetamac
Jan 12 2016 01:29
hey hi friends i need a help
dorkybelle
@dorkybelle
Jan 12 2016 01:30

@alexandragrace <form action ="/submit-cat-photo">

<input type="text" placeholder="cat photo URL">
</form>

tommy
@tommygebru
Jan 12 2016 01:30
@Billboz .hasOwnProperty automatically evaluates to true or false
@preetamac welcome
preetamac
@preetamac
Jan 12 2016 01:31
can anybody explain me about uninitialized variables i,and as per instruction i have done the code but its not working the code is as follows
Billboz
@Billboz
Jan 12 2016 01:31
@tommygebru right, I am trying to use that to separate the good from the bad.
preetamac
@preetamac
Jan 12 2016 01:31
var a=6;
var b=15;
var c="i am a";
Dan
@dan4505
Jan 12 2016 01:32
question regarding: Bonfire: Return Largest Numbers in Arrays. I solved it successfully but it showed a syntax error for a "missing semicolon." I tried the code here- http://www.webtoolkitonline.com/javascript-tester.html and it suggested to not make a function within a loop.
is it okay to use a sort function within a loop?
preetamac
@preetamac
Jan 12 2016 01:33
hey hi tommygebru
tommy
@tommygebru
Jan 12 2016 01:33
@dan4505 have you tried the Bonfire room?
help rooms
preetamac
@preetamac
Jan 12 2016 01:33
no
tommy
@tommygebru
Jan 12 2016 01:33
@preetamac does uninitialized mean i
Dan
@dan4505
Jan 12 2016 01:33
no. still pretty new. didn't know it was separate. will try there
tommy
@tommygebru
Jan 12 2016 01:34
@dan4505 :+1:
Blake Wight
@bwighthunter
Jan 12 2016 01:34
Who needs help?
tommy
@tommygebru
Jan 12 2016 01:34
@Billboz @hollyhascode
(myObj.hasOwnProperty(checkProp))
preetamac
@preetamac
Jan 12 2016 01:35
in the instruction they told me to do this "Initialize the three variables a, b, and c with 5, 10, and "I am a" respectively so that they will not be undefined."
Billboz
@Billboz
Jan 12 2016 01:35
thanks @tommygebru I am going to think about that for a minute
CamperBot
@camperbot
Jan 12 2016 01:35
billboz sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 259 | @tommygebru | http://www.freecodecamp.com/tommygebru
preetamac
@preetamac
Jan 12 2016 01:36
which i did but still when i run n test its not working
Holly Williford
@hollyhascode
Jan 12 2016 01:36
thanks @tommygebru
CamperBot
@camperbot
Jan 12 2016 01:36
hollyhascode sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 260 | @tommygebru | http://www.freecodecamp.com/tommygebru
Blake Wight
@bwighthunter
Jan 12 2016 01:36
@preetamac I would guess they are looking for something like this : ```
var
tommy
@tommygebru
Jan 12 2016 01:36
@preetamac can you post link or waypoint name please :smile:
Blake Wight
@bwighthunter
Jan 12 2016 01:36
var a = 5
var b = 10
Coding Warrior
@CodingWarrior
Jan 12 2016 01:37
@bwighthunter ME ME ME please ... I just arrived at 'CODING IS HARD' section. Qs: 1) How many hours needed 2B vested so that I don't kill myself on the FRONTEND?
Blake Wight
@bwighthunter
Jan 12 2016 01:37
var c = "i am a"
@CodingWarrior hold on, lemme look
Holly Williford
@hollyhascode
Jan 12 2016 01:37
so if you do an if statement and just add in stuff with the parenthesis it adds it into the parameters
Blake Wight
@bwighthunter
Jan 12 2016 01:38
@CodingWarrior Which set of bonfires?
Holly Williford
@hollyhascode
Jan 12 2016 01:38
oh that is how you odd a property
*add
Holly Williford
@hollyhascode
Jan 12 2016 01:39
alright!
thanks again!
Coding Warrior
@CodingWarrior
Jan 12 2016 01:40
@bwighthunter bonfires? Hmmm...I'm referring to the bootcamp steps, where I've pledged to commit to Stack, and completed several steps to arrive at 'CODING IS HARD' section
Pathrinathan (Pat). P
@pathmanp
Jan 12 2016 01:40

any idea, how to re-write this code with out using If else statement (Waypoint: Returning Boolean Values from Functions)

function isLess(a, b) {
// Fix this code
if(a < b) {
return true;
} else {
return false;
}
}

// Change these values to test
isLess(10, 15);

@preetamac @CodingWarrior

David Rivera
@dvriv
Jan 12 2016 01:41
@code4ninja return a < b
Pathrinathan (Pat). P
@pathmanp
Jan 12 2016 01:41
are the asking me to write with case? I'm don't get the question. @CodingWarrior
@Dav1605 return a <b, but doesn't have meet any conditions?
David Rivera
@dvriv
Jan 12 2016 01:42
@code4ninja what conditions do you see?
Evans Ibok
@evansibok
Jan 12 2016 01:43
@tommygebru Like this?

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
    var result = "";
    // Your code below this line
    result = "The big dog ran quickly";

    // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog", "bit", "ran", "quickly");
Blake Wight
@bwighthunter
Jan 12 2016 01:43
@CodingWarrior look at this, and see if it doesnt answer your question: http://www.freecodecamp.com/map
Pathrinathan (Pat). P
@pathmanp
Jan 12 2016 01:43
f(a < b) {
return true;
@Dav1605
nf15
@nf15
Jan 12 2016 01:43
need help on this..thanks...Waypoint: Local Scope and Functions...Declare a local variable myVar inside myFunction
David Rivera
@dvriv
Jan 12 2016 01:44
a < b return true already
tommy
@tommygebru
Jan 12 2016 01:44
@evansibok yes but also you are suppose to concatenate the strings that way it will join later the way you have it now
Pathrinathan (Pat). P
@pathmanp
Jan 12 2016 01:44
@Dav1605 how this possibly equal to return a,b;
@Dav1605 sorry. equal to a < b
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:44
@evansibok "The " + myNoun + "etc...."
nf15
@nf15
Jan 12 2016 01:44

here is my answer.....function myFunction() {
var myVar = 'use strict';

}

myFunction();

Pathrinathan (Pat). P
@pathmanp
Jan 12 2016 01:44
@Dav1605 i meant return a<b
David Rivera
@dvriv
Jan 12 2016 01:45
< is a comparison operator
< return true or false
if you ask
nf15
@nf15
Jan 12 2016 01:45
But couldnt come up right with this...No global myVar variable
David Rivera
@dvriv
Jan 12 2016 01:45

for example if you do:

a == b

It will return true if a == b and false if a isnt == b

jmesa92
@jmesa92
Jan 12 2016 01:45
How do you make the code return "-3 Hold" or "5 bet" on checkpoint "counting cards"
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:46
@jmesa92 I can show you how I was doing it
Erland Lami
@Texber
Jan 12 2016 01:47
var count = 0;

function cc(card) {
  // Only change code below this line
  if(card = 2) {
    return "5 Bet";
  }

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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
tommy
@tommygebru
Jan 12 2016 01:47
@hollyhascode @Billboz
function checkObj(checkProp) {
  // Your Code Here
   if (myObj.hasOwnProperty(checkProp))//checkprop is a string being called
     {return myObj[checkProp];}//accessing object  through the string
  else if(myObj.hasOwnProperty(checkProp))//again
     {return myObj[checkProp];}//again
else//checkprop will turn up empty here
{return "Not Found";}//this is naturally not found
}

// Test your code by modifying these values
checkObj("gift");//this is checkProp that access the function block
Erland Lami
@Texber
Jan 12 2016 01:47
I'm on the same one. Please check anyone and point me in the right direction
jmesa92
@jmesa92
Jan 12 2016 01:47
@Nyarlat-hotep okay, that would probably help alot
Erland Lami
@Texber
Jan 12 2016 01:47
var count = 0;

function cc(card) {
  // Only change code below this line
  if(card = 2) {
    return "5 Bet";
  }

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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:48
@Texber @jmesa92 I used if/else if/else statements.
if (card >= 2 && card <= 6) {
count++;
return count + " Bet";
}
that is the if portion.
jmesa92
@jmesa92
Jan 12 2016 01:49
@Nyarlat-hotep well, that seems much easier than trying to use a switch
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:49
lol people keep using the switch but yea I found this much easier.
Erland Lami
@Texber
Jan 12 2016 01:49
@Nyarlat-hotep what does count++ mean again?
nf15
@nf15
Jan 12 2016 01:50
help! Waypoint: Local Scope and Functions...Declare a local variable myVar inside myFunction
CamperBot
@camperbot
Jan 12 2016 01:50
no wiki entry for: waypoint local scope and functionsdeclare a local variable myvar inside myfunction
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:50
increment that 0 variable by 1. You can also decrement it by 1 with count--;
@Texber
Dominic Mensah
@mensahdx
Jan 12 2016 01:50

Hey everyone, i am stuck on this JavaScript, the question is assign the contents of a to variable. // Setup
var a = 7;
var b = 2;

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

Please what am i doing wrong? It is returning an error
Erland Lami
@Texber
Jan 12 2016 01:50
@Nyarlat-hotep I see
tommy
@tommygebru
Jan 12 2016 01:51

@evansibok

result="Hi " + myNoun + " hello " + myAdjective + " big " + myVerb + " ran " + myAdverb + " quickly ";

add spaces and your own words as well as concatenating the given strings

Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:51
@Texber so if the card is >= 2 and <= to 6, increment count by 1, making it +1
Dominic Mensah
@mensahdx
Jan 12 2016 01:51
Nevermind, i have figured it out
nf15
@nf15
Jan 12 2016 01:52
@mensahdx write the waypoint question
ok
no genius here to answer mine:)
Ok I go google!!
Erland Lami
@Texber
Jan 12 2016 01:53
@Nyarlat-hotep I have to think hard about what you described as it's not clicking with me
Eina
@thelittleblacksmith
Jan 12 2016 01:54
@nf15 what are you having issues with?
nf15
@nf15
Jan 12 2016 01:54
Waypoint: Local Scope and Functions...Declare a local variable myVar inside myFunction

@thelittleblacksmith here is my answer.....function myFunction() {
var myVar = 'use strict';

}

myFunction();

tommy
@tommygebru
Jan 12 2016 01:55
@nf15 :+1:
nf15
@nf15
Jan 12 2016 01:55
But couldnt come up right with this: No global myVar variable
jmesa92
@jmesa92
Jan 12 2016 01:55
@Nyarlat-hotep Okay, now another silly question, how do I make it return the sum and and Bet/Hold

'var count = 0;

function cc(card) {
// Only change code below this line
if(card >= 2 && card <= 6){
return count + "Hold";
}else if (card >= 7 && card <= 9){
return count;
}else if (card == 10 || card == 'J' || card == 'Q' || card == 'K' || card == 'A'){
return count + "Bet";
}
return count + "Bet";
// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');'

Eina
@thelittleblacksmith
Jan 12 2016 01:56
@nf15 there's no other variable before the function right?
nf15
@nf15
Jan 12 2016 01:57
@thelittleblacksmith ..yes. where is my mistake?
John Cerpa
@johncerpa
Jan 12 2016 01:57
// Setup
function phoneticLookup(val) {
  var result = "";

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

    "alpha": "Adams",
    "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");
Brian
@sludge256
Jan 12 2016 01:57
do you still have a console.log outside of the function?
Nyarlat-hotep
@Nyarlat-hotep
Jan 12 2016 01:58
@jmesa92 you only need one if else in there. you also forgot to add in count++ to your first if statement.
if (card >= 2 && card <= 6) {
count++;
return count + " Bet";
}
sorry one else if
nf15
@nf15
Jan 12 2016 01:58
@modest-hobbit no, I removed that
Erland Lami
@Texber
Jan 12 2016 01:58
@jmesa92 I'm on the exact same one.
var count = 0;

function cc(card) {
  // Only change code below this line
  if(card >= 2 && card <=6) {
    count++;
    return count+ " Bet";
  }

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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
John Cerpa
@johncerpa
Jan 12 2016 01:58
can anyone help me
// Setup
function phoneticLookup(val) {
  var result = "";

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

    "alpha": "Adams",
    "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");
nf15
@nf15
Jan 12 2016 01:58
Oops @sludge256 I removed that
John Cerpa
@johncerpa
Jan 12 2016 01:58
You should not use case, switch, or if statements
Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string.
Brian
@sludge256
Jan 12 2016 01:59
@johncerpa you need to "lookup" what val is

@johncerpa pass val into lookup similar to what is in the example

alpha[value];

and assign it to the variable result

jmesa92
@jmesa92
Jan 12 2016 02:00

```var count = 0;

function cc(card) {
// Only change code below this line
if(card >= 2 && card <= 6){
count++;
return count + "Hold";
}else if (card == 10 || card == 'J' || card == 'Q' || card == 'K' || card == 'A'){
count --;
return count + "Bet";
}

// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
```

John Cerpa
@johncerpa
Jan 12 2016 02:01
hmn let me see
Brian
@sludge256
Jan 12 2016 02:01
@nf15 can you paste in everything from your code window?
tommy
@tommygebru
Jan 12 2016 02:01
@johncerpa val is a string passing into the function and lookup is an object within the function :smile:
@nf15 still working on local vs global
Evans Ibok
@evansibok
Jan 12 2016 02:03
@tommygebru Can't get this to work. Here's what I came up with. Have you got a code snippet I can work with?

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
    var result = "";
    // Your code below this line
  var a = myNoun;
  var b = myAdjective;
  var c = myVerb;
  var d = myAdverb;

    result += "The " + myAdjective + myNoun + myVerb + myAdverb;

    // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks(" dog", " big", " ran", " quickly");
Brian
@sludge256
Jan 12 2016 02:03
@evansibok no need to assign all your parameters to variables.
Jasmine W
@jnwright
Jan 12 2016 02:04
This message was deleted
Brian
@sludge256
Jan 12 2016 02:04
You can edit your message instead of deleting :D
Ryan Thomas
@Placid7
Jan 12 2016 02:04
hi guys I stuck on Local Scope and Functions. The test is to create a local var. "Declare a local variable myVar inside myFunction"
Teleisha Hall
@hallnt
Jan 12 2016 02:05
@johncerpa add result = lookup[val]; after your lookup object
Jasmine W
@jnwright
Jan 12 2016 02:05
Can someone help me with my profile lookup code? it only works in the first nested array
for (var i=0; i<contacts.length; i++) {
  if (contacts[i].firstName === firstName && contacts[i].hasOwnProperty(prop)) {
  return contacts[i][prop];
}
  else if (contacts[i].firstName === firstName && !contacts[i].hasOwnProperty(prop)) {
    return "No such property";
  }
    else if (contacts[i].firstName !== firstName) {
    return "No such contact";
  }
@sludge256 thanks haha, just realized that
CamperBot
@camperbot
Jan 12 2016 02:05
jnwright sends brownie points to @sludge256 :sparkles: :thumbsup: :sparkles:
:star: 724 | @sludge256 | http://www.freecodecamp.com/sludge256
Evans Ibok
@evansibok
Jan 12 2016 02:05
@sludge256 variables out. Still the same result
jmesa92
@jmesa92
Jan 12 2016 02:06
@Texber I added '''else if (card == 10 || card == 'J' || card == 'Q' || card == 'K' || card == 'A'){
count --;
return count + " Hold";''' to get everything but 7-9 completed
CamperBot
@camperbot
Jan 12 2016 02:06
:bulb: to format code use backticks! ``` more info
Brian
@sludge256
Jan 12 2016 02:07

@evansibok You're on the right track with

 result += "The " + myAdjective + myNoun + myVerb + myAdverb

I'd make it just result =

Make sure you have spaces between each of your "words" when creating the string

jmesa92
@jmesa92
Jan 12 2016 02:07
Now I'm just stuck on making it return hold for 7 - 9
tommy
@tommygebru
Jan 12 2016 02:07
@evansibok I am so sorry I am mistaken
this works fine
result=myNoun + " " + myAdjective +" "+ myVerb +" "+ myAdverb;
you dont have to add strings between the words like this
result="Hi " + myNoun + " hello " + myAdjective + " big " + myVerb + " ran " + myAdverb + " quickly ";
Brian
@sludge256
Jan 12 2016 02:08
@tommygebru looks like they removed the 30 char length test
Ryan Thomas
@Placid7
Jan 12 2016 02:08
@tommygebru you need a space after Hi
Brian
@sludge256
Jan 12 2016 02:08
@Placid7 What do you have so far?
Ryan Thomas
@Placid7
Jan 12 2016 02:08

function myFunction() {
var myVar = 'use strict';

console.log(myVar);
}
myFunction();

// run and check the console
// myVar is not defined outside of myFunction
console.log(myVar);

// now remove the console log line to pass the test

cshane
@cshane
Jan 12 2016 02:08
Anyone have experience with making an element with position: absolute; hoverable?
Brian
@sludge256
Jan 12 2016 02:09
@Placid7 delete the console log at the bottom that isn't inside the function
Ryan Thomas
@Placid7
Jan 12 2016 02:09
I'm not passing "No global myVar variable"
cannelflow
@cannelflow
Jan 12 2016 02:09
@Placid7 WHICH EXERCISE ?
Ryan Thomas
@Placid7
Jan 12 2016 02:09
Local Scope and Functions
Brian
@sludge256
Jan 12 2016 02:09

It does say

now remove the console log line to pass the test

:P

Ryan Thomas
@Placid7
Jan 12 2016 02:10
@cannelflow i actually posted that in my first post
Erland Lami
@Texber
Jan 12 2016 02:10
@jmesa92
Ryan Thomas
@Placid7
Jan 12 2016 02:10
@sludge256 it still doesn't pass
Erland Lami
@Texber
Jan 12 2016 02:10
else if(card >= 7 && card <= 9) {

    return "0 Hold";
cannelflow
@cannelflow
Jan 12 2016 02:10
@Placid7 sorry i was late comer :P
tommy
@tommygebru
Jan 12 2016 02:10
@evansibok
result=myNoun + " " + myAdjective + " " + myVerb + " " + myAdverb;
Erland Lami
@Texber
Jan 12 2016 02:10
@jmesa92 that's how I was able to complete 7 through 9
Brian
@sludge256
Jan 12 2016 02:11
@Placid7 Odd it passes for me
Ryan Thomas
@Placid7
Jan 12 2016 02:11
browser restart :-)
cannelflow
@cannelflow
Jan 12 2016 02:11
@Placid7 see last line instruction // now remove the console log line to pass the test
Marcello Balboa
@mgbalboa
Jan 12 2016 02:12
Any hints for Waypoint: Using Objects for Lookups ?
Evans Ibok
@evansibok
Jan 12 2016 02:13
@tommygebru @sludge256 Thanks guys! Just got it right.. This can really confuse you even if you know it.


function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
    var result = "";
    // Your code below this line

    result = "The " + myAdjective + " " + myNoun + " " + myVerb + " " + myAdverb;

    // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
CamperBot
@camperbot
Jan 12 2016 02:13
evansibok sends brownie points to @tommygebru and @sludge256 :sparkles: :thumbsup: :sparkles:
:star: 261 | @tommygebru | http://www.freecodecamp.com/tommygebru
:star: 725 | @sludge256 | http://www.freecodecamp.com/sludge256
Marcello Balboa
@mgbalboa
Jan 12 2016 02:14
Got it, nevermind
Elifaz Filho
@Elifaz
Jan 12 2016 02:14
@mgbalboa what have you done so far?
@mgbalboa np
Ryan Thomas
@Placid7
Jan 12 2016 02:15
@tommygebru @cannelflow @sludge256 thx guys browser restart fixed it!
CamperBot
@camperbot
Jan 12 2016 02:15
placid7 sends brownie points to @tommygebru and @cannelflow and @sludge256 :sparkles: :thumbsup: :sparkles:
:star: 262 | @tommygebru | http://www.freecodecamp.com/tommygebru
:star: 382 | @cannelflow | http://www.freecodecamp.com/cannelflow
:star: 726 | @sludge256 | http://www.freecodecamp.com/sludge256
tommy
@tommygebru
Jan 12 2016 02:15
@evansibok sorry i had solved it without really understanding
Brian
@sludge256
Jan 12 2016 02:15
@tommygebru You used to have to add extra words
or just filler string
Jordi Gomez
@Jgomezalberti
Jan 12 2016 02:17
Any tip for Waypoint: Testing Objects for Properties
tommy
@tommygebru
Jan 12 2016 02:17
@sludge256 so it probably updated since then :smile:
Brian
@sludge256
Jan 12 2016 02:17
I think because it was too confusing
and didn't serve much purpose
Evans Ibok
@evansibok
Jan 12 2016 02:18
@sludge256 filler strings works. The goal was to also input any word of your choice while forming the sentence.
tommy
@tommygebru
Jan 12 2016 02:18
@sludge256 probably needs an additional waypoint before/ after
Jordi Gomez
@Jgomezalberti
Jan 12 2016 02:18
''''
Evans Ibok
@evansibok
Jan 12 2016 02:18
@tommygebru Lol. Errors are normality in coding
CamperBot
@camperbot
Jan 12 2016 02:18
:bulb: to format code use backticks! ``` more info
John Cerpa
@johncerpa
Jan 12 2016 02:18
// Setup
function phoneticLookup(val) {
  var result = "";

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

    "alpha": "Adams",
    "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");
Brian
@sludge256
Jan 12 2016 02:19
@jnwright still troubleshooting your code btw
John Cerpa
@johncerpa
Jan 12 2016 02:19
Still don't get it hahaha
Evans Ibok
@evansibok
Jan 12 2016 02:20
I'm off guys. @tommygebru @sludge256
Jasmine W
@jnwright
Jan 12 2016 02:20

@sludge256 thank you! i also tried

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

  if (contacts[i].firstName == firstName) {

    if (contacts[i].hasOwnProperty(prop)) {

      return contacts[i][prop];
  }

    else return "No such property";
}

  else return "No such contact";
  }

because i thought the first return was stopping the loop, but this also didn't work. I'm at a loss

CamperBot
@camperbot
Jan 12 2016 02:20
jnwright sends brownie points to @sludge256 :sparkles: :thumbsup: :sparkles:
:warning: jnwright already gave sludge256 points
tommy
@tommygebru
Jan 12 2016 02:20
@Jgomezalberti create an if statement and use checkProp as a string :smile:
Jordi Gomez
@Jgomezalberti
Jan 12 2016 02:20

`````// Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
// Your Code Here

if(myObj.hasOwnProperty("checkProp")===true){
return myObj.chekProp;
}
else{
return "Not Found";
}

}

// Test your code by modifying these values
checkObj("gift");

tommy
@tommygebru
Jan 12 2016 02:20
@evansibok also if you check under the console it also ask for more words but lets you pass :smile:
Jordi Gomez
@Jgomezalberti
Jan 12 2016 02:21
````
John Cerpa
@johncerpa
Jan 12 2016 02:21
3 ```
tommy
@tommygebru
Jan 12 2016 02:21
@Jgomezalberti three ticks before and after the code block
help format
Jordi Gomez
@Jgomezalberti
Jan 12 2016 02:21
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here

  if(myObj.hasOwnProperty("checkProp")===true){
     return myObj.chekProp;
     }
     else{
      return "Not Found";
     }

}

// Test your code by modifying these values
checkObj("gift");
thanks
John Cerpa
@johncerpa
Jan 12 2016 02:21
// Setup
function phoneticLookup(val) {
  var result = "";

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

    "alpha": "Adams",
    "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");


help!!
cannelflow
@cannelflow
Jan 12 2016 02:21
@Jgomezalberti which exercise?
John Cerpa
@johncerpa
Jan 12 2016 02:22
Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string.
Jordi Gomez
@Jgomezalberti
Jan 12 2016 02:22
@cannelflow Waypoint: Testing Objects for Properties
tommy
@tommygebru
Jan 12 2016 02:22
@Jgomezalberti the method .hasOwnProperty automatically evaluates true or false so you can remove
===true :smile:
Elifaz Filho
@Elifaz
Jan 12 2016 02:23
@Jgomezalberti hasOwnProperty is already an evaluation function, no need to set it equa to === true.
tommy
@tommygebru
Jan 12 2016 02:24
LOL i just discovered another mistake in an old challenge!
Jordi Gomez
@Jgomezalberti
Jan 12 2016 02:24
@tommygebru @Elifaz still not working without the ===
cannelflow
@cannelflow
Jan 12 2016 02:24
@Jgomezalberti you have to check weather myObj has given proporty or not by trying like myObj.hasOwnProperty("propname")
John Cerpa
@johncerpa
Jan 12 2016 02:24
Can anyone help? please
cannelflow
@cannelflow
Jan 12 2016 02:25
@johncerpa which exercise?
tommy
@tommygebru
Jan 12 2016 02:25
@Jgomezalberti check spelling
return myObj.chekProp;
John Cerpa
@johncerpa
Jan 12 2016 02:25
Using objects for lookups
Thanks
// Setup
function phoneticLookup(val) {
  var result = "";

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

    "alpha": "Adams",
    "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");
Jordi Gomez
@Jgomezalberti
Jan 12 2016 02:26
@tommygebru spelling mistake is fixed, but still not passing the tests
Khademul Islam Mahin
@Mahin2k
Jan 12 2016 02:26
someone help me with the checkpoint counting cards
Elifaz Filho
@Elifaz
Jan 12 2016 02:26
@Jgomezalberti remove the “” from the evaluation
B. Garber
@TheBGar
Jan 12 2016 02:26
@Mahin2k what are you having problems with?
Khademul Islam Mahin
@Mahin2k
Jan 12 2016 02:27
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 "5 Bet";
    case 7:
    case 8:
    case 9:
      count++;
      return "0 Hold";
    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":
      count++;
      return "-5 Hold";



  }

  return "-1 Hold";
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
John Cerpa
@johncerpa
Jan 12 2016 02:27
return count + " Bet";
and
return count + " Hold";
cannelflow
@cannelflow
Jan 12 2016 02:27
@Mahin2k return count+" Bet"
John Cerpa
@johncerpa
Jan 12 2016 02:28
case 7, 8 and 9 shouldn't be there
erase that
cannelflow
@cannelflow
Jan 12 2016 02:28
@Mahin2k remove return "-1 Hold";
John Cerpa
@johncerpa
Jan 12 2016 02:28
case 10, j, q, k , a
should be count--;
Elifaz Filho
@Elifaz
Jan 12 2016 02:28
@Jgomezalberti did it worked?
Jordi Gomez
@Jgomezalberti
Jan 12 2016 02:28
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here

  if (myObj.hasOwnProperty(checkProp)){
     return myObj.checkProp;
     }
     else{
      return "Not Found";
     }

}

// Test your code by modifying these values
checkObj("gift");
still not passing tests, result says undefined
John Cerpa
@johncerpa
Jan 12 2016 02:29
// Setup
function phoneticLookup(val) {
  var result = "";

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

    "alpha": "Adams",
    "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");
anyone knows about this
Khademul Islam Mahin
@Mahin2k
Jan 12 2016 02:29
@cannelflow still doesn't work
cannelflow
@cannelflow
Jan 12 2016 02:30
@Mahin2k show how your code looks now
Khademul Islam Mahin
@Mahin2k
Jan 12 2016 02:30
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 "5 Bet";
    case 7:
    case 8:
    case 9:
      count++;
      return "0 Hold";
    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":
      count++;
      return "-5 Hold";



  }

  return count+"Bet";
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
John Cerpa
@johncerpa
Jan 12 2016 02:30
lol
Elifaz Filho
@Elifaz
Jan 12 2016 02:30
@johncerpa check your exercise to see if here you need to use a Switch statement to return the value of the property passed on the argument
John Cerpa
@johncerpa
Jan 12 2016 02:30
no
Brian
@sludge256
Jan 12 2016 02:30
@johncerpa you need to pass val into your object
John Cerpa
@johncerpa
Jan 12 2016 02:30
You should not use case, switch, or if statements
Khademul Islam Mahin
@Mahin2k
Jan 12 2016 02:30
@cannelflow
^^^^^^
John Cerpa
@johncerpa
Jan 12 2016 02:30
"val":
Elifaz Filho
@Elifaz
Jan 12 2016 02:30
@johncerpa no switch of if? how?
John Cerpa
@johncerpa
Jan 12 2016 02:31
what do you mean
Elifaz Filho
@Elifaz
Jan 12 2016 02:31
@johncerpa I meant the exercise that you are looking for help. To Evaluate the val.
John Cerpa
@johncerpa
Jan 12 2016 02:31
it says
Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string.
FarionLord
@FarionLord
Jan 12 2016 02:32
format
Brian
@sludge256
Jan 12 2016 02:32
result = alpha[value];
if you pass a variable called value into the alpha object
it will pass the object's value under that key to result
cannelflow
@cannelflow
Jan 12 2016 02:32
@Mahin2k code?
Marcus
@mmassey
Jan 12 2016 02:32
find JSON
FarionLord
@FarionLord
Jan 12 2016 02:32
format help
find format
CamperBot
@camperbot
Jan 12 2016 02:32

find format

:zero: code formatting

John Cerpa
@johncerpa
Jan 12 2016 02:32
what should go in the brackets?
Elifaz Filho
@Elifaz
Jan 12 2016 02:33
@johncerpa alright, cool, here the lookup is converted to an object already, create an if statement or a switch that will use val as it’s evaluation property and see if the argument correspond to lookup[val], if yes return the value.
John Cerpa
@johncerpa
Jan 12 2016 02:33
no man
you should not use case, switch, or if statements
Jordi Gomez
@Jgomezalberti
Jan 12 2016 02:33

on Waypoint: Testing Objects for Properties still getting undefined ```
// Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
// Your Code Here

if (myObj.hasOwnProperty(checkProp)){
var text= myObj.checkProp;
return text;
}
else{
return "Not Found";
}

}

// Test your code by modifying these values
checkObj("gift");
```
it seems like can open the object property, how can i access it

Brian
@sludge256
Jan 12 2016 02:33
@johncerpa the final part of his message will be helpful though
the lookup part
Elifaz Filho
@Elifaz
Jan 12 2016 02:34
@johncerpa I don’t know a way that you can do a validation check without if, or switch. Try ternary operator then...
Brian
@sludge256
Jan 12 2016 02:34
all he has to do is pass lookup[val] to his result variable
FarionLord
@FarionLord
Jan 12 2016 02:34
<<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

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

      width: 100px;
    }
  }
</style>

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

<img src="https://bit.ly/fcc-relaxing-cat">

<p class="red-text">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>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>>
Brian
@sludge256
Jan 12 2016 02:34
I was hoping not to say it but we're gettinga bit off track
FarionLord
@FarionLord
Jan 12 2016 02:35
so what am I doing wrong?
John Cerpa
@johncerpa
Jan 12 2016 02:35
can you guys just do it for me hahaha
Brian
@sludge256
Jan 12 2016 02:35
@johncerpa scroll up a bit I provided the necessary snippet
FarionLord
@FarionLord
Jan 12 2016 02:35
I am trying to make the image smaller.
John Cerpa
@johncerpa
Jan 12 2016 02:36
I'm a retard
// Setup
function phoneticLookup(val) {
  var result = "";

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

    "alpha": "Adams",
    "bravo": "Boston",
    "charlie": "Chicago",
    "delta": "Denver",
    "echo": "Easy",
    "foxtrot": "Frank",      
    "val": ""
  };

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

// Change this value to test
phoneticLookup("charlie");
Billboz
@Billboz
Jan 12 2016 02:36
@tommygebru Thanks for the code. But why does the else if have to be there? It confuses me. Is it because of the number of tests, three?
CamperBot
@camperbot
Jan 12 2016 02:36
billboz sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 264 | @tommygebru | http://www.freecodecamp.com/tommygebru
John Cerpa
@johncerpa
Jan 12 2016 02:36
var result = "";
cannelflow
@cannelflow
Jan 12 2016 02:36
@FarionLord which ex you have to make a class smaller-image then set property in style
Brian
@sludge256
Jan 12 2016 02:37
@johncerpa get rid of that val line in lookup
John Cerpa
@johncerpa
Jan 12 2016 02:37
oh god
FarionLord
@FarionLord
Jan 12 2016 02:37
@cannelflow ?
John Cerpa
@johncerpa
Jan 12 2016 02:37
finally
Brian
@sludge256
Jan 12 2016 02:37
use result = lookup[val]; before your return
John Cerpa
@johncerpa
Jan 12 2016 02:37
yeah man thank you so much
Brian
@sludge256
Jan 12 2016 02:37
understand how that works?
Khademul Islam Mahin
@Mahin2k
Jan 12 2016 02:37
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 "5 Bet";
    case 7:
    case 8:
    case 9:
      count++;
      return "0 Hold";
    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":
      count++;
      return "-5 Hold";



  }

  return count+ "Bet";
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
John Cerpa
@johncerpa
Jan 12 2016 02:37
now I get it
cannelflow
@cannelflow
Jan 12 2016 02:37
@FarionLord which exercise ?
FarionLord
@FarionLord
Jan 12 2016 02:38
Waypoint: size your images
Khademul Islam Mahin
@Mahin2k
Jan 12 2016 02:38
i need help with the checkpoint counting cards
tommy
@tommygebru
Jan 12 2016 02:38
@Jgomezalberti just an if statement , the variable is unecessary :smile:
FarionLord
@FarionLord
Jan 12 2016 02:38
exercise 16
Elifaz Filho
@Elifaz
Jan 12 2016 02:38
@sludge256 I see what you are saying, this is basically an assignment and not an evaluation.. I misunderstood the exercise.
cannelflow
@cannelflow
Jan 12 2016 02:39
@FarionLord Create a class called smaller-image and use it to resize the image so that it's only 100 pixels wide.

@FarionLord <style>

.larger-image {

width: 500px;

}

</style>

tommy
@tommygebru
Jan 12 2016 02:40
@Billboz is this Testing Objects for propertise
Billboz
@Billboz
Jan 12 2016 02:40
yes
Lydell Gaines
@dasnic
Jan 12 2016 02:40
Hey everybody I'm an issue with Waypoint: Understanding Uninitialized Variables, can anyone help please
Khademul Islam Mahin
@Mahin2k
Jan 12 2016 02:40
can someone please help me?
cannelflow
@cannelflow
Jan 12 2016 02:40
@Mahin2k you have to return count+" Bet"
Khademul Islam Mahin
@Mahin2k
Jan 12 2016 02:40
@cannelflow I did
tommy
@tommygebru
Jan 12 2016 02:41
@Billboz
this is updated code previously I had an extra, else if, but it was the same as the if, therefore it was redundant :smile:
function checkObj(checkProp) {
  // Your Code Here
   if (myObj.hasOwnProperty(checkProp))
     {return myObj[checkProp];}
  else
      {return "Not Found";}
}
// Test your code by modifying these values
checkObj("gift");
cannelflow
@cannelflow
Jan 12 2016 02:41
@Mahin2k but your pasted code looks like same return "5 Bet";
@FarionLord worked?
Billboz
@Billboz
Jan 12 2016 02:43
You are awesome! thanks for looking at that for me…. I was making my three hamsters work overtime trying to figure that out. @tommygebru
CamperBot
@camperbot
Jan 12 2016 02:43
billboz sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:warning: billboz already gave tommygebru points
Khademul Islam Mahin
@Mahin2k
Jan 12 2016 02:43
@cannelflow omg i thought you told me to replace it wit the last return
FarionLord
@FarionLord
Jan 12 2016 02:43
<style>
.smaller-image {
width: 100px;
}
</style>
Your img element should have the class smaller-image.
nope
Khademul Islam Mahin
@Mahin2k
Jan 12 2016 02:43
@cannelflow
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 count+"Bet";
    case 7:
    case 8:
    case 9:
      count++;
      return "0 Hold";
    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":
      count++;
      return "-5 Hold";



  }

  return ;
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
cannelflow
@cannelflow
Jan 12 2016 02:44
@Mahin2k no remove the last return
FarionLord
@FarionLord
Jan 12 2016 02:44
well time to go to... Youtube!
Khademul Islam Mahin
@Mahin2k
Jan 12 2016 02:44
@cannelflow k i did
tommy
@tommygebru
Jan 12 2016 02:45
cannelflow
@cannelflow
Jan 12 2016 02:45
@Mahin2k give space in bat like " Bat" so that it will print 5 Bet Now IT Is printing 5Bet and do same for every return
John Cerpa
@johncerpa
Jan 12 2016 02:47
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
  if(myObj.hasOwnProperty(checkProp)) {
    return myObj[checkProp];
  } else {

    return "Not found";
  }

}

// Test your code by modifying these values
checkObj("gift");
hmmn
Pawan
@pawan92
Jan 12 2016 02:47
did anyone do the new checkpoint. profile lookup?
tommy
@tommygebru
Jan 12 2016 02:47
@dasnic have you been helped yet?
John Cerpa
@johncerpa
Jan 12 2016 02:47
tommy
FarionLord
@FarionLord
Jan 12 2016 02:47
@tommygebru lol thanks
CamperBot
@camperbot
Jan 12 2016 02:47
farionlord sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
John Cerpa
@johncerpa
Jan 12 2016 02:47
what is missing there
CamperBot
@camperbot
Jan 12 2016 02:47
:star: 265 | @tommygebru | http://www.freecodecamp.com/tommygebru
tommy
@tommygebru
Jan 12 2016 02:48
@pawan92 I am doing it now
marksayers96
@marksayers96
Jan 12 2016 02:48
Instructions
Encode the following sequence, separated by spaces:
backslash tab tab carriage-return new-line and assign it to myStr lost on this waypoint
Lydell Gaines
@dasnic
Jan 12 2016 02:48
no @tommygebru
Khademul Islam Mahin
@Mahin2k
Jan 12 2016 02:48
@cannelflow it does return 5 bet but the others dont do what they are supposed to
tommy
@tommygebru
Jan 12 2016 02:48
@dasnic it wants you to assign values to a b and c in that order as they give it to you
John Cerpa
@johncerpa
Jan 12 2016 02:48
Testing Objects for Properties
@tommygebru can you help me
marksayers96
@marksayers96
Jan 12 2016 02:49
thank you
tommy
@tommygebru
Jan 12 2016 02:49
@johncerpa whats up
John Cerpa
@johncerpa
Jan 12 2016 02:49
function checkObj(checkProp) {
  // Your Code Here
  if(myObj.hasOwnProperty(checkProp)) {
    return myObj[checkProp];
  } else {    
    return "Not found";
  }

}
what is missing
tommy
@tommygebru
Jan 12 2016 02:49
@johncerpa capitalize Found
John Cerpa
@johncerpa
Jan 12 2016 02:49
for real
hahahahaha
cannelflow
@cannelflow
Jan 12 2016 02:49
@Mahin2k show your code now
tommy
@tommygebru
Jan 12 2016 02:49
@johncerpa For realls :smile:
John Cerpa
@johncerpa
Jan 12 2016 02:50
case sensitive!!!
tommy
@tommygebru
Jan 12 2016 02:51
@marksayers96 have you been helped?
John Cerpa
@johncerpa
Jan 12 2016 02:52
@tommygebru :+1:
you're the man hahahaha
FarionLord
@FarionLord
Jan 12 2016 02:52
When in doubt... go to Youtube....
cannelflow
@cannelflow
Jan 12 2016 02:53
@Mahin2k ?
Elifaz Filho
@Elifaz
Jan 12 2016 02:53
Alright, who needs help?
Jennifer Linkenauger
@jlinkenauger
Jan 12 2016 02:55

JSON Objects

var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1993,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }
  // Add record here
 {
   "artist":"Minus the Bear",
   "title": "Menos el Oso",
   "release_year": 2005,
   "formats": [
     "mp3",
     "LP", 
     "CD"]
 }
];

what do i need to fix?

John Cerpa
@johncerpa
Jan 12 2016 02:55
I'm in the same exercise
Jennifer Linkenauger
@jlinkenauger
Jan 12 2016 02:55
I feel like it's something simple i need to fix
John Cerpa
@johncerpa
Jan 12 2016 02:55
{}
when I type those
marksayers96
@marksayers96
Jan 12 2016 02:56
yes thank you
John Cerpa
@johncerpa
Jan 12 2016 02:56
It gives me an error
Brian
@sludge256
Jan 12 2016 02:56
@jnwright still here?
Jennifer Linkenauger
@jlinkenauger
Jan 12 2016 02:56
yeah same @johncerpa
Elifaz Filho
@Elifaz
Jan 12 2016 02:56
@jlinkenauger you are missing the comma , between objects
Jasmine W
@jnwright
Jan 12 2016 02:56
@sludge256 yes, still troubleshooting!
marksayers96
@marksayers96
Jan 12 2016 02:56
var myStr = '\ \t \t \r \n';
tommy
@tommygebru
Jan 12 2016 02:56
@jlinkenauger add that the record went platinum !
John Cerpa
@johncerpa
Jan 12 2016 02:56
oh
I get
it
after the } put a comma
before add record here
Elifaz Filho
@Elifaz
Jan 12 2016 02:57
@johncerpa correct.
Brian
@sludge256
Jan 12 2016 02:57
@jnwright I think the reason it doesnt't work is because it's only ever checking the first contact
because return will end the loop
I should've noticed sooner
Jennifer Linkenauger
@jlinkenauger
Jan 12 2016 02:57
woohoo! thanks @johncerpa , @Elifaz
CamperBot
@camperbot
Jan 12 2016 02:57
jlinkenauger sends brownie points to @johncerpa and @elifaz :sparkles: :thumbsup: :sparkles:
:star: 215 | @johncerpa | http://www.freecodecamp.com/johncerpa
:star: 319 | @elifaz | http://www.freecodecamp.com/elifaz
John Cerpa
@johncerpa
Jan 12 2016 02:58
hahaha :)
Elifaz Filho
@Elifaz
Jan 12 2016 02:58
@jlinkenauger you got it!
Jennifer Linkenauger
@jlinkenauger
Jan 12 2016 02:58
it's always a comma, semicolon, or misspelling!!!
John Cerpa
@johncerpa
Jan 12 2016 02:58
I know!
It's frustrating
Jasmine W
@jnwright
Jan 12 2016 02:58
@sludge256 i realized that and that's why i nested the return inside another if statement, but that still didn't work /: i'm not sure how to fix it
Elifaz Filho
@Elifaz
Jan 12 2016 02:59
@jnwright paste your current code in here.
OGCheshireCat223
@OGCheshireCat223
Jan 12 2016 02:59

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

// Only change code below this line

var secondTree = myPlants.trees1; // Change this line

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

// Only change code below this line

var secondTree = myPlants.trees1; // Change this line

Jasmine W
@jnwright
Jan 12 2016 03:00
@Elifaz
 for (var i=0; i<contacts.length; i++) {

  if (contacts[i].firstName == firstName) {

    if (contacts[i].hasOwnProperty(prop)) {

      return contacts[i][prop];
  }

    else return "No such property";
}

  else return "No such contact";
  }
Brian
@sludge256
Jan 12 2016 03:00
I think that will still only loop once
I'll work on my own solution though since I haven't done that one yet :D
Mohammad Hassaan Mahmood
@CampMahmood
Jan 12 2016 03:01
I am having trouble with the Stand in line check point in the JavaScript section
Elifaz Filho
@Elifaz
Jan 12 2016 03:01
@jnwright is firstName the argument of the function?
Mohammad Hassaan Mahmood
@CampMahmood
Jan 12 2016 03:02
Write a function queue which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The queue function should then return the element that was removed.
FarionLord
@FarionLord
Jan 12 2016 03:02
Mohammad Hassaan Mahmood
@CampMahmood
Jan 12 2016 03:02
here is my code:

function queue(arr, item) {
// Your code here
removed = testArr.shift();
testArr.push(item);

return removed; // Change this line
}

// Test Setup
var testArr = [5,6,7,8,9];

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

Jasmine W
@jnwright
Jan 12 2016 03:03

@Elifaz

var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intruiging Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    },
];


function lookUp(firstName, prop){

that's the array i am trying to go through..it works if i use "Akira" as firstName, but inputting "Harry" or anything after comes up as no such contact

@sludge256 let me know if you have better luck!
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:03
hey can someone help me understand why 'contNum' in this code wont work

function lookUp(firstName, prop){
// Only change code below this line
//var lastName = "";
var contNum = "";
 switch (firstName) {
   case "Akira" : 
     contNum = 1;
     break;
   case "Harry":
     contNum = 2;
     break;
   case "Sherlock":
     contNum = 3;
     break;
   case "Kristian":
     contNum = 4;
     break;
 }

var pooptest = "";
 pooptest = contacts[contNum].firstName;

  return pooptest;
// Only change code above this line
}
Justin Richardsson
@hallaathrad
Jan 12 2016 03:03
I’m working on that one too
Jose Seijas
@DanGaming3
Jan 12 2016 03:04
Hi! just copied the img src... code into my editor and it doesnt work!
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:04
it'll work if i hardcode the number in its place so i know it's something wrong with the contNum variable
Elifaz Filho
@Elifaz
Jan 12 2016 03:04
@jnwright paste your function with the params
Derek Welton
@freefora11
Jan 12 2016 03:04
Using the http://openweathermap.org/current API, I don't see anywhere in the document that shows how to call the state of location, referring to a state in the United States, how am I suppose to add the state name to my weather app?
tommy
@tommygebru
Jan 12 2016 03:04
@KaanMasters is this the Checkpoint: Profile Lookup?
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:05
@tommygebru sure is
Benjamin Corry
@becorry
Jan 12 2016 03:05
hey Im stuck maybe you guys can help me. my assignment is "Size your image" i need to make my image 100px wide. Im getting 2 errors "Your img element should have the class smaller-image." and "Your image should be 100 pixels wide."
heres my code:
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .smaller-image{
    width:100px;
  }
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

  p {
    font-size: 16px;
    font-family: Monospace;
  }
</style>

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

<img src="https://bit.ly/fcc-relaxing-cat">

<p class="red-text">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>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
Aaron Graves
@gravesmeister
Jan 12 2016 03:05
Can anyone tell me what I'm doing wrong with Waypoint: Escaping Literal Quotes in Strings?
'''
CamperBot
@camperbot
Jan 12 2016 03:05
:bulb: to format code use backticks! ``` more info
tommy
@tommygebru
Jan 12 2016 03:05
@freefora11 try the zipline room :smile: help rooms
Jasmine W
@jnwright
Jan 12 2016 03:05

@Elifaz

function lookUp(firstName, prop){
// Only change code below this line
  for (var i=0; i<contacts.length; i++) {

  if (contacts[i].firstName == firstName) {

    if (contacts[i].hasOwnProperty(prop)) {

      return contacts[i][prop];
  }

    else return "No such property";
}

  else return "No such contact";
  }



// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");

this works, but does not work if i use another name in following arrays

tommy
@tommygebru
Jan 12 2016 03:05
help rooms
CamperBot
@camperbot
Jan 12 2016 03:05

:point_right: help rooms [wiki]

There are official help rooms for each major section of FCC content:

Chat Room Description
Help get help with our Waypoint challenges from your fellow campers
HelpBonfires get help with our Bonfire challenges from your fellow campers
HelpZiplines get help with our Zipline challenges from your fellow campers
HelpBasejumps get help with our Basejump challenges from your fellow campers
NonprofitProjects get help with your Nonprofit Projects from your fellow campers
CodeReview get constructive criticism and advice on finished code from your fellow campers
YouCanDoThis learning to code is hard - share your feelings and get moral support here

Choose the right room for your question!
:pencil: read more about help rooms on the FCC Wiki

Aaron Graves
@gravesmeister
Jan 12 2016 03:05
var myStr = "I am a \"double quoted\" string inside \"double quotes\"."; // Change this line
Elifaz Filho
@Elifaz
Jan 12 2016 03:06
@jnwright alright, let me take a look here
Brian
@sludge256
Jan 12 2016 03:06
@gravesmeister no period
Justin Richardsson
@hallaathrad
Jan 12 2016 03:06
@jnwright try map instead of for… #win
Elifaz Filho
@Elifaz
Jan 12 2016 03:06
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intruiging Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    },
];


function lookUp(firstName, prop){
function lookUp(firstName, prop){
// Only change code below this line
  for (var i=0; i<contacts.length; i++) {

  if (contacts[i].firstName == firstName) {
    if (contacts[i].hasOwnProperty(prop)) 
      return contacts[i][prop];
    else 
      return "No such property";
    }
  else return "No such contact";
}

// Change these values to test your function
lookUp("Akira", "likes");
Aaron Graves
@gravesmeister
Jan 12 2016 03:07
Yeah I got that thanks @sludge256
CamperBot
@camperbot
Jan 12 2016 03:07
gravesmeister sends brownie points to @sludge256 :sparkles: :thumbsup: :sparkles:
:star: 727 | @sludge256 | http://www.freecodecamp.com/sludge256
Justin Richardsson
@hallaathrad
Jan 12 2016 03:07
forand whileare not your friends
Aaron Graves
@gravesmeister
Jan 12 2016 03:07
I saw that while I was posting the question lol
Ok back to coding :)
FarionLord
@FarionLord
Jan 12 2016 03:07
Well if anyone wants it, I can be reference person and all you have to do is tell me what exercise you guys are on and I will send you guys a youtube videos.
tommy
@tommygebru
Jan 12 2016 03:08
@FarionLord profile lookup
FarionLord
@FarionLord
Jan 12 2016 03:08
?
Number please?
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:08
thanks @FarionLord
CamperBot
@camperbot
Jan 12 2016 03:08
kaanmasters sends brownie points to @farionlord :sparkles: :thumbsup: :sparkles:
:star: 24 | @farionlord | http://www.freecodecamp.com/farionlord
Nahum T
@nahomtefera
Jan 12 2016 03:09
Hey guys I need some help on Nesting For Loops
Benjamin Corry
@becorry
Jan 12 2016 03:09
can anyone help me with my question?
Nahum T
@nahomtefera
Jan 12 2016 03:09
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line

  for (i = 0; i < arr[i]; i++){

    for(j = 0; j < arr[i][j]; j++){

       product = arr[i][j] * arr[i++][j++];

    }


  }

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Jasmine W
@jnwright
Jan 12 2016 03:09
@Elifaz thanks for helping me out
CamperBot
@camperbot
Jan 12 2016 03:09
jnwright sends brownie points to @elifaz :sparkles: :thumbsup: :sparkles:
:star: 320 | @elifaz | http://www.freecodecamp.com/elifaz
twmerrill
@twmerrill
Jan 12 2016 03:10
When you are setting a dead link it's 'Link href="#"' correct?
I'm new to all of this, so thanks for bearing with me
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:10
Anyone have an idea why my 'contNum' variable wont work in this code?

function lookUp(firstName, prop){
// Only change code below this line
//var lastName = "";
var contNum = "";
 switch (firstName) {
   case "Akira" : 
     contNum = 1;
     break;
   case "Harry":
     contNum = 2;
     break;
   case "Sherlock":
     contNum = 3;
     break;
   case "Kristian":
     contNum = 4;
     break;
 }

var pooptest = "";
 pooptest = contacts[contNum].firstName;

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

// Change these values to test y
FarionLord
@FarionLord
Jan 12 2016 03:11
Well if anyone need help just tell me what exercise number you guys are on and I will send you a link.
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:11
is it because it gets defined as a string and not a number?
Benjamin Corry
@becorry
Jan 12 2016 03:12
@FarionLord im on "Waypoint: Size your Images"
twmerrill
@twmerrill
Jan 12 2016 03:12
Farion - It's HTML 23. Thank you
twmerrill
@twmerrill
Jan 12 2016 03:13
thank you :)
Elifaz Filho
@Elifaz
Jan 12 2016 03:13
@jnwright copy what I wrote on the code above, and see if it works. I haven’t changed much only the position of the curly braces, the code should run, your code looks good
FarionLord
@FarionLord
Jan 12 2016 03:13

err img {

  width: 100px;
}

}

tommy
@tommygebru
Jan 12 2016 03:13
@nahomtefera remember that j is already the first and the last
FarionLord
@FarionLord
Jan 12 2016 03:13
then you go to your image than write <img src="https://bit.ly/fcc-relaxing-cat" class="smaller-image">
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:14
can anyone help me with the profile lookup checkpoint
tommy
@tommygebru
Jan 12 2016 03:14
@FarionLord hell no !!!! i didnt know there were videos
FarionLord
@FarionLord
Jan 12 2016 03:14
np @twmerrill I am just on the scrubby parts and I just send links. :D
Abdikane
@Abdikane
Jan 12 2016 03:15
Help I've Found a Bug"Browse
CamperBot
@camperbot
Jan 12 2016 03:15
no wiki entry for: ive found a bugbrowse
Benjamin Corry
@becorry
Jan 12 2016 03:15
Thanks so much @FarionLord i was stuck on that for so long lol !
CamperBot
@camperbot
Jan 12 2016 03:15
becorry sends brownie points to @farionlord :sparkles: :thumbsup: :sparkles:
FarionLord
@FarionLord
Jan 12 2016 03:15
yep just that guy who barely know anything about code but know about videos and stuff... I am just that guy.... So lonely.
CamperBot
@camperbot
Jan 12 2016 03:15
:star: 25 | @farionlord | http://www.freecodecamp.com/farionlord
Justin Richardsson
@hallaathrad
Jan 12 2016 03:15
where’s this bug? @Abdikane
FarionLord
@FarionLord
Jan 12 2016 03:15
@KaanMasters what number please?
Wendy Huang
@gutentag1026
Jan 12 2016 03:16

Waypoint: Using Objects for Lookups // Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {
"alpha": "Adams",
"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");
what's wrong with my code???

FarionLord
@FarionLord
Jan 12 2016 03:17
err @gutentag1026 exercise number?
Wendy Huang
@gutentag1026
Jan 12 2016 03:17
86.
John Cerpa
@johncerpa
Jan 12 2016 03:17
return result = lookup[val];
gutentag
add it
tommy
@tommygebru
Jan 12 2016 03:18
@FarionLord 98 is new
John Cerpa
@johncerpa
Jan 12 2016 03:18
Record collection
Justin Richardsson
@hallaathrad
Jan 12 2016 03:18
@KaanMasters I’m looking into your code
John Cerpa
@johncerpa
Jan 12 2016 03:18
update or set the value for the prop.
what does that mean
FarionLord
@FarionLord
Jan 12 2016 03:18
@gutentag1026 html?
Jasmine W
@jnwright
Jan 12 2016 03:18
@Elifaz still not working u_u
FarionLord
@FarionLord
Jan 12 2016 03:19
err @gutentag1026 go to the bottom https://www.youtube.com/user/pizzapokerguy87/playlists
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:19
@hallaathrad thanks man
CamperBot
@camperbot
Jan 12 2016 03:19
kaanmasters sends brownie points to @hallaathrad :sparkles: :thumbsup: :sparkles:
:star: 393 | @hallaathrad | http://www.freecodecamp.com/hallaathrad
Abdikane
@Abdikane
Jan 12 2016 03:19
@hallaathrad i got a strange layout and nothing it's working for me. Am linking a code from google while the country am in current Google is blocked yet am using VPN
tommy
@tommygebru
Jan 12 2016 03:19
@nahomtefera still on the same challenge ?
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:19
@FarionLord 98
Wendy Huang
@gutentag1026
Jan 12 2016 03:19
ooooooooooooo that's it...thanks a mil
John Cerpa
@johncerpa
Jan 12 2016 03:19
:)
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:19
@FarionLord i don't think im doing it the right way but i just wanna know why my code wont work
Justin Richardsson
@hallaathrad
Jan 12 2016 03:20
@Abdikane when using vpns, if the layout is broken maybe because CSS failed to load… your connection may have stalled
Brian
@sludge256
Jan 12 2016 03:21
@jnwright ok to make sure you don't return early
your final else statement
don't have it return anything
Abdikane
@Abdikane
Jan 12 2016 03:22
@hallaath how to solve this problem now please? any idea
Brian
@sludge256
Jan 12 2016 03:22
hold on while i try to write down what I'm thinking :D
Justin Richardsson
@hallaathrad
Jan 12 2016 03:22
@KaanMasters your code, albeit a bit unortodox, is working
the number is indeed defining a position in the array
and it is identifying the contacts, when they do exist
@Abdikane try reloading the site?
Brian
@sludge256
Jan 12 2016 03:24

@jnwright So this probably isn't the best way of completing the exercise but with your newest code
the problem is

  else return "No such contact";

ends your for loop

What you can do instead is have a result variable

and then use

else result = "No such contact";

this will allow your loop to continue

through the rest of the contacts
then after your loop is done return result;
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:26
@hallaathrad hmm... it doesn't seem to be working for me though
Brian
@sludge256
Jan 12 2016 03:26
This allows your for loop to iterate through your contacts array until it can't find a contact based on your input
There's most likely a better way but I'm eating :D
Justin Richardsson
@hallaathrad
Jan 12 2016 03:28
I ran console.logs and it all checks out
Mike W.
@micwill007
Jan 12 2016 03:28
Checkpoint: Profile Lookup
Brian
@sludge256
Jan 12 2016 03:28
@micwill007 Just finished helping someone with that :+1:
Jasmine W
@jnwright
Jan 12 2016 03:29
@sludge256 wow, it works! thanks so much for your explanation, too
CamperBot
@camperbot
Jan 12 2016 03:29
jnwright sends brownie points to @sludge256 :sparkles: :thumbsup: :sparkles:
:star: 729 | @sludge256 | http://www.freecodecamp.com/sludge256
Brian
@sludge256
Jan 12 2016 03:29
@jnwright Now you can help @micwill007 with his :D
Mike W.
@micwill007
Jan 12 2016 03:30
halp
pls
Hold on.. gonna start from scratch again
Mauricio
@maudevelop
Jan 12 2016 03:31
Hey, I have a question on the new javascript checkpoint "Checkpoint: Stand in Line"
it's giving me a rangeerror: Maximum Call stack size exceeded no matter what i change or do
even commenting everything out
Brian
@sludge256
Jan 12 2016 03:32
@maudevelop refresh the page or restart your browser
it's a site bug assuming it's not your code
Mauricio
@maudevelop
Jan 12 2016 03:34
Hahaha @slude256 I dont know why i didnt think of that
@sludge256 *
Thanks, it worked
Benjamin Corry
@becorry
Jan 12 2016 03:36
says "Create an a element that links to http://freecatphotoapp.com and has "cat photos" as its anchor text."
where is the cat photos anchor text?
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<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;
    border-radius: 50%;
  }

  .smaller-image {
    width: 100px;
  }
</style>

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

<img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat">

<p class="red-text">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>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
Holly Williford
@hollyhascode
Jan 12 2016 03:36
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1993,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }
  var myMusic = [
  {
   "artist": "artist", 
   "title": "random",
   "release_year": 2100,
    "formats": [
    "CS",
    "8T",
    "LP"
    ],

  }// Add record here
];
Introducing Javascript object notation
Do they want me to add the properties behind the commas
or add them by doing myMusic.album = "name of album"
i'm trying to figure it out
Brian
@sludge256
Jan 12 2016 03:37
@hollyhascode don't declare/make a new array
Holly Williford
@hollyhascode
Jan 12 2016 03:38
just add the new properties
Brian
@sludge256
Jan 12 2016 03:38
Yea just make a new object
Pawan
@pawan92
Jan 12 2016 03:39
function lookUp(firstName, prop){
// Only change code below this line
   for(var i=0;i<contacts.length;i++)
   {
       if(contacts[i].firstName===firstName){
            if (contacts[i].hasOwnProperty(prop)) {

            return contacts[i][prop];
  }

    else return "No such property";
}

  else return "No such contact";

   }


// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");
Brian
@sludge256
Jan 12 2016 03:39
var myMusic = [
{ their example object

},
{your object

}
];
@hollyhascode
Pawan
@pawan92
Jan 12 2016 03:39
does anyne know why this doesnt work
Brian
@sludge256
Jan 12 2016 03:40
@pawan92 It won't loop more than once
if it hits any code that says return
the loop will end
and it won't check the other contacts
Holly Williford
@hollyhascode
Jan 12 2016 03:40
oh okay . So each variable can have more than one object?
thanks @sludge256
CamperBot
@camperbot
Jan 12 2016 03:41
hollyhascode sends brownie points to @sludge256 :sparkles: :thumbsup: :sparkles:
Brian
@sludge256
Jan 12 2016 03:41
@hollyhascode Yea it's an array of objects
CamperBot
@camperbot
Jan 12 2016 03:41
:star: 730 | @sludge256 | http://www.freecodecamp.com/sludge256
Holly Williford
@hollyhascode
Jan 12 2016 03:41
ooooh
ok
thanks again!
Brian
@sludge256
Jan 12 2016 03:41
You can basically copy paste on that lesson :P
if you're too lazy to type
You didn't hear me say that though :hear_no_evil:
redeyesblackdragon
@redeyesblackdragon
Jan 12 2016 03:42
when my form element s should have a background-color what exactly do i do?
Jonathan Coleman
@jondcoleman
Jan 12 2016 03:43
@sludge256 nice new avatar :)
Brian
@sludge256
Jan 12 2016 03:43
@jondcoleman thanks :+1: @Spatzerny made it
CamperBot
@camperbot
Jan 12 2016 03:43
sludge256 sends brownie points to @jondcoleman and @spatzerny :sparkles: :thumbsup: :sparkles:
:warning: sludge256 already gave spatzerny points
:star: 376 | @jondcoleman | http://www.freecodecamp.com/jondcoleman
Jonathan Coleman
@jondcoleman
Jan 12 2016 03:44
Nice work @Spatzerny
redeyesblackdragon
@redeyesblackdragon
Jan 12 2016 03:44
<form action="/submit-cat-photo" id="cat-photo-form">

<label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<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>
Brian
@sludge256
Jan 12 2016 03:45
@redeyesblackdragon are you on Waypoint: Create a Set of Radio Buttons
or something else?
Pawan
@pawan92
Jan 12 2016 03:46
@sludge256 im at a loss how to fix it
Aprophecy
@Aprophecy
Jan 12 2016 03:47
Starting to get really discouraged. I can't figure these out without help.........
//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intruiging Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    },
];


function lookUp(firstName, prop){
// Only change code below this line
var result;

  if (name.firstName === firstName) {
    result = firstName[prop] || "No such property";

  }

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

// Change these values to test your function
lookUp("Akira", "address");
Benjamin Corry
@becorry
Jan 12 2016 03:48
what does href stand for?
Brian
@sludge256
Jan 12 2016 03:48
@pawan92 Try reading through this. Then help @Aprophecy :)
@becorry Hypertext Reference
Aprophecy
@Aprophecy
Jan 12 2016 03:50
Im really discouraged right now, honestly.
this should be so damn simple but I really can;t figure ito ut?
a simple if/else statement?
come the hell on..
Brian
@sludge256
Jan 12 2016 03:51
@Aprophecy if you scroll up there were at least two other people working on it
read through their code
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:51
@Aprophecy dude ive been struggling on it for 3 hours
tommy
@tommygebru
Jan 12 2016 03:51
There should be a Profile Lookup chatroom
Brian
@sludge256
Jan 12 2016 03:52
shouldn't it include record collection? :P
Dan Santos
@CanIGetAPickle
Jan 12 2016 03:52
I'm stuck on it too. lol
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:52
@Aprophecy If you're not willing to be bad at something you'll never be good at it.
tommy
@tommygebru
Jan 12 2016 03:52
@sludge256 is this meant to be a hint?
Brian
@sludge256
Jan 12 2016 03:52
record collection and the one about plants
@tommygebru no I'm saying those ones are hot topics also
Aprophecy
@Aprophecy
Jan 12 2016 03:53
ive looked ay someone elses solution but it doesn't seem like the way FCC taught us so im trying to do something beased on it but idk.
Pawan
@pawan92
Jan 12 2016 03:53
@Aprophecy what you have is not going through every element in the array. you will need some kind of loop for that
tommy
@tommygebru
Jan 12 2016 03:53
@sludge256 for Profile Lookup
...
I see Checkpoint Challenges :smile:
Brian
@sludge256
Jan 12 2016 03:54
At some point in time FCC won't explicitly tell you how to do every step
Dan Santos
@CanIGetAPickle
Jan 12 2016 03:54
  for (var i = 0; i < contacts.length; i++) {
    var contactName = contacts[i].firstName;
    var contactProp = contacts[i].hasOwnProperty(prop);
    if (contactName == firstName && contactProp === true) {
      return contacts[i][prop];
    } else if (contactName == firstName && contactProp === false) {
      return "No such property";
    } else {
      return "No such contact";
    }
  }
Brian
@sludge256
Jan 12 2016 03:54
otherwise you'll start on your own projects in the real world and have no idea what to do
Dan Santos
@CanIGetAPickle
Jan 12 2016 03:54
That's what I came up with, but it's apparently no bueno!
Aprophecy
@Aprophecy
Jan 12 2016 03:54
This doesn't require a loop, you're only looking up by one arguement at a time.
function lookUp(firstName, prop)
Brian
@sludge256
Jan 12 2016 03:54
@CanIGetAPickle If you hit any line with a return statement it will end for your for loop
Dan Santos
@CanIGetAPickle
Jan 12 2016 03:54
lol Duh.
Of course I wasn't thinking simply
Brian
@sludge256
Jan 12 2016 03:55
So the problem becomes you only ever check the first contact
and then the loop ends
Aprophecy
@Aprophecy
Jan 12 2016 03:55
The solution Im looking at someone made a function inside of the function and called a on a library function...
Pawan
@pawan92
Jan 12 2016 03:56
exactly personally whenever arrays are involved i always start thinking in terms of for loops
tommy
@tommygebru
Jan 12 2016 03:56
maybe a while loop?
Aprophecy
@Aprophecy
Jan 12 2016 03:56
This doesn't need a loop.
That implies all your objects are akira or bob or something.
Jasmine W
@jnwright
Jan 12 2016 03:58
@Aprophecy you need a loop
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:58
This code works for everything except "akira, address"
function lookUp(firstName, prop){
// Only change code below this line

for (i = 0; i < contacts.length; i++){
  if (contacts[i].firstName == firstName){
    if (contacts[i].hasOwnProperty(prop)){
     return   contacts[i][prop];        
    }
    else result = "No such property";
  }
    else result = "No such contact";
}
  return result;
}

// Change these values to test your function
lookUp("Bob", "number");
Brian
@sludge256
Jan 12 2016 03:59
@KaanMasters Your loop will end after checking the first contact
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:59
it gives me "no such contact, when it should say no such property
Mike W.
@micwill007
Jan 12 2016 03:59
 var result;

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

    if(contacts[i].firstName == firstName ) {
      if(contacts[i][prop]) {
        result = contacts[i][prop];
      }
    } else if (!contacts[i].firstName) {
       result = 'No such contact';      
    } else if (!contacts[i][prop]) {
      result = 'No such property';
    }
  }
return result;
Mine works for all but bob
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 03:59
are you sure? cause it works for everything else
CompGeekGirl
@LisaRamos
Jan 12 2016 03:59

@tommygebru But the instructions say function myTest(val) {
var answer = "";
// Only change code below this line
switch(val){
case 1:
return "a";
break;
case 2:
return "b";
break;
case 3:
return "c";
break;
case 4:
return "stuff";
}

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

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

Brian
@sludge256
Jan 12 2016 03:59
@KaanMasters oh right you don't have purely return lines my bad
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 04:00
@sludge256 any idea why it wont return the right value for "akira address"?
Pawan
@pawan92
Jan 12 2016 04:00
@micwill007 how are you checking if the property exists
Mike W.
@micwill007
Jan 12 2016 04:00
if(contacts[i][prop])
Pawan
@pawan92
Jan 12 2016 04:02
oh missed that thats one way to do it. javascript also has a hasOwnProperty method for future reference
tommy
@tommygebru
Jan 12 2016 04:02
@LisaRamos which waypoint again?
CompGeekGirl
@LisaRamos
Jan 12 2016 04:03
@tommygebru #73
tommy
@tommygebru
Jan 12 2016 04:04
@LisaRamos whats the question?
Jasmine W
@jnwright
Jan 12 2016 04:05
@KaanMasters i think you're reassigning the result...change else result = "No such property"; to else return = "No such property";
tommy
@tommygebru
Jan 12 2016 04:05
@KaanMasters except for "akira" and "address" ?
your code has been adopted :smile:
Jasmine W
@jnwright
Jan 12 2016 04:05
@KaanMasters else return "No such property";* sorry
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 04:06
@jnwright that was it
@jnwright you're a baller
Pawan
@pawan92
Jan 12 2016 04:06
@KaanMasters yup you only need to set result to one instance of return like @jnwright said
Mike W.
@micwill007
Jan 12 2016 04:06
share it
xD
im stuck too
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 04:06
thanks @jnwright
CamperBot
@camperbot
Jan 12 2016 04:06
kaanmasters sends brownie points to @jnwright :sparkles: :thumbsup: :sparkles:
:star: 241 | @jnwright | http://www.freecodecamp.com/jnwright
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 04:07
Alright boys feast your eyes

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

for (i = 0; i < contacts.length; i++){
  if (contacts[i].firstName == firstName){
    if (contacts[i].hasOwnProperty(prop)){
     return   contacts[i][prop];        
    }
    else return  "No such property";
  }
    else result = "No such contact";
}
  return result;
}
Mike W.
@micwill007
Jan 12 2016 04:07
oo i needed an else return
weird o.O
Pawan
@pawan92
Jan 12 2016 04:07
@Aprophecy you still need help
Brian
@sludge256
Jan 12 2016 04:07
shouldn't the no such property variable assignment work though?
since it shouldn't hit no such contact
oh
Dan Santos
@CanIGetAPickle
Jan 12 2016 04:08
@KaanMasters you are a gentleman and a scholar!
Brian
@sludge256
Jan 12 2016 04:08
it's because it's still looping that's way
it gets reassigned later in the loop
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 12 2016 04:08
@CanIGetAPickle I got a lot of help too man -.-
Wendy Huang
@gutentag1026
Jan 12 2016 04:08

Waypoint: Testing Objects for Properties// Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
if (myObj.hasOwnProperty("checkProp") === true)
{
return checkProp;// Your Code Here
}
else
{
return "Not Found!";
}
};

// Test your code by modifying these values
checkObj("gift");

Brian
@sludge256
Jan 12 2016 04:08
fun stuff :+1:
Wendy Huang
@gutentag1026
Jan 12 2016 04:08
what's wrong with my code?