These are chat archives for FreeCodeCamp/HelpJavaScript

22nd
Jan 2016
Alexander Fischetti
@lexifiatu
Jan 22 2016 00:17
I am unsure of why I keep getting the RangeError: Maximum call stack size exceeded
rphares
@rphares
Jan 22 2016 00:18
@lexifiatu , try refreshing
Alexander Fischetti
@lexifiatu
Jan 22 2016 00:18

function myFunction() {
var myVar = 'use strict';
console.log(myVar);
}
myFunction();

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

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

rphares
@rphares
Jan 22 2016 00:18
oh-- also read and follow the last line in the comments :) @lexifiatu
Alexander Fischetti
@lexifiatu
Jan 22 2016 00:18
Thank you I will
rphares
@rphares
Jan 22 2016 00:18
then, refresh and run test~
sure thing :)
Alexander Fischetti
@lexifiatu
Jan 22 2016 00:19
That fixed it thank you so much
rphares
@rphares
Jan 22 2016 00:19
Anytime!
(also, maximum call stack crops up a few times in the challenges-- refresh will usually do the trick, @lexifiatu :) )
Matthew Towles
@matthewdtowles
Jan 22 2016 00:24
Need help with "Using Objects for Lookups"
rphares
@rphares
Jan 22 2016 00:24
@matthewdtowles , what have you tried so far? Could you share your code please?:blush:
Matthew Towles
@matthewdtowles
Jan 22 2016 00:25

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

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

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

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

ObradovicM
@ObradovicM
Jan 22 2016 00:25
hello all
Pattri
@pttvntrdz
Jan 22 2016 00:26
@matthewdtowles you should change your return
@ObradovicM hi!^^
rphares
@rphares
Jan 22 2016 00:26
Okay, thats a good start... where did "": undefined come from?
ObradovicM
@ObradovicM
Jan 22 2016 00:26
I think there is a bug related to test cases, because when I call this function
function golfScore(par, strokes) {
// Only change code below this line
if(strokes == 1){
return "Hole-in-one!";
}
else if(strokes <= par - 2){
return "Eagle";
}
else if(strokes == par - 1){
return "Birdie";
}
else if(strokes == par){
return "Par";
}
else if(strokes == par + 1){
return "Bogey";
}
else if(strokes == par + 2){
return "Double Bogey";
}
else if(strokes >= par + 3){
return "Go Home";
}
return "Change Me";
// Only change code above this line
}
Matthew Towles
@matthewdtowles
Jan 22 2016 00:26
it states that I should only change code above that line
rphares
@rphares
Jan 22 2016 00:26
yep, @matthewdtowles
Matthew Towles
@matthewdtowles
Jan 22 2016 00:26
phoneticLookup("") should equal undefined
rphares
@rphares
Jan 22 2016 00:26
so, we are gonna return result, @matthewdtowles
ObradovicM
@ObradovicM
Jan 22 2016 00:26
when I call this function with golfScore(5, 9);
rphares
@rphares
Jan 22 2016 00:27
but right now, thats just " ", @matthewdtowles
so we will need to assign our lookup to it :) @matthewdtowles
Pattri
@pttvntrdz
Jan 22 2016 00:27
@matthewdtowles so you should think of what you need to return
like @rphares sais :smile:
ObradovicM
@ObradovicM
Jan 22 2016 00:27
I got returned Go Home, but that test case I can't pass even thogh it is stated that output shoud be Go Home
Pattri
@pttvntrdz
Jan 22 2016 00:27
@matthewdtowles try to refresh the page
rphares
@rphares
Jan 22 2016 00:27
@pttvntrdz :)
Matthew Towles
@matthewdtowles
Jan 22 2016 00:28
how do i do that
i mean assign our lookup to it
rphares
@rphares
Jan 22 2016 00:28
well, the examples are
alpha[2]; // "Y"
and
alpha[24]; // "C"
check out the left column...
Pattri
@pttvntrdz
Jan 22 2016 00:29
@matthewdtowles something like 'result = lookup[..]'
Matthew Towles
@matthewdtowles
Jan 22 2016 00:29
so I should just do like lookup[0] lookuplotus/model#35; etc..
Pattri
@pttvntrdz
Jan 22 2016 00:29
yes but instead of a number something more general
rphares
@rphares
Jan 22 2016 00:29
kinda, except you aren't looking by [indexnumber]
Pattri
@pttvntrdz
Jan 22 2016 00:29
@ObradovicM try to refresh
Matthew Towles
@matthewdtowles
Jan 22 2016 00:29
val?
Pattri
@pttvntrdz
Jan 22 2016 00:30
yes!
ObradovicM
@ObradovicM
Jan 22 2016 00:30
tried already
rphares
@rphares
Jan 22 2016 00:30
:)
Matthew Towles
@matthewdtowles
Jan 22 2016 00:30
thank you so much
rphares
@rphares
Jan 22 2016 00:30
Anytime!
tak, @pttvntrdz :)
CamperBot
@camperbot
Jan 22 2016 00:30
rphares sends brownie points to @pttvntrdz :sparkles: :thumbsup: :sparkles:
:star: 241 | @pttvntrdz | http://www.freecodecamp.com/pttvntrdz
matthew3454
@matthew3454
Jan 22 2016 00:31
I have a question on: Comparison with the Equality Operator
Can someone please help me? These are the instructions: myTest(10) should return "Not Equal, You should use the == operator
rphares
@rphares
Jan 22 2016 00:32
@ObradovicM , why do you still have return "Change me"?
matthew3454
@matthew3454
Jan 22 2016 00:32
// Setup
function myTest(val) {
  if {
   (myTest == 10) return "Equal";
  }
  return "Not Equal";
}

// Change this value to test
myTest(12);
That is what I have so far.
Pattri
@pttvntrdz
Jan 22 2016 00:33
@ObradovicM try to write else { return "Go Home " }
ObradovicM
@ObradovicM
Jan 22 2016 00:33
@rphares It shouldn't be matter That return statement will be executed only if none of the above branches is executed. Even if I comment that out it will not work!
Pattri
@pttvntrdz
Jan 22 2016 00:34
@matthew3454 you have to change the order of the brackets in the if statement!
rphares
@rphares
Jan 22 2016 00:34
was just wondering...
Pattri
@pttvntrdz
Jan 22 2016 00:34
if(your condition){
}
so @matthew3454 it is like
if (val==10){
...
}
ObradovicM
@ObradovicM
Jan 22 2016 00:36
@pttvntrdz it is not a right logic. because whatever I pass for strokes and par if one of the above branches is not executed than else statement in that case will return "Go Home" but "Go Home" should be returned only in specific situation when strokes >= par + 3
matthew3454
@matthew3454
Jan 22 2016 00:38
@pttvntrdz
/ Setup
function myTest(val) {
  if 

    (val== 10) return "Equal"{

  return "Not Equal";
}
};

// Change this value to test
myTest(12);
Pattri
@pttvntrdz
Jan 22 2016 00:38
@ObradovicM yeah i see what you mean, but I think the "Go Home" can apply when 'strokes >=par + 3' and also when there are no matches
@matthew3454 try to put the 'if(val ==10){ ' in one line
and then the 'return "Equal' after the '{'
and in the line after you close the '}'
ObradovicM
@ObradovicM
Jan 22 2016 00:40
tried to put in else { "Go Home"; } but doesn't work
have to go out now. will be back in about hour. Thanks for help
Pattri
@pttvntrdz
Jan 22 2016 00:41
if (val ==10){ return "Equal"; } return "Not Equal"
@ObradovicM okok you're welcome
i will try to figure it out also
ObradovicM
@ObradovicM
Jan 22 2016 00:42
it will always return "Equal"; at least should always return "Equal"
thanks
Pattri
@pttvntrdz
Jan 22 2016 00:42
if (val ==10){
return "Equal";
} 
return "Not Equal"
Jorge Mollón
@kazlan
Jan 22 2016 00:42
exercise makes you change comparable value to 12
Add the equality operator to the indicated line so that the function will return "Equal" when val is equivalent to 12
p funk
@prodigalFUNK
Jan 22 2016 00:43
has anyone done the Counting Cards exercise?
matthew3454
@matthew3454
Jan 22 2016 00:43
@pttvntrdz This is what I changed it to.
Pattri
@pttvntrdz
Jan 22 2016 00:43
@kazlan ah ok i didn remember that
matthew3454
@matthew3454
Jan 22 2016 00:43
/ Setup
function myTest(val) 
  if(val== 10) {
    return "Equal"
  };

  return "Not Equal";

// Change this value to test
myTest(12);
Pattri
@pttvntrdz
Jan 22 2016 00:43
@prodigalFUNK yees
rphares
@rphares
Jan 22 2016 00:43
Done? yes. Good at helping on it?no... :pensive: @prodigalFUNK
Pattri
@pttvntrdz
Jan 22 2016 00:43
you're missing the semicolon after the "Equal"
p funk
@prodigalFUNK
Jan 22 2016 00:44
@pttvntrdz how did you get the var(count) to compound instead of giving an output of 1, 0 or -1 every time?
matthew3454
@matthew3454
Jan 22 2016 00:45
@pttvntrdz Okay it's updated but still not working
/ Setup
function myTest(val) {
  if(val== 10) {
    return "Equal";
  };

  return "Not Equal";
};

