These are chat archives for FreeCodeCamp/HelpJavaScript

30th
Jan 2016
Jessann
@jessgraus
Jan 30 2016 00:00
This is the first time I have been totally stuck so not doing too bad!
Brian
@sludge256
Jan 30 2016 00:00
What does your string look like in the little box on the left?
that might clear up some confusion
Jessann
@jessgraus
Jan 30 2016 00:01
hmm, box to the left?
rphares
@rphares
Jan 30 2016 00:01
(@sludge256 -- side note, have you run it w/o spaces to check if it outputs the issue? I've had a few people tell me theres looks right...? )
Brian
@sludge256
Jan 30 2016 00:01
@jessgraus under the run button
well I'm headed out anyways you can just keep pushing forward
or bug @rphares to fix it for you
rphares
@rphares
Jan 30 2016 00:02
very funny, @sludge256 ...
Jessann
@jessgraus
Jan 30 2016 00:04
@sludge256 It doesn't show my code, it just has instructions for generally what they are looking for.
rphares
@rphares
Jan 30 2016 00:04
okeydoke-- you are on word blanks, @jessgraus ?
you mind repasting what you have tried so i can catch up?
JackeL
@jackel27
Jan 30 2016 00:10
@rsprice Thanks for being so informative!
CamperBot
@camperbot
Jan 30 2016 00:10
jackel27 sends brownie points to @rsprice :sparkles: :thumbsup: :sparkles:
:star: 230 | @rsprice | http://www.freecodecamp.com/rsprice
Jon
@jcmockbee
Jan 30 2016 00:16
@rphares I am happy to see you in the help section today . You helped me out with the challenge of grocery list
Hi all hoping somone could help me with this local scope and functions
rphares
@rphares
Jan 30 2016 00:17
Oh, yay! Thank you, @jcmockbee , that really means a ton!! I'm having an off day and thats really reassuring, heh :blush:
CamperBot
@camperbot
Jan 30 2016 00:17
rphares sends brownie points to @jcmockbee :sparkles: :thumbsup: :sparkles:
:star: 177 | @jcmockbee | http://www.freecodecamp.com/jcmockbee
rphares
@rphares
Jan 30 2016 00:18
sure thing, @jcmockbee , what have you tried?
Will Holland
@wcholland
Jan 30 2016 00:18
Hey guys, I'm having a hard time adding a second object to my JSON array
Adria Alvarado
@n3rdvana
Jan 30 2016 00:18

I have some trouble again with Testing Objects for Properties. This is what I have so far:

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

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

}

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

It's asking me to modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "not found"

rphares
@rphares
Jan 30 2016 00:18
@wcholland , name of challenge and could you paste your code, please?
Will Holland
@wcholland
Jan 30 2016 00:19
Introducing JavaScript Object Notation JSON
rphares
@rphares
Jan 30 2016 00:19
@jcmockbee , are you getting maximum call stack?
Jessann
@jessgraus
Jan 30 2016 00:19
@sludge256 I finally got it! So "" is used as a space? Also, "." is always used to end a sentence with punctuation?
Jon
@jcmockbee
Jan 30 2016 00:19
somehting happend let me repost
rphares
@rphares
Jan 30 2016 00:19
@jcmockbee , befor eyou do
Will Holland
@wcholland
Jan 30 2016 00:19
Screen Shot 2016-01-29 at 4.17.39 PM.jpg
rphares
@rphares
Jan 30 2016 00:19
refresh your page and run tests again
@jessgraus , yes to the first-- " " is one way to add a space,
Will Holland
@wcholland
Jan 30 2016 00:20
Not sure how they want the brackets formatted, and why
John
@spriggs81
Jan 30 2016 00:20
//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUp(firstName, prop){
// Only change code below this line
  for (s = 0; s < contacts.length; s++) {
    for (n = 0; n < contacts[s].firstName.length; n++) {
      if (contacts[s].firstName == firstName) {
        if (contacts[s].prop == prop) {
          return contacts[s][prop];
        }
        else {
          return "No such property";
        }
      }
      else {
        return "No such contact";
      }
    }
  }


// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");
My code isn't work and I don't understand why. Does anyone see my mistake?
rphares
@rphares
Jan 30 2016 00:20
and, "." is one way to end a sentence, @jessgraus . "!" would also be fine, @jessgraus
@wcholland , off the bat,
floydd
@floydd
Jan 30 2016 00:21
// Example
var changed = 0;

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

changed = change(10);

// Setup
var processed = 0;

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

// Only change code below this line

var processed = 2;

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

processed = process(2);
What am I missing?
rphares
@rphares
Jan 30 2016 00:21
you probs want a comma in between :) @wcholland
@CodeVandal , you were only supposed to change above the line...
Will Holland
@wcholland
Jan 30 2016 00:22
Dang... it was just a comma!
rphares
@rphares
Jan 30 2016 00:22
This message was deleted
Enrique Cahua
@enriquecahua
Jan 30 2016 00:22
@n3rdvana you should return a reference to the value of the property, not a word or another call to that function
rphares
@rphares
Jan 30 2016 00:22
@CodeVandal
and the last line, should be like you have it, except that it is calling 2, and you are supposed to call 7, if i recall....
Will Holland
@wcholland
Jan 30 2016 00:22
Thanks @rphares
CamperBot
@camperbot
Jan 30 2016 00:22
wcholland sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 2166 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 30 2016 00:22
anytime :)
Will Holland
@wcholland
Jan 30 2016 00:22
I will take you up on that...
rphares
@rphares
Jan 30 2016 00:22
@jcmockbee , did refreshing sort it?
hahaha, lemme rephrase-- anytime until you need explanations/things that are passed me... I'm a newbie and slow at concepts. But ill do what i can, @wcholland :)
Jon
@jcmockbee
Jan 30 2016 00:23
my sniiping tool is suddenly not working to show you what I did I am going to log out and in again
floydd
@floydd
Jan 30 2016 00:23
Thanks @rphares!
CamperBot
@camperbot
Jan 30 2016 00:23
codevandal sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 2167 | @rphares | http://www.freecodecamp.com/rphares
Enrique Cahua
@enriquecahua
Jan 30 2016 00:24
@n3rdvana
rphares
@rphares
Jan 30 2016 00:24
sure thing, @CodeVandal !
Enrique Cahua
@enriquecahua
Jan 30 2016 00:24
 if ( myObj.hasOwnProperty(checkProp))
Jessann
@jessgraus
Jan 30 2016 00:24
@rphares Thank you!!
CamperBot
@camperbot
Jan 30 2016 00:24
jessgraus sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
jasonmiles
@jasonmiles
Jan 30 2016 00:24
I want to search a string for these characters: ["-", "%", "+", "/"]. If there's a match I want it to return true. Can I use a regex for this?
CamperBot
@camperbot
Jan 30 2016 00:24
:star: 2168 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 30 2016 00:24
@jcmockbee -- you need to name that var myVar, not var loc
you aren't console.logging var loc, @jcmockbee
name it the same as everything else in your code, run tests. (you may get a 'maximum call stack' error even after you fix the name. Then, refresh the page and run tests again) @jcmockbee :)
@jessgraus , anytime!
Adria Alvarado
@n3rdvana
Jan 30 2016 00:26
@enriquecahua I'm not sure what to return. I tried checkProp but it doesn't work
Dan
@dee-one
Jan 30 2016 00:27
whats wrong with my code?
var myStr;// ="I am a \"double quoted\" string inside \"double quotes\""
Jon
@jcmockbee
Jan 30 2016 00:28
will do
rphares
@rphares
Jan 30 2016 00:28
what is this stuff after myStr, @dee-one : ;//
stacyHere
@stacyHere
Jan 30 2016 00:29
Can anyone help me figure out what I'm doing wrong with "mutations"? the first 2 and last test work but not the others. I'm not sure what I'm missing.
function mutation(arr) {
  var arr0 = arr[0].split().map(function(arr0){
    return arr0.toLowerCase();});
  var arr1 = arr[1].split().map(function(arr1){
    return arr1.toLowerCase();
    });
for(var i=0;i<arr0.length;i++){
  if(arr1[i].indexOf(arr0[i]) !== -1){
  return true;
  }
  else {
    return false;
  }
}
//  return arr1 + arr0;
}
mutation(["Mary", "Army"]) ;
Dan
@dee-one
Jan 30 2016 00:29

Use backslashes to assign the following to myStr variable:

I am a "double quoted" string inside "double quotes"

Antoine Leclercq
@antoineLeclercq
Jan 30 2016 00:29
Hi guys I have a technical question regarding objects:
var Car = function() {
  this.wheels = 4;
  this.engines = 1;
  this.seats = 1;
};

var myCar = new Car(); //this creates a new object
var myCar = Car(); //does this point to Car? so If I were to change myCar, would I modify the object stored in Car?
rphares
@rphares
Jan 30 2016 00:30
@dee-one -- yes, and the strong part may be okay.... but look in-between var myStr = and the string, "I am a \"double quoted\" string inside \"double quotes\"";, @dee-one ... you have some weird extra characters in there...
Dan
@dee-one
Jan 30 2016 00:32
this is how it starts:
var myStr; // Change this line
Jon
@jcmockbee
Jan 30 2016 00:32
With my snipping tool I was always able to make a copy and then paste in this section is there a different procedure ?
rphares
@rphares
Jan 30 2016 00:32
@jcmockbee :
explain format
CamperBot
@camperbot
Jan 30 2016 00:32

: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

