These are chat archives for FreeCodeCamp/Help

5th
Jan 2016
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:00
@agbales you never called the switch statement
GiovannyJean
@GiovannyJean
Jan 05 2016 00:00
@Jonatan-B What would playerNumber used for if I can just use var player to access the properties?
Alexis Reina
@alexisreina
Jan 05 2016 00:00
@Ernest-stewart undefined its not a string
Jaime Victoria
@jaime-evr
Jan 05 2016 00:00
@Ernest-stewart you should return it as undefined not "undefined"
GiovannyJean
@GiovannyJean
Jan 05 2016 00:01

' ' '
// Setup
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};

// Only change code below this line;

var playerNumber= testObj[16]; // Change this Line
var player ; // Change this Line
' ' '

Andrew Bales
@agbales
Jan 05 2016 00:01
@Jonatan-B ... wow. Somehow I thought function(val) { was the opening of it. Thank you!
CamperBot
@camperbot
Jan 05 2016 00:01
agbales sends brownie points to @jonatan-b :sparkles: :thumbsup: :sparkles:
:star: 289 | @jonatan-b | http://www.freecodecamp.com/jonatan-b
Ernest-stewart
@Ernest-stewart
Jan 05 2016 00:01
ok thank you so very much
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:01
@GiovannyJean playerNumber is not suppose to call the object. Just specify what number you want to get on the next statement, where you call the object.
@agbales glad I could help :)
@nelsonbranco I'm hoping I'm not being too cryptic, if you need more explanation I'll be happy to provide

@NateHutchison well that is also how you call the array by index, but in this case for Objects you can use two forms to call their properties:

ObjVariable.PropertyName
ObjVariable[PropertyName]

Now if you wish to call the property based on a pre-existing variable, i.e. propertyName = 15;, you have to use the second method:

ObjVariable.PropertyName; :thumbsdown:
ObjVariable[PropertyName]; :thumbsup:

Bryan Anderson
@Steoso
Jan 05 2016 00:08
// Setup
var collection = {
    2548: {
      album: "Slippery When Wet",
      artist: "Bon Jovi",
      tracks: [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    2468: {
      album: "1999",
      artist: "Prince",
      tracks: [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    1245: {
      artist: "Robert Palmer",
      tracks: [ ]
    },
    5439: {
      album: "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function update(id, prop, value) {
  if(value !== null){




  } else {
    delete collection.id.prop;
  }

  return collection;
}

// Alter values below to test your code
update(2548, "album", "");
Anybody know why this doesn't delete the album from 2548?
Alexis Reina
@alexisreina
Jan 05 2016 00:09
@NateHutchison if you know the name you could use the dot notation, when the name is store in a variable you need to use the bracket notation
Nate Hutchison
@NateHutchison
Jan 05 2016 00:10
thanks @Jonatan-B @alexisreina
CamperBot
@camperbot
Jan 05 2016 00:10
natehutchison sends brownie points to @jonatan-b and @alexisreina :sparkles: :thumbsup: :sparkles:
:warning: natehutchison already gave jonatan-b points
:star: 308 | @alexisreina | http://www.freecodecamp.com/alexisreina
nelsonbranco
@nelsonbranco
Jan 05 2016 00:10
@Jonatan-B , finally got it, all the examples i found on google send me the wrong way... seems so easy and logical now.. thanks
CamperBot
@camperbot
Jan 05 2016 00:10
nelsonbranco sends brownie points to @jonatan-b :sparkles: :thumbsup: :sparkles:
:star: 291 | @jonatan-b | http://www.freecodecamp.com/jonatan-b
Alex
@alex9jk
Jan 05 2016 00:10
does anyone know why my code: var myStr = \, \t, \t, \r, \n; is not encoded correctly from backslash tab tab carriage-return new-line ??
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:10
I'm glad I could help @NateHutchison @nelsonbranco
@Steoso you can't call a property stored in a variable by using the dot notation, you have to use the [variableName] form.
@alex9jk you have to put it in a string, i.e. "\n"
Bryan Anderson
@Steoso
Jan 05 2016 00:14
@Jonatan-B I tried this ```
delete collection[id][prop];
still doesn't work
Nate Hutchison
@NateHutchison
Jan 05 2016 00:14
@Steoso I'm still stuck on this too...
Bryan Anderson
@Steoso
Jan 05 2016 00:15
do i need to make it a variable in the funcation by declaring new var's from the id, prop, value?
Nate Hutchison
@NateHutchison
Jan 05 2016 00:15
I was trying to go off of yours too, since you got father than me lol
Alex
@alex9jk
Jan 05 2016 00:16
@Jonatan-B Do I have to put each one in quotes?
Bryan Anderson
@Steoso
Jan 05 2016 00:16
yeah, i think there needs to be a little more transition on this concept before the waypoint
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:16
@Steoso what is the name of the Waypoint again?
Bryan Anderson
@Steoso
Jan 05 2016 00:16
sorry, checkpoint: record collection
Nate Hutchison
@NateHutchison
Jan 05 2016 00:16
record collection
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:16
@alex9jk You can put them in 1 string.
@Steoso oh that is because you are doing == null, but its not == null, its actually == ""
common mistake :P
@NateHutchison i'm happy to lend assistance if you have more questions
Nate Hutchison
@NateHutchison
Jan 05 2016 00:18
@Jonatan-B I tried that ""
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:18
@NateHutchison can you post your code again? So I can take a look to what you have now?
Bryan Anderson
@Steoso
Jan 05 2016 00:18
ok, that helped @Jonatan-B thank you
CamperBot
@camperbot
Jan 05 2016 00:18
steoso sends brownie points to @jonatan-b :sparkles: :thumbsup: :sparkles:
:star: 292 | @jonatan-b | http://www.freecodecamp.com/jonatan-b
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:19

Also for both @NateHutchison and @Steoso make sure to fully read the instructions:

For the given id in collection:

  • If value is non-blank (value !== ""), then update or set the value for the prop.

  • If the prop is "tracks" and value is non-blank, push the value onto the end of the tracks array.

  • If value is blank, delete that prop.

  • Always return the entire collection object.

When I was doing it I had issues because I didn't read all the requirements :x

Nate Hutchison
@NateHutchison
Jan 05 2016 00:19
// Only change code below this line
function update(id, prop, value) {
if(value !== ""){
collection.id[prop] = value;
} else {
collection.id[prop] = value;
}

  return collection;
}
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:20
Does anyone know what I"m doing wrong here?
Sarah Sivilich
@ssivilich
Jan 05 2016 00:20
Can't figure this out? Any help? Trying to add properties to JSON object, but I get err message: illegal syntax...
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1993,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }];
myMusic.artist= "Celine Dion";
myMusic.title="titanic";
myMusic.release_year ="1999";
myMusic.formats=["cd","avi","mp3"];
// Add record here
return myMusic[1];
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:20

// Setup
var processed = 0;

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

// Only change code below this line
function process(2) {
return (num);
}

Bryan Anderson
@Steoso
Jan 05 2016 00:20
when i tried it the first time with the value !== "" i didn't have the delete in bracket notation so i was running circles
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:20
@NateHutchison you still got it a bit mixed up. It should be collection[id][prop]
nelsonbranco
@nelsonbranco
Jan 05 2016 00:20
@Jonatan-B once again the lookup table... the comments saying to only change above are incorrect... only worked out when ignoring them...
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:21
@justinshort2015 please be sure to wrap your code between ``` so that it formats the code correctly.
Nate Hutchison
@NateHutchison
Jan 05 2016 00:21
ohhhh...trying it now...
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:21
oh ok!
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:21
@justinshort2015 also it helps to include which waypoint you are working on so that we know what you are trying to accomplish.
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:22
Waypoint: Assignment with a Returned Value
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:22
@nelsonbranco can you post your new code?
nelsonbranco
@nelsonbranco
Jan 05 2016 00:22
@Jonatan-B yes, but where?
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:23
@nelsonbranco just here, or you can PM me if you want.
Alex
@alex9jk
Jan 05 2016 00:23
@Jonatan-B This still doesnt work: var myStr = '\, \t, \t, \r, \n'; Am I not putting it in a string correctly ?
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:23
@justinshort2015 from what I see in your code it doesn't seem you have accomplished what was asked
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:23
yea, i don't understand this one
i watched some tutorials but still can't get it
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:24
@alex9jk can you tell me which Waypoint you are working on? also if you could post your code by using the ` method that'd make it more readable
nelsonbranco
@nelsonbranco
Jan 05 2016 00:25
This message was deleted
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:25

@justinshort2015 well the Waypoint is asking for the following:

Call the process function with an argument of 7 and assign its return value to the variable processed.

The objective is for you to learn how to assign the result of the function directly to the variable. Please let me know where you are having confusions and I can explain further, but I would hate to spoil the fun by giving away the answer.

nelsonbranco
@nelsonbranco
Jan 05 2016 00:26
This message was deleted
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:26
blob
It should be like this @nelsonbranco
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:27
I don't understand any of that!
nelsonbranco
@nelsonbranco
Jan 05 2016 00:28
@Jonatan-B .... // Only change code above this line (26)
return result;
Alex
@alex9jk
Jan 05 2016 00:28
@Jonatan-B waypoint 26*
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:28
I wrote my code thinking that is what they wanted but I really don't know what they are asking for
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:29
@alex9jk okay, and when you run your code what is the error you are getting?
@justinshort2015 okay, do you understand how variable value assignment is done?
George Slade
@GeorgeSlade1
Jan 05 2016 00:29
GE everyone. Have instructions to make sure each of your div elements has a closing tag but i keep getting stuck. Here is what i have so far:

<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<Div>
<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>
<Div class="container-fluid">

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

<p>Click here for <a href="#">cat photos</a>.</p>

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

<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
<form action="/submit-cat-photo">
<label><input type="radio" name="indoor-outdoor"> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality"> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Crazy</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
</Div>

any help is appreciated
Alex
@alex9jk
Jan 05 2016 00:29
@Jonatan-B undefined
Chris
@Aoxom
Jan 05 2016 00:29
@GeorgeSlade1 dont capitalize the d in div :)
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:30
Yea, I think we did that on the last assignment
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:30
@nelsonbranco haha, yeah that did not come through correctly :P
@justinshort2015 can you explain it to me?
Chris
@Aoxom
Jan 05 2016 00:31
@GeorgeSlade1 and i dont think you need that div above your style tag
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:31
is that where you write var ourSum = (5,2);
George Slade
@GeorgeSlade1
Jan 05 2016 00:31
thanks @Aoxom
CamperBot
@camperbot
Jan 05 2016 00:31
georgeslade1 sends brownie points to @aoxom :sparkles: :thumbsup: :sparkles:
:star: 382 | @aoxom | http://www.freecodecamp.com/aoxom
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:32
@alex9jk I copy pasted your code on mine and it didn't return undefined. Are you sure you aren't missing something in your code?

@justinshort2015 close. So variable value assignment is the process of assigning a value to a variable. For example:

var variableName = 1;

Does that make sense?

Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:33
Yes!
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:33
@justinshort2015 okay, now do you understand how 'return' works in a function?
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:33
i think, is it where it add two numbers in ()
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 00:34
Good Day, Can I ask?
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:35

@justinshort2015 you need to think outside of the particular example. A function will return the value that is after the keyword return, so if you have:

function myF(var){
return var;
}

When you call the function it by saying myF(1); it will return the value of 1.

Now let say you want to call myF(1); and instead of printing the value by saying console.log(myF(1)); you want to save that value to use it later. You would then want to save it to a variable.

Based on the information I have given you, how would you go about doing that?

Gabriel Dennis Parangan
@gparangan
Jan 05 2016 00:35
on Basic Javascript, idk what does it mean on escaping strings
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:35
@gparangan feel free
Alex
@alex9jk
Jan 05 2016 00:36
@Jonatan-B Just had to get rid of those damn commas! Thanks for working through that with me !
CamperBot
@camperbot
Jan 05 2016 00:36
alex9jk sends brownie points to @jonatan-b :sparkles: :thumbsup: :sparkles:
Robert Richey
@0x0936
Jan 05 2016 00:36
@wishe here are some hints for caesar cipher.
function rot13(encodedStr) {
  var codeArr = encodedStr.split("");  // String to Array
  var decodedArr = []; // Your Result goes here
  // Only change code below this line

  // mostly pseudo code
  // decodedArr needs to be an array of values from which we can generate using .map()
  decodedArr = codeArr.map(function(letter) {
    // first find the difference between current letter and "A"
    // if letter is alphanumeric
    //   if diff >= 13
    //     return letter - 13 positions
    //   else
    //     return character "Z" - (12 - diff)
    // else
    //   return letter

  // Only change code above this line
  return decodedArr.join(""); // Array to String
}
CamperBot
@camperbot
Jan 05 2016 00:36
:star: 293 | @jonatan-b | http://www.freecodecamp.com/jonatan-b
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:36
@gparangan So there is special characters that when you put them into a string it does something special, for example . So in order to print out the \ in the string you have to 'escape it' by putting a \ before it.
@alex9jk my pleasure man :)
Sarah Sivilich
@ssivilich
Jan 05 2016 00:37
I have no idea how to do this. nothing works :worried:
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1993,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }
  // Add record here
];
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:37
var myVar = 1
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:37
@ssivilich what is the waypoint you are working on?
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 00:37
@Jonatan-B Before the ("")?
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:38
@justinshort2015 but let say you want to do it with a function.
@gparangan no before the character like this: var myStr = "Path: C:\Windows\System32"
Jibin M
@jmathew1991
Jan 05 2016 00:38
@ssivilich I think u just put a comma and then add another hash table
Sarah Sivilich
@ssivilich
Jan 05 2016 00:38
Waypoint Introducing JSON
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:39
function myF(1) ?
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 00:40
@Jonatan-B I'll try again thanks a lot
CamperBot
@camperbot
Jan 05 2016 00:40
gparangan sends brownie points to @jonatan-b :sparkles: :thumbsup: :sparkles:
:star: 294 | @jonatan-b | http://www.freecodecamp.com/jonatan-b
careyd62
@careyd62
Jan 05 2016 00:40
Anyone have a minute to give me a little direction with Waypoint: Return Early Pattern for Functions? The example in the exercise does not make sense to me. I can't figure out what method to use. Hints welcome.
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:40

@justinshort2015 so what you want to do is

var myVar = myF(1);

So that the value of myF will be saved to your variable.

Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:40
Ok!
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:41
@careyd62 feel free to ask :)
Sarah Sivilich
@ssivilich
Jan 05 2016 00:41
@jmathew1991 wow, thank you so much! It's embarassing how long it took me to do something so simple. Arg!!
CamperBot
@camperbot
Jan 05 2016 00:41
ssivilich sends brownie points to @jmathew1991 :sparkles: :thumbsup: :sparkles:
:star: 266 | @jmathew1991 | http://www.freecodecamp.com/jmathew1991
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:41
@justinshort2015 I sort of gave you the answer, but I hope that I helped understand the whole thing better.
careyd62
@careyd62
Jan 05 2016 00:41
@Jonatan-B I'm asking, JB.
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:41
sort of but it's not accepting that as an answer
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:42
@justinshort2015 can you post your new code so that I can see what you did?

@careyd62 well what its trying to show you is how to exit a function before reaching the end of the function. We know that by default the 'return' keyword will end the function, so in this case it wants you to add a logic to exit the function if the value of the parameters are 0.

Does that make sense?

Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:44
function process (2)
return (2,5)
careyd62
@careyd62
Jan 05 2016 00:44
@Jonatan-B Ah. Let me work on that. Very helpful. Thanks for the explanation!
CamperBot
@camperbot
Jan 05 2016 00:44
careyd62 sends brownie points to @jonatan-b :sparkles: :thumbsup: :sparkles:
:star: 295 | @jonatan-b | http://www.freecodecamp.com/jonatan-b
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:44
@careyd62 happy to help. If you have any further issues let me know and I'll be happy to help :)
@justinshort2015 are you removing any parts of the code, or is that all you have?
Justinshort2015@icloud.com
@justinshort2015
Jan 05 2016 00:45
thats what I have, I just added a "
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:47
@justinshort2015 I hope I don't come off as rude, or that I don't want to help, but I believe you might want to go back and look through the previous lessons. It seems that you are lacking a fundamental understanding of what functions are and how to call them.
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 00:49
I still don't get it though. Sorry
Waypoint: Escaping Literal Quotes in String.
Amar Patel
@amaryana
Jan 05 2016 00:51
would this function successfully triple a number ? var triple = function (x) {
return x + x + x;
}
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 00:51
@amaryana yes
Amar Patel
@amaryana
Jan 05 2016 00:51
thanks
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:51
@gparangan You know how you start a string with " and then have to end it with " as well?
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 00:52
@amaryana just making sure, you are aware you can do 3 * x?
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 00:52
@Jonatan-B yep. but still having syntaxError by adding backslashes
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 00:52
@gparangan copy paste your string here?
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 00:53
var myStr ="I am a \double quoted\ \string inside\ \double quotes\";
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 00:53
@gparangan erm, shouldn't your \ be followed by a "?
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:53
@gparangan yup, as @CaroleAnneHannon said :P
Amr Elsekilly
@amrsekilly
Jan 05 2016 00:54

Hi, I’m stuck at Bonfire: Spinal Tap Case I can’t figure how to match the null character between both lowerCase & UpperCase characters with Regular Expressions.

e.g.

spinalCase("thisIsSpinalTap”);

Can anyone help me with that Regex, please?

Gabriel Dennis Parangan
@gparangan
Jan 05 2016 00:54
I see. HAHA. Sorry. Thanks to both of you
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 00:54
@gparangan and don't escape the last one. you need that last " for the end of the string
Amar Patel
@amaryana
Jan 05 2016 00:54
Hi, I'm trying to do an exercise out of a book and am stuck. It's on this same subject. I need some help. please and thanks. here is the problem:
Create a function called myChildren that takes one parameter: a child's name.
When passed in ‘Dave’ return ‘Oldest’
When passed in ‘Michelle’ return ‘Middle’
When given any other value return ‘Not my kid!”
I've tried a few things and nothing has worked so far
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 00:55
@amaryana well can you put your code?
Amar Patel
@amaryana
Jan 05 2016 00:55
typing it now...one sec
Nate Hutchison
@NateHutchison
Jan 05 2016 00:56
its saying tracks should have a length of one [checkpoint: record collection]
// Only change code below this line
function update(id, prop, value) {
if(value !== ""){
collection[id][prop] = value;

} else {
collection[id][prop] = value;
delete collection[id][prop] ;



} 

  return collection;
}
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:57
@amrme what do you have so far?
Andrew Bryan
@DrewStephen
Jan 05 2016 00:57
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here

  for (var i in myObj) {
    for (var j in myObj) {
       if (myObj.hasOwnProperty(checkProp)) {
          return myObj[j]; 
    }else{
      return "Not Found";

  }
  }
  }
}


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

Instructions
Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".

I need some help with this. Here is what I have so far

Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 00:57
@NateHutchison in your else, you're making a value then immediately deleting it. Is that really what you intended to do?
Amr Elsekilly
@amrsekilly
Jan 05 2016 00:57
@Jonatan-B I’ve passed all the other test cases except for that case
@Jonatan-B this is my regex so far /(\s|\_|)/g
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:58
@NateHutchison remember that you need to check if prop is tracks and if it is then you have to add to the array, not replace the property :)
Bryan Anderson
@Steoso
Jan 05 2016 00:58
@NateHutchison I messaged you an example to give you an idea.
Amar Patel
@amaryana
Jan 05 2016 00:58
function myChildren('Dave', 'Michelle'){
if myChildren = 'Dave'
console.log('Oldest')
}
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 00:58
@amrme you don't need to escape the underscore
Amar Patel
@amaryana
Jan 05 2016 00:58
im trying to get one right and then do the other two
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 00:58
@amaryana you're missing () for the if
Sakib Shaikh
@sshaikh210
Jan 05 2016 00:58
Has anyone worked JavaScript #37 - Word Blanks?
pecansalad
@pecansalad
Jan 05 2016 00:58
can someone help me please i cant seem to get the code to work
var myArray = [];


for (var i = 1; i < 6; i++) {
  ourArray.push(i);
}
Sakib Shaikh
@sshaikh210
Jan 05 2016 00:58

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

Nate Hutchison
@NateHutchison
Jan 05 2016 00:58
@CaroleAnneHannon I'm not sure..
@Jonatan-B thanks
@Steoso Thanks!
CamperBot
@camperbot
Jan 05 2016 00:58
natehutchison sends brownie points to @caroleannehannon and @jonatan-b and @steoso :sparkles: :thumbsup: :sparkles:
:star: 222 | @steoso | http://www.freecodecamp.com/steoso
:star: 590 | @caroleannehannon | http://www.freecodecamp.com/caroleannehannon
:star: 296 | @jonatan-b | http://www.freecodecamp.com/jonatan-b
Jonatan Bernal
@Jonatan-B
Jan 05 2016 00:59
@sshaikh210 I believe I have, what question do you have?
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 00:59
@amaryana and you shouldn't have 'Dave' or 'Michelle' in your function parameters
Amr Elsekilly
@amrsekilly
Jan 05 2016 00:59
@CaroleAnneHannon but there’s that case that needs matching underscores The_Andy_Griffith_Show
Bryan Anderson
@Steoso
Jan 05 2016 00:59
@sshaikh210 for word blanks make sure you put in spaces between the "'s like myVerb + " hits the " + myAdjective etc
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 00:59
@amaryana try something more like function myChildren(child)
Jonatan Bernal
@Jonatan-B
Jan 05 2016 01:00
@pecansalad shouldn't it be myarray.push?
Amr Elsekilly
@amrsekilly
Jan 05 2016 01:00
I’m replacing the matched Regex with a dash
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:00
@amrme in regex _ doesn't need to be escaped \_ is the same as _. It's not wrong, just saying it's not necessary
Amr Elsekilly
@amrsekilly
Jan 05 2016 01:00
Ok, sorry about that :D
Sakib Shaikh
@sshaikh210
Jan 05 2016 01:01
@Steoso Am I supposed to do it like - "myNoun = "dog"; etc
@Steoso or directly concatenate a sentence by calling the variables?
Bryan Anderson
@Steoso
Jan 05 2016 01:01
i don't have it in front of me but should be something like this ```
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:01
@sshaikh210 more like "this is my "+myNoun
Bryan Anderson
@Steoso
Jan 05 2016 01:01
This message was deleted
Amar Patel
@amaryana
Jan 05 2016 01:02
function myChildren(child) {
if child = ('Dave')
console.log('Oldest')
elseif
child = ('Michelle')
console.log('Middle')
else
console.log('not my child')
}
is that closer?
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:02
@amaryana much closer
Bryan Anderson
@Steoso
Jan 05 2016 01:02
something = "This is my " + myNoun + " and I enjoy being " + etc
Amr Elsekilly
@amrsekilly
Jan 05 2016 01:02
Is there a way to target the null character between two concatenated words with Regex?
Jonatan Bernal
@Jonatan-B
Jan 05 2016 01:02
@DrewStephen why are you using forloops? myObj is not an array, its an object.
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:02
@amaryana but your () for the if are in the wrong place, and for comparison use == not =
pecansalad
@pecansalad
Jan 05 2016 01:03
@Jonatan-B yes I'm so careless thanks haha
CamperBot
@camperbot
Jan 05 2016 01:03
pecansalad sends brownie points to @jonatan-b :sparkles: :thumbsup: :sparkles:
:star: 297 | @jonatan-b | http://www.freecodecamp.com/jonatan-b
Jonatan Bernal
@Jonatan-B
Jan 05 2016 01:03
@pecansalad happy to help :)
careyd62
@careyd62
Jan 05 2016 01:04

@Jonatan-B the code returns the right result but it is not passing all the tests. ```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));
}
```

Jonatan Bernal
@Jonatan-B
Jan 05 2016 01:04
Did we miss anyone there? There was a lot of questions asked at the same time.
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:04
@amaryana as an example: if (something == 'mysomething')
Jonatan Bernal
@Jonatan-B
Jan 05 2016 01:04
blob
@careyd62 make sure to put your code like the one above.
Sakib Shaikh
@sshaikh210
Jan 05 2016 01:05
Got it, thanks guys
Amar Patel
@amaryana
Jan 05 2016 01:05
function myChildren(child) {
if (child == 'Dave');
console.log('Oldest')
elseif
(child == 'Michelle');
console.log('Middle')
else
console.log('not my child')
}
careyd62
@careyd62
Jan 05 2016 01:05
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));
}
Amar Patel
@amaryana
Jan 05 2016 01:05
i know im missing a few things but not sure what
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:05
@amaryana and a space between else and if
Amar Patel
@amaryana
Jan 05 2016 01:05
oh
Jonatan Bernal
@Jonatan-B
Jan 05 2016 01:06
@careyd62 undefined is not a string, its a predefined property. Remove the "" :)
Amar Patel
@amaryana
Jan 05 2016 01:06
function myChildren(child) {
if (child == 'Dave');
console.log('Oldest')
else if
(child == 'Michelle');
console.log('Middle')
else
console.log('not my child')
}
Andrew Bryan
@DrewStephen
Jan 05 2016 01:06
I need some help with Waypoint: Testing Objects for Properties
Jonatan Bernal
@Jonatan-B
Jan 05 2016 01:06