// Change this value to test
myTest(12);
Pattri
@pttvntrdz
Jan 22 2016 00:45
with the 'count += 1'
p funk
@prodigalFUNK
Jan 22 2016 00:45
ah
rphares
@rphares
Jan 22 2016 00:45
@matthew3454 , you need to swap the 10 and the twelve,
the instructions told you to Add the equality operator to the indicated line so that the function will return "Equal" when val is equivalent to 12
Jorge Mollón
@kazlan
Jan 22 2016 00:46
@matthew3454 change the 10 for a 12 ;)
matthew3454
@matthew3454
Jan 22 2016 00:46
I did @kazlan @rphares
Pattri
@pttvntrdz
Jan 22 2016 00:46
@matthew3454 10 should be 12, and the firs line should be //Setup, with two '/'
Jorge Mollón
@kazlan
Jan 22 2016 00:46
yup, that comment line too :)
Pattri
@pttvntrdz
Jan 22 2016 00:46
@prodigalFUNK you need switch, case, and break
p funk
@prodigalFUNK
Jan 22 2016 00:47
ok, I had tried both switch and a series of if statements but in each one I had it saying count++ or count--
Pattri
@pttvntrdz
Jan 22 2016 00:47
aah and when is A, J , Q or K you do 'count -=1'
rphares
@rphares
Jan 22 2016 00:48
i just used ifs... @pttvntrdz , @prodigalFUNK ...
Pattri
@pttvntrdz
Jan 22 2016 00:48
no no you dont need the if
p funk
@prodigalFUNK
Jan 22 2016 00:48
@pttvntrdz yeah I'm changing it now. thanks. Ive go tit set up as if statements now so ill see if that works before I go back to switches
CamperBot
@camperbot
Jan 22 2016 00:48
prodigalfunk sends brownie points to @pttvntrdz :sparkles: :thumbsup: :sparkles:
:star: 242 | @pttvntrdz | http://www.freecodecamp.com/pttvntrdz
ulBenson
@ulbenson
Jan 22 2016 00:48
every([{"single": "double"}, {"single": NaN}], "single")
how to know it is NaN? seems can't use ==
or ===
Pattri
@pttvntrdz
Jan 22 2016 00:49
it would start like..
function cc (card){
case 2:
case 3:
case 4:
case 5:
case 6:
  count += 1;
  break;
@prodigalFUNK you're welcome :smile: avec plaisir ^^
matthew3454
@matthew3454
Jan 22 2016 00:51
@pttvntrdz @rphares @kazlan Thank You
CamperBot
@camperbot
Jan 22 2016 00:51
matthew3454 sends brownie points to @pttvntrdz and @rphares and @kazlan :sparkles: :thumbsup: :sparkles:
:star: 289 | @kazlan | http://www.freecodecamp.com/kazlan
:star: 1828 | @rphares | http://www.freecodecamp.com/rphares
:star: 243 | @pttvntrdz | http://www.freecodecamp.com/pttvntrdz
rphares
@rphares
Jan 22 2016 00:51
Anytime :)
ulBenson
@ulbenson
Jan 22 2016 00:55
wiki NaN
CamperBot
@camperbot
Jan 22 2016 00:55
no wiki entry for: nan
@ulbenson
NaN is my least favorite value
@rphares how the flip do you have so many brownie points
l33t hax?
rphares
@rphares
Jan 22 2016 00:58
lol, @centraleft -- I'm on a lot and people are nice to me for no apparent reason... : /
ulBenson
@ulbenson
Jan 22 2016 00:58
@centraleft thank I will look up for inf
CamperBot
@camperbot
Jan 22 2016 00:58
ulbenson sends brownie points to @centraleft :sparkles: :thumbsup: :sparkles:
:star: 333 | @centraleft | http://www.freecodecamp.com/centraleft
rphares
@rphares
Jan 22 2016 00:58
Im slowing down a lot now, people realized I'm getting fat and aren't so quick with the thanks anymore , which is a VERY good thing as its weird i have so many and don't know much :blush:
Herman Fassett
@HermanFassett
Jan 22 2016 00:59
lol @rphares
Pattri
@pttvntrdz
Jan 22 2016 00:59
@rphares haha
rphares
@rphares
Jan 22 2016 00:59
heh, funny... but true :)
Robbie
@centraleft
Jan 22 2016 01:00
lol I feel like I'm on here a lot
I don't even know how long it would take to get that many
if only you could turn them into candy
rphares
@rphares
Jan 22 2016 01:00
not long, i think I'm at close to two months?
Robbie
@centraleft
Jan 22 2016 01:00
wow dang
well my goal is to catch up to ya ;D
rphares
@rphares
Jan 22 2016 01:00
do it, my goal is to redistribute wealth,
@centraleft :cookie:
CamperBot
@camperbot
Jan 22 2016 01:01
rphares sends brownie points to @centraleft :sparkles: :thumbsup: :sparkles:
:star: 334 | @centraleft | http://www.freecodecamp.com/centraleft
Robbie
@centraleft
Jan 22 2016 01:05
@rphares thanks for being sensible
CamperBot
@camperbot
Jan 22 2016 01:05
centraleft sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 1829 | @rphares | http://www.freecodecamp.com/rphares
Robbie
@centraleft
Jan 22 2016 01:05
we need some of that
also yay! I solved the dumb roman numeral challenge
idk why but that one was hard for me, I had to come back to it
rphares
@rphares
Jan 22 2016 01:05
lol-- you are doing it!
Oh,congrats!
(i liked that one... I'm weird, i guess)
Robbie
@centraleft
Jan 22 2016 01:06
I was just trying to be clever and find a neat solution, and I ended up doing what I didn't want to do and making a big library of all the roman numeral values
I'm certain there is a simpler way because 4 and 9 are the only special cases but I just couldn't make it work
rphares
@rphares
Jan 22 2016 01:07
I'm sure it was great! Most everyone says that one is horrible
(maybe i only like it cause I'm not to the point where i know/care about cleverness, i just like understanding my own answer, lol)
Robbie
@centraleft
Jan 22 2016 01:09
lmao everyone is different I guess
sheesh it's quiet in here tonight
rphares
@rphares
Jan 22 2016 01:10
yep--
but maybe thats a good thing! People are figuring things out more :)
valerush
@valerush
Jan 22 2016 01:10
Need help missing something on Assignment with a Returned Value
processed should have a value of 2 - this one is done
rphares
@rphares
Jan 22 2016 01:11
Sure! What have you tried so far, @valerush ~
valerush
@valerush
Jan 22 2016 01:11
You should assign process to processed - this one I can not figure out
Wesly Jason
@wesly-jason
Jan 22 2016 01:11
Record Collection
valerush
@valerush
Jan 22 2016 01:11
var processed = 2;
function process() {
return (7 + 3) / 5;
}
this is the code
so far I've done
Robbie
@centraleft
Jan 22 2016 01:12
@valerush if you set a variable equal to a function
then whatever that function returns will be the valuable for that variable
value
rphares
@rphares
Jan 22 2016 01:12
@valerush , actually you weren't meant to change var processed, that was above the line...
Wesly Jason
@wesly-jason
Jan 22 2016 01:13
How do you get help for a specific topic, again?
rphares
@rphares
Jan 22 2016 01:13
you may want to reset your code and then follow @centraleft 's good advice :)
things like,
help record
CamperBot
@camperbot
Jan 22 2016 01:13

:point_right: checkpoint record collection [wiki]

Checkpoint: Record Collection

Instructions

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

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

For the given id in collection:

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

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

If value is blank, delete that prop.

Always return the entire collection object.

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

:pencil: read more about checkpoint record collection on the FCC Wiki

rphares
@rphares
Jan 22 2016 01:13
@neglakay33 :point_up:
Wesly Jason
@wesly-jason
Jan 22 2016 01:14
@rphares thanks
CamperBot
@camperbot
Jan 22 2016 01:14
neglakay33 sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 1831 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 22 2016 01:14
Sure thing!
Wesly Jason
@wesly-jason
Jan 22 2016 01:14
help record collection
CamperBot
@camperbot
Jan 22 2016 01:14

:point_right: checkpoint record collection [wiki]

Checkpoint: Record Collection

Instructions

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

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

For the given id in collection:

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

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

If value is blank, delete that prop.

Always return the entire collection object.

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

:pencil: read more about checkpoint record collection on the FCC Wiki

rphares
@rphares
Jan 22 2016 01:15
(also, if help doesn't work, you can try the commands wiki XX, or explain XX, @neglakay33 :)
valerush
@valerush
Jan 22 2016 01:15
@camperbot that's what I am trying
Wesly Jason
@wesly-jason
Jan 22 2016 01:16
cool. I learn something today, next I forget all about it.
rphares
@rphares
Jan 22 2016 01:16
@valerush , what we mean is, right now you have passed that test by changing something you shouldn't have. First step, reset (or change it back, if you can remember exactly how)
Second step:
Wesly Jason
@wesly-jason
Jan 22 2016 01:16
week*
rphares
@rphares
Jan 22 2016 01:17
reassign var processed, @valerush
you don't need to change it up top,
you can still use = to give it a new meaning,
mthussey
@mthussey
Jan 22 2016 01:17
I'm trying the challenge "Title Case a Sentence" and having trouble over a small issue: I can easily convert a sentence into an array of strings, but then don't know how to access the first letter in each string. It won't allow the array[0] or array[i][0] for a given string within the array...how to fix?
rphares
@rphares
Jan 22 2016 01:17
including a function, @valerush
Aaron
@mark-xyz
Jan 22 2016 01:17
Hi! someone solved the falsy bouncer bonfire?
I have problems with NaN
rphares
@rphares
Jan 22 2016 01:20
This message was deleted
This message was deleted
@valerush :point_up:
gettingcodenhere
@gettingcodenhere
Jan 22 2016 01:21
Hello can someone help me with my switch default statement, I have default: text = "stuff"
Shruti Hardat
@shrutihardat
Jan 22 2016 01:21
Bonfire Chunky Monkey
CamperBot
@camperbot
Jan 22 2016 01:21

:fire:Bonfire: Chunky Monkey :link:

function chunk(arr, size) {
  // Break it up.
  return arr;
}

chunk(['a', 'b', 'c', 'd'], 2);

Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.

more info:  bf details | bf links | hint

Shruti Hardat
@shrutihardat
Jan 22 2016 01:21
hint
CamperBot
@camperbot
Jan 22 2016 01:21
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
valerush
@valerush
Jan 22 2016 01:22
@rphares I figure out when you send me the solution, thanx
CamperBot
@camperbot
Jan 22 2016 01:22
valerush sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
d wilder
@alhazen1
Jan 22 2016 01:22
@mthussey maybe slice()?
CamperBot
@camperbot
Jan 22 2016 01:22
:star: 1832 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 22 2016 01:22
sure thing, @valerush :)
valerush
@valerush
Jan 22 2016 01:23
@rphares such a simple code I am taking to high :)))
rphares
@rphares
Jan 22 2016 01:23
it's easy to get stuck, @valerush -- don't worry about it at all! :)
mthussey
@mthussey
Jan 22 2016 01:28
What I mean is, if I try to capitalize "year" by doing str[i][0] = "Y"; it won't let me change the string by using brackets [0]
TypeError: Cannot assign to read only property of '0'
d wilder
@alhazen1
Jan 22 2016 01:28
@mthussey Oh yeah. Can't change a string - I forgot about that. Maybe make each string in the array into subarray?
Khademul Islam Mahin
@Mahin2k
Jan 22 2016 01:29
// Setup
var myPlants = [
  { 
    type: "flowers",
    list: [
      "rose",
      "tulip",
      "dandelion"
    ]
  },
  {
    type: "trees",
    list: [
      "fir",
      "pine",
      "birch"
    ]
  }  
];

// Only change code below this line