rphares
@rphares
Jan 30 2016 00:32
@dee-one -- so, what that means is two things,
they are giving you just plain var myStr to start...
the ; goes to the end of the line, its like punctuation
their myStr is empty when they give it to you, so thats the end, but when you put stuff in it, you need to move it to the end,
Jon
@jcmockbee
Jan 30 2016 00:34
I just cut out saved as png and then clicked paste to show what I was putting in
rphares
@rphares
Jan 30 2016 00:34
otherwise, its like a period after the first word in the sentence. it changes the meaning.
Dan
@dee-one
Jan 30 2016 00:34
ok i moved the code to the left of the semi-colon and that fixed it
idk why they had the second part to confuse me
thanks!
rphares
@rphares
Jan 30 2016 00:34
Second, the // is to start a comment
So its the same issue-- can't be before your code :)
Sure thing, @dee-one ! All good now?
Dan
@dee-one
Jan 30 2016 00:35
yeah
rphares
@rphares
Jan 30 2016 00:35
sweet-- happy coding!
Vivek
@vivek28111992
Jan 30 2016 00:37
@rphares when you sleep?
rphares
@rphares
Jan 30 2016 00:38
Bots don't sleep ;)
Andrew Charlebois
@andrewchar
Jan 30 2016 00:38
anyone do "Return Early Pattern for Functions" recently?
rphares
@rphares
Jan 30 2016 00:38
Srue, @andrewchar
what have you tried?
Andrew Charlebois
@andrewchar
Jan 30 2016 00:39
am i suppose to only use console.log and return?
or do it with a switch statement
rphares
@rphares
Jan 30 2016 00:40
you need an if, and a return
you don't need a console.log or a switch :)
(though, i suppose you can console.log, shouldn't hurt anything shrug )
Andrew Charlebois
@andrewchar
Jan 30 2016 00:40
it has a return at the end of its code
Jon
@jcmockbee
Jan 30 2016 00:41
anyone please refresh my memory on how to use sniping tool and paste in here
snipping
rphares
@rphares
Jan 30 2016 00:42
explain format
CamperBot
@camperbot
Jan 30 2016 00:42

: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

rphares
@rphares
Jan 30 2016 00:42
@jcmockbee :point_up:
you can also 'copy as pretty code'
Luis
@zdrifted
Jan 30 2016 00:42
I feel like some of these lessons are out of order
rphares
@rphares
Jan 30 2016 00:42
either one is far preferable to images, @jcmockbee
we can't copy and run/test/comment images,
Andrew Charlebois
@andrewchar
Jan 30 2016 00:43
woohoo got it
rphares
@rphares
Jan 30 2016 00:43
and links to other peoples exercises create history, so we have to use our profile to call up our solutions, instead of just typing the name in the browser,
:)
congrats, @andrewchar !
Andrew Charlebois
@andrewchar
Jan 30 2016 00:43
i thought at first i had to make it add the numbers
Jon
@jcmockbee
Jan 30 2016 00:43
ok will do
Andrew Charlebois
@andrewchar
Jan 30 2016 00:43
i was making something like var add = a + b
James C. Smith
@JamesCSmithPDX
Jan 30 2016 00:44
Working on Truncate a String
Have issue
Ege Tuncoz
@etuncoz
Jan 30 2016 00:44
do you guys know any editor for javascipt that has a compiler in it so i can build an see step by step if i made something wrong?
James C. Smith
@JamesCSmithPDX
Jan 30 2016 00:44
```js
function truncate(str, num) {
  // Clear out that junk in your trunk

  if(str.length > num) {
    if (num < 3) {
    return str.substring(0, num)  + "...";
    }
    return str.substring(0, num + 3) + "...";
  }
  return str;
}
truncate("Peter Piper picked a peck of pickled peppers", 14);
```
Andrew Charlebois
@andrewchar
Jan 30 2016 00:45
i have a question about this. it tells me ""When a return statement is reached, the execution of the current function stops and control returns to the calling location."" Is that not saying that if a return statement is reached it stops the whole function?
Jon
@jcmockbee
Jan 30 2016 00:45
function myFunction() {
  myVar='use strict';


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

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

// now remove the console log line to pass the test
Ege Tuncoz
@etuncoz
Jan 30 2016 00:46
@andrewchar yes i would say, same thing to me
Jon
@jcmockbee
Jan 30 2016 00:46
this is what I have that is not working I changes to myVar as suggested and reran
Blauelf
@Blauelf
Jan 30 2016 00:46
@JamesCSmithPDX You have triple backticks twice :P
Your numbers in slicing are a bit off, should be num and num-3, and I think it's num<=3, not num<3
rphares
@rphares
Jan 30 2016 00:46
@jcmockbee , so check the last line of the comments
one of those console.logs is out of scope...
Andrew Charlebois
@andrewchar
Jan 30 2016 00:47
@etuncoz because in the exercise there are 3 "return" statements.. i dont get it lol
Jon
@jcmockbee
Jan 30 2016 00:47
function myFunction() {
  myVar='use strict';


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

// run and check the console 
// myVar is not defined outside of myFunction


// now remove the console log line to pass the test
I removed the last line now
rphares
@rphares
Jan 30 2016 00:48
cool,
now, refresh the page since you are likely getting a 'maximum call stack' error, @jcmockbee :)
Jon
@jcmockbee
Jan 30 2016 00:49
refresshed getting this
No global myVar variable
Add a local myVar variable
rphares
@rphares
Jan 30 2016 00:49
oh, yeah-0- sorry, didn't look hard
var myVar should fix that
Ege Tuncoz
@etuncoz
Jan 30 2016 00:51
@andrewchar i mean a function can have lots of return statements BUT it can only use one of them. Think about a function which returns true if a>5 and returns false if a<5, here it returns either true or false, only one of them. hopefully i didnt confuse you
Jon
@jcmockbee
Jan 30 2016 00:51
var=myVar="use strict' would give me two variables yes?
rphares
@rphares
Jan 30 2016 00:52
not with an equals, @jcmockbee
the way you normally introduce a var,
Jon
@jcmockbee
Jan 30 2016 00:52
ok
Andrew Charlebois
@andrewchar
Jan 30 2016 00:52
@etuncoz ohhhhhhh ok, crystal clear now. thanks!
CamperBot
@camperbot
Jan 30 2016 00:52
andrewchar sends brownie points to @etuncoz :sparkles: :thumbsup: :sparkles:
:star: 251 | @etuncoz | http://www.freecodecamp.com/etuncoz
Jon
@jcmockbee
Jan 30 2016 00:52
trying now
rphares
@rphares
Jan 30 2016 00:52
var myVar = "whatever you want!" ;
Jon
@jcmockbee
Jan 30 2016 00:53
oh yea thats right
ok this is what I have from run test
No global myVar variable
Add a local myVar variable
ad local variabal checked
rphares
@rphares
Jan 30 2016 00:54
okay-- repaste what you are trying now, @jcmockbee ... you were so close before, lol
i really hope this isn't my second time making things worse in one day,
shall need log off and come back tomorrow if i keep misguiding people! :pensive:
Ege Tuncoz
@etuncoz
Jan 30 2016 00:55
ur fiiiiiiiiine
Jon
@jcmockbee
Jan 30 2016 00:55
function myFunction() {
  var myVar='use strict';


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

// run and check the console 
// myVar is not defined outside of myFunction


// now remove the console log line to pass the test
Ege Tuncoz
@etuncoz
Jan 30 2016 00:55
:-)
Jon
@jcmockbee
Jan 30 2016 00:55
your doing great please stay up
:)
rphares
@rphares
Jan 30 2016 00:57
yeah... that looks okay to me, really don't see it... i mean, the spaces around the = could be prettier, but it looks aOkay... what am i missing...
you have refreshed and run again?
Jon
@jcmockbee
Jan 30 2016 00:58
it worked !!!!!!!
rphares
@rphares
Jan 30 2016 00:58
phew
i was about to really worry, lol
congrats and happy coding, @jcmockbee ~
Jon
@jcmockbee
Jan 30 2016 00:59
thankyou do you know why the refresh and run again scenario something I should look for to know to do it?
your doing great!
rphares
@rphares
Jan 30 2016 01:00
@jcmockbee , it will come up again when you see some errors like 'maximum call stack' i think--
stand in line challenge is another common one
Jon
@jcmockbee
Jan 30 2016 01:00
ok never hurts to try it thanks again
rphares
@rphares
Jan 30 2016 01:00
as i understand it, it is when the list of things you ask it to do gets too long,
so you need to reset it
(ish) thats my very simple, newbie explanation :blush:
Kevin Elser
@CoffeeCodeKevin
Jan 30 2016 01:07
function every(collection, pre) {
  // Is everyone being true?
  for (i=0; i<collection.length;i++) {
    if(isNaN(collection[i][pre])) {
      return false;
    }
    if (collection[i][pre] === null || collection[i][pre]===0 || collection[i][pre]==="" || collection[i][pre]===undefined) {
      return false;
    }
    if (i == collection.length-1 && collection[i].hasOwnProperty(pre) && collection[i][pre] !== false) {
      return true;
    }
    if (collection[i].hasOwnProperty(pre) && collection[i][pre] !== false) {
      continue;
    }
  }

}

every([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex");
I'm struggling to figure out why this returns false.
every([{"single": "yes"}], "single") also returns false.
I thought it might be the "", but I removed that and it's still false.
hellomichiyabu
@hellomichiyabu
Jan 30 2016 01:15
"Assignment with a returned value"

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

}

var processed=process(2);

Instructions
Call the process function with an argument of 7 and assign its return value to the variable processed.
rphares
@rphares
Jan 30 2016 01:15
@hellomichiyabu , you are close,
but.... two things,
first, you don't need to rewrite the function,
you only need the very bottom line,
second, for that line, where you are assigning process called by 7 to processed,
two things:
you are calling it by 2 right now... you want to call it by 7, if i recall
hellomichiyabu
@hellomichiyabu
Jan 30 2016 01:16
All I just need to do is,
var processed=process(7);
rphares
@rphares
Jan 30 2016 01:17
and, you don't actually need to write var processed... you already declared var processed, so you can drop the keywordvar and just say processed = process(?)
hellomichiyabu
@hellomichiyabu
Jan 30 2016 01:17
Ah, thanks!
rphares
@rphares
Jan 30 2016 01:17
anytime: )
Kala Radl
@mossandboar
Jan 30 2016 01:23

myFunction should be a function
myFunction should output "Hi World" to the dev console
Call myFunction after you define it. // Example
function ourFunction() {
console.log("Heyya, World");
}

ourFunction();

// Only change code below this line

function myFunction() {
console.log("Hi World");
}

myFunction(); what am I doing wrong?

Andrew Charlebois
@andrewchar
Jan 30 2016 01:26
If i want to add a number to a global variable from inside a function. i cannot just call the variable from inside the function so that it will add to the global variable can I?
Vivek
@vivek28111992
Jan 30 2016 01:29
@mossandboar I don't see any mistake
Andrew Charlebois
@andrewchar
Jan 30 2016 01:29
@mossandboar me either lol
rphares
@rphares
Jan 30 2016 01:30
@mossandboar , can you tell us the name so we can look for differences?
(also... refreshing is always good when stuck :) )
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 01:33
Good morning all😋
rphares
@rphares
Jan 30 2016 01:34
morning, @HemanthVarmaChekuri ~
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 01:34
@rphares 😄
Luis
@zdrifted
Jan 30 2016 01:37
Is this asking me to use .push and .shift? Write a function queue which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The queue function should then return the element that was removed.
rphares
@rphares
Jan 30 2016 01:37
@Rushh , those are exactly what you wanna use :)
Luis
@zdrifted
Jan 30 2016 01:37
sweet thanks! :)
rphares
@rphares
Jan 30 2016 01:37
:)
Adam
@Blakemilton6
Jan 30 2016 01:38
Hi guys I'm stuck on Using Objects for lookups any pointers ?thanks
// Only change code below this line
 var lookup= {
  alpha:"Adams",
    bravo:"Boston",
    charlie:"Chicago",
    delta:"Denver",
    echo:"Easy",
    foxtrot:"Frank"
  };
rphares
@rphares
Jan 30 2016 01:39
(you may wanna throw some "" on the alpha, bravo stuff, though ;) )
also, we want to think about what we are returning...
@Blakemilton6 , good start
you are gonna return result, right? (no choice, its below the 'do not change' line)
so, we want to set whatever it is we are looking for in result before we return it...
Adam
@Blakemilton6
Jan 30 2016 01:40
yes but what would I attach to ""?
rphares
@rphares
Jan 30 2016 01:40
oh, shoot, lag, may replies are all outta order, heh
Adria Alvarado
@n3rdvana
Jan 30 2016 01:41

I keep having syntax errors for the Intro to JSON:

var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1993,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }
   "artist": "Coldplay",
    "title": "Parachutes",
    "release_year": 2000,
    "formats": [
       "CD",
       "LP" ],

];

I've also tried separating the second part with [ ] but it gave me an error also saying that it wasn't an array

rphares
@rphares
Jan 30 2016 01:41
mm, you will wanna ignore the top-=- you can just do result = right before the return, @Blakemilton6
lets look at the example,
@n3rdvana , check your punctuation :)
you will wanna make the second one like the first one, with a woman inbetween, @n3rdvana :)
@Blakemilton6 , their table is named var alpha and they are looking for 2, so they wrote alpha[2]
your table is named var lookup and you are looking for val, so you can write.... ?
Andrew Charlebois
@andrewchar
Jan 30 2016 01:43
When i am doing a switch statement inside of a function. Does my switch expression have to match my function expression?
Adam
@Blakemilton6
Jan 30 2016 01:44
lookup[val]?
rphares
@rphares
Jan 30 2016 01:44
@n3rdvana -- it doesn't go in [], the whole thing (both of them) goes in one set of those... what goes around just the first one that you need a second set of for the second on??
@Blakemilton6 great!
Andrew Charlebois
@andrewchar
Jan 30 2016 01:45

like this

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

the expression card, do they always need to match>?