@DrewStephen I replied to your question above.

@DrewStephen why are you using forloops? myObj is not an array, its an object.

Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:06
@amaryana careful with the semicolons. you don't want them after the if condition, and you do want them after your console statements
careyd62
@careyd62
Jan 05 2016 01:07
@Jonatan-B Thanks again. Didn't realize that about undefined.
CamperBot
@camperbot
Jan 05 2016 01:07
careyd62 sends brownie points to @jonatan-b :sparkles: :thumbsup: :sparkles:
:warning: careyd62 already gave jonatan-b points
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:07
@amaryana think of the if (stuff goes here) as being incomplete, so you shouldn't put a ; immediately after them
Andrew Bryan
@DrewStephen
Jan 05 2016 01:07
oh okay! @Jonatan-B
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:07
@amaryana example
if (mytest == 'test')
console.log('stuff');
Andrew Bryan
@DrewStephen
Jan 05 2016 01:07
@Jonatan-B thanks
CamperBot
@camperbot
Jan 05 2016 01:07
drewstephen sends brownie points to @jonatan-b :sparkles: :thumbsup: :sparkles:
:star: 298 | @jonatan-b | http://www.freecodecamp.com/jonatan-b
Jonatan Bernal
@Jonatan-B
Jan 05 2016 01:07
@DrewStephen no problem, let me know if my clue allows you to get the code working. If not feel free to ask further and I'll be happy to further elaborate.
Amar Patel
@amaryana
Jan 05 2016 01:08
thanks
function myChildren(child) {
if (child = 'Dave')
console.log('Oldest);
else if (child = 'Michelle')
console.log('Middle');
else
console.log('Not my kid!');
}
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:09
@amaryana don't forget to use == instead of =
@amaryana and you're missing a ' after Oldest
@amaryana if you use =, you will actually override the child variable. == will compare it
Andrew Bryan
@DrewStephen
Jan 05 2016 01:11
Thanks @Jonatan-B Your clue worked. I just got it to work by just returning the bracket notation of the object.
CamperBot
@camperbot
Jan 05 2016 01:11
drewstephen sends brownie points to @jonatan-b :sparkles: :thumbsup: :sparkles:
:warning: drewstephen already gave jonatan-b points
Amar Patel
@amaryana
Jan 05 2016 01:11
ok thanks. i fixed those
function myChildren(child) {
if(child == 'Dave')
console.log('Oldest');
else if (child == 'Michelle')
console.log ('Middle);
else
console.log ('Not my child!')
}
i feel close but something still doesn't seem complete.
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:12
@amaryana lol, now your Middle is missing a '
Amar Patel
@amaryana
Jan 05 2016 01:13
fixed it. will that work?
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:13
@amaryana should
Amar Patel
@amaryana
Jan 05 2016 01:13
function myChildren(child) {
if(child == 'Dave')
console.log('Oldest');
else if (child == 'Michelle')
console.log ('Middle');
else
console.log ('Not my child!')
}
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:13
@amaryana yup. see here: https://repl.it/BbfB
Amar Patel
@amaryana
Jan 05 2016 01:13
"Oops! Errors. Try again.
Function returned
undefined
instead of
Oldest
when passed
"Dave"
it didnt :(
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:14
it should have. It worked for me. (also your last console.log doesn't have a semicolon)
@amaryana oh, you're supposed to return it, not just console.log it
@amaryana do return 'Oldest'; instead of console.log('Oldest');
David Hall
@haldav
Jan 05 2016 01:16
I'm having trouble with Escaping Literal Quotes in Strings!
Manish Giri
@Manish-Giri
Jan 05 2016 01:17
@haldav what’s your question
Alexis Reina
@alexisreina
Jan 05 2016 01:17
@haldav escape every quote but the first and last one
David Hall
@haldav
Jan 05 2016 01:18
When I input what I think I'm supposed to, the console says it's correct but it doesn't advance me. This leads me to believe that I am incorrect. "\"I am a \"double quoted\" string inside \"double quotes\"\"";
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:18
@haldav don't escape the first and last one
@haldav they are there to explain that it is a string, they're not part of the string (ex: "dog" is a string of the word dog. It doesn't actually contain the first and last ")
you want it to actually display: I am a "double quoted" string inside "double quotes"
Alexis Reina
@alexisreina
Jan 05 2016 01:19
@haldav your example has an extra quote at the end. Remove it.
Amar Patel
@amaryana
Jan 05 2016 01:20
got it! thanks so much
i spent an hour on that
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:20
you have the logic ok @amaryana , it's the syntax that you need a bit of practice on.
but that'll come with practice
David Hall
@haldav
Jan 05 2016 01:20
@CaroleAnneHannon thanks!
CamperBot
@camperbot
Jan 05 2016 01:20
haldav sends brownie points to @caroleannehannon :sparkles: :thumbsup: :sparkles:
:star: 591 | @caroleannehannon | http://www.freecodecamp.com/caroleannehannon
David Hall
@haldav
Jan 05 2016 01:21
@alexisreina thanks!
Alexis Reina
@alexisreina
Jan 05 2016 01:21
@haldav np
David Hall
@haldav
Jan 05 2016 01:21
@alexisreina thanks!
CamperBot
@camperbot
Jan 05 2016 01:21
haldav sends brownie points to @alexisreina :sparkles: :thumbsup: :sparkles:
:star: 309 | @alexisreina | http://www.freecodecamp.com/alexisreina
Jared Abel
@jaredabel
Jan 05 2016 01:21
if i wanted to add text to an html element that already has some text, wouldnt this be the way to do it
$('.readOut').text($('.readOut').text() + '0');
err
$('.readOut').text($('div.readOut').text() + '0');
Sarah Schlueter
@SarahMarie73
Jan 05 2016 01:24
Can someone tell me what I'm doing wrong here
// Example
function ourFunction(a, b) {
  console.log(a - b);
}
ourFunction(10, 5); // Outputs 5

// Only change code below this line.

function myFunction(c, d) {
  console.log(c + b);
}
myFunction(1, 2);
Alexis Reina
@alexisreina
Jan 05 2016 01:24
@jaredabel00 I think it may work, but it's not the best way to do it
Sarah Schlueter
@SarahMarie73
Jan 05 2016 01:24
Waypoint: Passing Values to Functions with Arguments
Jared Abel
@jaredabel
Jan 05 2016 01:24
@alexisreina I am open to suggestions
Alexis Reina
@alexisreina
Jan 05 2016 01:28
@jaredabel00 try this
$('.readonly').text(function(idx, text) { return text + 0; });
meatyogre
@meatyogre
Jan 05 2016 01:29
I am on the same one @SarahMarie73
...
Bryan Anderson
@Steoso
Jan 05 2016 01:30
@SarahMarie73 what is the task?
meatyogre
@meatyogre
Jan 05 2016 01:30
your console.log(c+b) should be c+d
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 01:30
@SarahMarie73 myFunction has parameters c and d. but inside you're doing console.log(c + b);. d and b are not the same letters.
Ashley
@atan77
Jan 05 2016 01:30
@jaredabel00 why not just .html or .append?
meatyogre
@meatyogre
Jan 05 2016 01:30
(c + d) that is.
Alexis Reina
@alexisreina
Jan 05 2016 01:30
@jaredabel00 you can pass a function to $.textwhere the first arg is the index of the node and the second the text of the node
meatyogre
@meatyogre
Jan 05 2016 01:31
and you also should have myFunction(7, 9); underneath the myFunction (1,2);
Tommy
@tcool612
Jan 05 2016 01:32
Waypoint: Create a Form Element
Jared Abel
@jaredabel
Jan 05 2016 01:34
@alexisreina Thanks, looking at it now
CamperBot
@camperbot
Jan 05 2016 01:34
jaredabel00 sends brownie points to @alexisreina :sparkles: :thumbsup: :sparkles:
Elifaz Filho
@Elifaz
Jan 05 2016 01:34
@tcool612 Show us what you’ve got so far..
CamperBot
@camperbot
Jan 05 2016 01:34
:star: 310 | @alexisreina | http://www.freecodecamp.com/alexisreina
Tommy
@tcool612
Jan 05 2016 01:34
guys anyone can help with this Waypoint: Create a Form Element how to Nest your text input element within a form element.

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

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

what's wrong with this?
Alexis Reina
@alexisreina
Jan 05 2016 01:35
@tcool612 just put the input inside the form tag
Mark
@MarkFilchenko
Jan 05 2016 01:35

// 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
Not sure if I understand this one, example doesn't use type and list...Waypoint: Accessing Nested Arrays in JSON

I do have brackets around the 1
Tommy
@tcool612
Jan 05 2016 01:36
thankyou guys
Amar Patel
@amaryana
Jan 05 2016 01:36
ok. stuck on an array problem now. "Create a function called numbaOne that returns the first element of an array that is passed in as a parameter. Hint: This should work for an array of any size." My solution: "var numbaOne = [1,2,3];
console.log(numbaOne0);"
it says "Oops! Errors. Try again.
self[e.data.invoke.func].apply is not a function"
Fausto Payano
@FaustoPayano
Jan 05 2016 01:37
Anyone here willing to assist me on the Javascript Palindrome Bonfire problem?
help format
CamperBot
@camperbot
Jan 05 2016 01:38

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

``` ⇦ Type 3 backticks, then press [enter ⏎]

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

:pencil: read more about code formatting on the FCC Wiki

Amar Patel
@amaryana
Jan 05 2016 01:39
ok. stuck on an array problem now. "Create a function called numbaOne that returns the first element of an array that is passed in as a parameter. Hint: This should work for an array of any size." My solution: var numbaOne = [1,2,3]; console.log(numbaOne[0]);
Tommy
@tcool612
Jan 05 2016 01:39
@alexisreina thankyou it worked fine
meatyogre
@meatyogre
Jan 05 2016 01:39
I am reading this code formatting... kind of confused... are you supposed to put the backticks here in the forum before and after your code?
Fausto Payano
@FaustoPayano
Jan 05 2016 01:39
function palindrome(str) {
  var lowerCase = str.toLowerCase();
  var newLowerCaseArray = lowerCase.replace('^\w+$', "");
  for(var i = 0; i < lowerCase; i++)
    {
      if(newLowerCaseArray[i] !== newLowerCaseArray[newLowerCaseArray.length - i]);
      {
        return false;
      }
    }
  return true;
}



palindrome("not a palindrome");
Certain conditions aren't being satisfied
Anyone willing to provide some guidance on the bonfire palindrome problem?
hmm
Alexis Reina
@alexisreina
Jan 05 2016 01:40
@FaustoPayano the comparison in the for loop it's wrong
Fausto Payano
@FaustoPayano
Jan 05 2016 01:40
maybe this solution doesnt work
yeah
I realize that now that was a stupid approach
Going to try splitting into arrays
Alexis Reina
@alexisreina
Jan 05 2016 01:41
compare i with the length of lowercase
there are a few other approaches, for sure. Split the string in half, reverse the second half and compare it to the first half its what I did @FaustoPayano
Andrew Bryan
@DrewStephen
Jan 05 2016 01:43
// Setup
var myPlants = [
  { 
    type: "flowers",
    list: [
      "rose",
      "tulip",
      "dandelion"
    ]
  },
  {
    type: "trees",
    list: [
      "fir",
      "pine",
      "birch"
    ]
  }  
];

// Only change code below this line

var secondTree = myPlants.type.trees.list[1]; // Change this line
I can't figures this one out. Any suggestions fellow campers?
Alexis Reina
@alexisreina
Jan 05 2016 01:44
myPlants is an array not an Object
Steven Osterwald
@keks411
Jan 05 2016 01:44
@DrewStephen myPlants[1].list[1];
Andrew Bryan
@DrewStephen
Jan 05 2016 01:44
I'm tryiny to have var secondTree = "pine"
Thanks @keks411
CamperBot
@camperbot
Jan 05 2016 01:44
drewstephen sends brownie points to @keks411 :sparkles: :thumbsup: :sparkles:
:star: 218 | @keks411 | http://www.freecodecamp.com/keks411
Fausto Payano
@FaustoPayano
Jan 05 2016 01:44
@alexisreina thanks
CamperBot
@camperbot
Jan 05 2016 01:44
faustopayano sends brownie points to @alexisreina :sparkles: :thumbsup: :sparkles:
:star: 311 | @alexisreina | http://www.freecodecamp.com/alexisreina
md mehadi hasan mozumder
@mehadi07
Jan 05 2016 01:46
can any one please give me this solution Waypoint: Access MultiDimensional Arrays With Indexes
Steven Osterwald
@keks411
Jan 05 2016 01:48
@mehadi07 Count the other brackets, starting from 0. Then go to the ones inside. var data1 = arr[1][2];
Outer not other
meatyogre
@meatyogre
Jan 05 2016 01:49
need a hand here... Waypoint: Assignment with a Returned Value

// Setup
var processed = 0;

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

// Only change code below this line

function processed(7);
var processed = process;

Instructions
Call the process function with an argument of 7 and assign its return value to the variable processed.
Amar Patel
@amaryana
Jan 05 2016 01:50
var numbaOne = [5,2,3,4]; console.log(numbaOne[0]);
^ why doesn' that "Create a function called numbaOne that returns the first element of an array that is passed in as a parameter"
Steven Osterwald
@keks411
Jan 05 2016 01:51
@mehadi07 var myData = myArray[2][1];
Chris
@Aoxom
Jan 05 2016 01:52
@meatyogre you only name it function when you create the function, so when you call on a function, you can just say processed(7)
md mehadi hasan mozumder
@mehadi07
Jan 05 2016 01:52
@keks411 thanks
CamperBot
@camperbot
Jan 05 2016 01:52
mehadi07 sends brownie points to @keks411 :sparkles: :thumbsup: :sparkles:
:star: 219 | @keks411 | http://www.freecodecamp.com/keks411
Amar Patel
@amaryana
Jan 05 2016 01:53
can someone please help me, i really don't know what im doing wrong or what's missing.
Patrick McWilliams
@patrickmac110
Jan 05 2016 01:54
@DrewStephen and @MarkFilchenko
var secondTree = myPlants[1].list[1];
my Plants is an array and since arrays start with 0, we need the second one 1
then the second item in list
Chris
@Aoxom
Jan 05 2016 01:55
@meatyogre same deal with the variable. var processed = 0; is declared at the top, so when you assign it afterwards, you dont say var again
@amaryana "Create a function..." but you created an array variable var numbaOne = [5,2,3,4]; ?
meatyogre
@meatyogre
Jan 05 2016 02:00
right ok thanks @Aoxom
CamperBot
@camperbot
Jan 05 2016 02:00
meatyogre sends brownie points to @aoxom :sparkles: :thumbsup: :sparkles:
:star: 383 | @aoxom | http://www.freecodecamp.com/aoxom
Robert Richey
@0x0936
Jan 05 2016 02:01
@amaryana var numbaOne = function(arr) { return arr[0]; }; this function returns the first element of an array passed in as an argument
meatyogre
@meatyogre
Jan 05 2016 02:02

// Setup
var processed = 0;

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

// Only change code below this line

process(7);
processed = process;

Manish Giri
@Manish-Giri
Jan 05 2016 02:02
@meatyogre var processed = process(7);
meatyogre
@meatyogre
Jan 05 2016 02:06
ahh ok thanks @Manish-Giri that did the trick. So did I not need the process(7) line above processed = process(7); at all?
CamperBot
@camperbot
Jan 05 2016 02:06
meatyogre sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star: 569 | @manish-giri | http://www.freecodecamp.com/manish-giri
Amar Patel
@amaryana
Jan 05 2016 02:06

```var numbaOne = [8,2,3];

var firstNumber = numbaOne0;

console.log(firstNumber);```

`var numbaOne = [8,2,3];

var firstNumber = numbaOne0;

console.log(firstNumber);`

i fixed the code a little but i cant format it here
how can i turn that into a function?
"Oops! Errors. Try again.
self[e.data.invoke.func].apply is not a function"
Aaron Graves
@gravesmeister
Jan 05 2016 02:09
Could anyone be so kind as to help me with "Waypoint: Give a Background Color to a Div Element" I'm not a hundred percent sure where I should be adding the background color
Sarah Schlueter
@SarahMarie73
Jan 05 2016 02:11
@CaroleAnneHannon I realized that and fixed it...still didn't work
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 02:11
@SarahMarie73 it's been a little while. mind refreshing my memory?
Sarah Schlueter
@SarahMarie73
Jan 05 2016 02:12
Sorry about that, I was driving, I'm home now let me pull it up
frsRaza
@frsRaza
Jan 05 2016 02:15
need on on counting cards

```var count = 0;

function cc(card) {
// Only change code below this line

switch(card) {
case 2:
case 3:
case 4:
case 5:
case 6:
console.log = 1;
break;
case 7:
case 8:
case 9:
console.log = 0;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
console.log = -1;
}

card ++;

if (card > 0) {
return (card + "Bet");
} else if (card >= 0) {
return (card + "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');
```

Sarah Schlueter
@SarahMarie73
Jan 05 2016 02:17
@CaroleAnneHannon Nevermind, I guess it was right. For some reason they weren't taking it lol
frsRaza
@frsRaza
Jan 05 2016 02:18
var count = 0;

function cc(card) {
  // Only change code below this line

  switch(card) {
    case 2: 
    case 3:
    case 4:
    case 5:
    case 6:
      console.log = 1;
      break;
    case 7:
    case 8:
    case 9:
      console.log = 0;
      break;
    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":
      console.log = -1;
  }


  card ++;

  if (card > 0) {
    return (card + "Bet");
  } else if (card >= 0) {
    return (card + "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');
don't know what I'm doing here. sorry please help
Andrew Bales
@agbales
Jan 05 2016 02:19
@frsRaza I'm working on this as well
CompGeekGirl
@LisaRamos
Jan 05 2016 02:19

I'm having an issue with Waypoint's Assignment with Plus Equals. It says to convert the assignments for a, b, and c to use the += operator. I've done that and the code won't go through. What am I doing wrong here?

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

// Only modify code below this line

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

How can I fix this?

frsRaza
@frsRaza
Jan 05 2016 02:19
@agbales have you gotten anywhere?
Andrew Bales
@agbales
Jan 05 2016 02:20
Screen Shot 2016-01-04 at 9.19.52 PM.png
This is incorrect as well, but it's the approach I was taking.
frsRaza
@frsRaza
Jan 05 2016 02:20
@lisaramos you have to get rid of the first variable "a"
it should be a += 12;
@agbales ah I didn't even include the count variable
Mahendrasinh Rana
@mkr2005
Jan 05 2016 02:21

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

function queue(arr, item) {
// Your code here

return item; // Change this line
}

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

Andrew Bales
@agbales
Jan 05 2016 02:22
@frsRaza Your return is using the Card + "bet" or "hold"... I think it's asking for a return of the global variable and then one of those decisions
Dan Craycraft
@craycraftdan
Jan 05 2016 02:23
I'm not sure I'm understanding multidimensional arrays, why does the last one equal 11? I guess I don't get what the numbers in arr[] are even pointing too.
var arr = [
    [1,2,3],
    [4,5,6],
    [7,8,9],
    [[10,11,12], 13, 14]
];
arr[0]; // equals [1,2,3]
arr[1][2]; // equals 6
arr[3][0][1]; // equals 11
Aaron Graves
@gravesmeister
Jan 05 2016 02:23
<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>

<p>Click here for <a href="#">cat photos</a>.</p>

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

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

<form action="/submit-cat-photo">
  <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>
CompGeekGirl
@LisaRamos
Jan 05 2016 02:23

@lisaramos you have to get rid of the first variable "a"

But what about b = 9 + b; ?

Aaron Graves
@gravesmeister
Jan 05 2016 02:23
I'm not 100 percent on where to at the background color on this waypoint
I need to add it to what's in the div element
frsRaza
@frsRaza
Jan 05 2016 02:23
@lisaRamos look at what I did with your code. instead of a = a += 12; it's a += 12;
you do the same for "b"
+= operator already includes the variable
Andrew Bales
@agbales
Jan 05 2016 02:24
@gravesmeister I believe you'll need to give the div a class. Then you can assign properties to that class.
Simon
@simonshum
Jan 05 2016 02:25
can anyone give me some pointers on 'Checkpoint: Stand in Line'
CompGeekGirl
@LisaRamos
Jan 05 2016 02:25
@frsRaza for b I typed in 9 += b; and got an error message. How do I solve that?
Aaron Graves
@gravesmeister
Jan 05 2016 02:25
Ok I think I need to go back and redo some of the earlier lessons
Simon
@simonshum
Jan 05 2016 02:25
console just keeps popping maximum call stack size exceeded before i even change the code
Aaron Graves
@gravesmeister
Jan 05 2016 02:25
Thanks @agbales
CamperBot
@camperbot
Jan 05 2016 02:25
gravesmeister sends brownie points to @agbales :sparkles: :thumbsup: :sparkles:
:star: 204 | @agbales | http://www.freecodecamp.com/agbales
Jared Abel
@jaredabel
Jan 05 2016 02:26
@gravesmeister What is the name of the waypoint
Jason Deng
@jasonCodeng
Jan 05 2016 02:26
// Only change code below this line
function update(id, prop, value) {
  if (value !== "")
    collection.id[prop] = value;
  else if (prop == "tracks" && value !== "")
    collection.id.tracks.push(value);
  else if (value === "")
    delete collection.id[prop];

  return collection;
}
Mahendrasinh Rana
@mkr2005
Jan 05 2016 02:26
@simonshum same here
Jason Deng
@jasonCodeng
Jan 05 2016 02:27
need help with record collection waypoint
frsRaza
@frsRaza
Jan 05 2016 02:27
@LisaRamos reverse it. b += 9;
Andrew Bales
@agbales
Jan 05 2016 02:27
@gravesmeister It depends how the exercise asks you to add the background-color. However, it will be similar to how the h2 has a class of red-text, which is given a style in the <style> section.
Aaron Graves
@gravesmeister
Jan 05 2016 02:27
@jaredabel00 it's "Waypoint: Give a Background Color to a Div Element"
Jared Abel
@jaredabel
Jan 05 2016 02:27
@gravesmeister Create a class called gray-background with the background-color of gray. Assign this class to your div element.
CompGeekGirl
@LisaRamos
Jan 05 2016 02:27
@frsRaza I see. I got it. Thanks.
CamperBot
@camperbot
Jan 05 2016 02:27
lisaramos sends brownie points to @frsraza :sparkles: :thumbsup: :sparkles:
:star: 235 | @frsraza | http://www.freecodecamp.com/frsraza
frsRaza
@frsRaza
Jan 05 2016 02:27
the variable should go first. if you don't its reading it as is 9 = 9 + b. when you put b += 9 it reads b = b + 9;
Jared Abel
@jaredabel
Jan 05 2016 02:27
so see how you have the .green border thing
frsRaza
@frsRaza
Jan 05 2016 02:27
@LisaRamos
Robert Richey
@0x0936
Jan 05 2016 02:27
@jasonCodeng id is a variable name, not a property name. must used bracket notation
Jared Abel
@jaredabel
Jan 05 2016 02:28
@grave i'll PM you
Aaron Graves
@gravesmeister
Jan 05 2016 02:28
I understand what you're saying @jaredabel00 but I'm getting so many terms in my head that I think I need to redo the lessons so I understand fully what I'm doing
Jared Abel
@jaredabel
Jan 05 2016 02:28
i can help explain it real quck
Aaron Graves
@gravesmeister
Jan 05 2016 02:29
ok
Jason Deng
@jasonCodeng
Jan 05 2016 02:29
Thanks! @0x0936
CamperBot
@camperbot
Jan 05 2016 02:29
jasoncodeng sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
:star: 768 | @0x0936 | http://www.freecodecamp.com/0x0936
Jared Abel
@jaredabel
Jan 05 2016 02:29
@gravesmeister I opened a PM with you
frsRaza
@frsRaza
Jan 05 2016 02:29
@agbales i changed my if function to count instead of card. it now says 5 bet but doesn't fix anything else. still kind of stuck with what I'm doing wrong.
Aaron Graves
@gravesmeister
Jan 05 2016 02:30
Um ok. Haven't done that before @jaredabel00
Dan Craycraft
@craycraftdan
Jan 05 2016 02:30
Nevermind, I found a great video that explains it a better clearer. https://youtu.be/Cta5s1QBD8E?t=2m49s
Jared Abel
@jaredabel
Jan 05 2016 02:30
on the left
you'll see my name
Dan Craycraft
@craycraftdan
Jan 05 2016 02:30
Ops, didn't mean for it to be that big haha
Aaron Graves
@gravesmeister
Jan 05 2016 02:30
Oh in the chat app?
I'm using the help window
Jared Abel
@jaredabel
Jan 05 2016 02:30
ahh
ok everyone will have to suffer
everything inside your <style> is CSS
 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%;
  }
Aaron Graves
@gravesmeister
Jan 05 2016 02:31
Right ok
frsRaza
@frsRaza
Jan 05 2016 02:31
var count = 0;

function cc(card) {
  // Only change code below this line

  switch(card) {
    case 2: 
    case 3:
    case 4:
    case 5:
    case 6:
      console.log = count + 1;
      break;
    case 7:
    case 8:
    case 9:
      console.log = count;
      break;
    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":
      console.log = count -1;
  }


  count ++;

  if (count > 0) {
    return (count + " Bet");
  } else if (count >= 0) {
    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(7); cc('K'); cc('A');
Jared Abel
@jaredabel
Jan 05 2016 02:31
so we want to add .gray-background
Simon
@simonshum
Jan 05 2016 02:31
@mkr2005 figured it out. chrome browser breaks soem compiling issues. if u use firefox at leas the compiler works
Jared Abel
@jaredabel
Jan 05 2016 02:32
so it will be ```
.gray-background {
background-color:gray;
}
Andrew Bales
@agbales
Jan 05 2016 02:32
@frsRaza I'm trying the Switch method now instead of if/else
frsRaza
@frsRaza
Jan 05 2016 02:33
@agbales let me know if you find a solution
Andrew Bales
@agbales
Jan 05 2016 02:33
I'm not sure about console.log-- seems like something like this for 1 - 6 might work? var count++;
break;
frsRaza
@frsRaza
Jan 05 2016 02:33
@agbales I'm still tinkering the code myself
Mahendrasinh Rana
@mkr2005
Jan 05 2016 02:34
@simonshum Thanks man am Also using Chrome
frsRaza
@frsRaza
Jan 05 2016 02:34
@agbales var count = count++; didn't seem to work
Andrew Bales
@agbales
Jan 05 2016 02:36
@frsRaza You're right. I thought var count was necessary because it's a global variable, but I don't get the error when I remove var
Nikhil Bhutada
@nikhilbhutadauta
Jan 05 2016 02:37
Hello
Build myStr over several lines by concatenating these two strings:
"This is the first sentence. " and "This is the second sentence." using the += operator.
var myStr="This is the first sentence. ";
myStr += "This is the second sentence";
still getting error
frsRaza
@frsRaza
Jan 05 2016 02:39
@agbales does your switch statement look similar to mine?
@agbales it has to do with the argument for sure I just can't figure it out
Nikhil Bhutada
@nikhilbhutadauta
Jan 05 2016 02:39
any help??
CompGeekGirl
@LisaRamos
Jan 05 2016 02:40

Checkpoint: Convert Celsius to Farenheit issue. It says you are given a variable celsius representing a temperature in Celsius. Create a variable fahrenheit and apply the algorithm to assign it the corresponding temperature in Fahrenheit. I'm very confused and my code won't go through. Here it is.

function convert(celsius) {
// Only change code below this line
var farenheit = (farenheit - 32) * 5/9;
// Only change code above this line
if ( typeof fahrenheit !== 'undefined' ) {
return fahrenheit;
} else {
return 'fahrenheit not defined';
}
}

// Change the inputs below to test your code
convert(30);
convert(-30);
convert(-10);
convert(0);
convert(20);

How can I fix this?

Dan Craycraft
@craycraftdan
Jan 05 2016 02:41
use var celsius for the math
CompGeekGirl
@LisaRamos
Jan 05 2016 02:42
@craycraftdan How do I do that?
Dan Craycraft
@craycraftdan
Jan 05 2016 02:42
I just did mine today and had a similar issue but mine ended up looking something like this
var fahrenheit = (celsius * 9 / 5) + 32;
CompGeekGirl
@LisaRamos
Jan 05 2016 02:44

@craycraftdan I did that and it said that it's still not defined. Is it the bottom code that I have here?

function convert(celsius) {
// Only change code below this line
var farenheit = (celsius * 9/5) + 32;
// Only change code above this line
if ( typeof fahrenheit !== 'undefined' ) {
return fahrenheit;
} else {
return 'fahrenheit not defined';
}
}

// Change the inputs below to test your code
convert(30);
convert(-30);
convert(-10);
convert(0);
convert(20);

Dan Craycraft
@craycraftdan
Jan 05 2016 02:45
You have a typo check your var, farenheit should be fahrenheit
CompGeekGirl
@LisaRamos
Jan 05 2016 02:45
@craycraftdan I fixed it. Thanks.
CamperBot
@camperbot
Jan 05 2016 02:45
lisaramos sends brownie points to @craycraftdan :sparkles: :thumbsup: :sparkles:
:star: 170 | @craycraftdan | http://www.freecodecamp.com/craycraftdan
Vikash Kumar
@vikey725
Jan 05 2016 02:46
Social media symbols is not coming in my button instead, its showing one small rectangle, Please help. Here is my code :
<a href="#" class="btn btn-default btn-lg button"><i class="fa fa-twitter fa-fw" >Twitter</i></a>
Dan Craycraft
@craycraftdan
Jan 05 2016 02:46
no problem!
Derek Welton
@freefora11
Jan 05 2016 02:46
On the bonfire:"Sum All Odd Fibonacci Numbers"(http://www.freecodecamp.com/challenges/bonfire-sum-all-odd-fibonacci-numbers), I'm not understanding why I am getting the wrong answer. I am adding all the numbers before the number given in the function as they explained(unless I'm not understanding). Here is the code:
function sumFibs(num) {

    var arr = [1,1];
    var total = 0;
    for(var i = 1; i < num;i++){
        arr.push(arr[i]+arr[i-1]);
        total = arr[i+1];
        if(total > num){
            break;
        }
    }
    console.log(arr);


  return total;
}

sumFibs(1000);
Carla Souza
@CarlaSouzz
Jan 05 2016 02:49

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

<p>Click here for <a href="#">cat photos</a>.</p>

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

<p>Things cats love:</p>

<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>

<p>Top 3 things cats hate:</p>

<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>

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

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

Nest your text input element within a form element.
Make sure your form has an action attribute which is set to /submit-cat-photo
Make sure your form element has a closing tag.What am I doing wrong ?
Jason Deng
@jasonCodeng
Jan 05 2016 02:50
This message was deleted
CamperBot
@camperbot
Jan 05 2016 02:50
:bulb: to format code use backticks! ``` more info
Melissa Martinez
@Melimartin
Jan 05 2016 02:50

I'm not understanding why it's not recognizing my bracket notation. Thoughts anyone?

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

Jason Deng
@jasonCodeng
Jan 05 2016 02:50
This message was deleted
Need help with Waypoint: Local Scope and Functions
function myFunction() {
  var myVar = "test";


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

var myVar = "test2";
// 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
Mukul Patel
@Mukul215
Jan 05 2016 02:52
@Melimartin use the variable playerNumber instead of hard coding testObj[16]
@jasonCodeng make sure 'Use Strict' is above var myVar = "test";
after, remove the console.log after checking your console for the error.
@jasonCodeng sorry its: use strict;
"use strict";
Melissa Martinez
@Melimartin
Jan 05 2016 02:57
@Mukul215 I'm sorry, I don't think I quite understand. One of the requirements for this portion is that playerNumber should be a number. With the above code, all of the requirements are checked off instead of the last one ("You should use bracket notation to access testObj")
Mukul Patel
@Mukul215
Jan 05 2016 02:58
@Melimartin correct. So using playerNumber inside the brackets will give you the results you want.
DJ
@qualitymanifest
Jan 05 2016 02:58
@Melimartin var playerNumber = 16; playerNumber is a number. so you can use it in your bracket notation on the line below it, instead of [16]
Mukul Patel
@Mukul215
Jan 05 2016 02:58
testObj[yourVariable]
Jason Deng
@jasonCodeng
Jan 05 2016 02:59
@Mukul215 I am getting "No global myVar variable"
function myFunction() {

"use strict"; 

  var myVar = "test";

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

var myVar = "test2";
// run and check the console 
// myVar is not defined outside of myFunction
console.log(myVar);
Melissa Martinez
@Melimartin
Jan 05 2016 02:59
OH wow, now I understand! Thank you @Mukul215 @qualitymanifest Instead of using the actual number, I should use the variable name itself.
CamperBot
@camperbot
Jan 05 2016 02:59
melimartin sends brownie points to @mukul215 and @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 290 | @mukul215 | http://www.freecodecamp.com/mukul215
:star: 719 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
Mukul Patel
@Mukul215
Jan 05 2016 03:00
no problem @Melimartin !
@jasonCodeng try just initializing myVar instead of assigning it to something
var myVar; not var myVar = "";
Jason Deng
@jasonCodeng
Jan 05 2016 03:01
@Mukul215 The global one?
Mukul Patel
@Mukul215
Jan 05 2016 03:02
The one inside the function
remove the var myVar = "test2"; near the bottom.
this exercise is to show what error the use of "use strict;" will give you in the console
Jason Deng
@jasonCodeng
Jan 05 2016 03:04
function myFunction() {

  "use strict"; 

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

// run and check the console 
// myVar is not defined outside of myFunction
console.log(myVar);
I am getting console.log never called
Aaron Graves
@gravesmeister
Jan 05 2016 03:04
@jaredabel00 Thanks
CamperBot
@camperbot
Jan 05 2016 03:04
gravesmeister sends brownie points to @jaredabel00 :sparkles: :thumbsup: :sparkles:
:star: 302 | @jaredabel00 | http://www.freecodecamp.com/jaredabel00
Mukul Patel
@Mukul215
Jan 05 2016 03:04
also do not forget to remove the console.log(myVar); to pass all test
outside the function
function myFunction() {

  "use strict"; 

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

// run and check the console 
// myVar is not defined outside of myFunction
//console.log(myVar);
your code
Jason Deng
@jasonCodeng
Jan 05 2016 03:06
I am still getting console.log never called
even after commentating out console.log(myVar) after the function
Mukul Patel
@Mukul215
Jan 05 2016 03:06
That should pass your requirements
same code works fine for me and asks me to move onto the next waypoint
Jason Deng
@jasonCodeng
Jan 05 2016 03:07
That's weird, I copied and pasted the same thing and it's not letting me pass.
Mukul Patel
@Mukul215
Jan 05 2016 03:08
function myFunction() {
  'use strict';

  var myVar;
  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
that is the one i did.
there may be a bug in that waypoint. It works fine for me
Jason Deng
@jasonCodeng
Jan 05 2016 03:09
Still no luck.
Mukul Patel
@Mukul215
Jan 05 2016 03:09
hmm. not sure then.
Colton Ehrman
@coltonehrman
Jan 05 2016 03:09
This message was deleted
This message was deleted
Gordon Davidescu
@gordondavidescu
Jan 05 2016 03:10
Waypoint: Quoting Strings with Single Quotes
Jason Deng
@jasonCodeng
Jan 05 2016 03:10
@Mukul215 I'll look at Issues on Github. Thanks for the help!
CamperBot
@camperbot
Jan 05 2016 03:10
jasoncodeng sends brownie points to @mukul215 :sparkles: :thumbsup: :sparkles:
:star: 291 | @mukul215 | http://www.freecodecamp.com/mukul215
Gordon Davidescu
@gordondavidescu
Jan 05 2016 03:10
I have no idea what I am doing wrong
Mukul Patel
@Mukul215
Jan 05 2016 03:11
no problem! hope it doesn't give you too much trouble.
Ashley
@atan77
Jan 05 2016 03:12
@gordondavidescu what's your code look like?
Mukul Patel
@Mukul215
Jan 05 2016 03:12
@gordondavidescu whats the problem?
Jason Deng
@jasonCodeng
Jan 05 2016 03:13
@Mukul215 An issue was created on the same problem, someone advised to clearing browsers cache and submitting again, I tried and resubmitted and the waypoint passed! I guess it was just a bug then? Thanks again!
CamperBot
@camperbot
Jan 05 2016 03:13
jasoncodeng sends brownie points to @mukul215 :sparkles: :thumbsup: :sparkles:
:warning: jasoncodeng already gave mukul215 points
Mukul Patel
@Mukul215
Jan 05 2016 03:14
@jasonCodeng cool! no problem, happy to help!
frsRaza
@frsRaza
Jan 05 2016 03:16
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 = count++;
      break;
    case 7:
    case 8:
    case 9:
      console.log = count;
      break;
    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":
      count = count--;
  }


  count ++;

  if (count > 0) {
    return count + " Bet";
  } else if (count >= 0) {
    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(7); cc('K'); cc('A');
stuck on Checkpoint: Counting Cards
angelbenoit
@angelbenoit
Jan 05 2016 03:17
how do you show picture of your text like that?
your code*
frsRaza
@frsRaza
Jan 05 2016 03:18
@angelbenoit back ticks ```
Mukul Patel
@Mukul215
Jan 05 2016 03:18
use ``` between your code @angelbenoit
frsRaza
@frsRaza
Jan 05 2016 03:18
three before three after
angelbenoit
@angelbenoit
Jan 05 2016 03:18
ty
frsRaza
@frsRaza
Jan 05 2016 03:18
can anyone help with my dilemna?
angelbenoit
@angelbenoit
Jan 05 2016 03:19

'''
function queue(arr, item) {
// Your code here

arr.push([item]);
arr.shift();

return arr; // Change this line
}
'''

CamperBot
@camperbot
Jan 05 2016 03:19
:bulb: to format code use backticks! ``` more info
Mukul Patel
@Mukul215
Jan 05 2016 03:19
@frsRaza your problem is in your else if statement
@angelbenoit backticks, the ones above the tab button on the left side of the keyboard
@frsRaza you have greater than 0 and then again greater than or equal to 0
angelbenoit
@angelbenoit
Jan 05 2016 03:20
oh
for checkpoint: stand in line i have
function queue(arr, item) {
  // Your code here

  arr.push([item]);
  arr.shift();

  return arr;  // Change this line
}
you know what i'm doing wrong? still a bit confused
frsRaza
@frsRaza
Jan 05 2016 03:20
@Mukul215 that was such a simple fix... thanks a lot man!
CamperBot
@camperbot
Jan 05 2016 03:20
frsraza sends brownie points to @mukul215 :sparkles: :thumbsup: :sparkles:
:star: 292 | @mukul215 | http://www.freecodecamp.com/mukul215
Mukul Patel
@Mukul215
Jan 05 2016 03:21
@frsRaza no problem!
@angelbenoit try inline return
for example, return arr.shift();
and remove the first arr.shift
@frsRaza remember you have a global myArr to worry about too.
msha833
@msha833
Jan 05 2016 03:26

Hey guys, I'm doing a jQuery waypoint and for some reason, after writing:

$("#target5").clone().appendTo("#left-well");

the target5 button appears twice on the left-well, I'm not sure if this is a bug or not but I haven't a clue why this is the case.

CamperBot
@camperbot
Jan 05 2016 03:26
:bulb: to format code use backticks! ``` more info
Andrew Bales
@agbales
Jan 05 2016 03:30
@frsRaza Thanks!
CamperBot
@camperbot
Jan 05 2016 03:30
agbales sends brownie points to @frsraza :sparkles: :thumbsup: :sparkles:
:star: 236 | @frsraza | http://www.freecodecamp.com/frsraza
Patrick Beseda
@pbeseda
Jan 05 2016 03:31
Hey everyone, I'm doing Waypoint: Local Scope and Functions (it's one of the new ones.). I can't seem to get the "No global myVar variable" to pass. I feel like the directions are a little unclear. Which console log line is the comment instructions referring to? (Removing either and both doesn't work).
Mukul Patel
@Mukul215
Jan 05 2016 03:32
@pbeseda clear your browser cache and re-try. Someone had a problem with the same thing earlier.
angelbenoit
@angelbenoit
Jan 05 2016 03:32
var myArr = [1,2,3,4,5];

function queue(arr, item) {
  // Your code here

  arr.push([item]);

  return arr.shift();  // Change this line
}
Mukul Patel
@Mukul215
Jan 05 2016 03:32
@pbeseda the second console.log
angelbenoit
@angelbenoit
Jan 05 2016 03:32
it says After queue(myArr, 10), myArr[4] should be 10
and after tracing the code i think i got it right, but still getting an error
Mukul Patel
@Mukul215
Jan 05 2016 03:33
@angelbenoit you are using arr instead of the global myArr
see how above the myArr is initialized, you are suppose to manipulate that.
Nikolajs Korolkovs
@NickEU
Jan 05 2016 03:34
why would he use a global variable there?
@angelbenoit the problem in your code is in your push function argument, why are you using [ - there things around it?
rmtc3
@rmtc3
Jan 05 2016 03:35
its the brackets
around item.
Mukul Patel
@Mukul215
Jan 05 2016 03:36
@NickEU i see what you mean. No need to use the myArr.
Patrick Beseda
@pbeseda
Jan 05 2016 03:37
@Mukul215 tried that. now the tests (red x and green check) aren't showing?
it shows everything correctly for other waypoints. only this one seems to be broken
Jason Deng
@jasonCodeng
Jan 05 2016 03:39
@pbeseda I asked the same question and got it to pass after submitting

```function myFunction() {
'use strict';

var myVar;
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```

function myFunction() {
  'use strict';

  var myVar;
  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
after clearing my cache
Patrick Beseda
@pbeseda
Jan 05 2016 03:41
@jasonCodeng that worked for me. thank you.
CamperBot
@camperbot
Jan 05 2016 03:41
pbeseda sends brownie points to @jasoncodeng :sparkles: :thumbsup: :sparkles:
:star: 237 | @jasoncodeng | http://www.freecodecamp.com/jasoncodeng
mb0207
@angelwyan
Jan 05 2016 03:41

Hey guys, i have a question regarding Waypoint: Using Objects for Lookups.
I am confused as to what I should name my object table. I did it as var lookup but it doesn't work.
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");

rmtc3
@rmtc3
Jan 05 2016 03:41
@angelbenoit sorry Its the brackets you have around item that's causing it to fail still. you are adding [#] so it sill print [2, 3, 4, [item]]
Patrick Beseda
@pbeseda
Jan 05 2016 03:41
I was initializing that variable and it wasn't passing.
Mukul Patel
@Mukul215
Jan 05 2016 03:43
@angelwyan I was confused with this one too. Since the directions say only change everything above return result; it can be confusing. In reality, change return result; to `return lookup[val
angelbenoit
@angelbenoit
Jan 05 2016 03:44
var myArr = [1,2,3,4,5];

function queue(arr, item) {
  // Your code here
  arr.push(item);

  return arr.shift();  // Change this line
}
like that? i removed them
rmtc3
@rmtc3
Jan 05 2016 03:44
yes.
mb0207
@angelwyan
Jan 05 2016 03:44
@Mukul215 Awesome! That works. Glad I asked. Thanks so much!
CamperBot
@camperbot
Jan 05 2016 03:44
angelwyan sends brownie points to @mukul215 :sparkles: :thumbsup: :sparkles:
:star: 293 | @mukul215 | http://www.freecodecamp.com/mukul215
Mukul Patel
@Mukul215
Jan 05 2016 03:45
@angelwyan no problem!
angelbenoit
@angelbenoit
Jan 05 2016 03:47
it still shows an error with that code
var myArr = [1,2,3,4,5];

function queue(arr, item) {
  // Your code here
  arr.push(item);

  return arr.shift();  // Change this line
}

// Display Code
console.log("Before: " + JSON.stringify(myArr));
console.log(queue(myArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(myArr));
Holly Williford
@hollyhascode
Jan 05 2016 03:47
stuck on Waypoint accessing object properties with variables
angelbenoit
@angelbenoit
Jan 05 2016 03:47
that's the whole code so far
Nikolajs Korolkovs
@NickEU
Jan 05 2016 03:47
@angelbenoit what's the error? stack call? :D
Holly Williford
@hollyhascode
Jan 05 2016 03:47
// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};

// Only change code below this line;

var playerNumber = [16];       // Change this Line
var player = testObj[Montana];   // Change this Line
angelbenoit
@angelbenoit
Jan 05 2016 03:48
yeah stack size exceeded
Mukul Patel
@Mukul215
Jan 05 2016 03:48
@hollyhascode use the variable that you assigned 16 to, not the name of the state
Nikolajs Korolkovs
@NickEU
Jan 05 2016 03:48
@angelbenoit reload the page ;)
@angelbenoit and your prayers will be answered - it's a bug ;)
rmtc3
@rmtc3
Jan 05 2016 03:48
yes what @NickEU says.
angelbenoit
@angelbenoit
Jan 05 2016 03:49
Holly Williford
@hollyhascode
Jan 05 2016 03:49
@Mukul215 Oooooh. Thanks so much. I spent so much time on that way point. Now I see it.
CamperBot
@camperbot
Jan 05 2016 03:49
hollyhascode sends brownie points to @mukul215 :sparkles: :thumbsup: :sparkles:
:star: 294 | @mukul215 | http://www.freecodecamp.com/mukul215
angelbenoit
@angelbenoit
Jan 05 2016 03:49
how do you do those brownie points lol
Mukul Patel
@Mukul215
Jan 05 2016 03:49
@hollyhascode no problem
angelbenoit
@angelbenoit
Jan 05 2016 03:49
thanks @rmtc3
CamperBot
@camperbot
Jan 05 2016 03:49
angelbenoit sends brownie points to @rmtc3 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for rmtc3
rmtc3
@rmtc3
Jan 05 2016 03:50
haha no credit goes to @Mukul215
Nikolajs Korolkovs
@NickEU
Jan 05 2016 03:50
@angelbenoit i'm here to protect and serve lol :cop:
angelbenoit
@angelbenoit
Jan 05 2016 03:51
thanks @Mukul215
CamperBot
@camperbot
Jan 05 2016 03:51
angelbenoit sends brownie points to @mukul215 :sparkles: :thumbsup: :sparkles:
:star: 295 | @mukul215 | http://www.freecodecamp.com/mukul215
Mukul Patel
@Mukul215
Jan 05 2016 03:53
anytime @angelbenoit
chloegott
@chloegott
Jan 05 2016 03:57
hi all! so i'm on waypoint 111 and i'm having a bit of trouble. it's probably really obvious, but I cant seem to spot what exactly I'm missing. Any help would be awesome! thanks!
Derek Welton
@freefora11
Jan 05 2016 03:58
This bonfire doesn't make sense to me: http://www.freecodecamp.com/challenges/bonfire-smallest-common-multiple, how is it that the least common multiple of 1 and 5 is 60?
Rex Schrader
@SaintPeter
Jan 05 2016 03:58
@freefora11 Not one AND five - one THROUGH five. IE: 1,2,3,4,5
@chloegott I don't know what waypoint 111 is - what is the name?
Derek Welton
@freefora11
Jan 05 2016 03:59
@SaintPeter oh ok, that makes more sense haha, thanks
CamperBot
@camperbot
Jan 05 2016 03:59
freefora11 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 2145 | @saintpeter | http://www.freecodecamp.com/saintpeter
Javeed Ishaq
@JaveedIshaq
Jan 05 2016 03:59
Hi dear All please help me Checkpoint: Record Collection
how to add value to an array inside an JSON object value array . array.push() is pushing the value but returning it as not an array

// Setup
var collection = {
2548: {
album: "Slippery When Wet",
artist: "Bon Jovi",
tracks: [
"Let It Rock",
"You Give Love a Bad Name"
]
},
2468: {
album: "1999",
artist: "Prince",
tracks: [
"1999",
"Little Red Corvette"
]
},
1245: {
artist: "Robert Palmer",
tracks: [ ]
},
5439: {
album: "ABBA Gold"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

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

return collection;
}

// Alter values below to test your code
update(1245, "tracks", "Addicted to Love");

Rex Schrader
@SaintPeter
Jan 05 2016 04:00
@JaveedIshaq push does not return an array. Push returns the index of the number you just added. You need to specify the "path" to the areay, then push onto it.
chloegott
@chloegott
Jan 05 2016 04:00
@SaintPeter Add Font Awesome Icons to our Buttons. here's the link: http://www.freecodecamp.com/challenges/waypoint-add-font-awesome-icons-to-our-buttons
Rex Schrader
@SaintPeter
Jan 05 2016 04:01
@JaveedIshaq ok, take a look at your code - tell me this: if value is non-blank, will you ever reach the portion of code that does a push?
@chloegott yikes, please edit/delete yuor message
@chloegott What is the trouble?
Pranav Doshi
@pranavdoshi
Jan 05 2016 04:02
gm
wassp
Rex Schrader
@SaintPeter
Jan 05 2016 04:02
Yo Yo
Pranav Doshi
@pranavdoshi
Jan 05 2016 04:03
how r u @SaintPeter
Rex Schrader
@SaintPeter
Jan 05 2016 04:03
Kickin' it live at the Mcdonalds in Walmat. Love me some free WiFi :D
Pranav Doshi
@pranavdoshi
Jan 05 2016 04:03
u r gr8 mcd fan??
Amar Patel
@amaryana
Jan 05 2016 04:03

How can I write a function that returns the total of all of the items in the array added together? here is my code so far: `var myData = [1,2,3,4,5];

var myTotal = 0;

for(var i = 0, len = myData.length; i < len; i++) {
myTotal += myData[i][1];
}

console.log(myTotal);`

Javeed Ishaq
@JaveedIshaq
Jan 05 2016 04:04
@SaintPeter thanks dear .... if value is non-blank it set the collection[id][prop] = value;
CamperBot
@camperbot
Jan 05 2016 04:04
javeedishaq sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 2146 | @saintpeter | http://www.freecodecamp.com/saintpeter
Sam Friedman
@samtx
Jan 05 2016 04:04
I'm stuck on the same waypoint, @JaveedIshaq , but I do see what @SaintPeter is talking about: suppose that "tracks" is your prop, then instead of pushing the value on the tracks array you are replacing the whole array with the value.
chloegott
@chloegott
Jan 05 2016 04:04
@SaintPeter not 100 percent sure. It tells me i need to Add an i element with the classes fa and fa-thumbs-up, which shouldn't be a problem, so I'm not quite sure where i'm going wrong. should i send the code?
Rex Schrader
@SaintPeter
Jan 05 2016 04:04
@JaveedIshaq Right - which overwrites your array :D
Pranav Doshi
@pranavdoshi
Jan 05 2016 04:04
@amaryana hey
Amar Patel
@amaryana
Jan 05 2016 04:05
hey @pranavdoshi
Rex Schrader
@SaintPeter
Jan 05 2016 04:05
@chloegott nope - so the example is this: <i class="fa fa-info-circle"></i> - you need to put that in the right place inside your button, before the button text . . . and with the right icon - rather than fa-info-circle I thnk it's fa-thumbs-up, right?
CamperBot
@camperbot
Jan 05 2016 04:05
saintpeter sends brownie points to @chloegott :sparkles: :thumbsup: :sparkles:
:star: 112 | @chloegott | http://www.freecodecamp.com/chloegott
Pranav Doshi
@pranavdoshi
Jan 05 2016 04:05
it will come total = total + mydata[i];
Sam Friedman
@samtx
Jan 05 2016 04:06
For me, I think my collections variable is undefined from within my function...
function update(id, prop, value) {
  if (value !== "") {
    if (prop === "tracks") {
      collection.id.prop.push(value);
    }
    else {
      collection.id.prop = value;
    }
  }

  else {
    delete collection.id.prop;
  }

  return collection;
}
Pranav Doshi
@pranavdoshi
Jan 05 2016 04:06
try using this see if u get o/p
@amaryana
Herman Fassett
@HermanFassett
Jan 05 2016 04:06
@samtx you need to use bracket notation for variables
Rex Schrader
@SaintPeter
Jan 05 2016 04:06
@samtx Part of the issues is that you MUST use bracket notation and cannot use dot notation. id is not a property of collection, neither is prop
Javeed Ishaq
@JaveedIshaq
Jan 05 2016 04:06
@SaintPeter thanks dear.... it is replacing the all the array
CamperBot
@camperbot
Jan 05 2016 04:06
:warning: javeedishaq already gave saintpeter points
javeedishaq sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
mb0207
@angelwyan
Jan 05 2016 04:07

For Waypoint: Testing Objects for Properties, how do i write a function that return "Not Found" if the property doesn't exist ? Should i use an if statement?

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

function checkObj(checkProp) {
myObj.hasOwnProperty(checkProp);
return myObj[checkProp];

}

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

Sam Friedman
@samtx
Jan 05 2016 04:07
@HermanFassett @SaintPeter a ha
Maryam
@Maryam1362
Jan 05 2016 04:07
quick question about waypoint: testing objects for properties

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

function checkObj(checkProp) {
// Your Code Here

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

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

Amar Patel
@amaryana
Jan 05 2016 04:07
@pranavdoshi that part works now! thanks. how can I make this into a functin?
CamperBot
@camperbot
Jan 05 2016 04:07
amaryana sends brownie points to @pranavdoshi :sparkles: :thumbsup: :sparkles:
Rex Schrader
@SaintPeter
Jan 05 2016 04:07
@angelwyan Yes, you need to use an if statement - use the hasOwnProperty function which returns a boolean
CamperBot
@camperbot
Jan 05 2016 04:07
:star: 281 | @pranavdoshi | http://www.freecodecamp.com/pranavdoshi
Pranav Doshi
@pranavdoshi
Jan 05 2016 04:08
np dude
@amaryana
anything else??
Rex Schrader
@SaintPeter
Jan 05 2016 04:08
@Maryam1362 Note that hasOwnProperty returns a boolean already - you don't need to compare it to true
Sam Friedman
@samtx
Jan 05 2016 04:08
success!
Mox Gaa
@9-9-0
Jan 05 2016 04:08
BF: Title Case A Sentence
Output says Type Error: 0 is read-only. Any way to bypass this? Do I have to create additional copies of the original string?
function titleCase(str) {
  str = str.split(" ");
  for (var i = 0; i < str.length; i++)
    {
      str[i][0] = str[i][0].toUpperCase();
    }
  str = str.join();
  return str;
}

titleCase("I'm a little tea pot");
CamperBot
@camperbot
Jan 05 2016 04:08
Sorry, can't find a bonfire called title case a sentenceoutput says type error 0 is read-only any way to bypass this do i have to create additional copies of the original stringfunction titlecasestr str strsplit for var i 0 i strlength i stri0 stri0touppercase str strjoin return strtitlecaseim a little tea pot. [ Check the map? ]
Sam Friedman
@samtx
Jan 05 2016 04:09
thanks @SaintPeter
thanks @HermanFassett
Maryam
@Maryam1362
Jan 05 2016 04:09
@SaintPeter I also tried
CamperBot
@camperbot
Jan 05 2016 04:09
samtx sends brownie points to @saintpeter and @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 2147 | @saintpeter | http://www.freecodecamp.com/saintpeter
:star: 1291 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
chloegott
@chloegott
Jan 05 2016 04:09
@SaintPeter thanks so much for all your help!
CamperBot
@camperbot
Jan 05 2016 04:09
chloegott sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 2148 | @saintpeter | http://www.freecodecamp.com/saintpeter
Maryam
@Maryam1362
Jan 05 2016 04:09

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

but is does not work
Amar Patel
@amaryana
Jan 05 2016 04:10
@pranavdoshi how can I make that code into a function?
mb0207
@angelwyan
Jan 05 2016 04:10
@Maryam1362 I did the same thing, but doesn't work
Pranav Doshi
@pranavdoshi
Jan 05 2016 04:10
@Maryam1362 there is no checkProp
Rex Schrader
@SaintPeter
Jan 05 2016 04:10
@Maryam1362 You must use bracket notation. There is no property of myObj called checkProp
Pranav Doshi
@pranavdoshi
Jan 05 2016 04:10
@amaryana simply add within a function
and call it
Rex Schrader
@SaintPeter
Jan 05 2016 04:11
@qqTpp PLease re-read the waypoint "Understanding immutability in Strings"
Pranav Doshi
@pranavdoshi
Jan 05 2016 04:11
try checking the examples within fcc u will get it
:)
Andrew Bales
@agbales
Jan 05 2016 04:11
@hollyhascode Thanks!
CamperBot
@camperbot
Jan 05 2016 04:11
agbales sends brownie points to @hollyhascode :sparkles: :thumbsup: :sparkles:
:star: 232 | @hollyhascode | http://www.freecodecamp.com/hollyhascode
Maryam
@Maryam1362
Jan 05 2016 04:13
@SaintPeter :still not clear for me so when we call the function the prameter gift should be replaced by ckeckPro
still
mb0207
@angelwyan
Jan 05 2016 04:14
@Maryam1362 return myObj[checkProp];
@SaintPeter Thank you!
CamperBot
@camperbot
Jan 05 2016 04:15
angelwyan sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 2149 | @saintpeter | http://www.freecodecamp.com/saintpeter
Amar Patel
@amaryana
Jan 05 2016 04:16
@pranavdoshi "Function returned
undefined
instead of
15
when passed
[1,2,3,4,5]"
Maryam
@Maryam1362
Jan 05 2016 04:16
@SaintPeter thanks a lot it works now
CamperBot
@camperbot
Jan 05 2016 04:16
maryam1362 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 2150 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Jan 05 2016 04:16
@Maryam1362 :D
Franco Zapata
@Francozt01
Jan 05 2016 04:16
Waypoint: Accessing Nested Arrays in JSON
Maryam
@Maryam1362
Jan 05 2016 04:16
@angelwyan thanks
CamperBot
@camperbot
Jan 05 2016 04:16
maryam1362 sends brownie points to @angelwyan :sparkles: :thumbsup: :sparkles:
:star: 214 | @angelwyan | http://www.freecodecamp.com/angelwyan
Amar Patel
@amaryana
Jan 05 2016 04:17

@pranavdoshi what's wrong with this code? "function addThemAllTogether(myArray) {}

myArray = [1,2,3,4,5];
var total = 0;

for(var i = 0, len = myArray.length; i < len; i++) {
total = total + myArray[i];
}
console.log(total);
"

Mox Gaa
@9-9-0
Jan 05 2016 04:17
@SaintPeter So if I can't change them, I'd have to loop through all the letters and add them to a string (performing .toUpperCase() on the first letter)?
Rex Schrader
@SaintPeter
Jan 05 2016 04:18
@qqTpp There are several ways to do it and that is one of them. You can also "build" each word by taking the capital first letter and using "slice" to get the rest of the word.
@qqTpp You could also split it into an array of letters and have some logic to detect spaces. You can replace elements in an array without trouble. Then join them back together.
Dan Craycraft
@craycraftdan
Jan 05 2016 04:19
Anyone ever use Cloud9?
Mox Gaa
@9-9-0
Jan 05 2016 04:20
@SaintPeter Thanks, forgot about slicing
CamperBot
@camperbot
Jan 05 2016 04:20
qqtpp sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 2151 | @saintpeter | http://www.freecodecamp.com/saintpeter
Herman Fassett
@HermanFassett
Jan 05 2016 04:21
@craycraftdan yep
Rex Schrader
@SaintPeter
Jan 05 2016 04:21
@amaryana Your loop is not looping. What is len equal to?
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 04:21
Anyone can check what I've done wrong here?
var myStr; "I am a \"double quoted"\ string inside \"double quotes"\";
Anthony DeFreitas
@biganth
Jan 05 2016 04:21
@pranavdoshi what error are you getting?
Franco Zapata
@Francozt01
Jan 05 2016 04:22
@amaryana look the addThemAllTogether(myArray) {} <--- curly brackets should be opened and close at the end also maybe u need to " return total; " instead of console.log() or the exercise resquested to console.log(total);
Dan Craycraft
@craycraftdan
Jan 05 2016 04:23
@HermanFassett I was thinking about using it instead of Codepen when I get to that point. I used Codepen before when doing codeacademy last year and it was buggy back then. Would you recommend cloud9?
Rex Schrader
@SaintPeter
Jan 05 2016 04:23
@gparangan You're escaping the LAST quote, rather than the next to last quote. that means that your string ends early and probably confuses things.
Averuma
@Averuma
Jan 05 2016 04:23
how i nest the text input element with a form element?
Franco Zapata
@Francozt01
Jan 05 2016 04:23
and what is ien ¿?¿ s
Herman Fassett
@HermanFassett
Jan 05 2016 04:24
@craycraftdan well, I used codepen for my first ziplines and cloud9 for my first basejump, but I've switched to doing it all locally
Dan Craycraft
@craycraftdan
Jan 05 2016 04:24
@HermanFassett does that seem to be the best option?
Herman Fassett
@HermanFassett
Jan 05 2016 04:25
Personally I much prefer dev in atom and host ziplines on github pages and basejumps on heroku
Amar Patel
@amaryana
Jan 05 2016 04:26
it works in here https://repl.it/BbfB/1
im trying to make it into a function. that's not working
I've spent over an hour on this one problem. ive tried as much as i know on my own and would love some help now.
Rex Schrader
@SaintPeter
Jan 05 2016 04:27
Dan Craycraft
@craycraftdan
Jan 05 2016 04:27
@HermanFassett thanks for the information
CamperBot
@camperbot
Jan 05 2016 04:27
craycraftdan sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
Rex Schrader
@SaintPeter
Jan 05 2016 04:27
@amaryana BTW, and hour is nothing ;)
CamperBot
@camperbot
Jan 05 2016 04:27
:star: 1292 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Amar Patel
@amaryana
Jan 05 2016 04:27
@SaintPeter it's not returning anything now
Holly Williford
@hollyhascode
Jan 05 2016 04:28
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line

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

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

// Change this value to test
phoneticLookup("charlie");
from Waypoint: Using Objects for Lookups
Rex Schrader
@SaintPeter
Jan 05 2016 04:29
@amaryana You need to call a function to make it go
Holly Williford
@hollyhascode
Jan 05 2016 04:30
these new javascript lessons are tough
Chris Bjornn
@cbjornn
Jan 05 2016 04:30
So, they recently added a lot of Javascript problems and flat out, a lot of them are hard to understand what they're even asking
I'm completely lost on Checkpoint: Stand in Line
Rex Schrader
@SaintPeter
Jan 05 2016 04:30
@hollyhascode You have an unholy mix of object and switch syntax. You need to build a lookup object, then do a lookup using that object and assign the result to result
Chris Bjornn
@cbjornn
Jan 05 2016 04:31
Screen Shot 2016-01-04 at 9.30.45 PM.png
Rex Schrader
@SaintPeter
Jan 05 2016 04:31
@cbjornn You need to do two things:
1) Add a number to the end of arr
2) Pull the first number off arr and return it
@hollyhascode Also, sorry that the new lessons are so tough. Maybe it's tough love? I wanted the Bonfires to be easier when you got to them, so that means making the rest of the curriculum a bit harder.
Holly Williford
@hollyhascode
Jan 05 2016 04:32
Yeah I know I've tried multiple ways of deleting all the switch language, but I wasn't have any luck with that either
Rex Schrader
@SaintPeter
Jan 05 2016 04:33
@cbjornn Look into push and shift
anthonygallina1
@anthonygallina1
Jan 05 2016 04:33
@hollyhascode they make me wonder if they are lessons. Or bonfires. Too much in the leaps from what they have in the instructions.
Holly Williford
@hollyhascode
Jan 05 2016 04:33
Yeah, I appreciate the added lessons, I feel make you applied what you learned. But still it is tough!
Chris Bjornn
@cbjornn
Jan 05 2016 04:33
Ah. Okay. push and shift. That makes sense.
Thank you!!
@SaintPeter :)
Anthony DeFreitas
@biganth
Jan 05 2016 04:34
@Francozt01 yes
anthonygallina1
@anthonygallina1
Jan 05 2016 04:34
@SaintPeter Hi
Rex Schrader
@SaintPeter
Jan 05 2016 04:34
Hola :D
Franco Zapata
@Francozt01
Jan 05 2016 04:34
@biganth yes what ?¿? :D
Hola Saint
Anthony DeFreitas
@biganth
Jan 05 2016 04:34
@Francozt01 I've done that lesson
Abhisek Pattnaik
@abhisekp
Jan 05 2016 04:34
Saint is Innocent :innocent:
Holly Williford
@hollyhascode
Jan 05 2016 04:34
Yeah, maybe for the more difficult javascript lessons it would be nice to label them as bonfires just so people know that this particular waypoint requires applying what you learned in previous lesson plus some outside research.
Franco Zapata
@Francozt01
Jan 05 2016 04:35
@biganth oh ok.. already did it by myself :D
Anthony DeFreitas
@biganth
Jan 05 2016 04:35
cool
Franco Zapata
@Francozt01
Jan 05 2016 04:35
:+1::
Rex Schrader
@SaintPeter
Jan 05 2016 04:35
@hollyhascode Well, they now have "Checkpoints" which are basically "mini-bonfires"
They're supposed to be more structured/easier than a bonfire
anthonygallina1
@anthonygallina1
Jan 05 2016 04:36
@hollyhascode :) At which point does it change from a Lesson to a assignment.
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 04:36
@SaintPeter Still got no idea. :worried:
Rex Schrader
@SaintPeter
Jan 05 2016 04:36
@gparangan Sorry, can't remember which issue you had . . . lemme scroll up
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:36
@hollyhascode for "Waypoint: Using Objects for Lookups" follow a similar format as the example, but instead of using 1: 2: 3:, use what the values for the case statement used to be . ex: "alpha":
Franco Zapata
@Francozt01
Jan 05 2016 04:37
@cbjornn have some problems with Stand in Line ?
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 04:37
@SaintPeter It's all about Escaping quotes in strings.
Rex Schrader
@SaintPeter
Jan 05 2016 04:37
@gparangan Show me what you've got again, please?
Andrew Bales
@agbales
Jan 05 2016 04:38
@hollyhascode Do you need the result = ?
Holly Williford
@hollyhascode
Jan 05 2016 04:38
IDK it'd probably be a good idea to indicate verbally the difference between simple waypoints and assignments just to prevent people from being frustrated.
Nah I'm going to work on it based on advice given
thanks though!
anthonygallina1
@anthonygallina1
Jan 05 2016 04:38
:)
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:38
@hollyhascode that one is a waypoint, the harder ones are called checkpoints
Amar Patel
@amaryana
Jan 05 2016 04:38

@SaintPeter it works in repl.it but i get these errors 'myArray is undefined' or 'cannot read property 'length' of undefined.'

what's wrong with https://repl.it/BbfB/3

Gabriel Dennis Parangan
@gparangan
Jan 05 2016 04:39

var myStr; "I am a "\double quoted"\ string inside "\double quotes\"

@SaintPeter Here it is. Idk how to send screenshot here. lol

Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:39
@amaryana you're not passing the array
Rex Schrader
@SaintPeter
Jan 05 2016 04:39
@amaryana myArray should be a parameter - you are defining it locally
@gparangan You're missing the last double quote - just put it on there and you should be good to go.
@gparangan oh, also, yo uneed to do assignment. Do you know how to store a value in a variable?
Holly Williford
@hollyhascode
Jan 05 2016 04:40
Oh lol I'm dumb
anthonygallina1
@anthonygallina1
Jan 05 2016 04:40
no
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:40
@hollyhascode no you're not :/
Rex Schrader
@SaintPeter
Jan 05 2016 04:40
@hollyhascode Naw - you're fine
Chris Bjornn
@cbjornn
Jan 05 2016 04:40
@Francozt01 Yeah, I'm still working on it. @SaintPeter recommended I look at shift and push but still having a hard time.
Rex Schrader
@SaintPeter
Jan 05 2016 04:41
@hollyhascode I think facepalm moments are part of programming
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 04:41
@SaintPeter I forgot what you mean. Is it about equal?
Amar Patel
@amaryana
Jan 05 2016 04:41
@CaroleAnneHannon @SaintPeter Im not that good at understanding this stuff yet so what does that mean? I'm confused still of how to change my code https://repl.it/BbfB/3
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 04:41
I'm sorry for being a noob
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:41
@amaryana your function has a parameter called myArray function addThemAllTogether(myArray) {
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 04:42
@SaintPeter I'm getting a syntax error..
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:42
@amaryana but then you override it here var myArray = [1,2,3,4,5,6,7];
Amar Patel
@amaryana
Jan 05 2016 04:42
i removed that line
anthonygallina1
@anthonygallina1
Jan 05 2016 04:42
@hollyhascode Highly intelligent Reminds me of a old story the King has no clothes.
TypeError: Cannot read property 'length' of undefined
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:42
@amaryana now look at your log statement
@amaryana see how you call addThemAllTogether()?
@amaryana but it was defined as function addThemAllTogether(myArray) {
Rex Schrader
@SaintPeter
Jan 05 2016 04:43
@gparangan var someVariable = "some string";
Amar Patel
@amaryana
Jan 05 2016 04:43
https://repl.it/BbfB/5 now it says "ReferenceError: myArray is not defined"
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:43
@amaryana put the array in there, like console.log(addThemAllTogether([1,2]));
Chris Bjornn
@cbjornn
Jan 05 2016 04:44
wait. Actually, I think it's just the page. It's saying "Range Error: Maximum call stack size exceeded"
Rex Schrader
@SaintPeter
Jan 05 2016 04:44
@gparangan Also, being at FCC means never having to say you're sorry for being a n00b. We're all n00bs here.
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:44
@amaryana https://repl.it/BbfB/7 <- if this makes sense
Chris Bjornn
@cbjornn
Jan 05 2016 04:44
wth?
Rex Schrader
@SaintPeter
Jan 05 2016 04:45
@cbjornn Try refreshing the page.
Amar Patel
@amaryana
Jan 05 2016 04:45
THANK YOU! finally. it makes sense and i got it right. im starting to get why i keep making the same mistakes
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 04:46
@SaintPeter I still get some syntaxerror. idk what to add.
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:46
@amaryana I think seeing the 3 console.logs really explains the purpose of functions being pre-made reusable code
Amr Elsekilly
@amrsekilly
Jan 05 2016 04:47
can you share it @gparangan ?
Amar Patel
@amaryana
Jan 05 2016 04:47
@CaroleAnneHannon it definitely does help. this is so new to my brain, its gonna take some time
Rex Schrader
@SaintPeter
Jan 05 2016 04:47
@gparangan Previously your code looked like var myStr; "stuff" - but that semicolon is the end of the statement. You need to assign the string to myStr
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:49
@amaryana you'll get there :)
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 04:51
blob

var myVar= "I am a \"double quoted"\ string inside \"double quotes\"";

@amrme @SaintPeter

Amr Elsekilly
@amrsekilly
Jan 05 2016 04:51
you have to escape the "
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:52
\" not "\
Sarah Schlueter
@SarahMarie73
Jan 05 2016 04:52
Can anyone help explain Waypoint: Assignment with a Returned Value?
Rex Schrader
@SaintPeter
Jan 05 2016 04:52
@SarahMarie73 Sure
oops, nope, My wife is done with shopping
'night all
DJ
@qualitymanifest
Jan 05 2016 04:53
@gparangan see how string inside is white? that shows you that part is not a string. so see @CaroleAnneHannon 's response above
Sarah Schlueter
@SarahMarie73
Jan 05 2016 04:53
take that back, Checkpoint: Stand in Line
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:53
everybody loves Stand in Line
mukhtaarabdi
@mukhtaarabdi
Jan 05 2016 04:53
This message was deleted
MoniqueE
@MoniqueE
Jan 05 2016 04:53
@gparangan your \ should be after the word "quoted" and before the "
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:53
@SarahMarie73 first it wants you to add the item into the array, do you know what function does that?
Dan Craycraft
@craycraftdan
Jan 05 2016 04:54
Javascript.info is a godsend
Sarah Schlueter
@SarahMarie73
Jan 05 2016 04:54
@CaroleAnneHannon I don't even know where to begin. These functions are so confusing, just when I think I've got it down something else throws me
mukhtaarabdi
@mukhtaarabdi
Jan 05 2016 04:54
guys which one should i use
var count = 0;

function cc(card) {
  // Only change code below this line


  //this is switch
switch (card){
  case 2, 3, 4, 5, 6:
    return "5 Bet";
    break;

  case 2, 3, 4, 5, 6:
    return "5 Bet";
    break;


  case 7, 8, 9:
    return "0 Hold";
    break;

  case 10, "J", "Q", "K", "A":
    return "-5 Hold";
    break;

  case 3, 2, "A", 10, "K":
    return "-1 Hold";
    break;

}


  //this is if/else statement
if (card<=6){
    return "5 Bet";
  }
  else if (card>6){
    return "0 Hold";
  }
  else if (card===10 || card==='J','Q','K','A'){
    return "-5 Hold";
  }
  else if(card==3,2,10 || card==='A','K') {
    return "-1 Hold";
  }

}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A’);
Gabriel Dennis Parangan
@gparangan
Jan 05 2016 04:54
Now I understand. Thanks a lot @qualitymanifest @amrme @SaintPeter @MoniqueE
CamperBot
@camperbot
Jan 05 2016 04:54
gparangan sends brownie points to @qualitymanifest and @amrme and @saintpeter and @moniquee :sparkles: :thumbsup: :sparkles:
:star: 2152 | @saintpeter | http://www.freecodecamp.com/saintpeter
:star: 206 | @moniquee | http://www.freecodecamp.com/moniquee
:star: 292 | @amrme | http://www.freecodecamp.com/amrme
:star: 722 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:54
@SarahMarie73 well not too long before you learned push, pop, shift, and unshift
Amr Elsekilly
@amrsekilly
Jan 05 2016 04:55
You are welcome @gparangan
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:55
@SarahMarie73 push adds an item to the end, pop removes an item from the end, shift removes an item from the front, unshift adds an item to the front
@SarahMarie73 which of these 4 will allow you to put item at the end of arr?
Sarah Schlueter
@SarahMarie73
Jan 05 2016 04:56
@CaroleAnneHannon push
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:56
@SarahMarie73 right, then it wants you to remove the first element. which of these 4 will do that?
Andrew Bales
@agbales
Jan 05 2016 04:56
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line

   "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");
Sarah Schlueter
@SarahMarie73
Jan 05 2016 04:56
@CaroleAnneHannon unshift
Andrew Bales
@agbales
Jan 05 2016 04:57
Working on "Waypoint: Using Objects for Lookups"... feel like this is close-ish?
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:57
@SarahMarie73 unshift adds an item to the front, this task is to remove the first element
@SarahMarie73 so which will remove the first element?
Andrew Bales
@agbales
Jan 05 2016 04:57
Given the prompt, perhaps I need a new variable lookup?
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:58
@agbales yup
Sarah Schlueter
@SarahMarie73
Jan 05 2016 04:58
@CaroleAnneHannon shift
Andrew Bales
@agbales
Jan 05 2016 04:58
@CaroleAnneHannon this doesn't seem to work, though..
// 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");
Amr Elsekilly
@amrsekilly
Jan 05 2016 04:58
@agbales you need to let result be the object containing all these key value pairs
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:58
@SarahMarie73 right, and there's a special thing about shift (and pop), it will give you the item it removed
Amr Elsekilly
@amrsekilly
Jan 05 2016 04:59
@agbales that works
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 04:59
@SarahMarie73 and notice they want "The queue function should return the element that was removed."
Amr Elsekilly
@amrsekilly
Jan 05 2016 04:59
so you have to replace result with the new variable and index it with the value to get the resulted key
*wanted key :D
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:00
@SarahMarie73 so you can either store that returned element in a variable, or return it directly in the function's return statement by putting the shift in the return statement
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:00
as in lookup[’something']
@agbales
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:01
@SarahMarie73 so depending on how you view it, it's either a 2 step or a 3 step problem, but the logs at the end should be able to let you see what changes you've made
Holly Williford
@hollyhascode
Jan 05 2016 05:01
// 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",
  };

   lookup["alpha"];

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

// Change this value to test
phoneticLookup("charlie");
sooooo what am I doing wrong?
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:01
@hollyhascode you ned to return lookup[value]
Holly Williford
@hollyhascode
Jan 05 2016 05:01
I see you guys are talking about this
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:01
@hollyhascode nice holly, you just need to make sure you store your lookup in result
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:02
because you pass the value to the function to lookup for a key
Holly Williford
@hollyhascode
Jan 05 2016 05:02
sooooo... how do I do that
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:02
@hollyhascode result =
Holly Williford
@hollyhascode
Jan 05 2016 05:02
@amrme @CaroleAnneHannon thanks!
CamperBot
@camperbot
Jan 05 2016 05:02
hollyhascode sends brownie points to @amrme and @caroleannehannon :sparkles: :thumbsup: :sparkles:
:star: 293 | @amrme | http://www.freecodecamp.com/amrme
:star: 594 | @caroleannehannon | http://www.freecodecamp.com/caroleannehannon
Sarah Schlueter
@SarahMarie73
Jan 05 2016 05:02
@CaroleAnneHannon ok I will try to digest this and give it a go
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:03
you are welcome @hollyhascode did you finish it correctly?
Do you still need help @hollyhascode ?
Holly Williford
@hollyhascode
Jan 05 2016 05:03
lol no
Andrew Bales
@agbales
Jan 05 2016 05:03
@amrme Still trying to sort out the last change here. Not sure why it's not clicking for me.
Holly Williford
@hollyhascode
Jan 05 2016 05:03
result = lookup ?
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:03
yup that’s one way to do it @hollyhascode
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:03
@agbales you need to use lookup and put it into result
anthonygallina1
@anthonygallina1
Jan 05 2016 05:03
@hollyhascode result = lookup[val];
Anthony DeFreitas
@biganth
Jan 05 2016 05:04
@agbales @hollyhascode You lookup is supposed to be an object literal, so the name part shouldn't be in quotes, that would be json
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:04
sorry @hollyhascode it’s as @anthonygallina1 said
Holly Williford
@hollyhascode
Jan 05 2016 05:04
huh
@anthonygallina1 thanks!
CamperBot
@camperbot
Jan 05 2016 05:05
hollyhascode sends brownie points to @anthonygallina1 :sparkles: :thumbsup: :sparkles:
:star: 624 | @anthonygallina1 | http://www.freecodecamp.com/anthonygallina1
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:05
@biganth the name part can be in quotes. It's fine @hollyhascode @agbales
anthonygallina1
@anthonygallina1
Jan 05 2016 05:05
Thank you @hollyhascode
CamperBot
@camperbot
Jan 05 2016 05:05
anthonygallina1 sends brownie points to @hollyhascode :sparkles: :thumbsup: :sparkles:
:star: 233 | @hollyhascode | http://www.freecodecamp.com/hollyhascode
mukhtaarabdi
@mukhtaarabdi
Jan 05 2016 05:05

Why am getting this warning?

unreachable ‘break' after ‘return’ √

var count = 0;

function cc(card) {
  // Only change code below this line


  //this is switch
switch (card){
  case 2, 3, 4, 5, 6:
    return "5 Bet";
    break;

  case 2, 3, 4, 5, 6:
    return "5 Bet";
    break;


  case 7, 8, 9:
    return "0 Hold";
    break;

  case 10, "J", "Q", "K", "A":
    return "-5 Hold";
    break;

  case 3, 2, "A", 10, "K":
    return "-1 Hold";
    break;

}


}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A’);
Andrew Bales
@agbales
Jan 05 2016 05:05
@amrem @CaroleAnneHannon @anthonygallina1 Ah ha!
@amrem @CaroleAnneHannon @anthonygallina1 Thank you!
CamperBot
@camperbot
Jan 05 2016 05:05
agbales sends brownie points to @amrem and @caroleannehannon and @anthonygallina1 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for amrem
:star: 625 | @anthonygallina1 | http://www.freecodecamp.com/anthonygallina1
:star: 595 | @caroleannehannon | http://www.freecodecamp.com/caroleannehannon
Andrew Bales
@agbales
Jan 05 2016 05:06
@amrme Thanks to you, too! :)
CamperBot
@camperbot
Jan 05 2016 05:06
agbales sends brownie points to @amrme :sparkles: :thumbsup: :sparkles:
:star: 294 | @amrme | http://www.freecodecamp.com/amrme
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:06
@mukhtaarabdi becasue return breaks from the switch statement, you don’t need to break after it
anthonygallina1
@anthonygallina1
Jan 05 2016 05:06
@amrme thank you
CamperBot
@camperbot
Jan 05 2016 05:06
anthonygallina1 sends brownie points to @amrme :sparkles: :thumbsup: :sparkles:
:star: 295 | @amrme | http://www.freecodecamp.com/amrme
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:06
@agbales you are welcome :D
anthonygallina1
@anthonygallina1
Jan 05 2016 05:07
:)
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:07
you are welcome @anthonygallina1 :D
mukhtaarabdi
@mukhtaarabdi
Jan 05 2016 05:07
@amrme so should i delete break?
scgordo
@scgordo
Jan 05 2016 05:07
can anyone help me pass one of the tests for Checkpoint: Record Collection?
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:07
@mukhtaarabdi return will stop the function, so there's no need to break because it'll never get there. However I believe for that one you're not supposed to return in the switch, you should be adding up according to the rules and returning at the end
Anthony DeFreitas
@biganth
Jan 05 2016 05:08
@CaroleAnneHannon If the name part is in quotes then it's json, not an object literal
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:09
@biganth json are objects, and it won't affect the code at all
Anthony DeFreitas
@biganth
Jan 05 2016 05:09
@CaroleAnneHannon I realize but there is a difference
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:09
"alpha":"Adams" is the same as alpha:"Adams"
and considering http://www.freecodecamp.com/challenges/waypoint-accessing-objects-properties-with-bracket-notation and http://www.freecodecamp.com/challenges/waypoint-accessing-objects-properties-with-the-dot-operator ,if FCC doesn't consider them different (because they're not apart from small differences. JSON is Javascript Object Notation. JSON requires using strings, object literals let you choose), why confuse people by making it seem like they are
mukhtaarabdi
@mukhtaarabdi
Jan 05 2016 05:12
@CaroleAnneHannon i see , thanks
CamperBot
@camperbot
Jan 05 2016 05:12
mukhtaarabdi sends brownie points to @caroleannehannon :sparkles: :thumbsup: :sparkles:
:star: 596 | @caroleannehannon | http://www.freecodecamp.com/caroleannehannon
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:14
@mukhtaarabdi I’m sorry I didn’t see your comment :cry:
@scgordo can you please post the problem?
Anthony DeFreitas
@biganth
Jan 05 2016 05:14
@CaroleAnneHannon yes but it would still be best to learn the difference, you can't store a function in json as you can in an object literal
mukhtaarabdi
@mukhtaarabdi
Jan 05 2016 05:14
@amrme haha thanks anyway
CamperBot
@camperbot
Jan 05 2016 05:14
mukhtaarabdi sends brownie points to @amrme :sparkles: :thumbsup: :sparkles:
:star: 296 | @amrme | http://www.freecodecamp.com/amrme
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:15
you are welcome @mukhtaarabdi :smile:
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:15
@biganth ok but the "difference" you pointed out isn't. object literals don't care if it's string or not
@biganth JSON is a subset of object literals, everything json can do, object literals can do
@biganth so if someone writes an object in "JSON" notation, JS doesn't care
Anthony DeFreitas
@biganth
Jan 05 2016 05:16
@CaroleAnneHannon all I'm saying is when I started out I was lead to believe they were the same, I mixed them up, got confused and surely someone else who sees them as the same will mix them up one day
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:16
"JSON is a subset of the object literal notation of JavaScript"
Anthony DeFreitas
@biganth
Jan 05 2016 05:16
I know that
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:17
but at least point out something that actually matters. the string thing was completely irrelevant because it IS valid object notation
Anthony DeFreitas
@biganth
Jan 05 2016 05:18
I think my point was relevant because you are leading people to believe you can use them the same and you can't always do that
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:18
I didn't lead them to anything. I didn't mention JSON or objects until you said something, and for the key, the string is completely valid for both
and JSON is covered later in the waypoints
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:22
That question answers the difference, and for that matter it wasn’t that relevant for that question. http://stackoverflow.com/questions/8294088/javascript-object-vs-json
all json keys are enclosed in “"
but objects are only enclosed in double quotes when they include special characters
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:23
no, objects only require double quotes when they include special characters
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:23
But I guess it wasn’t a problem in that certain waypoint
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:24
but you can choose to use double quotes even for when it's not required
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:24
Yes, but it’s not necessary for objects
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:24
well I know, but he was telling them not to do that
it's fine to do it, it's just not required
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:24
in contrast to JSON where you have to use double quotes
Wiley Debs
@Colortear
Jan 05 2016 05:25
how can i paste from the in browser prompt into this chat
DJ
@qualitymanifest
Jan 05 2016 05:25
help format
CamperBot
@camperbot
Jan 05 2016 05:25

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

``` ⇦ Type 3 backticks, then press [enter ⏎]

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

:pencil: read more about code formatting on the FCC Wiki

meatyogre
@meatyogre
Jan 05 2016 05:26
// Setup
var myArr = [1,2,3,4,5];

function queue(arr, item) {
  // Your code here
  queue(myArr, 0);

  return item;  // Change this line
}

// Display Code
console.log("Before: " + JSON.stringify(myArr));
console.log(queue(myArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(myArr));
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:26
Yes that’s right @CaroleAnneHannon :+1:
meatyogre
@meatyogre
Jan 05 2016 05:26
can someone give me a hand with Checkpoint: Stand in Line
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:27
@meatyogre if queue keeps calling itself, it'll never end
meatyogre
@meatyogre
Jan 05 2016 05:27
simple stuff I'm sure, but it's got me stumped.
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:27
@meatyogre try to use the array functions mentioned before. push, pop, shift, unshift. 2 of those will help you
meatyogre
@meatyogre
Jan 05 2016 05:27
ahh right, ok thanks.
Wentzel
@wentzelcoetzer
Jan 05 2016 05:30
Just butting in to say hi. Just starting to go through the first part of free code camp now.
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:30
@wentzelcoetzer hi
Wiley Debs
@Colortear
Jan 05 2016 05:30
When trying to solve for switch statements, why are letters not being recognized as values
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:31
@Colortear are you putting " around them?
Wiley Debs
@Colortear
Jan 05 2016 05:32
case "a": ?
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:32
yeah
Wiley Debs
@Colortear
Jan 05 2016 05:33
That didn't seem to work
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:33
show the rest of your code
hard to help without seeing
Wiley Debs
@Colortear
Jan 05 2016 05:33
Sorry, I am still trying to figure how to paste it in
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:33
wiki format
CamperBot
@camperbot
Jan 05 2016 05:33

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

``` ⇦ Type 3 backticks, then press [enter ⏎]

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

:pencil: read more about code formatting on the FCC Wiki

Amr Elsekilly
@amrsekilly
Jan 05 2016 05:33
you have to take in consideration case sensitivety @Colortear
if you are expecting “A” you can’t match ‘a'
Wiley Debs
@Colortear
Jan 05 2016 05:34

`function myTest(val) {
var answer = "";
// Only change code below this line
switch (val) {
case "a":
answer = "apple";
break;
case b:
answer = "bird";
break;
case c:
answer = "cat";
break;
default:
answer ="stuff";
}

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

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

Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:35
for multi-line use ``` and you need to have enters (shift+enter) before/after them
Wiley Debs
@Colortear
Jan 05 2016 05:35
My apologies
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:35
if you get stuck, ctrl+enter will force you to write the post
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:35
you have to make them all inclosed in “"
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:35
also you can edit posts
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:35
for b,c,.. etc
meatyogre
@meatyogre
Jan 05 2016 05:35
@CaroleAnneHannon this is a lesson about queues, I am a bit confused about how they work
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:36
@meatyogre so in the way they defined it, for the queue first you need to add the item into arr
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:36
*enclosed :D
Wiley Debs
@Colortear
Jan 05 2016 05:36
Hmm
Xing Chen
@xingnotzing
Jan 05 2016 05:36
can someone help me with Checkpoint: Record Collection?
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:36
@meatyogre which of the 4 functions (push, pop, shift, unshift) will add the item at the end of arr?
cannelflow
@cannelflow
Jan 05 2016 05:36
@Colortear whats wrong
Wiley Debs
@Colortear
Jan 05 2016 05:37
It went through, I had tried what was instructed before with quotes but nothing happened. All is well, thank you
Carole Anne Hannon
@CaroleAnneHannon
Jan 05 2016 05:37
@meatyogre then you have to remove the first element. which of those four functions will remove and element from the beginning of arr
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:38
@xingnotzing you have to build your logic around the value parameter, so you start writing if statements checking it, then you perform the required using the value on the parameters
@xingnotzing can you tell us what you are stuck at now?
Great @Colortear :D
Xing Chen
@xingnotzing
Jan 05 2016 05:40

@amrme this is what I have so far
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function update(id, prop, value) {

if(value !== ""){
if(prop === "tracks")
{
collection[id].tracks.push(value);
}
else{
if(prop === "artist")
collection[id].artist = value;
else
{
collection[id].album = value;
}
}
}
else{
delete collection[id[prop]];
}

return collection;
}

getting stuck with the delete property
meatyogre
@meatyogre
Jan 05 2016 05:40
thanks @CaroleAnneHannon I'll keep working on it.
CamperBot
@camperbot
Jan 05 2016 05:40
meatyogre sends brownie points to @caroleannehannon :sparkles: :thumbsup: :sparkles:
:star: 597 | @caroleannehannon | http://www.freecodecamp.com/caroleannehannon
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:41
delete collection[id].[prop] I guess
I’ll test it
Xing Chen
@xingnotzing
Jan 05 2016 05:42
giving me syntax error
Shannon Riester
@shriester
Jan 05 2016 05:42
Very confused on a simple Waypoint: Accessing Nested Arrays in JSON (number 89)...have been on this too long without much progress...some quick and easy help please!
Amr Elsekilly
@amrsekilly
Jan 05 2016 05:42
ollection[id][prop];
delete collection[id][prop];
@xingnotzing
Xing Chen
@xingnotzing
Jan 05 2016 05:43
@amrme thanks!