var secondTree = myPlants.trees[2]; // Change this line
what am i doing wrong?
rphares
@rphares
Jan 22 2016 01:29
oh, cool, a good start, but a few things left, @Mahin2k :)
Wesly Jason
@wesly-jason
Jan 22 2016 01:30
how do you push a property value onto the end an array, again? i
rphares
@rphares
Jan 22 2016 01:31
So, for the myPlants part, you need to index which part, @Mahin2k
d wilder
@alhazen1
Jan 22 2016 01:31
@mthussey I actually did this one differently. Used String.replace() but I spent way too mch time figuring out the regular expression
James
@Combinations
Jan 22 2016 01:31
@mthussey split your string into and array using string.split('');
rphares
@rphares
Jan 22 2016 01:32
is pine in myPlants[0] or in myPlants[1], @Mahin2k ?
d wilder
@alhazen1
Jan 22 2016 01:34
@mthussey like [ [s,H,o,R,t], [A,n,D], [s,T,o,U,t] ]
Khademul Islam Mahin
@Mahin2k
Jan 22 2016 01:35
@rphares i think its in myPlantslotus/model#35
@rphares but that doesnt matter what i need to know is the syntax for what im supposed to do
mthussey
@mthussey
Jan 22 2016 01:39
figured it out. it works to split the words into sub-arrays. not sure if that's the best way or not...but it works
d wilder
@alhazen1
Jan 22 2016 01:40
@mthussey I think that is what they intended. You did that right.
rphares
@rphares
Jan 22 2016 01:41
Good, @Mahin2k !
Then,we need to fix the second half, @Mahin2k
First, remember that indexing starts at zero... so it wouldn't be [2]... @Mahin2k
but bigger still-- is pine in trees? Look again, where is the : [ ], @Mahin2k ?
CKB
@bartlett9
Jan 22 2016 01:43
function myTest(val) {
  var answer = "";
  // Only change code below this line
  switch (answer) {
    case "a":
      return "apple";
      break;
    case "b":
      return "bird";
      break;
    case "c":
      return "cat";
      break;
    default:
      return "stuff";      
  }


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

// Change this value to test
myTest(1);
Robbie
@centraleft
Jan 22 2016 01:47
@bartlett9 you're passing the wrong thing to your switch statement
d wilder
@alhazen1
Jan 22 2016 01:48
@bartlett9 switch (answer) { you are testing answer not val
Simon Situ
@ssitu001
Jan 22 2016 01:50
function lookUp(firstName, prop){

  for (var i = 0; i < contacts.length; i++) {
  if (firstName === contacts[i].firstName && contacts[i].hasOwnProperty(prop)) {
    return contacts[i];
  } else if (firstName !== contacts[i].firstName) {
    return "no such contact";
  } else if (!contacts[i].hasOwnProperty(prop)) {
    return "no such contact";
  }

  }
}
any help guys..
Robbie
@centraleft
Jan 22 2016 01:50
I am so sick of this challenge
Jen
@calaminejen
Jan 22 2016 01:50
hello folks. I'm a bit stuck on this one.
break;
oops, hold
///
Robbie
@centraleft
Jan 22 2016 01:51
@ssitu001 the problem with your solution is this
Jen
@calaminejen
Jan 22 2016 01:51
// Setup
function abTest(a, b) {
  // Only change code below this line
  switch (a, b) {
  case (a < 0):
  case (b < 0):
  return "undefined";
  }
  // Only change code above this line

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

// Change values below to test your code
abTest(2,2);
Robbie
@centraleft
Jan 22 2016 01:51
the way your logic is set up, your loop is reaching a return statement before it can finish iterating
Jen
@calaminejen
Jan 22 2016 01:51
there we go.
Robbie
@centraleft
Jan 22 2016 01:52
you want to first check all the objects in the array for the firstName and given properties
only then can you either return a value from the correct object, or return whether or not a property or contact exists
@calaminejen undefined is it's own value
if you put it in strings, the program will think it is a string
in quotes lol
no strings
Wesly Jason
@wesly-jason
Jan 22 2016 01:53
Can some please tell me what is wrong with my code below?
// 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.prop.push(value);
  }
  else {
    delete collection.id.prop;
  }
  return collection;

}

// Alter values below to test your code
update(5439, "artist", "ABBA");
I am getting a typeError: cannot set property 'prop' of undefined
Robbie
@centraleft
Jan 22 2016 01:54

on first glance

" "

should be

""
then, more importantly
you are using dot notation but you need to use bracket notation for this
when you use dot notation the program will literally search for a property called id
Wesly Jason
@wesly-jason
Jan 22 2016 01:55
@centraleft ok i'll try that
Robbie
@centraleft
Jan 22 2016 01:55
you need to use bracket notation reference properties with variables
Wesly Jason
@wesly-jason
Jan 22 2016 01:57
@centraleft thanks
CamperBot
@camperbot
Jan 22 2016 01:57
neglakay33 sends brownie points to @centraleft :sparkles: :thumbsup: :sparkles:
:star: 335 | @centraleft | http://www.freecodecamp.com/centraleft
Jen
@calaminejen
Jan 22 2016 01:57
ahhhhh thanks @centraleft
Robbie
@centraleft
Jan 22 2016 01:57
my pleasure
Jen
@calaminejen
Jan 22 2016 01:58
ahh, flip, it's still not working though!
Robbie
@centraleft
Jan 22 2016 01:58
lol
Jen
@calaminejen
Jan 22 2016 01:58
is there a problem with the comparative statements being in the switch statement?
Najee Bartley
@ntbartley23
Jan 22 2016 01:58
can anyone help me with the global scope please
Robbie
@centraleft
Jan 22 2016 01:58
you may want to try using logical or
b < 0 || a < 0
in an if statement
@ntbartley23 sure whats up?
d wilder
@alhazen1
Jan 22 2016 01:59
@calaminejen I think so. I don't think you can do that in switch
Najee Bartley
@ntbartley23
Jan 22 2016 02:00
Thanks for the reply.. ok so here is what i got..
function fun1() {
// Assign 5 to oopsGlobal Here
oopsGlobal = 5;
}
Wesly Jason
@wesly-jason
Jan 22 2016 02:00
@alhazen1 yes you can.
Najee Bartley
@ntbartley23
Jan 22 2016 02:00
all i need to do is assign 5 to oppsGlobal..
so i did this. oopsGlobal = 5;
Wesly Jason
@wesly-jason
Jan 22 2016 02:01
@ntbartley23 where is your code?
Najee Bartley
@ntbartley23
Jan 22 2016 02:01

// Declare your variable here
var myGlobal = 10;

function fun1() {
// Assign 5 to oopsGlobal Here
oopsGlobal = 5;
}

// Only change code above this line
function fun2() {
var output = "";
if (typeof myGlobal != "undefined") {
output += "myGlobal: " + myGlobal;
}
if (typeof oopsGlobal != "undefined") {
output += " oopsGlobal: " + oopsGlobal;
}
console.log(output);
}

specifically:
d wilder
@alhazen1
Jan 22 2016 02:02
@neglakay33 Yes, but not they way they are using it. There will never be a match
Najee Bartley
@ntbartley23
Jan 22 2016 02:02
function fun1() {
// Assign 5 to oopsGlobal Here
oopsGlobal = 5;
}
Jen
@calaminejen
Jan 22 2016 02:02
YEAH LOGICAL OR, IF STATEMENTS
Robbie
@centraleft
Jan 22 2016 02:02
:satisfied:
Najee Bartley
@ntbartley23
Jan 22 2016 02:03
am i misunderstanding the instructions?
d wilder
@alhazen1
Jan 22 2016 02:03
@calaminejen this has to match that
switch(this)
   case that:
Andrew Bales
@agbales
Jan 22 2016 02:05
Hi all-- Working on multiple RegEX replacements. Feel like there must be a better way to do it than .replace() strung together multiple times...?
d wilder
@alhazen1
Jan 22 2016 02:05
@calaminejen Honestly, this is better solved with a if statement
Wesly Jason
@wesly-jason
Jan 22 2016 02:05
@ntbartley23 try refreshing
Najee Bartley
@ntbartley23
Jan 22 2016 02:05
ok
function fun1() {
// Assign 5 to oopsGlobal Here
oopsGlobal = 5;
}
i did it again
its not working
Jareth MacArthur
@Jtmaca9
Jan 22 2016 02:08
Hey guys, im just working on the Ceasers cipher challenge, and was going down the route of using ascii to change the values, i was just wondering if thats correct?
Najee Bartley
@ntbartley23
Jan 22 2016 02:08
it says
maximum call stack exceeded
rphares
@rphares
Jan 22 2016 02:09
@ntbartley23 , which one is that again?
Wesly Jason
@wesly-jason
Jan 22 2016 02:09
@ntbartley23 did you hitt F5 and run it again?
rphares
@rphares
Jan 22 2016 02:09
(also-- refresh when it says maximum call stack, it often takes care of it)
Robbie
@centraleft
Jan 22 2016 02:09
@Jtmaca9 I'm sure you can use ascii
but the challenge suggests you use unicode
however you solve it is fine as long as you solve it
Najee Bartley
@ntbartley23
Jan 22 2016 02:11
hey !! Thank you so much.. it worked after i closed the page
rphares
@rphares
Jan 22 2016 02:11
Woohoo~
Najee Bartley
@ntbartley23
Jan 22 2016 02:12
Thanks a lot!!!
Wesly Jason
@wesly-jason
Jan 22 2016 02:13
@thepersonname sends them brownie points
@ntbartley23 FYI
rphares
@rphares
Jan 22 2016 02:13
thanks, @neglakay33 :)
CamperBot
@camperbot
Jan 22 2016 02:13
rphares sends brownie points to @neglakay33 :sparkles: :thumbsup: :sparkles:
:star: 219 | @neglakay33 | http://www.freecodecamp.com/neglakay33
Wesly Jason
@wesly-jason
Jan 22 2016 02:14
yeah and thanks lol
d wilder
@alhazen1
Jan 22 2016 02:14
@Jtmaca9 I think in the range of alphabet ascii and unicode overlap so, yes that should work
Hau Harry
@counter1835
Jan 22 2016 02:14
hey can anyone help with lesson 212

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

// Only change code below this line

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

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

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

my code can only look for the last key :(
rphares
@rphares
Jan 22 2016 02:15
@counter1835 , good start!
Hau Harry
@counter1835
Jan 22 2016 02:15
thanks @rphares
CamperBot
@camperbot
Jan 22 2016 02:15
counter1835 sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 1834 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 22 2016 02:15
So, a few things--
Jareth MacArthur
@Jtmaca9
Jan 22 2016 02:16
Thanks heaps guys! appreciate it :)
rphares
@rphares
Jan 22 2016 02:17
first, you are going to want to put quotes on all that del/charlie/alpha stuff, are remove :result from them all, we don't need it:) @counter1835
Wesly Jason
@wesly-jason
Jan 22 2016 02:17
@counter1835 why not use a switch
Hau Harry
@counter1835
Jan 22 2016 02:17
the lesson wont allow
Wesly Jason
@wesly-jason
Jan 22 2016 02:17
ok
Hau Harry
@counter1835
Jan 22 2016 02:18
@rphares foxtrot:"Frank", like that?
rphares
@rphares
Jan 22 2016 02:18
close! "foxtrot": "Frank",
Hau Harry
@counter1835
Jan 22 2016 02:19
but then how does it return the result?
rphares
@rphares
Jan 22 2016 02:19
once the table's cleaned up, then we need to figure out our lookup :blush: Because, returning result (which we have to, as its under the lin)
hahaha, you are a step ahead
then, we can just assign our lookup to result before we return it :)
but to do that, we need the lookup part...
check out the example on the left, alpha[2]; // "Y"
Hau Harry
@counter1835
Jan 22 2016 02:20
ok
so is that putting result = val?
rphares
@rphares
Jan 22 2016 02:21
almost!
see how the example has varNameAlpha{thingItIsLookingFor]; ?
val is what we are looking for... but where is it looking?
Hau Harry
@counter1835
Jan 22 2016 02:22
result = val[val] ;?
rphares
@rphares
Jan 22 2016 02:22
almost! your var isn't names val, though....
successcoding
@successcoding
Jan 22 2016 02:23
a should be assigned to b with =
rphares
@rphares
Jan 22 2016 02:23
er-- or maybe it is and shouldn't be, can you repaste what you have?
successcoding
@successcoding
Jan 22 2016 02:23
a should be assigned to b with =
rphares
@rphares
Jan 22 2016 02:23
@successcoding ?
Hau Harry
@counter1835
Jan 22 2016 02:23

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

// Only change code below this line

val = {
" ":undefined,
"foxtrot":"Frank",
"echo":"Easy",
"delta":"Denver",
"charlie":"Chicago",
"bravo":"Boston",
"alpha":"Adams"
};
result = val[] ;

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

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