jpg8127
@jpg8127
Jan 30 2016 01:45
case 1:
rphares
@rphares
Jan 30 2016 01:45
but you can't just write lookup[val], it'll just sit there... you are gonna return result, so you need to set result to `lookup[val]... how can you write that, @Blakemilton6 ?
jpg8127
@jpg8127
Jan 30 2016 01:46
@andrewchar are you asking does your switch have to use card? You do not have to use the variable from the function call
Andrew Charlebois
@andrewchar
Jan 30 2016 01:47
ok thanks @jpg8127
CamperBot
@camperbot
Jan 30 2016 01:47
andrewchar sends brownie points to @jpg8127 :sparkles: :thumbsup: :sparkles:
:star: 334 | @jpg8127 | http://www.freecodecamp.com/jpg8127
Adam
@Blakemilton6
Jan 30 2016 01:47
I'm not sure...
Adria Alvarado
@n3rdvana
Jan 30 2016 01:48
@rphares I tried putting another set of { } but it's giving me a result of "unexpected token { "
rphares
@rphares
Jan 30 2016 01:48
@n3rdvana did you remember the comma in between?
if so, please paste what you tried now, @n3rdvana :blush:
@Blakemilton6 , result =....
Adria Alvarado
@n3rdvana
Jan 30 2016 01:50
@rphares I just put a comma in between and it worked, I would've never known to put a comma in between them. Thanks so much, you've been a great help today!
CamperBot
@camperbot
Jan 30 2016 01:50
n3rdvana sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 2173 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 30 2016 01:50
(at the beginning, we set result= " ", so we must set it to what we want, result = lookup[val] before we return it, otherwise our lookup[val] does no good, we are still just returning " " even though we wrote our search)
oh, yay, @n3rdvana, congrats !! and thank you thank you~
CamperBot
@camperbot
Jan 30 2016 01:51
rphares sends brownie points to @n3rdvana :sparkles: :thumbsup: :sparkles:
:star: 216 | @n3rdvana | http://www.freecodecamp.com/n3rdvana
Adam
@Blakemilton6
Jan 30 2016 01:53
result = lookup[val];
  var lookup= {
  alpha:"Adams",
    bravo:"Boston",
    charlie:"Chicago",
    delta:"Denver",
    echo:"Easy",
    foxtrot:"Frank"
  };
I just don't know about placement
rphares
@rphares
Jan 30 2016 01:54
@Blakemilton6 , that result line comes after the table :)
after the };
(also, you still may wanna add some "" on all the alpha, bravo stuff :blush: )
Luis
@zdrifted
Jan 30 2016 01:56
function queue(arr, item) {
  // Your code here
  arr.push(item);
  arr.shift(0);
  return item;  // Change this line
}
Adam
@Blakemilton6
Jan 30 2016 01:56
Thanks:) they let me through without adding the "" for some reason you're a huge help rphares!
JackeL
@jackel27
Jan 30 2016 01:56
hey @rphares , I need your help with exponential quantification algorithms/ciphers
jpg8127
@jpg8127
Jan 30 2016 01:56
@Rushh return the array
rphares
@rphares
Jan 30 2016 01:56
@jackel27 , the odds that i can help with that are very small,
jpg8127
@jpg8127
Jan 30 2016 01:56
@Rushh oh wait.. return the shifted value
rphares
@rphares
Jan 30 2016 01:56
@jpg8127 might be better :)
cannelflow
@cannelflow
Jan 30 2016 01:57
@Rushh return what is removed
JackeL
@jackel27
Jan 30 2016 01:57
@rphares jk ;)
Luis
@zdrifted
Jan 30 2016 01:57
I don't remember how lol. Let me look back at an old lesson
jpg8127
@jpg8127
Jan 30 2016 01:58
@Rushh you already have teh answer there
rphares
@rphares
Jan 30 2016 01:58
Anytime, @Blakemilton6 ! happy coding~
jpg8127
@jpg8127
Jan 30 2016 01:58
@Rushh shift <<< returns what is removed
Luis
@zdrifted
Jan 30 2016 01:58
return arr.shift(0);
?
jpg8127
@jpg8127
Jan 30 2016 01:58
@Rushh return arr.shift(); would return the first element of the array.
JackeL
@jackel27
Jan 30 2016 01:59
This message was deleted
Luis
@zdrifted
Jan 30 2016 01:59
one sec my brain fog is so bad right now. I've been on this for too long
jpg8127
@jpg8127
Jan 30 2016 02:00
I wish.. when you pressed map and it opened.. if you pressed it again it would close
Jon
@jcmockbee
Jan 30 2016 02:03
@rphares one last time before I call it a day

var processed = 0;

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

cannelflow
@cannelflow
Jan 30 2016 02:03
@Rushh return arr.shift() will eventully come with the value what is removed
Jon
@jcmockbee
Jan 30 2016 02:03

var processed = 0;

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

rphares
@rphares
Jan 30 2016 02:03
okey doke-- so you need to call process with 7, and assign that to processed, right, @jcmockbee
Jon
@jcmockbee
Jan 30 2016 02:04
from what I can tell yes
rphares
@rphares
Jan 30 2016 02:04
example:
orangequarter
@orangequarter
Jan 30 2016 02:04
I'm working on the Basic Algorithm Scripting section of the Map, and I want to remove all instances of punctuation from an array. Do I need to do that manually for each type of punctuation, or is there a command to use with '.filter' to cover all types?
rphares
@rphares
Jan 30 2016 02:05
@jcmockbee :point_up:
// Setup
var bob = 0;

function whatever(num) {
  return (num -10) / 25;
}

// Only change code below this line

bob = whatever(15);
in this, i called whatever by 15, and assigned it to var bob...
cannelflow
@cannelflow
Jan 30 2016 02:05
@orangequarter which exercise ?
orangequarter
@orangequarter
Jan 30 2016 02:06
Check for Palindromes! I know I only really need to remove comma's to pass, I was just curious
Oh, comma's and periods
rphares
@rphares
Jan 30 2016 02:07
@jcmockbee , once the var has been declared, we can drop the key word when we are assigning something to it... (thats how i went form var bob to bob)
and you can call a function by name(whatWeAreCalling)
Bill
@kirah1314
Jan 30 2016 02:08
@orangequarter you could use regular expressions to remove what you want to remove (or keep what you want to keep). Check out www.regexr.com
cannelflow
@cannelflow
Jan 30 2016 02:09
you need to use regx
orangequarter
@orangequarter
Jan 30 2016 02:10
ah okay. Thanks @kirah1314 , @cannelflow !
CamperBot
@camperbot
Jan 30 2016 02:10
orangequarter sends brownie points to @kirah1314 and @cannelflow :sparkles: :thumbsup: :sparkles:
:star: 903 | @kirah1314 | http://www.freecodecamp.com/kirah1314
:star: 644 | @cannelflow | http://www.freecodecamp.com/cannelflow
Jon
@jcmockbee
Jan 30 2016 02:11
thinking
looking at example
rphares
@rphares
Jan 30 2016 02:12
so, whatever called by 15 was assigned to var bob by:
bob = whatever(15)
you want process called by 7 assigned to var process, so your last line should be...?
Jon
@jcmockbee
Jan 30 2016 02:15
processed = processed (7);
rphares
@rphares
Jan 30 2016 02:15
@jcmockbee , soooo close
but, processed is the name of the var,
the function name is slightly different, it was function process
Jon
@jcmockbee
Jan 30 2016 02:16
processed = process (7);
rphares
@rphares
Jan 30 2016 02:17
@jcmockbee yep! now just remove the space in between process and (7) and you should be good to go :)
Jon
@jcmockbee
Jan 30 2016 02:18
your right:) but why no space between process and (7)
rphares
@rphares
Jan 30 2016 02:18
never space there, thats how we call, nameOfFunction(whatWeAreCalling)
dunno the whys :blush:
Jon
@jcmockbee
Jan 30 2016 02:19
got it after any function no spaces
Andrew Charlebois
@andrewchar
Jan 30 2016 02:19
stuck on counting cards. ive been trying different ways of writing it/ if else and switch statements but i cant wrap my head around what its asking me to do or where to start...
var count = 0;

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

  }
rphares
@rphares
Jan 30 2016 02:19
:)
congrats!!
Jon
@jcmockbee
Jan 30 2016 02:20
thankyou again, Im wrapping it up today,hope to see you again here soon
rphares
@rphares
Jan 30 2016 02:20
@andrewchar ,if i recall, i think you should be storing things in your count and incrementing/decrementing as you go...
have a good one, @jcmockbee ! rest well~
Andrew Charlebois
@andrewchar
Jan 30 2016 02:21
@rphares yes i should be
rphares
@rphares
Jan 30 2016 02:21
@andrewchar , i think, you don't wanna return till the end...
you'll need an if its greater than/less than conditional at the end, and then you can just return count + str;
ah... just read your text, sorry sorry for ignoring that you are stuck,
i used ifs, but a lot of people said switch is cleaner
however, I haven't really used switch except for the required places, so I'm not so confident on helping with that and don't wanna steer you wrong... :pensive: someone good will turn up soon, I'm sure!
Bobby Rath
@bobbyrath
Jan 30 2016 02:24
Can anyone help me getting at least one if statement through?
// 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 !== "" && prop !== "tracks") {
    collection.id.prop = value;
    }
  else if (prop == "tracks" && value !== "") {
    collection.id.tracks.push(value);  
  }
  else if (value === "") {
    delete prop;
  }
        return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");
After update(5439, "artist", "ABBA"), artist should be "ABBA"
rphares
@rphares
Jan 30 2016 02:25
@bobbyrath , bracket notation
i think your first if is almost okay if you use brackets on the id prop part
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 02:26
Anybody help me. I cant understand this waypoint. Please explain me what is the par and strokes? http://www.freecodecamp.com/challenges/golf-code
Bobby Rath
@bobbyrath
Jan 30 2016 02:26
brackets on id, or prop, or both?
rphares
@rphares
Jan 30 2016 02:27
both--
this is a key thing that i can't explain well,
you will need those brackets again, too
you can use dot when there is no space, AND it is a literal name
otherwise, you need brackets,
so your second if will need them too.
Bobby Rath
@bobbyrath
Jan 30 2016 02:28
id or prop has no spaces though i thought
so didn't think i needed brackets
rphares
@rphares
Jan 30 2016 02:28
(but your second if {} is a little more different from mine than your first one is)
its the literal name part,
someone sent me a great link, lemme see if i can find it
ack, nope, i cannot atm, I'm so sorry, and she's already offline
Alain Holly
@aholly38
Jan 30 2016 02:30

This challenge is driving me crazy, I know Im accessing the values correctly and comparing them.
'''js
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];

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

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

  return contacts[i];

}else{

  return console.log("No such contact");

} if(prop === contacts.prop[i]){

  return contacts.prop[i];

}else{


  return console.log("no such property");

}

}
}
// Only change code above this line
}

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

Bobby Rath
@bobbyrath
Jan 30 2016 02:31
@rphares ok it looks like the first if worked putting brackets around id & prop
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 02:31
@HemanthVarmaChekuri
Anybody help me. I cant understand this waypoint. Please explain me what is the par and strokes? http://www.freecodecamp.com/challenges/golf-code
@netNinja11
Bobby Rath
@bobbyrath
Jan 30 2016 02:32
but because id is a number
im getting confused as to why i needed brackets
DJ
@qualitymanifest
Jan 30 2016 02:32
@aholly38 so first thing i see is this is wrong for (var j = 0; j < contacts[i]; j++){
rphares
@rphares
Jan 30 2016 02:32
@qualitymanifest !!! Yay!! you are good at explaining,
Jonathan Mitchell
@Vanhealen
Jan 30 2016 02:32

In brackets, does anybody know how to have a separate file like main.css and have it be accessible in live preview? I tried just having them both in the same folder but it does not work

[6:31]
Or how to create that folder and where to put it, I tried putting a folder “new_website” in the usr/brackets/root/samples directory but clearly that is not where it is suppsoed to go

[6:31]
OR
if anybody has any other recommendations of editors that have the live preview capability, like if their is a sublime plug-in that does live preview

DJ
@qualitymanifest
Jan 30 2016 02:33
@aholly38 specifically j < contacts[i] you probably meant to include .length
rphares
@rphares
Jan 30 2016 02:33
can you address the 'why we need brackets/can't use dot thing', @qualitymanifest for @bobbyrath ?
Andrew Charlebois
@andrewchar
Jan 30 2016 02:33
switch (card) {
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      return card + 1;

    case 7:
    case 8:
    case 9:
      return card + 0;

    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":
      return card - 1;

  }
anyone done counting cards recently? im stuck here
DJ
@qualitymanifest
Jan 30 2016 02:34
@aholly38 here you probably meant to do contacts[i].prop
if(prop === contacts.prop[i]){

  return contacts.prop[i];
@aholly38 you don't want to return a console.log here, just return the string return console.log("No such contact");
Alain Holly
@aholly38
Jan 30 2016 02:36
ok
Bobby Rath
@bobbyrath
Jan 30 2016 02:38
@andrewchar js switch(card) { case 2: count += 1; break; case 3: count += 1; break; case 4: count += 1;
  switch(card) {
    case 2:
      count += 1;
      break;
    case 3:
      count += 1;
      break;
    case 4:
      count += 1;
you need to insert a counter
and break after every one
hellomichiyabu
@hellomichiyabu
Jan 30 2016 02:38
I could't anything in this assignment...
Stand in LIne,"Write a function queue which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The queue function should then return the element that was removed."

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

return item; // Change this line
}

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

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

The above is written, but I don't understand what to do next.
queue([2], 1) should return 2
queue([5,6,7,8,9], 1) should return 5
After queue(testArr, 10), myArr[4] should be 10
queue([], 1) should return 1
The above four are required.
rphares
@rphares
Jan 30 2016 02:40
@hellomichiyabu , check out the lessons on push and shift :blush:
Dustin Clay
@dcofjapan
Jan 30 2016 02:42
a = 5;
b = 10;
c = "I am a"; why did this work
..sorry wrong one
11 % 3
var remainder = 2;
rphares
@rphares
Jan 30 2016 02:43
@dcofjapan , kind of,
but, you don't want to tell it the remainder,
Bobby Rath
@bobbyrath
Jan 30 2016 02:43
it will already calculate the remainder for you
rphares
@rphares
Jan 30 2016 02:43
you want to let it do the work,
Dustin Clay
@dcofjapan
Jan 30 2016 02:43
yeah it let me complete it but i had an error @ 11 % 3
rphares
@rphares
Jan 30 2016 02:44
for example, var sum = 12 + 2;
Bobby Rath
@bobbyrath
Jan 30 2016 02:44
var remainder = 11 % 3;
Dustin Clay
@dcofjapan
Jan 30 2016 02:44
oh var sum is what I am looking for? it didn't say that
rphares
@rphares
Jan 30 2016 02:44
no--
you are looking for var remainder
what i mean is, you can set it to do the math,
i didn't write var sum = 14;, i can write var sum = 12 + 2;, or even var sum = 2 + x; etc...
you are learning to use %, so @bobbyrath gave you the answer :point_up: January 30, 2016 9:44 AM
Dustin Clay
@dcofjapan
Jan 30 2016 02:45
ooh now I get it I think thanks @bobbyrath @rphares
CamperBot
@camperbot
Jan 30 2016 02:45
dcofjapan sends brownie points to @bobbyrath and @rphares :sparkles: :thumbsup: :sparkles:
:star: 2176 | @rphares | http://www.freecodecamp.com/rphares
:star: 219 | @bobbyrath | http://www.freecodecamp.com/bobbyrath
Andrew Charlebois
@andrewchar
Jan 30 2016 02:46
@bobbyrath like this?
switch (card) {
    case 2:
      count += 1;
      break;
    case 3:
      count += 1;
      break;
    case 4:
      count += 1;
      break;
    case 5:
      count += 1;
      break;
    case 6:
      count += 1;
      break;
    case 7:
      count += 0;
      break;
    case 8:
      count += 0;
      break;
    case 9:
      count += 0;
      break;
    case 10:
      count += -1;
      break;
    case "J":
      count += -1;
      break;
    case "Q":
      count += -1;
      break;
    case "K":
      count += -1;
      break;
    case "A":
      count += -1;
      break;
   }
Bobby Rath
@bobbyrath
Jan 30 2016 02:46
@andrewchar yea but you still need if statements to return the Bet & Hold options
Cam
@CamMakoJ
Jan 30 2016 02:47
currently struggling on the record collection lesson
i understand the concept and how to get it, just struggling with the syntax of editing the fields in a json
anyone know of another good resource to really help me break it down
DJ
@qualitymanifest
Jan 30 2016 02:48
@bobbyrath if you were still curious about why you had to use bracket notation, i made an example here: https://repl.it/BiMh basically i think if you're using the actual key name, you can use dot notation, but if you're using a variable you have to use bracket notation
hellomichiyabu
@hellomichiyabu
Jan 30 2016 02:48
@rphares queue([2],1) seems var testArr=[1,2,2,4,5] to me
rphares
@rphares
Jan 30 2016 02:48
@qualitymanifest , thank you!!!
CamperBot
@camperbot
Jan 30 2016 02:48
rphares sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 866 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
hellomichiyabu
@hellomichiyabu
Jan 30 2016 02:48
because it return the third number in the array and pick up one?
Cam
@CamMakoJ
Jan 30 2016 02:49
Record Collection
rphares
@rphares
Jan 30 2016 02:49
@hellomichiyabu , I'm sorry, I'm not good at explaining anything, better to ask the room :pensive:
Bobby Rath
@bobbyrath
Jan 30 2016 02:50
@CamMakoJ this worked for the first checkmark
if (value !== "" && prop !== "tracks") {
        collection[id][prop] = value;
    }
        return collection;
}
i am working on the rest also
Cam
@CamMakoJ
Jan 30 2016 02:50
ok ok i have that but forgot to use "" around tracks
i have 2 now... just not the blank one
check mark 2 and 4
Adam
@Blakemilton6
Jan 30 2016 02:51
I'm on testing objects for properties and wondering how to get it through
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function myObj(checkProp) {
myObj.hasOwnProperty("gift");
myObj.hasOwnProperty("pet");  
myObj.hasOwnProperty("house");  
  return "Change Me!";
}
?
Cam
@CamMakoJ
Jan 30 2016 02:51
thanks @bobbyrath
CamperBot
@camperbot
Jan 30 2016 02:51
cammakoj sends brownie points to @bobbyrath :sparkles: :thumbsup: :sparkles:
:star: 220 | @bobbyrath | http://www.freecodecamp.com/bobbyrath
hellomichiyabu
@hellomichiyabu
Jan 30 2016 02:51
Help me! I can't do anything in the "Stand in Line".
CamperBot
@camperbot
Jan 30 2016 02:51
no wiki entry for: me i cant do anything in the stand in line
Bobby Rath
@bobbyrath
Jan 30 2016 02:52
@qualitymanifest thank you i will check it out
CamperBot
@camperbot
Jan 30 2016 02:52
bobbyrath sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 867 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
hellomichiyabu
@hellomichiyabu
Jan 30 2016 02:52
What queue([2],1) means?
Andrew Charlebois
@andrewchar
Jan 30 2016 02:52
@bobbyrath
hellomichiyabu
@hellomichiyabu
Jan 30 2016 02:52
This asks to compose queue([2],1) should return 2.
What to do?

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

return item; // Change this line
}

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

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

Andrew Charlebois
@andrewchar
Jan 30 2016 02:52

@bobbyrath

 case "K":
      count += -1;
      break;
    case "A":
      count += -1;
      break;


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

this is the end of my code. its returning Hold. nothing passed that.

hellomichiyabu
@hellomichiyabu
Jan 30 2016 02:53
The above code is written already.
Cam
@CamMakoJ
Jan 30 2016 02:53
@hellomichiyabu i suggest you go back and look at the accessing arrays lessons
hellomichiyabu
@hellomichiyabu
Jan 30 2016 02:54
@CamMakoJ Thanks! I do now
CamperBot
@camperbot
Jan 30 2016 02:54
hellomichiyabu sends brownie points to @cammakoj :sparkles: :thumbsup: :sparkles:
:star: 220 | @cammakoj | http://www.freecodecamp.com/cammakoj
Bobby Rath
@bobbyrath
Jan 30 2016 02:54
@andrewchar your case's for A & K look incorrect, you should be subtracting one from count
nm, probably works the same with negative number
Cam
@CamMakoJ
Jan 30 2016 02:56

also @andrewchar if you group your similiar outcomes you can clean up the code a bit ie.

case "1"
case "2"

Bobby Rath
@bobbyrath
Jan 30 2016 02:56
you need to return count also
it says "-3 Hold" as an example
your return isn't set up that way
only to return Hold
remember how to add variables plus strings... variable + " string"
putting a space before string will separate them by 1
Valerie
@valbee
Jan 30 2016 03:03
Can anyone explain the local scope and functions exercise? or look at my code.
Andrew Charlebois
@andrewchar
Jan 30 2016 03:04
@bobbyrath i finally got it thanks to your help... i feel stupid it took me a long time to figure that one out
CamperBot
@camperbot
Jan 30 2016 03:04
andrewchar sends brownie points to @bobbyrath :sparkles: :thumbsup: :sparkles:
:star: 221 | @bobbyrath | http://www.freecodecamp.com/bobbyrath
Bobby Rath
@bobbyrath
Jan 30 2016 03:05
@CamMakoJ i just finished record collection, still having trouble?
Cam
@CamMakoJ
Jan 30 2016 03:05
hi @bobbyrath thanks but i just got it too, i had to look up how to delete an atrribute... but i got their. thanks!
Valerie
@valbee
Jan 30 2016 03:06

function myFunction() {
'use strict';
var loc = 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

Andrew Charlebois
@andrewchar
Jan 30 2016 03:06
what is the average each of these exercises should take someone to complete ?
i feel like its taking me a long time. going back and reading past exercises to try and figure then out
Cam
@CamMakoJ
Jan 30 2016 03:07
@andrewchar i think it really depends some are much harder then others, while others are easier.
Valerie
@valbee
Jan 30 2016 03:07
so i delete the console log as the second part of the exercise
still says i have it wrong
i also tried deleting both console commands
orangequarter
@orangequarter
Jan 30 2016 03:07
@valbee you need a semicolon after oopsglobal = 5
Bobby Rath
@bobbyrath
Jan 30 2016 03:07
@andrewchar hard to answer that, varies for everybody of course. i'm still having a hard time and haven't even gotten to the required challenges yet.
tridling
@tridling
Jan 30 2016 03:08
I am on the "Word Blanks" Checkpoitn and cannot figure out what is being asked of me regarding the cat one.

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";

// Your code below this line
var myNoun = "dog ";
var myAdjective = "big ";
var myVerb = "ran ";
var myAdverb = "quickly ";

var result= "The " + myAdjective + myNoun + myVerb + myAdverb + "."
// Your code above this line
return result;
}

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

hellomichiyabu
@hellomichiyabu
Jan 30 2016 03:08
Though I do the internet research, I don't reach lol
tridling
@tridling
Jan 30 2016 03:08
The one that I can't get a green checkmark for ----> "wordBlanks("cat", "little", "hit", "slowly") should contain all of the passed words separated by non-word characters (and any additional words in your madlib)."
hellomichiyabu
@hellomichiyabu
Jan 30 2016 03:09
queue([2],1 ) means "third number in the "queue(arr,item)", annd pick one number?
Andrew Charlebois
@andrewchar
Jan 30 2016 03:09
@bobbyrath required challenges?
orangequarter
@orangequarter
Jan 30 2016 03:09
Wait, sorry @valbee . I was looking at the wrong one.
Valerie
@valbee
Jan 30 2016 03:09
@orangequarter thank you but i meant the exercise right after that one
CamperBot
@camperbot
Jan 30 2016 03:09
valbee sends brownie points to @orangequarter :sparkles: :thumbsup: :sparkles:
venit2
@venit2
Jan 30 2016 03:09
@tridling the function wordBlacks has 4 parameters passed to it... you don't have to declare and assign anything to them to use them
CamperBot
@camperbot
Jan 30 2016 03:09
:star: 250 | @orangequarter | http://www.freecodecamp.com/orangequarter
Valerie
@valbee
Jan 30 2016 03:10
ok :-) @orangequarter
venit2
@venit2
Jan 30 2016 03:10
@venit2 inside the function itself
Adam
@Blakemilton6
Jan 30 2016 03:10
this is how I did it tridling I was on it for 3 weeks
// Your code below this line
result= " " + myNoun + " " + myAdjective + " " + myVerb + " " + myAdverb + " ";
Bobby Rath
@bobbyrath
Jan 30 2016 03:10
@andrewchar Required challenges are marked with a *
if you look on the map
Valerie
@valbee
Jan 30 2016 03:10
the "loc" command is required right?
Bobby Rath
@bobbyrath
Jan 30 2016 03:11
none so far have been required :)
Andrew Charlebois
@andrewchar
Jan 30 2016 03:11
@bobbyrath oh, the algorithm's
orangequarter
@orangequarter
Jan 30 2016 03:12
okay! so, you don't need to name your variable 'loc', you can name it whatever- myVar works
rushi
@rush86999
Jan 30 2016 03:12
hello on truncate a string challenge seems there is a bug
Valerie
@valbee
Jan 30 2016 03:12
tried that too
rushi
@rush86999
Jan 30 2016 03:12

function truncate(str, num) {
// Clear out that junk in your trunk
if (str.length > num) {
str = str.slice(0, num-3);
}
if(num > 3) {
str = str + "...";
}

return str;
}

truncate("A-tisket a-tasket A green and yellow basket", 11);

function truncate(str, num) {
// Clear out that junk in your trunk
if (str.length > num) {
str = str.slice(0, num-3);
}
if(num > 3) {
str = str + "...";
}

return str;
}

truncate("A-tisket a-tasket A green and yellow basket", 11);

Brock Callahan
@brockc
Jan 30 2016 03:12
I find the wording in the 'Smallest Common Multiple' challenge to be worded in a confusing way.
Andrew Charlebois
@andrewchar
Jan 30 2016 03:12
@bobbyrath from what i seen people say in forum, even algorithm's teach you a lot by just challenging to fix something? i have yet to look at one
orangequarter
@orangequarter
Jan 30 2016 03:13
have you tried assigning it a string as a value?
Valerie
@valbee
Jan 30 2016 03:13
but let me tinker again. i just dont understand why i cant pass when i delete the console log @orangequarter
tridling
@tridling
Jan 30 2016 03:13
thanks you @Blakemilton6 . I am going to have to do some more extracurricular reading! :) brownie points
CamperBot
@camperbot
Jan 30 2016 03:13
tridling sends brownie points to @blakemilton6 :sparkles: :thumbsup: :sparkles:
:star: 214 | @blakemilton6 | http://www.freecodecamp.com/blakemilton6
rushi
@rush86999
Jan 30 2016 03:14
maybe i don't understand the challenge
Bobby Rath
@bobbyrath
Jan 30 2016 03:14
@andrewchar i haven't gotten there yet. but that's what i would imagine. freecodecamp has been the hardest free resource i've done so far.. but that's a good thing. hard means you'll learn something when you struggle to get through it. too easy probably means you aren't learning anything
Andrew Charlebois
@andrewchar
Jan 30 2016 03:15
@bobbyrath i was going to mention,. this isnt my first free code source and this one is the hardest ive done so far
Adam
@Blakemilton6
Jan 30 2016 03:15
Your welcome! @tridling
Andrew Charlebois
@andrewchar
Jan 30 2016 03:15
@bobbyrath ive only been coding for almost a month thou.
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:17
@rush86999 th string you return must always have ... at the end
Bobby Rath
@bobbyrath
Jan 30 2016 03:18
same. just be patient, it's going to get harder, but that's a good thing
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 03:19
CamperBot
@camperbot
Jan 30 2016 03:19
no wiki entry for: me to solve httpwwwfreecodecampcomchallengesreturn-early-pattern-for-functions
Adam
@Blakemilton6
Jan 30 2016 03:19
can anyone help on testing Objects for properties lesson?
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
myObj.hasOwnProperty("gift");
myObj.hasOwnProperty("pet");
myObj.hasOwnProperty("house")
orangequarter
@orangequarter
Jan 30 2016 03:20
@valbee So the way you had your code when you posted it, 'use string' is floating, a value not attached to a variable, and myVar is being assigned but it hasn't been defined, so it doesn't have any value. Try assigning 'use string' as the value of your variable instead! that way we get rid of the free floating string and an undefined variable. :)
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 03:20
hello @orangequarter . will u help me to solve @http://www.freecodecamp.com/challenges/return-early-pattern-for-functions
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:21
@HemanthVarmaChekuri the answer is in the question...
just read what their asking you carefully
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 03:21
hmmm ok @UniverSoulSun
Cam
@CamMakoJ
Jan 30 2016 03:23
hrmmm
i am struggling with iterate through an array with a for loop
var total = 0;

for (var i = 5; i < myArr.length; i--);

total += myArr.i;
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:23
@CamMakoJ whats the issue?
Cam
@CamMakoJ
Jan 30 2016 03:23
oh whoops the i at the end is in squarees [i] that was a change i tried after it didnt work initially
nothing is getting added to my variable total
rushi
@rush86999
Jan 30 2016 03:24
@UniverSoulSun i get that the attachment but the challenge is probably to keep whole words when you trim the string
Cam
@CamMakoJ
Jan 30 2016 03:24
and in the console when i log console.log(myArr[i]) i get undefined
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 03:25
hey i m getting the output but it shows wrong mark @UniverSoulSun
orangequarter
@orangequarter
Jan 30 2016 03:26
@HemanthVarmaChekuri It would make it easier for me to help you if you post your code here! If you just post a link to the challenge it brings me to what I did for the challenge
JackeL
@jackel27
Jan 30 2016 03:26

@CamMakoJ

what you're saying is that...

For i=5, and while i is less than array length add my.Arr.i to variable total, then minus 1 from 5?

UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:26
@rush86999 youll need to use substring
orangequarter
@orangequarter
Jan 30 2016 03:26
Also, is anyone here good with RegExr? Need help removing underscores specifically
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 03:26

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

if(a<0 || b<0){
return "undefined";}else{

// Only change code above this line

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

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

@orangequarter

UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:26
@HemanthVarmaChekuri can you show me your code?
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 03:26

@UniverSoulSun

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

if(a<0 || b<0){
return "undefined";}else{

// Only change code above this line

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

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

rphares
@rphares
Jan 30 2016 03:26
@HemanthVarmaChekuri , undefined is a special value,
"undefined" is just a string, @HemanthVarmaChekuri
you want to return the value... do you see the difference? :blush:
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 03:27
i am not able to understand @rphares
rphares
@rphares
Jan 30 2016 03:28
using "" makes it a string, @HemanthVarmaChekuri
Pandarati
@Pandarati
Jan 30 2016 03:28
@HemanthVarmaChekuri "undefined" and undefined are two different values
rphares
@rphares
Jan 30 2016 03:28
(also, you don't need an else)
orangequarter
@orangequarter
Jan 30 2016 03:28
@HemanthVarmaChekuri So!
return undefined;
and
return "undefined";
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 03:29
hoooo got ur point @orangequarter . thank youu
CamperBot
@camperbot
Jan 30 2016 03:29
hemanthvarmachekuri sends brownie points to @orangequarter :sparkles: :thumbsup: :sparkles:
:star: 251 | @orangequarter | http://www.freecodecamp.com/orangequarter
orangequarter
@orangequarter
Jan 30 2016 03:29
Welcome! :)
JackeL
@jackel27
Jan 30 2016 03:29
@HemanthVarmaChekuri Filter could check for falsys
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:29
@CamMakoJ you would have to keep the console log in the for statement since i only exist there
Mikel Duffy
@mikelduffy
Jan 30 2016 03:30
hello everyone, I'm working on the profile lookup problem in the basic javascript section. I found what seems to be a hacky way to solve it, but I know there is a more elegant solution. Any ideas on how I can refactor this:
function lookUp(firstName, prop) {
  // Only change code below this line

  for (i = 0; i < contacts.length; i++) {
    if (contacts[i].firstName === firstName && contacts[i].hasOwnProperty(prop)) {
      return contacts[i][prop];
    }
  }

  for (j = 0; j < contacts.length; j++) {
    if (contacts[j].firstName === firstName) {
      break;
    }
    else {
      return "No such contact";
    }
  }


  for (k = 0; k < contacts.length; k++) {
    if (!(contacts[k].hasOwnProperty(prop))) {
      return "No such property";
    }
  }

  // Only change code above this line
}
Cam
@CamMakoJ
Jan 30 2016 03:30
i got it figured
thanks all
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:31
@CamMakoJ also you need to make sure the for loop actions are inside of brackets
Pandarati
@Pandarati
Jan 30 2016 03:31
@mikelduffy I don't see why you would need the break; statement
This message was deleted
JackeL
@jackel27
Jan 30 2016 03:32
@mikelduffy You could do this....
function lookUp(firstName, prop) {
    for (var i = 0; i < contacts.length; i++) {
        if (contacts[i].firstName === firstName) {
            if (contacts[i][prop]) {
                return contacts[i][prop];
            } else {
                return "No such property";
            }
        }
    }
    return "No such contact";
}
rushi
@rush86999
Jan 30 2016 03:33
@UniverSoulSun slice does the same thing i can't figure out why substring doesn't work for me but i need to figure out how to keep the whole word
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:34
@rush86999 youll also need to slice if num>3
Mikel Duffy
@mikelduffy
Jan 30 2016 03:35
@jackel27 that looks much nicer! I forgot that you can validate the existence of prop by just wrapping it in parens..
Pandarati
@Pandarati
Jan 30 2016 03:35
@rush86999 There is also some info on it on the FFC wiki
wiki js String prototype substring
CamperBot
@camperbot
Jan 30 2016 03:35

:point_right: js string prototype substring [wiki]

js String prototype substring

The substring() method returns a subset of a string between one index and another, or through the end of the string.

:pencil: read more about js string prototype substring on the FCC Wiki

Mikel Duffy
@mikelduffy
Jan 30 2016 03:36
thanks! @Pandarati @jackel27
CamperBot
@camperbot
Jan 30 2016 03:36
mikelduffy sends brownie points to @pandarati and @jackel27 :sparkles: :thumbsup: :sparkles:
:star: 341 | @pandarati | http://www.freecodecamp.com/pandarati
:star: 294 | @jackel27 | http://www.freecodecamp.com/jackel27
JackeL
@jackel27
Jan 30 2016 03:36
:)
rushi
@rush86999
Jan 30 2016 03:38
@Pandarati thanks
CamperBot
@camperbot
Jan 30 2016 03:38
rush86999 sends brownie points to @pandarati :sparkles: :thumbsup: :sparkles:
:star: 342 | @pandarati | http://www.freecodecamp.com/pandarati
Armine
@Arminemash
Jan 30 2016 03:39
Hi guys. Tell me plse who passed the Drop it task?
Pandarati
@Pandarati
Jan 30 2016 03:42
I have @Arminemash. Are you stuck on it?
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 03:44
@Pandarati

@Pandarati

can u get me out f this. i cant able to understand.

http://www.freecodecamp.com/challenges/counting-cards

UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:44
@rush86999 i see a couple of things in your code. at first you need to test two conditions including the condition u use for your second if. n that same if make sure you had the ... at the end of the string.
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 03:45
Armine
@Arminemash
Jan 30 2016 03:45
@Pandarati no,I have a question about drop([0, 1, 0, 1], function(n) {return n === 1;}) should return [1, 0, 1] .why should function retrn 1 0 1 and not only 1 if n===1? Maybe don't I catch the meannig?
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:45
@HemanthVarmaChekuri show me what u got so far
Pandarati
@Pandarati
Jan 30 2016 03:46
@HemanthVarmaChekuri in this challenge a switch statement becomes very useful for your condition checking
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 03:46
@Pandarati thanku=you
rushi
@rush86999
Jan 30 2016 03:47

@UniverSoulSun function truncate(str, num) {
// Clear out that junk in your trunk
var originalLength = str.length;
if (str.length > num) {

var index = str.substring (0, num).search(/\b\s\W*\b/);
str = str.slice(0, index);
}
if(num > 3 && originalLength > num) {
str = str + "...";
}

return str;
}

truncate("A-tisket a-tasket A green and yellow basket", 11);

HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 03:47
@UniverSoulSun i m at initial stage. ok i wl do my best and come to u
Matt James
@thirteenten
Jan 30 2016 03:47
Hi guys, im having some trouble with the "Check for Palindromes" task. Ive got my code to run right for all but the last test: "0_0 (: /-\ :) 0-0".
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:48
@rush86999 why the regex?
Matt James
@thirteenten
Jan 30 2016 03:48
That is supposed to return true but im having trouble understanding how _ and - are supposed to be the same...
rushi
@rush86999
Jan 30 2016 03:48
@UniverSoulSun ham thinking the challenge wants me to end with a whole word
Pandarati
@Pandarati
Jan 30 2016 03:49
@Arminemash I hate redirecting people to links; however this is a useful explanation FreeCodeCamp/FreeCodeCamp#4741
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:49
just add ... instead @rush86999
rushi
@rush86999
Jan 30 2016 03:49
truncate("Peter Piper picked a peck of pickled peppers", 14) should return "Peter Piper...".
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:49
i can show you my solution if you want ?
rushi
@rush86999
Jan 30 2016 03:50
can i? yes that would help
i know i am missing something very simple
Sergio A Mercado
@sergioamercado
Jan 30 2016 03:50
Hi everyone!
Pandarati
@Pandarati
Jan 30 2016 03:51
Hi @sergioamercado
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:51
@rush86999 the second condition needs to be <=
```
This message was deleted
Sergio A Mercado
@sergioamercado
Jan 30 2016 03:51
I was curious if someone could point me to the resource(s) that can help me figure out "Return Early Pattern for Functions"? Not looking for the answer, just dont know where to start on this--am stumped!
Brock Callahan
@brockc
Jan 30 2016 03:51
I think I might need a pair programmer for this one. "Smallest Common Multiple"
Sergio A Mercado
@sergioamercado
Jan 30 2016 03:51
@Pandarati Hi!
Armine
@Arminemash
Jan 30 2016 03:52
@Pandarati thanks! :)
CamperBot
@camperbot
Jan 30 2016 03:52
arminemash sends brownie points to @pandarati :sparkles: :thumbsup: :sparkles:
:star: 343 | @pandarati | http://www.freecodecamp.com/pandarati
Pandarati
@Pandarati
Jan 30 2016 03:52
@sergioamercado This is a good explanation of what the challenge is trying to teach:
wiki Waypoint: Return Early Pattern for Functions
CamperBot
@camperbot
Jan 30 2016 03:52

:point_right: waypoint return early pattern for functions [wiki]

Waypoint: Return Early Pattern for Functions

When a return statement is reached, the execution of the current function stops and control returns to the calling location.

Example

function myFun() {
  console.log("Hello");
  return "World";
  console.log("byebye")
}
myFun();

The above outputs "Hello" to the console, returns "World", but "byebye" is never output, because the function exits at the return statement.
:pencil: read more about waypoint return early pattern for functions on the FCC Wiki

Sergio A Mercado
@sergioamercado
Jan 30 2016 03:53
@Pandarati Thank you! Am checking this out now...
CamperBot
@camperbot
Jan 30 2016 03:53
sergioamercado sends brownie points to @pandarati :sparkles: :thumbsup: :sparkles:
:star: 344 | @pandarati | http://www.freecodecamp.com/pandarati
rushi
@rush86999
Jan 30 2016 03:53
@UniverSoulSun why the minus 3?
Ogechi Ike
@BlackMG27
Jan 30 2016 03:53
Hi, I am having an issue with the Javascript Shopping List
var myList = ["Gummy Bears", 18, ["Bread", 10], ["Blueberries", 9], ["Grapes", 3], ["Veggie Burger Patties", 12], ["Hunger", 100]];
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:54
@rush86999 because you need to take in to account the three dots that youll had at the end of the string
rushi
@rush86999
Jan 30 2016 03:55
@UniverSoulSun oh is see LOL i thought it was a regex for getting whole words
@UniverSoulSun thanks
CamperBot
@camperbot
Jan 30 2016 03:55
rush86999 sends brownie points to @universoulsun :sparkles: :thumbsup: :sparkles:
Pandarati
@Pandarati
Jan 30 2016 03:55
@BlackMG27 Is each item suppose to be in the same array for this challenge? You many want to relook at your first element
CamperBot
@camperbot
Jan 30 2016 03:55
:star: 293 | @universoulsun | http://www.freecodecamp.com/universoulsun
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:55
@rush86999 did you make it happen?
rushi
@rush86999
Jan 30 2016 03:56
yep thanks
UniverSoulSun
@UniverSoulSun
Jan 30 2016 03:56
@rush86999 good
tommy
@tommygebru
Jan 30 2016 03:56
@BlackMG27 the first subarray is missing brackets :smile:
Sergio A Mercado
@sergioamercado
Jan 30 2016 03:57
@Pandarati Quick questio. Is this just a matter of an if, else statement for both a and b and ending with a Return "Undefined"; ?
Ogechi Ike
@BlackMG27
Jan 30 2016 03:57
@tommygebru Yes, that was it. Thank you.
CamperBot
@camperbot
Jan 30 2016 03:57
blackmg27 sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 538 | @tommygebru | http://www.freecodecamp.com/tommygebru
tommy
@tommygebru
Jan 30 2016 03:57
@BlackMG27 nice :+1:
Pandarati
@Pandarati
Jan 30 2016 03:58
@sergioamercado I'm not sure of the question that your asking :), but wherever the return statement is in the method that is where it stops in the method.
Amanda Krummel
@jupiterpenny
Jan 30 2016 03:58