rphares
@rphares
Jan 22 2016 02:24
oooh, oops, sorry, i didn't notice that!
Convert the switch statement into a lookup table called lookup.
see how they have var alpha for their table? We need to make one called lookup...
Hau Harry
@counter1835
Jan 22 2016 02:25
like lookup val?
rphares
@rphares
Jan 22 2016 02:26
for naming the table? just var lookup = {etc
then :point_up: January 22, 2016 9:22 AM what you did here was the right format... but your table isn't named val, it;'s named lookup :)
Hau Harry
@counter1835
Jan 22 2016 02:28
var lookup = {
" ":undefined,
"foxtrot":"Frank",
"echo":"Easy",
"delta":"Denver",
"charlie":"Chicago",
"bravo":"Boston",
"alpha":"Adams"
};
lookup[val]= result; like this?
rphares
@rphares
Jan 22 2016 02:29
Yep! Except you don't need " ":undefined
Hau Harry
@counter1835
Jan 22 2016 02:29
but it still not working :(
rphares
@rphares
Jan 22 2016 02:30
uhoh... hmm the only other difference i notice off the bat is that your order is opposite of alphabetical,
didn't realize that would be a thing,
but i wanna put those starting from a and ill look more closely for anything we missed? :)
oh, SHOOT
sorry, spacy moment-- i need to go to bed, heh
you have the last part backwards, @counter1835
result = lookup[val];
im so sorry :pensive:
Hau Harry
@counter1835
Jan 22 2016 02:33
ok ok
thanks it is done :)
thanks @rphares
CamperBot
@camperbot
Jan 22 2016 02:33
counter1835 sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:warning: counter1835 already gave rphares points
rphares
@rphares
Jan 22 2016 02:34
anytime! Do you get all the why's? (I'm not great at explaining things...)
Hau Harry
@counter1835
Jan 22 2016 02:34
sweet dream @rphares
rphares
@rphares
Jan 22 2016 02:34
thanks, @counter1835 ! :)
CamperBot
@camperbot
Jan 22 2016 02:34
rphares sends brownie points to @counter1835 :sparkles: :thumbsup: :sparkles:
:star: 214 | @counter1835 | http://www.freecodecamp.com/counter1835
Hau Harry
@counter1835
Jan 22 2016 02:34
yeah i know how it works . thanks
matthew3454
@matthew3454
Jan 22 2016 02:35
Can someone please help me on the waypoint: Comparisons with the Logical Or Operator?
rphares
@rphares
Jan 22 2016 02:36
Sure, though I'm not communicating well, a bit sleepy :)
What have you got so far, @matthew3454 :blush:
matthew3454
@matthew3454
Jan 22 2016 02:36
that's okay
this is what I've got
function myTest(val) {
  // Only change code below this line

  if (val > 10 || val < 20 ) {
    return "Inside";
  }

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

// Change this value to test
myTest(15);
rphares
@rphares
Jan 22 2016 02:36
oooh, you are SO close,
you will be annoyed
matthew3454
@matthew3454
Jan 22 2016 02:37
myTest(0) should return "Outside"myTest(21) should return "Outside"
myTest(25) should return "Outside"
myTest(9) should return "Outside"
rphares
@rphares
Jan 22 2016 02:37
look at your conditional...
matthew3454
@matthew3454
Jan 22 2016 02:38
i see
rphares
@rphares
Jan 22 2016 02:38
if the value is greater than ten or less than 20 it should be inside??
heh, easy fix, though :)
matthew3454
@matthew3454
Jan 22 2016 02:39
This is the update
function myTest(val) {
  // Only change code below this line

  if (val > 10 || val < 20 ) {
    return "Outside";
  }

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

// Change this value to test
myTest(15);
rphares
@rphares
Jan 22 2016 02:39
erm,.., did you change the code below the line?
matthew3454
@matthew3454
Jan 22 2016 02:39
no
rphares
@rphares
Jan 22 2016 02:40
oh, sorry-- like i said, sleep, one sec :)
you still are having it say,
Johannah
@eccentricafterglow
Jan 22 2016 02:40
Hey, I'm having trouble with this waypoint: Assignment with Plus Equals
rphares
@rphares
Jan 22 2016 02:41
if the number is greater than ten or less than twenty, retrun outside, @matthew3454
Johannah
@eccentricafterglow
Jan 22 2016 02:41
var a = 3;
var b = 17;
var c = 12;

// Only modify code below this line

a = a += 12;
b =+ 9 + b;
c = c += 7;
matthew3454
@matthew3454
Jan 22 2016 02:41
@rphares Combine the two if statements into one statement which returns "Outside" if val is not between 10 and 20, inclusive. Otherwise, return "Inside".
rphares
@rphares
Jan 22 2016 02:41
you want it to say if the number is Less than ten or greater than twenty, return outside, @matthew3454
Johannah
@eccentricafterglow
Jan 22 2016 02:41
The error I'm getting is -- You should use the += operator for each variable
but all the other answers are correct.
matthew3454
@matthew3454
Jan 22 2016 02:42
okay
rphares
@rphares
Jan 22 2016 02:42
hi, @eccentricafterglow !
Johannah
@eccentricafterglow
Jan 22 2016 02:42
hi!
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 02:42
@eccentricafterglow don't believe you can do =+, only +=
Johannah
@eccentricafterglow
Jan 22 2016 02:43
okay.
rphares
@rphares
Jan 22 2016 02:43
exactly-- you don't need the first bit of each of those :)
matthew3454
@matthew3454
Jan 22 2016 02:43
So what do I do besides switch the places of "Outside" and "Inside"? @rphares
rphares
@rphares
Jan 22 2016 02:43
no no-- don't switch the places, @matthew3454 ! The second one is below the line!
@matthew3454 , this is the line that needs to change, if (val > 10 || val < 20 )
matthew3454
@matthew3454
Jan 22 2016 02:44
okay
rphares
@rphares
Jan 22 2016 02:44
right now, you are saying if the number is ABOVE 10 or LESS than 20, return outside,
you want to say if the number is LESS than 10 or Greater THAN 20
matthew3454
@matthew3454
Jan 22 2016 02:45
okay
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 02:45
@rphares do you have exp with the iterate over arrays with map exercise?
rphares
@rphares
Jan 22 2016 02:45
heh, believe so, but lemme check :)
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 02:46
cool, I'm returning the array, just not sure what i'm doing that's not adding 3
Johannah
@eccentricafterglow
Jan 22 2016 02:46
I'm still confused -- the only way I can get the right answers is to switch them.
matthew3454
@matthew3454
Jan 22 2016 02:46
@rphares this is my updated code
rphares
@rphares
Jan 22 2016 02:46
hmm, alright, can you paste what you have, @Nyarlat-hotep ?
matthew3454
@matthew3454
Jan 22 2016 02:46
function myTest(val) {
  // Only change code below this line

  if (val > 10 || val < 20 ) {
    return "Inside";
  }

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

// Change this value to test
myTest(15);
rphares
@rphares
Jan 22 2016 02:46
@eccentricafterglow , same to you :)
Johannah
@eccentricafterglow
Jan 22 2016 02:47
var a = 3;
var b = 17;
var c = 12;

// Only modify code below this line

a = a += 12;
b =+ 9 + b;
c = c += 7;
rphares
@rphares
Jan 22 2016 02:47
nope-- @matthew3454 , now you have switched the returns! and one was below the line... your logic is fine now,
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 02:47
@matthew3454 you don't need to change the return statements, just change your > symbols the other way
rphares
@rphares
Jan 22 2016 02:47
but all you had to do was switch the direction of your greater than less thans
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 02:47
var oldArray = [1,2,3,4,5];
var newArray = [];

// Only change code below this line.
var plusThree = oldArray.map(function(val) {
  return [val] + 3;                           
});


newArray = oldArray;
rphares
@rphares
Jan 22 2016 02:48
k, give me a sec, I've never been asked about this one before :blush:
(and warning i am sleepy and unclear atm)
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 02:48
@eccentricafterglow you are saying b =+. That is not correct
matthew3454
@matthew3454
Jan 22 2016 02:48
@rphares Thank you!
CamperBot
@camperbot
Jan 22 2016 02:48
matthew3454 sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 1835 | @rphares | http://www.freecodecamp.com/rphares
matthew3454
@matthew3454
Jan 22 2016 02:48
Finally I got it
rphares
@rphares
Jan 22 2016 02:48
yay! you got it!! Congrats~
Johannah
@eccentricafterglow
Jan 22 2016 02:49
I know.
but if I switch it, it's still not correct.
rphares
@rphares
Jan 22 2016 02:49
okay, hmm, @Nyarlat-hotep , yours is a bit different from mine,
@eccentricafterglow -- you also only need ONE a/b/c per each of those,
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 02:49
try b = 9 += b; @eccentricafterglow
rphares
@rphares
Jan 22 2016 02:49
not a= a+= b
example
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 02:50
what does yours look like @rphares ?
Johannah
@eccentricafterglow
Jan 22 2016 02:50
I got a reference error
if I switched it
rphares
@rphares
Jan 22 2016 02:50
@eccentricafterglow , can you paste what you tried?
Johannah
@eccentricafterglow
Jan 22 2016 02:50
var a = 3;
var b = 17;
var c = 12;

// Only modify code below this line

a = a += 12;
b = 9 += b;
c = c += 7;
rphares
@rphares
Jan 22 2016 02:51
@eccentricafterglow --
you don't need a =
or b =
example:
d += 15;
not d = d+= 15;
:)
Dusan Nikodijevic
@pika89
Jan 22 2016 02:52

rphares
@rphares
Jan 22 2016 02:52
@Nyarlat-hotep , first, i assigned everything to var newArray, no empty array
Dusan Nikodijevic
@pika89
Jan 22 2016 02:52
could someone help with accessing object properties
// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};

// Only change code below this line;

var playerNumber;       // Change this Line
var player = testObj[16];   // Change this Line
rphares
@rphares
Jan 22 2016 02:54
then, i didn't have val in brackets in the return,
@Nyarlat-hotep
Johannah
@eccentricafterglow
Jan 22 2016 02:54
b needs to equal 26. :/
rphares
@rphares
Jan 22 2016 02:54
@eccentricafterglow , paste again, please:)
Dusan Nikodijevic
@pika89
Jan 22 2016 02:54
never mind i just got it
rphares
@rphares
Jan 22 2016 02:55
Congrats, @pika89 ! Sorry, you were next :)
Johannah
@eccentricafterglow
Jan 22 2016 02:55
var a = 3;
var b = 17;
var c = 12;

// Only modify code below this line

a = a += 12;
b = 9 + b;
c = c += 7;
rphares
@rphares
Jan 22 2016 02:55
okay,
@eccentricafterglow , when we use += it its the ONE operator in that little line,
we do not want a = a += 12;
Johannah
@eccentricafterglow
Jan 22 2016 02:56
ooh.
rphares
@rphares
Jan 22 2016 02:56
that line should be a += 12; :)
the others should be the same way ~
Johannah
@eccentricafterglow
Jan 22 2016 02:56
well hell
sigh
rphares
@rphares
Jan 22 2016 02:57
hahaha, yeah, its a tricky idea, took me forever to get my head around in practice :)
Wesly Jason
@wesly-jason
Jan 22 2016 02:57
var arr = [
  [1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
  for (var j=0; j < arr[i].length; j++) {
    console.log(arr[i][j]);
  }
}
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 02:58
@eccentricafterglow this exercise is about adding a value onto the existing variable value. so it's saying take a, add 12 to it and set that new value equal to a
Johannah
@eccentricafterglow
Jan 22 2016 02:58
ooohh
yeah.
Wesly Jason
@wesly-jason
Jan 22 2016 02:58
can someone please explain why is arr[i] is an array itself
rphares
@rphares
Jan 22 2016 02:59
tag, @Nyarlat-hotep -- all you, explanations are not a strong suite in general, and atm it would be a mistake for me to try :)
Johannah
@eccentricafterglow
Jan 22 2016 02:59
oh good lord
finally got it.
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 02:59
hehe no prob @rphares i'm a uxer by trade
rphares
@rphares
Jan 22 2016 02:59
Congrats, @eccentricafterglow !!
Johannah
@eccentricafterglow
Jan 22 2016 03:00
thanks @rphares
CamperBot
@camperbot
Jan 22 2016 03:00
eccentricafterglow sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 1836 | @rphares | http://www.freecodecamp.com/rphares
Johannah
@eccentricafterglow
Jan 22 2016 03:00
thanks @Nyarlat-hotep
CamperBot
@camperbot
Jan 22 2016 03:00
eccentricafterglow sends brownie points to @nyarlat-hotep :sparkles: :thumbsup: :sparkles:
:star: 168 | @nyarlat-hotep | http://www.freecodecamp.com/nyarlat-hotep
rphares
@rphares
Jan 22 2016 03:00
Oooh, cool-- it's awesome having experienced people on here, @Nyarlat-hotep :)
Wilson Heres
@hereswilson
Jan 22 2016 03:01
not really sure where to begin with this converting numbers to roman numerals. anyone have a hint that will get me on the right track?
rphares
@rphares
Jan 22 2016 03:07
@Nyarlat-hotep , sorry-- did that help at all? i think the brackets thing might have been the more important difference, but... not good at logic :blush:
Michael-Anthony
@Michael-Anthony
Jan 22 2016 03:08
Hey everyone. I'm stuck on "Passing Values to Functions with Arguments." I keep getting "RangeError Maximum call stack size exceeded"
Yeondam Park
@yeondam88
Jan 22 2016 03:08
help condense arrays with reduce
CamperBot
@camperbot
Jan 22 2016 03:08

:point_right: waypoint condense arrays with reduce [wiki]

Reduce can be useful for condensing an array of numbers into one value.

var array = [4,5,6,7,8];
var singleVal = 0;
// Only change code below this line.

var singleVal = array.reduce(function(previousVal, currentVal){

  return previousVal+currentVal;

});

:pencil: read more about waypoint condense arrays with reduce on the FCC Wiki

rphares
@rphares
Jan 22 2016 03:08
@Michael-Anthony , try refreshing :)
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 03:08
var oldArray = [1,2,3,4,5];
var newArray = [];

// Only change code below this line.
var newArray = oldArray.map(function(val) {
  return val + 3;                           
});


newArray = oldArray;
@rphares that's what I have now
Michael-Anthony
@Michael-Anthony
Jan 22 2016 03:08
@rphares Thank you
CamperBot
@camperbot
Jan 22 2016 03:08
michael-anthony sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 1837 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 22 2016 03:08
(a few lessons have a known issue with maximum call stack. refreshing/closignt he winds often does the trick! @Michael-Anthony :) )
anytime :)
Adam Yuhasz
@jayuhasz
Jan 22 2016 03:09
Hey, does anyone have good resources on the arguments object? I'm able to use them, but I don't feel like I have a super solid grasp on them.
rphares
@rphares
Jan 22 2016 03:09
@Nyarlat-hotep , why does newArray = OldArray?
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 03:10
that was there to begin with
rphares
@rphares
Jan 22 2016 03:10
it was? In the unchangeable part?
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 03:10
no it's in the area to change
rphares
@rphares
Jan 22 2016 03:11
i don't have the var newArray = []; or newArray = oldArray;...
phew Worried i'd cheated AND we'd found a bug, lol
elrix
@A19
Jan 22 2016 03:11
sir how to excape backslash \ >?
rphares
@rphares
Jan 22 2016 03:11
\\
Vik
@vvang044
Jan 22 2016 03:11
hi rphares.....
rphares
@rphares
Jan 22 2016 03:12
Hiya, @vvang044 ! WB :)
Vik
@vvang044
Jan 22 2016 03:12
im stuck again.....lol
rphares
@rphares
Jan 22 2016 03:12
hahaha, i think you are to the point where I'm useless... but what on?
Vik
@vvang044
Jan 22 2016 03:12
lol
nah.....
i doubt that
rphares
@rphares
Jan 22 2016 03:14
you on a bonfire?
Vik
@vvang044
Jan 22 2016 03:15
var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13, 14]
];
arr[0]; // equals [1,2,3]
arr[1][2]; // equals 6........ how is this equals to 6
bonefire is million miles away
André Ferreira
@andreferreira-me
Jan 22 2016 03:15
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 03:16
@vvang044 because you are targeting the 2nd array with lotus/model#35 and the 3rd number in that array with 2
wtf
André Ferreira
@andreferreira-me
Jan 22 2016 03:16
anybody can help me? I'm almost there
arr[i][0]

function titleCase(str) {
str = str.toLowerCase();
var arr = str.split(' ');

for(var i=0; i < arr.length;i++){
arr[i][0] = arr[i][0].toUpperCase();
str = arr.join(' ');
}

return str;
}

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

Vik
@vvang044
Jan 22 2016 03:16
im sorry i dont know what lotus/model is
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 03:16
haha yea idk why it did that
rphares
@rphares
Jan 22 2016 03:16
hahaha, that was a formatting accident
Tennile Edwards
@telaed
Jan 22 2016 03:16
Hi all! Been working through the new JavaScript tutorials. Stuck on the "Using Objects for Lookups" My phone is here:
rphares
@rphares
Jan 22 2016 03:17
when writing indexes, safest to use this grey stuff
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 03:17
@vvang044 you are targeting the first array with the 1, then targeting the 3rd number in that array with 2
André Ferreira
@andreferreira-me
Jan 22 2016 03:17
function titleCase(str) {
  str = str.toLowerCase();
  var arr = str.split(' ');

  for(var i=0; i < arr.length;i++){
    arr[i][0] = arr[i][0].toUpperCase();
    str = arr.join(' ');
  }

  return str;
}

titleCase("I'm a little tea pot");
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 03:17
@vvang044 arrays start at 0
rphares
@rphares
Jan 22 2016 03:18
the indexing always starts at 0, @vvang044 , and we have to go though both which array and then the spots in it
@telaed , good start!
now, you need to a) make your lookup,
and b) assign it to result
Tennile Edwards
@telaed
Jan 22 2016 03:20
thanks @rphares ! I will attempt and let you know if it works.
CamperBot
@camperbot
Jan 22 2016 03:20
telaed sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 1838 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 22 2016 03:20
@telaed , check out the example for how to write the lookup--
Perfect, please do and happy coding :)
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 03:21
@rphares finally got through my exercise. Thank you
CamperBot
@camperbot
Jan 22 2016 03:21
nyarlat-hotep sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 1839 | @rphares | http://www.freecodecamp.com/rphares
Tennile Edwards
@telaed
Jan 22 2016 03:21
Awesome @rphares ! It worked!
rphares
@rphares
Jan 22 2016 03:21
Fatastic, both of you--
congrats @Nyarlat-hotep and @telaed :)
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 22 2016 03:22
function queue(arr, item) {
  // Your code here

  //var newremoved = arr.pop();
  //var removed = arr.splice (0,1);
  //var myarray = [];
  arr.push(item);
  //var myreturn = arr.shift();
  arr.splice(0,1);



  return arr;  // Change this line
}
// Test Setup
var testArr = [5,6,7,8,9];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(queue(testArr, 1)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
hi, Im having problem to figure out the way to make it
its the "stand in line"
Vik
@vvang044
Jan 22 2016 03:23
sorry my computer is slow
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 22 2016 03:23
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.
queue([], 1) should return 1
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
I tried to do it separately using push & splice
rphares
@rphares
Jan 22 2016 03:24
hahaha, no worries, @vvang044 :blush: did that make sense?
Vik
@vvang044
Jan 22 2016 03:26
i understood this part arr[0]; // equals [1,2,3].....what i dont understand is arr[1] [2].....i was thinking it will be [4,5,6], [7,8,9]......but it equals 6.
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 03:27
This message was deleted
nvm smh
Vik
@vvang044
Jan 22 2016 03:28
?
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 03:29
sorry @vvang044 your arr 0 is finding the first smaller array within a larger array.
so arr 1 would find the 2nd smaller array within the larger array
then with that 2, you are finding the 3rd number within that smaller array
Vik
@vvang044
Jan 22 2016 03:30
i think it started to make sence
d wilder
@alhazen1
Jan 22 2016 03:32
@zgjorge Hi. You need to look at array.shift()
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 03:33
This message was deleted
Vik
@vvang044
Jan 22 2016 03:33
i was reading that message and got deleted
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 03:34
I know it keeps doing that stupid formatting when I try and enter square brackets.
What's the exercise? @vvang044
Vik
@vvang044
Jan 22 2016 03:34
access multidimensional arrays with indexes
Nyarlat-hotep
@Nyarlat-hotep
Jan 22 2016 03:36
// Setup
var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];

// Only change code below this line.
var myData = myArray[2][2];  --------Would equal 9
@vvang044
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 22 2016 03:36
thank you it worked @alhazen1
CamperBot
@camperbot
Jan 22 2016 03:36
zgjorge sends brownie points to @alhazen1 :sparkles: :thumbsup: :sparkles:
:star: 284 | @alhazen1 | http://www.freecodecamp.com/alhazen1
d wilder
@alhazen1
Jan 22 2016 03:37
@zgjorge you are welcome
Chris Kissoon
@ChrisKissoon
Jan 22 2016 03:39
Hi guy can you tell me what the Mad Libs word game is suppose to do?
rphares
@rphares
Jan 22 2016 03:40
Ahhh, okay, @vvang044 , you get it now?
Venkat Polumahanti
@venkat4541
Jan 22 2016 03:40
Hi, can I get some help with JSON?
I'm unable to understand the format to be used
djdrysdale
@djdrysdale
Jan 22 2016 03:42
Can anyone help me with a regex question? I am trying to remove all characters that are not numbers or letters. I can't seem to get it to remove the spaces.
This message was deleted
rphares
@rphares
Jan 22 2016 03:43
@ChrisKissoon , sure!
you are going to build a sentence,
you will want to concatenate the myNoune, myAdjective, etc
djdrysdale
@djdrysdale
Jan 22 2016 03:43

I've written this line:

str.replace(/[^0-9a-zA-Z]/g, '');

rphares
@rphares
Jan 22 2016 03:44
and be sure to include some non-word characters (i suggest spaces) in between them, @ChrisKissoon
Vik
@vvang044
Jan 22 2016 03:44
i figured it out
thank you guys @rphares @Nyarlat-hotep
CamperBot
@camperbot
Jan 22 2016 03:44
vvang044 sends brownie points to @rphares and @nyarlat-hotep :sparkles: :thumbsup: :sparkles:
:star: 1840 | @rphares | http://www.freecodecamp.com/rphares
:star: 170 | @nyarlat-hotep | http://www.freecodecamp.com/nyarlat-hotep
Vik
@vvang044
Jan 22 2016 03:45
1840 brownies?.......geez seriously
rphares
@rphares
Jan 22 2016 03:45
Congrats!
:pensive:
It's. Not. My. Fault.
Vik
@vvang044
Jan 22 2016 03:45
lol.....
alright happy coding....im outta here
rphares
@rphares
Jan 22 2016 03:45
:) :wave:
Wilson Heres
@hereswilson
Jan 22 2016 03:47
help Roman Numeral Converter
CamperBot
@camperbot
Jan 22 2016 03:47

:point_right: bonfire roman numeral converter [wiki]

Problem Explanation:

  • You will create a program that converts an integer to a roman numeral.
:pencil: read more about bonfire roman numeral converter on the FCC Wiki
DJ Bondoc
@DJBondoc
Jan 22 2016 03:50
help Introducing JavaScript Object Notation JSON
CamperBot
@camperbot
Jan 22 2016 03:50

:point_right: waypoint introducing javascript object notation json [wiki]

Waypoint: Introducing JavaScript Object Notation JSON

JavaScript Object Notation or JSON uses the format of JavaScript Objects to store data. JSON is flexible because it allows for Data Structures with arbitrary combinations of strings, numbers, booleans, arrays, and objects.

Here is an example of a JSON object:

var ourMusic = [
  {
    "artist": "Daft Punk",
    "title": "Homework",
    "release_year": 1997,
    "formats": [ 
      "CD", 
      "Cassette", 
      "LP" ],
    "gold": true
  }
];

:pencil: read more about waypoint introducing javascript object notation json on the FCC Wiki

DJ Bondoc
@DJBondoc
Jan 22 2016 03:50
hint
CamperBot
@camperbot
Jan 22 2016 03:50
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Matt Manion
@Mmanion
Jan 22 2016 03:50
Thanks @Rafase282 for your help with Bonfire: Confirm the Ending
CamperBot
@camperbot
Jan 22 2016 03:50
mmanion sends brownie points to @rafase282 :sparkles: :thumbsup: :sparkles:
:star: 897 | @rafase282 | http://www.freecodecamp.com/rafase282
djdrysdale
@djdrysdale
Jan 22 2016 03:52
help check for palindromes
CamperBot
@camperbot
Jan 22 2016 03:52

:point_right: bonfire check for palindromes [wiki]

Explanation:

You have to check if the string you get as an input is a palindrome and return true if it is, and false otherwise.

:pencil: read more about bonfire check for palindromes on the FCC Wiki

Micah Bales
@micahbales
Jan 22 2016 03:52
Working on "Find the Longest Word in a String" bonfire. Can't figure out what I'm doing wrong...
function findLongestWord(str) {
  var strArray = str.split(' ');
  var biggestNum = 0;
  for (i = 0; i < strArray.length; i++) {
    var currentNum = strArray[i];
    if (currentNum > biggestNum) {
      currentNum = biggestNum;
    } 
  }
  return biggestNum;
}