Stand in LIne

tommy
@tommygebru
Jan 30 2016 03:58
@sergioamercado the challenge asks that undefined be returned but not as a string
http://www.w3schools.com/jsref/jsref_undefined.asp
Amanda Krummel
@jupiterpenny
Jan 30 2016 03:58

Stand in Line

tommy
@tommygebru
Jan 30 2016 03:59
@jupiterpenny help bf stand in line
Sergio A Mercado
@sergioamercado
Jan 30 2016 03:59
@tommygebru Thank you! checking this out now.
CamperBot
@camperbot
Jan 30 2016 03:59
sergioamercado sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 539 | @tommygebru | http://www.freecodecamp.com/tommygebru
Pandarati
@Pandarati
Jan 30 2016 03:59
help Checkpoint: Stand In Line
CamperBot
@camperbot
Jan 30 2016 03:59

:point_right: checkpoint stand in line [wiki]

Checkpoint: Stand In Line

About queues

In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.

Instructions

Write a function queue which takes an "array" and an "item" as arguments.

Add the item onto the end of the array, then remove the first element of the array.

The queue function should return the element that was removed.

Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.

:pencil: read more about checkpoint stand in line on the FCC Wiki

Amanda Krummel
@jupiterpenny
Jan 30 2016 03:59
@tommygebru thanks
CamperBot
@camperbot
Jan 30 2016 03:59
jupiterpenny sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 540 | @tommygebru | http://www.freecodecamp.com/tommygebru
Pandarati
@Pandarati
Jan 30 2016 03:59
@tommygebru It happens to me also :P
tommy
@tommygebru
Jan 30 2016 04:00
@Pandarati ahh new commands :smile: thanks
CamperBot
@camperbot
Jan 30 2016 04:00
tommygebru sends brownie points to @pandarati :sparkles: :thumbsup: :sparkles:
:star: 345 | @pandarati | http://www.freecodecamp.com/pandarati
tommy
@tommygebru
Jan 30 2016 04:01
@Pandarati your weather app won't accept san fransokyo
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:03