findLongestWord("The quick brown fox jumped over the lazy dog");
d wilder
@alhazen1
Jan 22 2016 03:54
@djdrysdale That looks like it should work. You can test it here
Michael-Anthony
@Michael-Anthony
Jan 22 2016 03:55
@micahbales have you used reg expressions yet? I found that a little easier when i completed that one
Im looking at your code to see if i can find anything messing you up
Micah Bales
@micahbales
Jan 22 2016 03:55
@Michael-Anthony I have, though not extensively! That's a great suggestion. Does this code seem wrong to you in an obvious way? I thought it should work... :S
Great, thanks
André Ferreira
@andreferreira-me
Jan 22 2016 03:56
One question? Whats the better approach to get the first letter of each word in a array of words?
Venkat Polumahanti
@venkat4541
Jan 22 2016 03:56
I'm doing 'Record Collection' exercise where a prop needs to be set/updated. How do I do this?
Micah Bales
@micahbales
Jan 22 2016 03:56
@venkat4541 Can you share the code you have so far?
djdrysdale
@djdrysdale
Jan 22 2016 03:57
Weird, it seems to be working now? I am not sure why it wasn't...
Thanks!
Venkat Polumahanti
@venkat4541
Jan 22 2016 03:57
// 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"){
      id[prop] = value;
  }

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

  else if (value === ""){
      for (i=id.prop.length();i>0;i--){
        id.prop.shift();
      }
  }

  return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");
@micahbales
d wilder
@alhazen1
Jan 22 2016 03:58
@micahbales You will need to use string.length on each word in array
Micah Bales
@micahbales
Jan 22 2016 03:59
@alhazen1 Like this?
 for (i = 0; i < strArray.length; i++) {
    var currentNum = strArray[i].length;
    if (currentNum > biggestNum) {
      currentNum = biggestNum;
    }
Oscar Sanchez
@rubyRune
Jan 22 2016 04:00
can anyone explain what to do in waypoint stand in line ?
Michael-Anthony
@Michael-Anthony
Jan 22 2016 04:01
@micahbales One thing that tripped me up was the hyphenated words. Your str.split wont address those
d wilder
@alhazen1
Jan 22 2016 04:01
@micahbales Yes! Now you need to determine which word in that array is the longest.
rphares
@rphares
Jan 22 2016 04:01
@venkat4541 , two quick things (not looking hard yet, but...
all those {id[prop]} type things are a getting at things in collection, @venkat4541
also, you are gonna wanna use bracket notation, not dot (for example in you id.tracks.push(value); line).... and you are gonna wanna use it pretty much throughout, @venkat4541 :)
Micah Bales
@micahbales
Jan 22 2016 04:03
@Michael-Anthony So that's where we need regex?
Aaron Graves
@gravesmeister
Jan 22 2016 04:03
Can anyone help with Return Early Pattern for Functions?
Matthew Towles
@matthewdtowles
Jan 22 2016 04:04
need help with Record Collection
rphares
@rphares
Jan 22 2016 04:04
sure, @gravesmeister , whats up?
Michael-Anthony
@Michael-Anthony
Jan 22 2016 04:04
@micahbales that was my solution
Aaron Graves
@gravesmeister
Jan 22 2016 04:04
// Setup
function abTest(a, b) {
  // Only change code below this line
  if (a, b < 0);


  // 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);
Venkat Polumahanti
@venkat4541
Jan 22 2016 04:04
@rphares How can I push a new element into array? Instead of id.tracks.push(value);
Aaron Graves
@gravesmeister
Jan 22 2016 04:04
@rphares
I'm only guessing at this point as I'm not fully understanding what's going on here @rphares
rphares
@rphares
Jan 22 2016 04:06
right idea, @venkat4541 -- two things, though. See the notes above (start with collection and use bracket) and... id.tracks.push(value);? @venkat4541 ... is tracks what you want there?
Micah Bales
@micahbales
Jan 22 2016 04:06
@Michael-Anthony The thing is, with my current code, I'm not even having success with the strings that have only spaces and letters. Not sure why those aren't even working. "biggestNum" just returns as zero.
d wilder
@alhazen1
Jan 22 2016 04:06
@micahbales I don't remember hyphens in that challenge
rphares
@rphares
Jan 22 2016 04:06
@gravesmeister , okeydoke, what have you tried so far? :blush:
Aaron Graves
@gravesmeister
Jan 22 2016 04:06
@rphares What I've posted
I've also tried changing the abtest (-2,-2) I don't think I'm getting it
rphares
@rphares
Jan 22 2016 04:07
oooh, sorry, missed it in another room! one sec,lemme look :)
Aaron Graves
@gravesmeister
Jan 22 2016 04:07
Or understanding it rather
rphares
@rphares
Jan 22 2016 04:07
Ah.
Micah Bales
@micahbales
Jan 22 2016 04:07
@alhazen1 "findLongestWord("What if we try a super-long word such as otorhinolaryngology") should return 19."
rphares
@rphares
Jan 22 2016 04:08
okeydoke-- so we want our conditional to say `if a is less than zero OR is b is less than zero, @gravesmeister
Venkat Polumahanti
@venkat4541
Jan 22 2016 04:08
@rphares I'm trying to add a value into track property array using that. But I'm not sure if thats the right way to do it.
rphares
@rphares
Jan 22 2016 04:09
you don't want tracks, you want [prop] , i believe, @venkat4541 :)
but, you are gonna need a lot more brackets and `collection[blahblah][blah] throughout as well :)
d wilder
@alhazen1
Jan 22 2016 04:10
@micahbales Yes. You need to loop over each item in array and test length with string.length(). You need to keep tabs on which of those tests returns the largest number
Aaron Graves
@gravesmeister
Jan 22 2016 04:10
[Challenge - Return Early Pattern for Functions (gravesmeister's solution)](http://www.freecodecamp.com/challenges/return-early-pattern-for-functions#?solution=%2F%2F%20Setup%0Afunction%20abTest(a%2C%20b%29%20%7B%0A%20%20%2F%2F%20Only%20change%20code%20below%20this%20line%0A%20%20if%20(a%20%3C%200%20%7C%7C%20b%20%3C%200%29%3B%0A%20%20%0A%20%20%0A%20%20%2F%2F%20Only%20change%20code%20above%20this%20line%0A%0A%20%20return%20Math.round(Math.pow(Math.sqrt(a%29%20%2B%20Math.sqrt(b%29%2C%202%29%29%3B%0A%7D%0A%0A%2F%2F%20Change%20values%20below%20to%20test%20your%20code%0AabTest(2%2C%202%29%3B%0A)
rphares
@rphares
Jan 22 2016 04:10
we can write that using the ||, @gravesmeister
Aaron Graves
@gravesmeister
Jan 22 2016 04:10
// Setup
function abTest(a, b) {
  // Only change code below this line
  if (a < 0 || b < 0);


  // 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 22 2016 04:10
okay! First step done!
```
Aaron Graves
@gravesmeister
Jan 22 2016 04:10
:)
Venkat Polumahanti
@venkat4541
Jan 22 2016 04:10
@rphares haha okay. I'll try again and get back then. thanks :+1:
CamperBot
@camperbot
Jan 22 2016 04:10
venkat4541 sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 1841 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 22 2016 04:11
anytime, @venkat4541 :)
next, let's think about what we want it to do in that case, @gravesmeister
Aaron Graves
@gravesmeister
Jan 22 2016 04:11
Return undefined
That's where I'm lost
rphares
@rphares
Jan 22 2016 04:12
yep-- give writing that, capitalized and punctuated correctly in some{ } , a go :)
oh,
that's all you have to write, heh--
a lot of the time, you can write an if (condition) {do} statement
Aaron Graves
@gravesmeister
Jan 22 2016 04:12
Thanks @rphares
CamperBot
@camperbot
Jan 22 2016 04:12
gravesmeister sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 1842 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 22 2016 04:13
sure thing!
Aaron Graves
@gravesmeister
Jan 22 2016 04:13
This is very slowly starting to make sense lol
Well I need to get a lot done in a short time so I'm sure I'll be back. Thanks again :)
rphares
@rphares
Jan 22 2016 04:14
Anytime-- its good to go thoroughly and take breaks :) Enjoy~
Micah Bales
@micahbales
Jan 22 2016 04:15
@Michael-Anthony Thank you!
CamperBot
@camperbot
Jan 22 2016 04:15
micahbales sends brownie points to @michael-anthony :sparkles: :thumbsup: :sparkles:
:star: 336 | @michael-anthony | http://www.freecodecamp.com/michael-anthony
Michael-Anthony
@Michael-Anthony
Jan 22 2016 04:15
You're Welcome @micahbales
DJ Bondoc
@DJBondoc
Jan 22 2016 04:18
anyone have hints to start: Introducing JavaScript Object Notation JSON
Alex Rose
@thelyricalrose
Jan 22 2016 04:20
I'm having issues with the same challenge
rphares
@rphares
Jan 22 2016 04:21
hmmm, maybe @thelyricalrose , you can post what you've done so far and we can talk about it together?
DJ Bondoc
@DJBondoc
Jan 22 2016 04:23
i'm getting somehwere.. let's see if it works
M. Matthews
@mmatthews1981
Jan 22 2016 04:23
@thelyricalrose @rphares I've completed those challenges, I might be of some use? No promises though :)
Alex Rose
@thelyricalrose
Jan 22 2016 04:24
I actually just figured it out! I forgot that I have to put a comma between elements in an array. The brackets were throwing me off because it looked separate in my head.
rphares
@rphares
Jan 22 2016 04:24
Oooh, i have as well, but am bad at explaining them and several hours passed my bedtime-- passing you the button, @meredithmatthews :blush:
Michael-Anthony
@Michael-Anthony
Jan 22 2016 04:25
@thelyricalrose I believe you can put array elements on different lines, but you still need the comma separation. It might help you see the code better.
M. Matthews
@mmatthews1981
Jan 22 2016 04:25
@rphares maybe we can trade! I have a bug in my Pig Latin challenge and I'm completely lost.
Mohit Joshi
@mojoboss
Jan 22 2016 04:25
help Exact Change problem statement
CamperBot
@camperbot
Jan 22 2016 04:26
no wiki entry for: exact change problem statement
Mohit Joshi
@mojoboss
Jan 22 2016 04:26
help Exact Change
CamperBot
@camperbot
Jan 22 2016 04:26

:point_right: bonfire exact change [wiki]

Problem Explanation:

  • You have to create a program that will handle when the register does not have enough cash or will have no cash after the transaction. Other than that it needs to return an array of the change in the form of an array, so that will be a 2D array.
:pencil: read more about bonfire exact change on the FCC Wiki
M. Matthews
@mmatthews1981
Jan 22 2016 04:26
bonfire pig latin
CamperBot
@camperbot
Jan 22 2016 04:26

:fire:Bonfire: Pig Latin :link:

function translate(str) {
 return str;
}

translate("consonant");

Translate the provided string to pig latin.

more info:  bf details | bf links | hint

Akbar Mirza
@akbarbmirza
Jan 22 2016 04:30
@Alameen007 I already solved the challenge. I was just wondering exactly what was happening in the function callback. When the function is being called, is the parameter a being set to an entry in the array, while parameter b is cycled through the other entries in the array?
Jonathan Thompson
@Jon-thomps
Jan 22 2016 04:31

I am having trouble with Return Early Pattern for Functions in Java.
Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined.

I wrote:
if (a<0 || b<0) {
return "undefined";
}
I seem to get the output "undefined" when I test it. But the program doesn't think so. Thoughts?

d wilder
@alhazen1
Jan 22 2016 04:32
@Jon-thomps use without quotes
Josh Lumley
@JWLumley
Jan 22 2016 04:32
Struggling with Early Pattern Functions can anyone help
function abTest(a, b) {
  // Only change code below this line
  if (a, b < 0) {
    return "undefined";
  }
   else if {


  // 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);
Jonathan Thompson
@Jon-thomps
Jan 22 2016 04:34
that got it, Thanks @alhazen1
CamperBot
@camperbot
Jan 22 2016 04:34
jon-thomps sends brownie points to @alhazen1 :sparkles: :thumbsup: :sparkles:
:star: 285 | @alhazen1 | http://www.freecodecamp.com/alhazen1
Jonathan Thompson
@Jon-thomps
Jan 22 2016 04:35
just had the same problem @JWLumley . You have to take the quotes off of undefined
not sure why
Josh Lumley
@JWLumley
Jan 22 2016 04:35
Thanks @Jon-thomps I think I have some other issues too.
CamperBot
@camperbot
Jan 22 2016 04:35
jwlumley sends brownie points to @jon-thomps :sparkles: :thumbsup: :sparkles:
:star: 204 | @jon-thomps | http://www.freecodecamp.com/jon-thomps
Michael-Anthony
@Michael-Anthony
Jan 22 2016 04:36
@JWLumley in your If statement use OR its the ||
d wilder
@alhazen1
Jan 22 2016 04:36
@Jon-thomps "undefined" is just a plain Jane javascript string
Michael-Anthony
@Michael-Anthony
Jan 22 2016 04:37
instead of a,b <0 try a<0 || b<0
Jonathan Thompson
@Jon-thomps
Jan 22 2016 04:37
ohhh, like "true" and true
Josh Lumley
@JWLumley
Jan 22 2016 04:37
Thanks @Michael-Anthony
CamperBot
@camperbot
Jan 22 2016 04:37
jwlumley sends brownie points to @michael-anthony :sparkles: :thumbsup: :sparkles:
:star: 338 | @michael-anthony | http://www.freecodecamp.com/michael-anthony
Michael-Anthony
@Michael-Anthony
Jan 22 2016 04:37
thanks to @Jon-thomps code from above
CamperBot
@camperbot
Jan 22 2016 04:37
michael-anthony sends brownie points to @jon-thomps :sparkles: :thumbsup: :sparkles:
:star: 206 | @jon-thomps | http://www.freecodecamp.com/jon-thomps
Josh Lumley
@JWLumley
Jan 22 2016 04:37
That worked
Jonathan Thompson
@Jon-thomps
Jan 22 2016 04:38
woot
DJ Bondoc
@DJBondoc
Jan 22 2016 04:39

@thelyricalrose on Introducing JSON, after I add the new albums do I return anything?

"myMusic should have at least elements" - is that myMusic[0] and myMusiclotus/model#35?

var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1993,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }
  // Add record here
  [
    {
      "artist": "Sam Smith",
      "title": "In the Lonely Hour",
      "release_year": "2014",
      "formats": [
        "CS",
        "8T",
        "LP"]
  }
  ]
];
disregard the album used. it was playing on Spotify
shalinmahajan
@shalinmahajan
Jan 22 2016 05:18
Hey friends I need help
I was working on "Stand in Line"

```js
function queue(arr, item) {
// Your code here
arr.push(item);
arr.shift();
return arr; // Change this line
}

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

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

```I am getting following error: RangeError: Maximum call stack size exceeded

Shahidul Islam Majumder
@musafirshahid
Jan 22 2016 05:21
What's wrong with my code?
//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++){
    if (firstName == contacts[i].firstName){
      for (var j = 0; j < contacts[i].length; j++){
        if (prop == contacts[i][j]){
          return contacts.prop;
        }
        else {
          return "No such property";
        }
      }
    }    
    return "No such contact";
  }

// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");
Michael-Anthony
@Michael-Anthony
Jan 22 2016 05:22
@shalinmahajan try refreshing your browser
@shalinmahajan my shift call was a little different. I assigned it to item
Christine Babu
@Geeksten
Jan 22 2016 05:32

Hello World! I am on Accessing Nested Objects in JSON. Trying to figure out how to write the notation, seeing that glove box has a space between glove and box.// Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};

// Only change code below this line

var gloveBoxContents = myStorage.car["inside"].glove box; // Change this line

CamperBot
@camperbot
Jan 22 2016 05:32

welcome to FreeCodeCamp @Geeksten!

d wilder
@alhazen1
Jan 22 2016 05:38
@Geeksten Just use the bracket notation when you have a space.
@shalinmahajan Also, you are returning the array but the instructions indicated to just return the removed array element.
Christine Babu
@Geeksten
Jan 22 2016 05:41
@DJBondoc myMusic is an array of objects and has 2 objects. myMusiclotus/model#35 is the object you added.
@alhazen1 I tried that too
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};

// Only change code below this line

var gloveBoxContents = myStorage.car.inside.["glove box"]; // Change this line
d wilder
@alhazen1
Jan 22 2016 05:47
@Geeksten I thinnk if you remove the . before ["glove box" it will work
Christine Babu
@Geeksten
Jan 22 2016 05:49
@alhazen1 It did! Thank you so much. Extra set of eyes is always appreciated.
CamperBot
@camperbot
Jan 22 2016 05:49
geeksten sends brownie points to @alhazen1 :sparkles: :thumbsup: :sparkles:
:star: 286 | @alhazen1 | http://www.freecodecamp.com/alhazen1
d wilder
@alhazen1
Jan 22 2016 05:50
@Geeksten You're welcome (ha, I did the same thing too - it really looks like a . should go there)
Antonio Makins
@thesneakyartist
Jan 22 2016 05:52
working on conditional logic and cant figure how to get a false statement
Christine Babu
@Geeksten
Jan 22 2016 05:53
@thesneakyartist Please post your code I can help you figure it out.
d wilder
@alhazen1
Jan 22 2016 05:54
@thesneakyartist hmmmm... can you share your code?
Antonio Makins
@thesneakyartist
Jan 22 2016 05:54

function myFunction(wasThatTrue) {
if (myFunction) {
return "That was true" ;
}
return "That was false";
}

myFunction(true);

d wilder
@alhazen1
Jan 22 2016 05:54
@thesneakyartist you don't have a proper "if / else" statement
Antonio Makins
@thesneakyartist
Jan 22 2016 05:54
i get the true statement evry time
Shahidul Islam Majumder
@musafirshahid
Jan 22 2016 05:56
check by using myFunction(false);
d wilder
@alhazen1
Jan 22 2016 05:56
@thesneakyartist pseudocode
if wasThatTrue is true
   return "that was true"
else
   return "that was false"
Antonio Makins
@thesneakyartist
Jan 22 2016 05:56
@alhazen1 Thanks a lot.
CamperBot
@camperbot
Jan 22 2016 05:56
thesneakyartist sends brownie points to @alhazen1 :sparkles: :thumbsup: :sparkles:
:star: 287 | @alhazen1 | http://www.freecodecamp.com/alhazen1
Christine Babu
@Geeksten
Jan 22 2016 05:57
@thesneakyartist your if needs was that true inside the parentheses
if(wasThatTrue){
//fill this out
}
Shahidul Islam Majumder
@musafirshahid
Jan 22 2016 05:57
Yep @Geeksten .
Antonio Makins
@thesneakyartist
Jan 22 2016 05:58
@Geeksten appreciate it
d wilder
@alhazen1
Jan 22 2016 05:58
@thesneakyartist You're welcome
NainaPS
@Navyya
Jan 22 2016 06:07
can any one help for waypoint Introducing JavaScript Object Notation JSON?
Christine Babu
@Geeksten
Jan 22 2016 06:07
@Navyya Yes
NainaPS
@Navyya
Jan 22 2016 06:08
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1993,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }

  "artist": "Bob",
  "title": "The builder",
  "release_year": 1994, 
  "formats": ["Cs", "CD", "8T"]
  // Add record here
];
@Geeksten error with this?
Shahidul Islam Majumder
@musafirshahid
Jan 22 2016 06:08
What error?
NainaPS
@Navyya
Jan 22 2016 06:08
SyntaxError: missing ] after element list
but i guess this is right
eeflores
@eeflores
Jan 22 2016 06:09
@Navyya the second record isn't surrounded in braces
Shahidul Islam Majumder
@musafirshahid
Jan 22 2016 06:09
User {} in your second object
eeflores
@eeflores
Jan 22 2016 06:09
@Navyya add a comma to the end of the first record
Christine Babu
@Geeksten
Jan 22 2016 06:09
@Navyya So you need a , after the } before "artist":"Bob"
NainaPS
@Navyya
Jan 22 2016 06:09
@eeflores second record of?
eeflores
@eeflores
Jan 22 2016 06:10
@Navyya there should be a { above the artist:bob
and a } below formats
Shahidul Islam Majumder
@musafirshahid
Jan 22 2016 06:11
Every record should be inside {} and seperated by ,
NainaPS
@Navyya
Jan 22 2016 06:11
@eeflores thanks :)
CamperBot
@camperbot
Jan 22 2016 06:11
navyya sends brownie points to @eeflores :sparkles: :thumbsup: :sparkles:
:star: 471 | @eeflores | http://www.freecodecamp.com/eeflores
NainaPS
@Navyya
Jan 22 2016 06:11
@Geeksten thanks
eeflores
@eeflores
Jan 22 2016 06:11
@Navyya yw
NainaPS
@Navyya
Jan 22 2016 06:11
I got my error .... @musafirshahid thanks
CamperBot
@camperbot
Jan 22 2016 06:11
navyya sends brownie points to @musafirshahid :sparkles: :thumbsup: :sparkles:
:star: 228 | @musafirshahid | http://www.freecodecamp.com/musafirshahid
Shahidul Islam Majumder
@musafirshahid
Jan 22 2016 06:12
Keep it Uppp...
@Navyya
NainaPS
@Navyya
Jan 22 2016 06:26
@eeflores var gloveBoxContents = "myStorage.car["inside"].glove box"; is it right?
for waypoint Accessing Nested Objects in JSON?
anyone?
SyntaxError: missing ; before statement
Andrew Bales
@agbales
Jan 22 2016 06:30
Hi all! Anyone willing to take a look at my Sum All Primes code?
NainaPS
@Navyya
Jan 22 2016 06:30
@Geeksten can u help?
Andrew Bales
@agbales
Jan 22 2016 06:32
@Navyya
myStorage.car.inside["glove box"];
Sanmitha99
@Sanmitha99
Jan 22 2016 06:32
This message was deleted
NainaPS
@Navyya
Jan 22 2016 06:33
@agbales why did we use ["glove box"]? and not for inside?
Sanmitha99
@Sanmitha99
Jan 22 2016 06:34
function reverseString(str) {
return str;
}
reverseString("hello"); {this was the code given}
var array = ['hello']; array.reverse(); {this was the code I added} I am still not able to reverse the hello? What should I change??
NainaPS
@Navyya
Jan 22 2016 06:34
what was error with my code?
Miguel
@Miguel12321
Jan 22 2016 06:35
can someone help me with Using Objects for Lookups
Andrew Bales
@agbales
Jan 22 2016 06:35
@Navyya You're right that they're both properties-- but the change is because glove box is two words.
Miguel
@Miguel12321
Jan 22 2016 06:35
This message was deleted
levinishungry
@levinishungry
Jan 22 2016 06:35
Is there a difference between writing
for(var i = 0; i < arr.length; i+=size)
and
for(var i = 0, len=arr.length; i < len ; i+=size)
Miguel
@Miguel12321
Jan 22 2016 06:35
  var lookup={
    alpha:"Adams",
    bravo:"Boston",
    charlie:"Chicago",
    delta:"Denver",
    echo:"Easy",
    foxtrot:"Frank"
  };
this is what I have
NainaPS
@Navyya
Jan 22 2016 06:36
@agbales ok doest it mean that words with name spacing must be in [""]?
Christine Babu
@Geeksten
Jan 22 2016 06:36
@Navyya Which one, the glove box?
NainaPS
@Navyya
Jan 22 2016 06:37
@Miguel12321 yup wait
yup but i want explaination for my mistake @Geeksten
Andrew Bales
@agbales
Jan 22 2016 06:37
@Navyya I'll send you a DM with a link on this, but the difference in notation has to do with if it evaluates as a string.
NainaPS
@Navyya
Jan 22 2016 06:37
@Miguel12321 waypoint name?
Miguel
@Miguel12321
Jan 22 2016 06:38
@Navyya Using Objects for Lookups
Christine Babu
@Geeksten
Jan 22 2016 06:38
@Navyya We use the [] for glove box because of the space between glove and box
NainaPS
@Navyya
Jan 22 2016 06:39
ok
@Miguel12321 u need to write result as well
Miguel
@Miguel12321
Jan 22 2016 06:40
 var lookup={
    alpha:"Adams",
    bravo:"Boston",
    charlie:"Chicago",
    delta:"Denver",
    echo:"Easy",
    foxtrot:"Frank"
  };
@Navyya is this fine then
NainaPS
@Navyya
Jan 22 2016 06:40
yes but now below this u need to get the result which will get the value
Andrew Bales
@agbales
Jan 22 2016 06:41
@Miguel12321 Be sure to have alpha, etc within quotes as well
NainaPS
@Navyya
Jan 22 2016 06:41
try if not tell
var lookup= {
    "alpha": "Adams",
    "bravo": "Boston",
    "charlie": "Chicago",
    "delta" : "Denver",
    "echo"  : "Easy",
    "foxtrot": "Frank"
  };
@agbales is right
shalinmahajan
@shalinmahajan
Jan 22 2016 06:43
Thanks @Michael-Anthony and @alhazen1
CamperBot
@camperbot
Jan 22 2016 06:43
shalinmahajan sends brownie points to @michael-anthony and @alhazen1 :sparkles: :thumbsup: :sparkles:
:star: 354 | @michael-anthony | http://www.freecodecamp.com/michael-anthony
:star: 288 | @alhazen1 | http://www.freecodecamp.com/alhazen1
Miguel
@Miguel12321
Jan 22 2016 06:43
@Navyya var result?
@Navyya or var ""?
NainaPS
@Navyya
Jan 22 2016 06:44
@Miguel12321 result = ......
shalinmahajan
@shalinmahajan
Jan 22 2016 06:44
@thesneakyartist use if-else statement to get desired result
Sanmitha99
@Sanmitha99
Jan 22 2016 06:47
function reverseString(str) {
return str;
}
reverseString("hello"); {this was the code given}
var array = ['hello']; array.reverse(); {this was the code I added} I am still not able to reverse the hello. What should I change??
Miguel
@Miguel12321
Jan 22 2016 06:48
@Navyya @agbales thanks it worked
CamperBot
@camperbot
Jan 22 2016 06:48
miguel12321 sends brownie points to @navyya and @agbales :sparkles: :thumbsup: :sparkles:
:star: 20 | @navyya | http://www.freecodecamp.com/navyya
:star: 301 | @agbales | http://www.freecodecamp.com/agbales
NainaPS
@Navyya
Jan 22 2016 06:49
waypoint accessing nested array
var secondTree = myPlants.trees[1];
Andrew Bales
@agbales
Jan 22 2016 06:49
@Miguel12321 Great!
NainaPS
@Navyya
Jan 22 2016 06:49
@agbales
Andrew Bales
@agbales
Jan 22 2016 06:51
@Navyya Within myPlants you'll want to select which [#] of the array.
Also, trees is not the property name. That's one of the values. Rethink that word.
NainaPS
@Navyya
Jan 22 2016 06:53
var secondTree = myPlants.trees[1];
var secondTree = myPlants.type[1].list[1];
Andrew Bales
@agbales
Jan 22 2016 06:54
@Sanmitha99 Take a look at the links on the left. You're on the right track with .reverse(), but you'll also want to utilize .split() & .join()
@Navyya Close! Your list looks correct now. However, think about how you're using myPlants. You want a specific one, right?
myPlants[(the correct entry)].list[1]
NainaPS
@Navyya
Jan 22 2016 06:57
I got I got yeye
Andrew Bales
@agbales
Jan 22 2016 06:57
:)
NainaPS
@Navyya
Jan 22 2016 06:57
var secondTree = myPlants[1].list[1];
I was considering type as a prop
Spencer Kuzara
@kodaxx
Jan 22 2016 07:03
Anybody familiar with the 'Word Blanks' module?
I know I can figure out how to complete it without any code help, but I guess I'm having trouble understanding what the instructions are asking me to do
misterjaytee
@misterjaytee
Jan 22 2016 07:06
hint Fibonacci
CamperBot
@camperbot
Jan 22 2016 07:06
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Christine Babu
@Geeksten
Jan 22 2016 07:06
@kodaxx Your output should use all the given words plus a few random words that you choose. Your output sentence does not have to make sense
Spencer Kuzara
@kodaxx
Jan 22 2016 07:07
@Geeksten My output sentence does not make sense, but it should work regardless. I will paste the error
wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).
wordBlanks("cat", "little", "hit", "slowly") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).
I'm not sure what it wants me to do
How do I paste code?
Fidel Severino
@fidelscodes
Jan 22 2016 07:09
use three backticks (key above the TAB key) followed by js, paste your code and then on a separe line add another three backticks
Christine Babu
@Geeksten
Jan 22 2016 07:09
@kodaxx remove js
Spencer Kuzara
@kodaxx
Jan 22 2016 07:10

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

result = "blahbalh " + myNoun + myVerb + " this doents " + myAdverb + myAdjective + " final line!";
// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("cat ", "small", "walk", "slowly");
``` Is this wrong?

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

result = "blahbalh " + myNoun + myVerb + " this doents " + myAdverb + myAdjective + " final line!";
  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("cat ", "small", "walk", "slowly");
Ahh
Doesn't that code fulfill the requirements?
I think I'm confused on instructions
mkumar07
@mkumar07
Jan 22 2016 07:12
Hi, has anyone done counting cards problem?
I am experiencing some problem
Christine Babu
@Geeksten
Jan 22 2016 07:12
@kodaxx It looks ok, let me take a closer look
Fidel Severino
@fidelscodes
Jan 22 2016 07:12
It should, but I'm guessing they want you to provide a string in between each of the variables
mkumar07
@mkumar07
Jan 22 2016 07:12
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 ++;


  case 7:
  case 8:
  case 9:
  count +=0;

  case 10:
  case "J":
  case "Q":
  case "K":
  case "A":
  count--;
  }


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

}
// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Andrew Bales
@agbales
Jan 22 2016 07:12
@mkumar07 Yep. Are you stuck?
mkumar07
@mkumar07
Jan 22 2016 07:13
@agbales YUP, there, i hve pasted my code
@agbales For the given sequence, it shows -3 and hold , but for others, it don't work properly
Spencer Kuzara
@kodaxx
Jan 22 2016 07:15
@fidelscodes I just changed the code to reflect that, I still get errors. :(
It outputs sentence just like I imagine it would
Andrew Bales
@agbales
Jan 22 2016 07:17
@mkumar07 Intersting. I've used switch statements for individual outcomes. Because it was a range, I went with a few if/else statements that lumped 2-6, 7-9, etc.
@mkumar07 I believe if you want to keep it this way you'll need a break; for each case
mkumar07
@mkumar07
Jan 22 2016 07:18
@agbales So, it might have worked fine for numbers, i guess, you used switch for K, Q, J, A?
Christine Babu
@Geeksten
Jan 22 2016 07:18
@fidelscodes @kodaxx yes, that should work. Have the passed words separated by non word characters in order to pass the test.
Fidel Severino
@fidelscodes
Jan 22 2016 07:19
@kodaxx post the revised code, with strings in between each side of the variables
Andrew Bales
@agbales
Jan 22 2016 07:19
@mkumar07 Actually, I didn't need a switch at all. If it's not a number below ten, it's automatically -1, right?
So: if / else if / else
mkumar07
@mkumar07
Jan 22 2016 07:21
@agbales Damn!!...Yes!.....Dude, that was logical and much better than my elaborate program
Andrew Bales
@agbales
Jan 22 2016 07:21
(your final if statement for the returns looks good as far as I can tell)
Spencer Kuzara
@kodaxx
Jan 22 2016 07:21
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  var result = "";
  // Your code below this line

result = "blahbalh " + myNoun + " more " + myVerb + " this doents " + myAdverb + "strring " + myAdjective + " final line!";
  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("cat ", "small", "walk", "slowly");
mkumar07
@mkumar07
Jan 22 2016 07:22
@agbales Yes, it worked fine when i used break . Thanks :+1:
CamperBot
@camperbot
Jan 22 2016 07:22
mkumar07 sends brownie points to @agbales :sparkles: :thumbsup: :sparkles:
Andrew Bales
@agbales
Jan 22 2016 07:22
@mkumar07 Haha. I think it comes right after some switch lessons, right?? Almost makes it a trick Q.
CamperBot
@camperbot
Jan 22 2016 07:22
:star: 303 | @agbales | http://www.freecodecamp.com/agbales
Fidel Severino
@fidelscodes
Jan 22 2016 07:23
@kodaxx that looks good to me. Try copying your code, refresh the page and try it again
mkumar07
@mkumar07
Jan 22 2016 07:23
@agbales since,it came right after switch, i was much engrossed in those lessons
Fidel Severino
@fidelscodes
Jan 22 2016 07:23
@mkumar07 same here hehe
Spencer Kuzara
@kodaxx
Jan 22 2016 07:23
Okay, I thought I understood but this thing keeps telling me no! I tried to shortcut a little by doubling the word blanks hehe. Just goes to show there are no shortcuts
Fidel Severino
@fidelscodes
Jan 22 2016 07:23
I solved it the same way
mkumar07
@mkumar07
Jan 22 2016 07:25
@fidelscodes Haha... :high five: bro!
Christine Babu
@Geeksten
Jan 22 2016 07:26
@kodaxx add a space before string
Spencer Kuzara
@kodaxx
Jan 22 2016 07:26
Awesome that worked! Thanks @fidelscodes @Geeksten
CamperBot
@camperbot
Jan 22 2016 07:26
kodaxx sends brownie points to @fidelscodes and @geeksten :sparkles: :thumbsup: :sparkles:
:star: 404 | @fidelscodes | http://www.freecodecamp.com/fidelscodes
:star: 222 | @geeksten | http://www.freecodecamp.com/geeksten
Christine Babu
@Geeksten
Jan 22 2016 07:27
@kodaxx great! YW
Fidel Severino
@fidelscodes
Jan 22 2016 07:27
Wow lol So simple
nice eye @Geeksten
Spencer Kuzara
@kodaxx
Jan 22 2016 07:27
Wow lol So simple Right?!
Mohit Nehru
@MohitNehru
Jan 22 2016 07:37
Retrieve the second tree from the variable myPlants using object dot and array bracket notation.
NainaPS
@Navyya
Jan 22 2016 07:41
@MohitNehru
u need help?
first trace index of the array which is required
then take prop name and trace what u want from its array
myPlant[index of array u need].prop name[index of tree name u need]
Mohit Nehru
@MohitNehru
Jan 22 2016 07:44
var secondTree = myPlants.trees[1];
i think this right why it didn't
NainaPS
@Navyya
Jan 22 2016 07:45
check my syntax
nah
Mohit Nehru
@MohitNehru
Jan 22 2016 07:45
where is that
NainaPS
@Navyya
Jan 22 2016 07:45
tress is u are taking as prop name
Mohit Nehru
@MohitNehru
Jan 22 2016 07:45
right
NainaPS
@Navyya
Jan 22 2016 07:46
but check what i gave once again....
myPlant[index of array u need].prop name[index of tree name u need]
observe the code keenly
Mohit Nehru
@MohitNehru
Jan 22 2016 07:47
i see the example
var ourPets = {
"cats": [
"Meowzer",
"Fluffy",
"Kit-Cat"
],
"dogs": [
"Spot",
"Bowser",
"Frankie"
]
};
ourPets.catslotus/model#35; // "Fluffy"
ourPets.dogs[0]; // "Spot"
as per example,
NainaPS
@Navyya
Jan 22 2016 07:48
myPlants[index u need].list[plant index u need];
<