@Pandarati

http://www.freecodecamp.com/challenges/counting-cards

Once look at my code and help me boss

var count = 0;

function cc(card) {
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
return "5 Bet";
case 7:
case 8:
case 9:
return "0 Hold";

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

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

}
// Only change code below this line

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

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

tridling
@tridling
Jan 30 2016 04:05
What's the deal with the shopping list? I feel that I am doing what it asks for. :/
Pandarati
@Pandarati
Jan 30 2016 04:05
@HemanthVarmaChekuri You're heading in the right direction ;). Don't forget to use break; statements when needed
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:05
@HemanthVarmaChekuri you need to return count
Pandarati
@Pandarati
Jan 30 2016 04:07
@tommygebru It's an easter egg to one of my favorite movies. It isn't a real city though
dsousadev
@dsousadev
Jan 30 2016 04:07
Can anyone help me figure out the "Accessing Nested Arrays in JSON" challenge
tridling
@tridling
Jan 30 2016 04:07
var myList = [[["chocolate", 2]["cake", 2]][["peanuts", 4]["pickles", 7]][["pasta", 0]["buns", 644]];
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:07
@Pandarati yaa...after insrtng break stmts. i m nt getting out f this

@UniverSoulSun

where i need to return count?

Pandarati
@Pandarati
Jan 30 2016 04:08
@tridling For that challenge, you need to make sure each shopping item is in its own array properly.
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:08
@HemanthVarmaChekuri outside of your switch
tommy
@tommygebru
Jan 30 2016 04:08
@Pandarati i know great codepens !
dsousadev
@dsousadev
Jan 30 2016 04:09
var secondTree = myPlants.type["trees"].list[1];
how do I access an array in a JSON
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:10

@UniverSoulSun

i had inserted but it is not working

tridling
@tridling
Jan 30 2016 04:10
@Pandarati Thank you for the nudge. I believe I'm missing some commas.
dsousadev
@dsousadev
Jan 30 2016 04:10
this is what the object looks like: js var myPlants = [ { type: "flowers", list: [ "rose", "tulip", "dandelion" ] }, { type: "trees", list: [ "fir", "pine", "birch" ] } ];
CamperBot
@camperbot
Jan 30 2016 04:10
tridling sends brownie points to @pandarati :sparkles: :thumbsup: :sparkles:
Pandarati
@Pandarati
Jan 30 2016 04:10

@tridling Here is a great example.

var = myGroceries= [["Fish", 5], ["Carrots",  25], ["Beans", 50]];

My grocery list is in a array, but each item is also in its own array.

CamperBot
@camperbot
Jan 30 2016 04:10
:star: 346 | @pandarati | http://www.freecodecamp.com/pandarati
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:10
var count = 0;

function cc(card) {
  switch(card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      return "5 Bet";
      break;
    case 7:
    case 8:
    case 9:
      return "0 Hold";
      break;

    case 3:
    case 2:
    case 'A':
    case 10:
    case 'K':
      return "-1 Hold";
  break;    
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      return "-5 Hold";break;
  }
  // Only change code below this line


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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(3); cc(2); cc('A'); cc(10); cc('K');
tommy
@tommygebru
Jan 30 2016 04:10
@HemanthVarmaChekuri above all pay attention to the comments in your challenge and the sample tests underneath the console where it displays the output .... these are always great hints on how a function should operate and be structured :+1:
dsousadev
@dsousadev
Jan 30 2016 04:11
var myPlants = [
  { 
    type: "flowers",
    list: [
      "rose",
      "tulip",
      "dandelion"
    ]
  },
  {
    type: "trees",
    list: [
      "fir",
      "pine",
      "birch"
    ]
  }  
];
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:11
@HemanthVarmaChekuri count has to be incremented
Aaron Graves
@gravesmeister
Jan 30 2016 04:11
Can anyone help with Testing Objects for Properties? I'm not sure how to complete all 3 objectives.
dsousadev
@dsousadev
Jan 30 2016 04:11
trying to access the "pine "string
Aaron Graves
@gravesmeister
Jan 30 2016 04:11
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
    myObj.hasOwnProperty("gift");
  return "pony";


}

// Test your code by modifying these values
checkObj("gift");
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:12
@UniverSoulSun
var count = 0;

function cc(card) {
  switch(card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      return "5 Bet";
      break;
    case 7:
    case 8:
    case 9:
      return "0 Hold";
      break;

    case 3:
    case 2:
    case 'A':
    case 10:
    case 'K':
      return "-1 Hold";
  break;    
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      return "-5 Hold";break;
  }
  // Only change code below this line


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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(3); cc(2); cc('A'); cc(10); cc('K');
dsousadev
@dsousadev
Jan 30 2016 04:12
@gravesmeister just did that one. Rather than "gift" pass in checkProp
tommy
@tommygebru
Jan 30 2016 04:12
@dsousadev whats your question? if you want to access the pine you must first access plants
how would you do that?
dsousadev
@dsousadev
Jan 30 2016 04:12
yep
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:12
@dsousadev you want the second obj in myPlant
Aaron Graves
@gravesmeister
Jan 30 2016 04:13
@dsousadev I'm not sure what you mean
Pandarati
@Pandarati
Jan 30 2016 04:13
@tommygebru Thanks. That means alot to me
CamperBot
@camperbot
Jan 30 2016 04:13
pandarati sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 541 | @tommygebru | http://www.freecodecamp.com/tommygebru
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:13
@HemanthVarmaChekuri you want to increment count for the cases then test count to see if you bet or hold
tommy
@tommygebru
Jan 30 2016 04:14
@gravesmeister checkProp is the parameter of the function that means when we call it later usually the last line in our challenges.... we replace the parameter with something in this case it is "gift"
tridling
@tridling
Jan 30 2016 04:14
@Pandarati brownie points
dsousadev
@dsousadev
Jan 30 2016 04:14

if(myObj.hasOwnProperty("checkProp")){

    return myObj.checkProp
}
oops forgot a semicolon
Krista Prenesti
@kprenesti
Jan 30 2016 04:14
So what's the difference between this room and the FreeCodeCamp/Help room?
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:14

@UniverSoulSun

i am not getting your point.

Pandarati
@Pandarati
Jan 30 2016 04:15
@kprenesti I believe it just links to this room
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:15
case2:count++; break; as example
Krista Prenesti
@kprenesti
Jan 30 2016 04:15
@Pandarati Cool beans. I thought for a moment that this was a more advanced room, maybe?
dsousadev
@dsousadev
Jan 30 2016 04:16
thanks for the help @UniverSoulSun
CamperBot
@camperbot
Jan 30 2016 04:16
dsousadev sends brownie points to @universoulsun :sparkles: :thumbsup: :sparkles:
:star: 294 | @universoulsun | http://www.freecodecamp.com/universoulsun
Pandarati
@Pandarati
Jan 30 2016 04:16
@tridling No problem. You give brownie points by:
help Brownie Points
CamperBot
@camperbot
Jan 30 2016 04:16

:point_right: brownie points [wiki]

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

A user profile picture next to a with Brownie Points score

There are three ways you can get Brownie Points:

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

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

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

tommy
@tommygebru
Jan 30 2016 04:16
@kprenesti help room is for basic html and css ... this room takes on more difficult problem solving with javascript :smile:
Krista Prenesti
@kprenesti
Jan 30 2016 04:16
Good to know!
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:17
@dsousadev all good, u made it work?
tridling
@tridling
Jan 30 2016 04:17
@Pandarati help Brownie Points (Let's see if I get this now!)
Krista Prenesti
@kprenesti
Jan 30 2016 04:17
I'll come back to this room when i can think coherently enough to ask my questions.
Aaron Graves
@gravesmeister
Jan 30 2016 04:17
@tommygebru I'm having a really hard time understanding this
tommy
@tommygebru
Jan 30 2016 04:17
@dsousadev I see that you use dot notation earlier, here is a great short explanation why your earlier effort didn't work :smile:
https://medium.com/@prufrock123/js-dot-notation-vs-bracket-notation-797c4e34f01d#.s706fmync
tridling
@tridling
Jan 30 2016 04:17
thanks @Pandarati
CamperBot
@camperbot
Jan 30 2016 04:17
tridling sends brownie points to @pandarati :sparkles: :thumbsup: :sparkles:
:warning: tridling already gave pandarati points
tommy
@tommygebru
Jan 30 2016 04:17
@gravesmeister whats up ?
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:17
boss I am not good at coding
@UniverSoulSun
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:18
@HemanthVarmaChekuri you'll get there
Aaron Graves
@gravesmeister
Jan 30 2016 04:18
@tommygebru I understood what you said but that doesn't clue me in to how I would proceed
Pandarati
@Pandarati
Jan 30 2016 04:18
@kprenesti Cool! By the way, you can look at the different rooms using the command "wiki Help Rooms"
Aaron Graves
@gravesmeister
Jan 30 2016 04:18
Some of these waypoints seem really "out there"
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:19

can u explain me clearly what can i do now?

@UniverSoulSun

Krista Prenesti
@kprenesti
Jan 30 2016 04:19
@Pandarati @Pandarati :+1:
@gravesmeister How so? Which ones?
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:20
@HemanthVarmaChekuri this is the break down: first you go through all your casses incrementing or decrementing count. Once you get out of the switch statement you test count to see if youll bet or hold
Aaron Graves
@gravesmeister
Jan 30 2016 04:20
I can't recall with exact one. It just seems like they be moderately easy then I'll come upon one that I'll be stuck on for a week because I don't really get what the instructions are asking. It's going to take me 4 years to get through it all at this rate lol
*ones
Everywhere else I'm learning Java is explained so much better
Catalin Scripcariu
@CatalinScr
Jan 30 2016 04:21
Help Smallest Common Multiple
CamperBot
@camperbot
Jan 30 2016 04:21

:point_right: bonfire smallest common multiple [wiki]

Explanation:

This particular problem can be confusing because most people look for the smallest common multiple of the two number but forget the keyword range. This means that if you get [1,5] then you have to check for the smallest common multiple for all these numbers [1,2,3,4,5] that is evenly divisible by all of them.

:pencil: read more about bonfire smallest common multiple on the FCC Wiki

Krista Prenesti
@kprenesti
Jan 30 2016 04:21
Hey is anyone confident in using gh-pages to create project pages?
On Github, I mean
Warren
@warrenonline
Jan 30 2016 04:21
wiki profile lookup
CamperBot
@camperbot
Jan 30 2016 04:21

:point_right: checkpoint profile lookup [wiki]

Checkpoint: Profile Lookup

Instructions

We have an array of objects representing different people in our contacts lists.

A lookUp function that takes firstName and a property (prop) as arguments has been pre-written for you.

The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact.

If both are true, then return the "value" of that property.

If firstName does not correspond to any contacts then return "No such contact"

If prop does not correspond to any valid properties then return "No such property"

Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.

:pencil: read more about checkpoint profile lookup on the FCC Wiki

tommy
@tommygebru
Jan 30 2016 04:22

@gravesmeister

function functionName(parameter){execute code}

this is your entire function above
below is the callback so that it returns the function or executes

functionName(parameter);

the parameter can be called anything think of it like creating a variable with var
but later we reassign it so that it has a value when we callback :smile:

Aaron Graves
@gravesmeister
Jan 30 2016 04:23
@tommygebru Thanks
CamperBot
@camperbot
Jan 30 2016 04:23
gravesmeister sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 542 | @tommygebru | http://www.freecodecamp.com/tommygebru
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:24
@UniverSoulSun
var count = 0;

function cc(card) {
  switch(card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      return "5 Bet";
      count++;
      break;
    case 7:
    case 8:
    case 9:
      return "0 Hold";
      break;

    case 3:
    case 2:
    case 'A':
    case 10:
    case 'K':
      return "-1 Hold";
      count--;
  break;    
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      return "-5 Hold";count--;break;
  }
  // Only change code below this line


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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(3); cc(2); cc('A'); cc(10); cc('K');
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:24
first off remove the returns from your cases @HemanthVarmaChekuri
tommy
@tommygebru
Jan 30 2016 04:25

@HemanthVarmaChekuri

case 3:
    case 2:
    case 'A':
    case 10:
    case 'K':
      return "-1 Hold";
      count--;

I was going to say remove this but I recognize you are recreating the sample test :+1:

HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:26

@UniverSoulSun

ok i removed then?

@tommygebru

i m nt gtng ur point!

tommy
@tommygebru
Jan 30 2016 04:27
@HemanthVarmaChekuri the first return statement of the switch statement
is a string however we want it to account for count++ which has already counted up to 5 :smile: lets rewrite those lines and do the same for the others :+1:
ignore my first comment :smiley_cat:
Aaron Graves
@gravesmeister
Jan 30 2016 04:28
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
  myObj.hasOwnProperty("gift");
    return "pony";


}

// Test your code by modifying these values
checkObj("gift");
When I put this in it completes the first objective.
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:28
@HemanthVarmaChekuri now test count. if its higher then a certain number bet if not hold
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:28

@tommygebru

send me the code please

Aaron Graves
@gravesmeister
Jan 30 2016 04:28
I can't put that code in again because of the return statement. I can have only 1 I believe
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:29
@HemanthVarmaChekuri
var count = 0;

function cc(card) {
  // Only change code below this line
  switch(card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      count +=1;
      break;
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      count -=1;
      break;

  }
  if(count>0)return(count + " Bet");
  else
  return (count +" Hold");
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Gagandeep Singh
@Guggu
Jan 30 2016 04:30
hey guys m stuck with this code... pls look in to this link
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:32
@Guggu show us your code plz
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:32
@UniverSoulSun
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:33

@UniverSoulSun

By seeing the code also i am not able to understand.
Atlast i understand how poor i am at coding!!!

UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:33
i see the challenge but not where u are spefically @Guggu
@HemanthVarmaChekuri keep at it, you'll get the hang of it. Perseverance & patience
tommy
@tommygebru
Jan 30 2016 04:35
you know what I was wrong I opened the challenge now .... would you like to pair program? @HemanthVarmaChekuri
Gagandeep Singh
@Guggu
Jan 30 2016 04:36
@UniverSoulSun specifically where it should require this one phoneticLookup("alpha")
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:36
help switch
CamperBot
@camperbot
Jan 30 2016 04:36

:point_right: waypoint adding a default option in switch statements [wiki]

Waypoint: Adding a default option in Switch statements

In a switch statement you may not be able to specify all possible values as case statements. Instead, you can add the default statement which will be executed if no matching case statements are found. Think of it like the final else statement in an if/else chain.

A default statement should be the last case.

switch (num) {
  case value1:
    statement1
    break;
  case value2:
    statement2;
    break;
...
  default:
    defaultStatement;
}

:pencil: read more about waypoint adding a default option in switch statements on the FCC Wiki

tommy
@tommygebru
Jan 30 2016 04:37
@Guggu you are using the functionName twice that is a big no no :smile:
TnTien
@TnTien
Jan 30 2016 04:38
@UniverSoulSun hey can you explain how the code works for @HemanthVarmaChekuri . I am doing that one too but I don't quite understand how it works
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:38

@UniverSoulSun

ufff! finally i am able to understand it. Thankyou @UniverSoulSun

UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:38
@HemanthVarmaChekuri bless
Aaron Graves
@gravesmeister
Jan 30 2016 04:38
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
  myObj.hasOwnProperty("gift");

}

// Test your code by modifying these values
checkObj("gift", "pet", "bed");
tommy
@tommygebru
Jan 30 2016 04:38
@HemanthVarmaChekuri keep it up :+1:
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:39
@TnTien so you start off using a switch to increment the count on specific cases
HEMANTH SIVA SAI SURYA VARMA CHEKURI
@HemanthVarmaChekuri
Jan 30 2016 04:39
@tommygebru 👍
Gagandeep Singh
@Guggu
Jan 30 2016 04:40
@tommygebru lol still I didn't get this
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:40
@TnTien next step is to , once out of the switch, test count to see if you bet or hold
Aaron Graves
@gravesmeister
Jan 30 2016 04:40
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
  myObj.hasOwnProperty("gift");
  return "pony";
}

// Test your code by modifying these values
checkObj("gift");
jpg8127
@jpg8127
Jan 30 2016 04:40
@gravesmeister do you need help on that one?
Aaron Graves
@gravesmeister
Jan 30 2016 04:40
Yes please
Rashid Thompson
@RashidT
Jan 30 2016 04:40
hey @/all I'm having trying to figure what to do next with this bonfire Roman Numeral converter. I think i have to use a while loop or a for loop but besides that I'm not so sure what to iterate. My code is below.
function convert(num) {
 var realNum = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
 var romNum = ["I", "IV", "V","IX", "X","XL", "L","XC", "C","CD", "D", "CM", "M"];
  while(num)

  return num;
}

convert(36);
jpg8127
@jpg8127
Jan 30 2016 04:40
@gravesmeister lesson name?
Aaron Graves
@gravesmeister
Jan 30 2016 04:40
@jpg8127 Testing Objects for Properties
tommy
@tommygebru
Jan 30 2016 04:41
@gravesmeister
.hasOwnProperty() is a method that returns a boolean value true or false
right now it works fine because it is checking if gift has an associated value :smiley_cat:
if you were to replace it with a parameter it will check whatever you callback in the bottom like the string "gift"
jpg8127
@jpg8127
Jan 30 2016 04:41
@gravesmeister first you need to check if the variable from the function is a property of myObj, if it is return it, if it is not then return not found
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:41
@RashidT use two loops one in the other
Sherouk
@sherouk
Jan 30 2016 04:43

Hi everyone, I have no idea why but I seem to be stuck on assigning variables. I've tried all combinations but I don't know what to do with the fact that variable b has already been assigned the number 2. Any thoughts?Thanks
// Setup
var a;
var b = 2;

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

Aaron Graves
@gravesmeister
Jan 30 2016 04:43
I'm sorry I'm just picking up what either of you are laying down
tommy
@tommygebru
Jan 30 2016 04:43
@Guggu following the example
var alpha = {
  1:"Z",
  2:"Y",
  3:"X",
  4:"W",
  ...
  24:"C",
  25:"B",
  26:"A"
};
alpha[2]; // "Y"
alpha[24]; // "C"

var value = 2;
alpha[value]; // "Y"
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:43
@RashidT you want to iterate through realNum
tommy
@tommygebru
Jan 30 2016 04:43
@sherouk var b cannot be assigned var a but it can be assigned a :smiley_cat:
TnTien
@TnTien
Jan 30 2016 04:43
@UniverSoulSun how do you test it?
jpg8127
@jpg8127
Jan 30 2016 04:43
@sherouk lesson name?
Mark Nolley
@mnolley
Jan 30 2016 04:43
ar myStr= "I am a \"double quoted\"string inside \"double quotes\""; // Change this line
jpg8127
@jpg8127
Jan 30 2016 04:44
@gravesmeister are you still completely confused?
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:44
if(count>5){action}
Mark Nolley
@mnolley
Jan 30 2016 04:44
var myStr= "I am a \"double quoted\"string inside \"double quotes\"";
Aaron Graves
@gravesmeister
Jan 30 2016 04:44
Yes
@jpg8127
Mark Nolley
@mnolley
Jan 30 2016 04:44
doesn't anyone know what's wrong with this?
dsdunn
@dsdunn
Jan 30 2016 04:44
Can someone please explain why my function doesn't work once I add the else if and else statements ?
function lookUp(firstName, prop){
// Only change code below this line 

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


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

        var value = contacts[i][prop];

     return value;

    }   else if (contacts[i].firstName !== firstName){

          return "No such contact";

    }   else{ 

            return "No such property";
    }         

  }

// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "lastname");
tommy
@tommygebru
Jan 30 2016 04:44
@Guggu lets declare our large object with the name lookup :smile:
Mark Nolley
@mnolley
Jan 30 2016 04:44
ar myStr= "I am a \"double quoted\"string inside \"double quotes\""; // Change this line
jpg8127
@jpg8127
Jan 30 2016 04:44
@gravesmeister you know how to use an if statement right?
Sherouk
@sherouk
Jan 30 2016 04:45
The lesson is "storing values with the equal operator". I tried assigning just 'a' to var b but it still doesn't work
Aaron Graves
@gravesmeister
Jan 30 2016 04:45
@jpg8127 Yes
tommy
@tommygebru
Jan 30 2016 04:45
@mnolley share the link & title please :smile:
Gagandeep Singh
@Guggu
Jan 30 2016 04:45
@tommygebru will try :)
TnTien
@TnTien
Jan 30 2016 04:45
@UniverSoulSun sorry I guess what I meant was what var is it counting from?
Mark Nolley
@mnolley
Jan 30 2016 04:45
Title: Escaping Literal Quotes in Strings
Thanks @tommygebru
CamperBot
@camperbot
Jan 30 2016 04:46
mnolley sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 543 | @tommygebru | http://www.freecodecamp.com/tommygebru
jpg8127
@jpg8127
Jan 30 2016 04:46
@gravesmeister myObj.hasOwnProperty(checkProp) returns true or false so you put that in an if. the checkProp part is from the function's parameter. When checkObj("gift"); calls the function "gift" goes into the function's variable checkProp
tommy
@tommygebru
Jan 30 2016 04:46
@mnolley watch out for spacing :smile: :+1:
@jpg8127 :+1:
TnTien
@TnTien
Jan 30 2016 04:47
@UniverSoulSun switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count += 1;
break;
Mark Nolley
@mnolley
Jan 30 2016 04:47
Ok...let me take a look at that @tommygebru
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:47
@TnTien each time the occurence of a case pops up
tommy
@tommygebru
Jan 30 2016 04:47
@UniverSoulSun the count increments or increases :smile_cat:
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:48
both are one and the same @tommygebru
matthew3454
@matthew3454
Jan 30 2016 04:48
Help! I'm on the Waypoint Iterate Through an Array with a For Loop and my green tea induced caffeine high is severely impeding my concentration capapabilities. Here is my code:
CamperBot
@camperbot
Jan 30 2016 04:48
no wiki entry for: im on the waypoint iterate through an array with a for loop and my green tea induced caffeine high is severely impeding my concentration capapabilities here is my code
matthew3454
@matthew3454
Jan 30 2016 04:48
// Example
var ourArr = [ 9, 10, 11, 12];
var ourTotal = 0;

for (var i = 0; i < ourArr.length; i++) {
  ourTotal += ourArr[i];
}

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

// Only change code below this line


var myTotal = 0;

for  (var i = 0; i < myArr.length; i ++) {
  myTotal += myArr[i];
}
Gagandeep Singh
@Guggu
Jan 30 2016 04:48
image.png
tommy
@tommygebru
Jan 30 2016 04:48
@dsdunn you declared a variable in your loop you should assign a value to value :smile:
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:48
@tommygebru plz correct me if im wrong
Gagandeep Singh
@Guggu
Jan 30 2016 04:48
image.png
image.png
resolved now @tommygebru
tommy
@tommygebru
Jan 30 2016 04:49
@Guggu excellent did it pass the challenge :smile:
Gagandeep Singh
@Guggu
Jan 30 2016 04:49
image.png
jpg8127
@jpg8127
Jan 30 2016 04:50
@matthew3454 I think you have to have the variable named total not myTotal
Gagandeep Singh
@Guggu
Jan 30 2016 04:50
yes @tommygebru :)
tommy
@tommygebru
Jan 30 2016 04:50
@UniverSoulSun for the adding?
@Guggu nice :+1: keep it up
Aaron Graves
@gravesmeister
Jan 30 2016 04:50
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
 myObj.hasOwnProperty(checkprop);


}

// Test your code by modifying these values
checkObj("pet");
TnTien
@TnTien
Jan 30 2016 04:50
how do you guys send the codes in that view ?
matthew3454
@matthew3454
Jan 30 2016 04:50
@jpg8127
jpg8127
@jpg8127
Jan 30 2016 04:51
@gravesmeister .. you did not do anything?
matthew3454
@matthew3454
Jan 30 2016 04:51
// Example
var ourArr = [ 9, 10, 11, 12];
var ourTotal = 0;

for (var i = 0; i < ourArr.length; i++) {
  ourTotal += ourArr[i];
}

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

// Only change code below this line


var  = total;

for  (var i = 0; i < myArr.length; i ++) {
  myTotal += myArr[i];
}
Aaron Graves
@gravesmeister
Jan 30 2016 04:51
It completes the first objective
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:51
@tommygebru yea, increments increases both the same!
jpg8127
@jpg8127
Jan 30 2016 04:51
@matthew3454 myTotal change to total
Aaron Graves
@gravesmeister
Jan 30 2016 04:51
Sorry I girlfriend interrupted me
jpg8127
@jpg8127
Jan 30 2016 04:51
@gravesmeister myObj.hasOwnProperty(checkProp) returns true or false so you put that in an if. the checkProp part is from the function's parameter. When checkObj("gift"); calls the function "gift" goes into the function's variable checkProp
Aaron Graves
@gravesmeister
Jan 30 2016 04:52
@jpg8127 I read that. I'm trying to make sense of it now that I'm not being bothered
tommy
@tommygebru
Jan 30 2016 04:52
@UniverSoulSun nice :+1: did you pass the challenge?
matthew3454
@matthew3454
Jan 30 2016 04:52
@jpg8127 okay that worked. Thanks! But why?
CamperBot
@camperbot
Jan 30 2016 04:52
matthew3454 sends brownie points to @jpg8127 :sparkles: :thumbsup: :sparkles:
:star: 339 | @jpg8127 | http://www.freecodecamp.com/jpg8127
jpg8127
@jpg8127
Jan 30 2016 04:52
@matthew3454 sometimes to test if you did the lesson right they need to be specific about things
@matthew3454 it is not in a function so no return
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:53
@tommygebru i was not in challenge mode, im just helping fellow campers as i can
matthew3454
@matthew3454
Jan 30 2016 04:53
@jpg8127 okay I see thanks
CamperBot
@camperbot
Jan 30 2016 04:53
matthew3454 sends brownie points to @jpg8127 :sparkles: :thumbsup: :sparkles:
:warning: matthew3454 already gave jpg8127 points
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:53
This message was deleted
tommy
@tommygebru
Jan 30 2016 04:53
@UniverSoulSun even better !!
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:53
help markup
CamperBot
@camperbot
Jan 30 2016 04:53
no wiki entry for: markup
tommy
@tommygebru
Jan 30 2016 04:54
@matthew3454 did you see this :smile:
var  = total;
UniverSoulSun
@UniverSoulSun
Jan 30 2016 04:54
@tommygebru how do you get the markup wiki to pop up?
tommy
@tommygebru
Jan 30 2016 04:54
lets see
wiki markup
CamperBot
@camperbot
Jan 30 2016 04:54
no wiki entry for: markup
tommy
@tommygebru
Jan 30 2016 04:55
camperbot markup
help markup
CamperBot
@camperbot
Jan 30 2016 04:55
no wiki entry for: markup
jpg8127
@jpg8127
Jan 30 2016 04:55
@gravesmeister do you need more help....?
tommy
@tommygebru
Jan 30 2016 04:55
help format
CamperBot
@camperbot
Jan 30 2016 04:55

: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

Aaron Graves
@gravesmeister
Jan 30 2016 04:55
@jpg8127 I give up. I'll give it another week and see if it makes sense then.
jpg8127
@jpg8127
Jan 30 2016 04:55
@gravesmeister lol k
tommy
@tommygebru
Jan 30 2016 04:55
@gravesmeister woah a week is a long time
jpg8127
@jpg8127
Jan 30 2016 04:55
@gravesmeister it is not too complicated once you understand though..
Mark Nolley
@mnolley
Jan 30 2016 04:56
var myStr = "I am a \"double quoted\" string inside\"double quotes\"";
Aaron Graves
@gravesmeister
Jan 30 2016 04:56
I know but I'm going on a few weeks on this one stupid waypoint
Paramjeet Singh
@Paramjeet-Singh
Jan 30 2016 04:56
Can anyone help me in the lookup tutorial? Here's the code
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
   val={
    alpha:"Adams",
    bravo:"Boston",
    charlie:"Chicago",
    delta:"Denver",
    echo:"Easy",
    foxtrot:"Frank"
  };
/*  switch(val) {
    case "alpha": 
      result = "Adams";
      break;
    case "bravo": 
      result = "Boston";
      break;
    case "charlie": 
      result = "Chicago";
      break;
    case "delta": 
      result = "Denver";
      break;
    case "echo": 
      result = "Easy";
      break;
    case "foxtrot": 
      result = "Frank";
  }
*/
  // Only change code above this line
 return result;
}

// Change this value to test

phoneticLookup("alpha");
Mark Nolley
@mnolley
Jan 30 2016 04:56
I'm still stuck...@tommygebru....I know you said spacing
dsdunn
@dsdunn
Jan 30 2016 04:56

@tommygebru

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


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

         value = contacts[i][prop];

     return value;

    }   else if (contacts[i].firstName !== firstName){

          return "No such contact";

    }   else{ 

            return "No such property";
    }         

  }

// Only change code above this line
}

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

I tried it like this first but get the same outcome. It seems to work fine to plug in the names and spit out the properties without the if else, but once I add the exceptions i get nothing... I appreciate any advice

TnTien
@TnTien
Jan 30 2016 04:56
test
test
okay
jpg8127
@jpg8127
Jan 30 2016 04:56
@gravesmeister if you want I can go in private chat with you and explain in more detail
Aaron Graves
@gravesmeister
Jan 30 2016 04:56
@tommygebru @jpg8127 I switch to other Java learning tools that explain things so much better
tommy
@tommygebru
Jan 30 2016 04:56
@gravesmeister read the comments
// Setup
var myObj = {//your object contains
  gift: "pony",//properties and associated values 
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {//checkprop is simply a variable
  // Your Code Here
 myObj.hasOwnProperty(checkprop);


}

// Test your code by modifying these values
checkObj("pet");//pet is the substitution, it can be anything!
Aaron Graves
@gravesmeister
Jan 30 2016 04:57
@tommygebru That's what I thought. So if I change the call it should complete the objective correct?