These are chat archives for FreeCodeCamp/HelpJavaScript

17th
Jan 2016
iokonokh
@iokonokh
Jan 17 2016 00:00 UTC
I was ChemE which was much easier than this stuff
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 17 2016 00:00 UTC
@jong649 except I dont actually care about it haha
@iokonokh chemical engineering was easier than this? lol?
Jon Grant
@jong649
Jan 17 2016 00:00 UTC
@KaanMasters I got an AA from a crappy for-profit school, totally worthless in real life haha
re4ect
@re4ect
Jan 17 2016 00:02 UTC
@alanbuchanan I still don't see what I'm not suppose to edit.
Jon Grant
@jong649
Jan 17 2016 00:02 UTC
@rpmullig I'll check out what I did; that one was really confusing for me
wushupork
@wushupork
Jan 17 2016 00:04 UTC
@rpmullig you were correct with collection[id][prop], but what do you use to push a value onto an array?
Jon Grant
@jong649
Jan 17 2016 00:07 UTC
@rpmullig yup, that is the trick
what @wushupork said
rphares
@rphares
Jan 17 2016 00:09 UTC
@re4ect , let's give it one last go
paste what you have so far, please :blush:
wushupork
@wushupork
Jan 17 2016 00:09 UTC
WB @rphares :)
iokonokh
@iokonokh
Jan 17 2016 00:09 UTC
yes ChemE was hard but i understood it
Satchmo37
@Satchmo37
Jan 17 2016 00:10 UTC
Bonfire: Where art thou?
CamperBot
@camperbot
Jan 17 2016 00:10 UTC

:fire:Bonfire: Where art thou :link:

function where(collection, source) {
  var arr = [];
  // What's in a name?
  return arr;
}

where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });

Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument).

more info:  bf details | bf links | hint

Satchmo37
@Satchmo37
Jan 17 2016 00:10 UTC
hint
CamperBot
@camperbot
Jan 17 2016 00:10 UTC
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
iokonokh
@iokonokh
Jan 17 2016 00:10 UTC
i think writing a term paper is hard
rphares
@rphares
Jan 17 2016 00:10 UTC
Thanks, @wushupork ! Very little left before i head to bed, getting sleepy but trying to manage a bit longer :blush:
CamperBot
@camperbot
Jan 17 2016 00:10 UTC
rphares sends brownie points to @wushupork :sparkles: :thumbsup: :sparkles:
:star: 294 | @wushupork | http://www.freecodecamp.com/wushupork
iokonokh
@iokonokh
Jan 17 2016 00:14 UTC
// 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;
}

  return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");
Jon Grant
@jong649
Jan 17 2016 00:15 UTC
@iokonokh you're almost there, there's a different way to push something to an array
there's a key word in that last sentence
Rory Smith
@alanbuchanan
Jan 17 2016 00:19 UTC
@re4ect what code do you have so far?
Jason
@jimillett
Jan 17 2016 00:19 UTC
Hey guys I am doing the local scope and functions but I don't know what to do to get past it. I pass the "add a local myVar variable but can't pass the "no global myVar variable"
function myFunction() {
  'use strict';
  var myVar = "test";
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
local scope and functions challenge*
rphares
@rphares
Jan 17 2016 00:21 UTC
check out the last comment, @jimillett :)
Jon Grant
@jong649
Jan 17 2016 00:21 UTC
@jimillett do what last comment asks
Jason
@jimillett
Jan 17 2016 00:21 UTC
I tried removing the console log line
it doesn't help
rphares
@rphares
Jan 17 2016 00:21 UTC
which one? :)
Jason
@jimillett
Jan 17 2016 00:25 UTC
I have tried removing both console logs separately and neither one lets me pass it
Rory Smith
@alanbuchanan
Jan 17 2016 00:25 UTC
@jimillett what error message is it?
rphares
@rphares
Jan 17 2016 00:26 UTC
if it's maximum stack...
Jason
@jimillett
Jan 17 2016 00:26 UTC
no error, the output just shows myVar text of "test"
Rory Smith
@alanbuchanan
Jan 17 2016 00:27 UTC
@jimillett i copy and pasted your code and it passes
try clearing cache
Jason
@jimillett
Jan 17 2016 00:27 UTC
? how do you do that?
Jon Grant
@jong649
Jan 17 2016 00:27 UTC
@jimillett ctrl+F5
Jon Grant
@jong649
Jan 17 2016 00:28 UTC
@jimillett or what @alanbuchanan linked haha
rphares
@rphares
Jan 17 2016 00:29 UTC
(did they change the test? it shouldn't pass with the second console.log there... @alanbuchanan ? This was the weird ' q...)
Jason
@jimillett
Jan 17 2016 00:29 UTC
That did it
Jon Grant
@jong649
Jan 17 2016 00:29 UTC
@jimillett awesome
rphares
@rphares
Jan 17 2016 00:29 UTC
awesome,
but intriguing :)
Jason
@jimillett
Jan 17 2016 00:30 UTC
Thanks @jong649 @alanbuchanan
CamperBot
@camperbot
Jan 17 2016 00:30 UTC
jimillett sends brownie points to @jong649 and @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 713 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
:star: 312 | @jong649 | http://www.freecodecamp.com/jong649
Rory Smith
@alanbuchanan
Jan 17 2016 00:30 UTC
@rphares i'm not sure. lots of bizarre little things like that in the challenges :smirk_cat:
rphares
@rphares
Jan 17 2016 00:30 UTC
good to know
iokonokh
@iokonokh
Jan 17 2016 00:31 UTC
// 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].push("value");
} else if(prop == "track" && value !== "") {
  collection.id.prop.push(value);
} else if (value === "") {
  collection.id.delete(prop);
} else

  return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");
it keeps saying "undefined is not an object
Rory Smith
@alanbuchanan
Jan 17 2016 00:34 UTC
@iokonokh collection[id] is { album: 'ABBA Gold' }
@iokonokh so collection[id][prop] doesn't exist
Jill
@ghjal
Jan 17 2016 00:34 UTC
Anyone know why all my old code is gone when I click on earlier map sections?
Rory Smith
@alanbuchanan
Jan 17 2016 00:35 UTC
@ghjal your solutions should still be viewable on your profile page
@ghjal but code that was saved in local storage might not be there anymore after the update
Jill
@ghjal
Jan 17 2016 00:36 UTC
Oh, good! Thanks.
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 00:43 UTC
var count = 0;
var totalCount = 0;

function cc(card) {
  // Only change code below this line
  if ((card = 2) || (card = 3) || (card = 4) || (card = 5) || (card = 6)) {
    count += 1;
  } else if ((card = 7) || (card = 8) || (card = 9)) {
    count += 0;
  } else if((card = 10) || (card = "J") || (card = "Q") || (card = "K") || (card = "A")) {
    count -= 1;
  } 
  return count;
Why is this returning 1 for cc(7) ?
Rich Cordero
@corderophilosophy
Jan 17 2016 00:43 UTC
So this Caesars Cipher business requires some math, re: the charcodes you're converting to and from, yes? Have there been any lessons prior to this challenge that show you how to handle any of that?
Rory Smith
@alanbuchanan
Jan 17 2016 00:44 UTC
@KellenKolbeck you want == not =
Jon Grant
@jong649
Jan 17 2016 00:44 UTC
@corderophilosophy you just need to find the charcode for A, then each following letter is 1 more
Bobby Mulligan
@rpmullig
Jan 17 2016 00:44 UTC
What is the JS JSON function to find if the property exsists within the variable
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 00:45 UTC
hahhaha I can't believe I did that. @alanbuchanan thanks
CamperBot
@camperbot
Jan 17 2016 00:45 UTC
kellenkolbeck sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 714 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
Wilson Heres
@hereswilson
Jan 17 2016 00:45 UTC
This message was deleted
Rory Smith
@alanbuchanan
Jan 17 2016 00:45 UTC
@KellenKolbeck you could also use a switch
@rpmullig Object.hasOwnProperty for object keys
Jon Grant
@jong649
Jan 17 2016 00:45 UTC
@rpmullig .hasOwnProp()
@rpmullig oops, yeah, .hasOwnProperty()
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 00:46 UTC
Yeah I know I like my if's though. Just had a brainfart.
Bobby Mulligan
@rpmullig
Jan 17 2016 00:47 UTC
thanks @jong649
CamperBot
@camperbot
Jan 17 2016 00:47 UTC
rpmullig sends brownie points to @jong649 :sparkles: :thumbsup: :sparkles:
:star: 313 | @jong649 | http://www.freecodecamp.com/jong649
Wilson Heres
@hereswilson
Jan 17 2016 00:48 UTC
This message was deleted
Bobby Mulligan
@rpmullig
Jan 17 2016 00:48 UTC
thanks @alanbuchanan
CamperBot
@camperbot
Jan 17 2016 00:48 UTC
rpmullig sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 715 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
Wilson Heres
@hereswilson
Jan 17 2016 00:50 UTC
This message was deleted
CamperBot
@camperbot
Jan 17 2016 00:50 UTC
:bulb: to format code use backticks! ``` more info
Rory Smith
@alanbuchanan
Jan 17 2016 00:51 UTC
@KellenKolbeck did it earlier with livescript. i just wish you could do this with vanilla js
count = 0
hold = ' Hold'

cc = (card) ->
  switch card
  case 2, 3, 4, 5, 6      then count++ + ' Bet'
  case 7, 8, 9            then count   + hold
  case 10, \J, \Q, \K, \A then count-- + hold
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 00:51 UTC
Yeah that is definitely cleaner and easier to read
Rich Cordero
@corderophilosophy
Jan 17 2016 00:51 UTC
@hereswilson, you want to target contacts[i].firstName in your first 'if' statement, there. There's one issue
Wilson Heres
@hereswilson
Jan 17 2016 00:54 UTC
This message was deleted
CamperBot
@camperbot
Jan 17 2016 00:54 UTC
:bulb: to format code use backticks! ``` more info
Hadrien Lepoutre
@H-L
Jan 17 2016 00:56 UTC
Hey guys, is it normal that in the new "Escape Sequences in Strings" (Front End Development Certification/ Basic Javascript) little challenge it returns myStr = " \b \t \t \r \n " instead of the escape sequence related ?
Wilson Heres
@hereswilson
Jan 17 2016 00:56 UTC
//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
  if ((firstName===(contacts[i].firstName))&& (prop===contacts.firstName.prop)){
    return contacts.firstName.prop;
    }
  else if(firstName!=contacts.firstName){
    return "No such contact";
  }
  else if(firstName==contacts.firstName){
    return "No such property";
  }
// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");
@corderophilosophy, like that or is there something else?
Rich Cordero
@corderophilosophy
Jan 17 2016 00:58 UTC
@hereswilson, you'll also want to use Object.hasOwnProperty() for the check to see if the individual called with firstName has prop
Rory Smith
@alanbuchanan
Jan 17 2016 00:58 UTC
@H-L there's a little problem with that string
Rich Cordero
@corderophilosophy
Jan 17 2016 00:59 UTC
And the return if the contact does have the prop should be contacts[i][prop] -- you'll want bracket notation
Rory Smith
@alanbuchanan
Jan 17 2016 00:59 UTC
@H-L \b isn't a backslash
Hadrien Lepoutre
@H-L
Jan 17 2016 01:00 UTC
Screen Shot 2016-01-17 at 01.53.18.png
@alanbuchanan Here are the instructions in the challenge :
Sumant Sareen
@SareenCoder
Jan 17 2016 01:00 UTC
Just a quick question. How do I type the "or" operatin JS? I can't find the key :worried:
Rory Smith
@alanbuchanan
Jan 17 2016 01:01 UTC
@H-L read them super carefully
Rich Cordero
@corderophilosophy
Jan 17 2016 01:01 UTC
@SareenCoder it's the double pipe ||
Rory Smith
@alanbuchanan
Jan 17 2016 01:01 UTC
@SareenCoder ||
Sumant Sareen
@SareenCoder
Jan 17 2016 01:01 UTC
Where is the kye located Alan? thanks
Is it two capital i's because that doesn't work
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:02 UTC
@SareenCoder you have to hit shift and backslash
Rory Smith
@alanbuchanan
Jan 17 2016 01:02 UTC
@SareenCoder no it's the pipe, not two capital i's
Hadrien Lepoutre
@H-L
Jan 17 2016 01:02 UTC
@alanbuchanan Hmm ok, i'm going to do this. But i'm confused, when i log it, it is displayed as it should :/
@H-L \b = backspace
not backslash
Hadrien Lepoutre
@H-L
Jan 17 2016 01:03 UTC
@alanbuchanan Ok thank you for the hint :D
CamperBot
@camperbot
Jan 17 2016 01:03 UTC
h-l sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 716 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
Sumant Sareen
@SareenCoder
Jan 17 2016 01:04 UTC
Thanks Alan
It worked haha
And Kellen for the effort
!
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:04 UTC
np
Anyone else having issues with viewing solutions on their profile?
Hadrien Lepoutre
@H-L
Jan 17 2016 01:07 UTC
I'm such a bad reader ahah
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:09 UTC
@H-L It's always the little things
Hadrien Lepoutre
@H-L
Jan 17 2016 01:09 UTC
Arf, but even thought, it is still returning a string.
Is it normal or do i need to seek a little more ?
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:09 UTC
?
Can you post it again?
Hadrien Lepoutre
@H-L
Jan 17 2016 01:10 UTC
Yep, wait for it...
In the new "Escape Sequences in Strings" (Front End Development Certification/ Basic Javascript) little challenge it returns myStr = " \\ \t \t \r \n " instead of the escape sequence related ?
...dary
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:12 UTC
I think you might just be missing ;
Rory Smith
@alanbuchanan
Jan 17 2016 01:13 UTC
and the spaces...
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:13 UTC
Also try with no space in between quotes like:
var myStr = "\\ \t \t \r \n"; // Change this line
Hadrien Lepoutre
@H-L
Jan 17 2016 01:14 UTC
The code above is the return statement, not the JS itself... Ok i try it !
Eureka
!!
rocket
@rengas
Jan 17 2016 01:15 UTC
hi Guys! I also having same problem.
Hadrien Lepoutre
@H-L
Jan 17 2016 01:15 UTC
@KellenKolbeck thanks ! It was the spaces afterall ahah
CamperBot
@camperbot
Jan 17 2016 01:15 UTC
h-l sends brownie points to @kellenkolbeck :sparkles: :thumbsup: :sparkles:
:star: 216 | @kellenkolbeck | http://www.freecodecamp.com/kellenkolbeck
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:15 UTC
@H-L Like I said it always seems to be the little things...
Rory Smith
@alanbuchanan
Jan 17 2016 01:15 UTC
@H-L it'll be the semicolon as well
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 17 2016 01:15 UTC
does anyone know why the unicode is different from what i see here? http://unicode-table.com/en/
for instance, charCodeAt(72) = H, but on that website it's q
Hadrien Lepoutre
@H-L
Jan 17 2016 01:16 UTC
Details, little details... anyway see you later and thanks again for your help ;)
Rory Smith
@alanbuchanan
Jan 17 2016 01:17 UTC
@KaanMasters charCodeAt returns a number
wushupork
@wushupork
Jan 17 2016 01:17 UTC
@KaanMasters that table is in hexadecimal, charCodeAt uses decimal
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 17 2016 01:17 UTC
fromCharCode my bad
wushupork
@wushupork
Jan 17 2016 01:17 UTC
72 in decimal is 48 in hexadecimal
which is H on that unicode table you linked
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 17 2016 01:18 UTC
so you're telling me to use unicode i have to conver from hexadecimal to decimal
wushupork
@wushupork
Jan 17 2016 01:18 UTC
no
just use decimal
Morenar
@Morenar
Jan 17 2016 01:18 UTC
hi I got some issues in the Accessing Nested Arrays in JSON - the describtion is different than the actual code does someone know how to solve it? thanks in commen
so the relevant range is 65-90
Jason W Strong
@1jstrong
Jan 17 2016 01:19 UTC
Hello All...a bit stuck on exercise "Stand in Line". Can anyone assist with first line or pseudocode?
Rory Smith
@alanbuchanan
Jan 17 2016 01:19 UTC
@Morenar can you post your code so far?
@1jstrong what have you got so far?
Morenar
@Morenar
Jan 17 2016 01:19 UTC
in a extra chat or direct here
Rory Smith
@alanbuchanan
Jan 17 2016 01:19 UTC
here
wiki format
CamperBot
@camperbot
Jan 17 2016 01:20 UTC

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Morenar
@Morenar
Jan 17 2016 01:20 UTC
var secondTree = myPlants.trees1; //Change this line
thats the part i need to change
there are [ ] near the 1
wushupork
@wushupork
Jan 17 2016 01:21 UTC
@Morenar trees is the second element of the myPlants array. how would you call that?
Jason W Strong
@1jstrong
Jan 17 2016 01:21 UTC
function queue(arr, item) {


  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(queue(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Rory Smith
@alanbuchanan
Jan 17 2016 01:22 UTC
@Morenar you are trying to access pine but at the moment your secondTree is { type: 'trees', list: [ 'fir', 'pine', 'birch' ] }
Morenar
@Morenar
Jan 17 2016 01:22 UTC

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

// Only change code below this line

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

@wushupork i would call it with myPlants.trees1; //

Rory Smith
@alanbuchanan
Jan 17 2016 01:23 UTC
@1jstrong what have you tried so far?
wushupork
@wushupork
Jan 17 2016 01:24 UTC
@Morenar if you had an array called myPlants["flowers","trees"] would you call that with myPlants.trees? or with myPlants[1]?
Jason W Strong
@1jstrong
Jan 17 2016 01:24 UTC
sorry...am stuck. Don't know where to begin.
Rory Smith
@alanbuchanan
Jan 17 2016 01:25 UTC
@1jstrong you need to:
  • Add the number to the end of the array
  • then remove the first element of array
  • then return the element that was removed
    so you'll need to use a couple of array methods
Jason W Strong
@1jstrong
Jan 17 2016 01:26 UTC
ahhh... .pop and .push. Thanks All!
Morenar
@Morenar
Jan 17 2016 01:26 UTC
@alanbuchanan yes trying to access pine and normaly it is reached by Objname.listname[ id ] the example in the instruction is also different than the code i need to change so i am a little bit confused.
@wushupork should work with the said above... but is says that myPlants is not defined
Rory Smith
@alanbuchanan
Jan 17 2016 01:26 UTC
This message was deleted
wushupork
@wushupork
Jan 17 2016 01:27 UTC
@alanbuchanan yes, he doesn't need pop
Jason W Strong
@1jstrong
Jan 17 2016 01:27 UTC
Thanks much Alan B.!
Rory Smith
@alanbuchanan
Jan 17 2016 01:28 UTC
woops sorry - you don't need pop i should've said
@1jstrong
Bakari Holmes
@bakarih
Jan 17 2016 01:32 UTC
Using this code for Stand in Line:

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

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

Rory Smith
@alanbuchanan
Jan 17 2016 01:33 UTC
@bakarih that passes
Bakari Holmes
@bakarih
Jan 17 2016 01:33 UTC
Getting: RangeError: Maximum call stack size exceeded
Huh?
wushupork
@wushupork
Jan 17 2016 01:33 UTC
@bakarih you can't return shift(), you have to assign it to a variable and return the variable
Rory Smith
@alanbuchanan
Jan 17 2016 01:33 UTC
@wushupork you can return arr.shift()
wushupork
@wushupork
Jan 17 2016 01:34 UTC
@alanbuchanan Really? because I've had more people complain about that :) (I never tried it)
kelly
@kwhms
Jan 17 2016 01:35 UTC
Hello - stuck on Quoting Strings with Single Quotes challenge.
Bakari Holmes
@bakarih
Jan 17 2016 01:35 UTC
@alanbuchanan that did it! Thanks!
CamperBot
@camperbot
Jan 17 2016 01:35 UTC
bakarih sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 717 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
Jose E. Pimentel
@jedpimentel
Jan 17 2016 01:35 UTC
@kwhms what did you try?
kelly
@kwhms
Jan 17 2016 01:36 UTC

Orig soln: var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";

My soln: var myStr = '<a href="http://www.example.com" target="_blank">Link</a>';

Devyn Hedin
@djhedin
Jan 17 2016 01:36 UTC
Is there anyone who can help point me in the right direction with Profile Lookup?
wushupork
@wushupork
Jan 17 2016 01:37 UTC
@alanbuchanan thanks, learn something new every day
CamperBot
@camperbot
Jan 17 2016 01:37 UTC
wushupork sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 718 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
Jose E. Pimentel
@jedpimentel
Jan 17 2016 01:37 UTC
@kwhms weird... I think it should work, can you copy/paste the whole text submitted (including the FCC code)?
Rory Smith
@alanbuchanan
Jan 17 2016 01:37 UTC
@wushupork me too :smile_cat:
Morenar
@Morenar
Jan 17 2016 01:38 UTC
@alanbuchanan got it by myself but i think the challenge/lesson is false.. myPlants1.list1; was the answer but nothing is writen in the describtion
kelly
@kwhms
Jan 17 2016 01:39 UTC
Just realized what was wrong. I didn't delete the original solution but just commented it out. I deleted it totally. Now passes.
Forgot how exact the testing is.
Jose E. Pimentel
@jedpimentel
Jan 17 2016 01:39 UTC
cool, the tests are pretty finnicky like that,
(worth every penny though)
kelly
@kwhms
Jan 17 2016 01:40 UTC
thanks for the confirmation that it should work though! got me thinking what else could it be.
Aron Rightious
@arightious
Jan 17 2016 01:40 UTC

Need a little help w/ "Using Objects for Lookups"...
I think my lookup table is right, but I'm stuck at "Use it to lookup val and return the associated string."

var lookup = { "alpha":"Adams", "bravo":"Boston", "charlie":"Chicago", "delta":"Denver", "echo":"Easy", "foxtrot":"Frank" };

whole thing:
`function phoneticLookup(val) {
var result = "";

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

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

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

Rory Smith
@alanbuchanan
Jan 17 2016 01:41 UTC
@djhedin here's how i did it:
  • declare an empty object, loop through the contacts and assign the object with the firstName to the empty object
  • you've found the object you want to work with, so now make two if statements; one that checks if it's still empty (return no such contact) and one that checks if it doesn\t have the property (return no such property)
  • at this point you can simply return the value of the prop you're being passed
Jose E. Pimentel
@jedpimentel
Jan 17 2016 01:42 UTC
@arightious you need to update the value of result using the val variable on the lookup object (I think)
Rory Smith
@alanbuchanan
Jan 17 2016 01:42 UTC
@Morenar you could open a github issue if you feel the instructions were too vague
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:42 UTC
has anyone completed the "Using Objects for Lookups"?
Linearcitrus
@Linearcitrus
Jan 17 2016 01:42 UTC
I'm stuck on the "Using Objects for Lookups" checkpoint. Having trouble understanding where to start
Aron Rightious
@arightious
Jan 17 2016 01:43 UTC
@KellenKolbeck & @Linearcitrus look at my question LOL
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:43 UTC
haha I didn't even see this ^. The example is not very good
Aron Rightious
@arightious
Jan 17 2016 01:43 UTC
no it isn't, not for what is being asked.
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:43 UTC
I'm searching other places right now I'll get back to you if I find anything
Rory Smith
@alanbuchanan
Jan 17 2016 01:44 UTC
@arightious your code is really close to passing
wushupork
@wushupork
Jan 17 2016 01:44 UTC
@arightious you're close, but you need to assign the value from the lookup table to result
Rory Smith
@alanbuchanan
Jan 17 2016 01:45 UTC
i think what makes it confusing is that it wants you to return result (i changed the code below where it says not to)
:worried:
iokonokh
@iokonokh
Jan 17 2016 01:47 UTC
// 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 == "track" && value !== "") {
  collection[id][prop].push(value);
} else if (value === "") {
  delete collection[id][prop];
} 

  return collection;
}

// Alter values below to test your code
update(1245, "tracks", "Addicted to Love");
i can't get the the tack to push
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 01:48 UTC
Hey guys, would array[0-9} work to select the 1st to 10th index of an array?
stacyHere
@stacyHere
Jan 17 2016 01:48 UTC
Hi, can anyone help me with the Record Collection waypoint? I can't seem to get the value pushed onto the "tracks". Everything else isw orking
wushupork
@wushupork
Jan 17 2016 01:48 UTC
@iokonokh you have a typo
iokonokh
@iokonokh
Jan 17 2016 01:48 UTC
oh
wushupork
@wushupork
Jan 17 2016 01:48 UTC
"track" should be "tracks"
stacyHere
@stacyHere
Jan 17 2016 01:48 UTC
@iokonokh Geez, I'm stuck on the same thing and have been looking it up off and on all day
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:49 UTC
@arightious I had to change what it returned to (where it says not to) but it passes
// Setup
function phoneticLookup(val) {
  var result = "";

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

  // Only change code above this line
  return lookup[val];
}

// Change this value to test
phoneticLookup("alpha");
iokonokh
@iokonokh
Jan 17 2016 01:49 UTC
thanks @wushupork
CamperBot
@camperbot
Jan 17 2016 01:49 UTC
iokonokh sends brownie points to @wushupork :sparkles: :thumbsup: :sparkles:
:star: 295 | @wushupork | http://www.freecodecamp.com/wushupork
Rory Smith
@alanbuchanan
Jan 17 2016 01:49 UTC
@KellenKolbeck that's what i did
Aron Rightious
@arightious
Jan 17 2016 01:49 UTC
@KellenKolbeck & @Linearcitrus 1) get your lookup table right 2) change the return result
yup got it
Rory Smith
@alanbuchanan
Jan 17 2016 01:50 UTC
the alternative would be to just assign lookup[val] to result, and i suppose that's what they're driving at
Aron Rightious
@arightious
Jan 17 2016 01:50 UTC
awesome! thanks guys
wushupork
@wushupork
Jan 17 2016 01:50 UTC
@alanbuchanan that's what i did
Linearcitrus
@Linearcitrus
Jan 17 2016 01:50 UTC
Here is what I did and it worked...
// Setup
function phoneticLookup(val) {
  var result = "";

  var lookup = {
    "alpha":"Adams",
    "bravo":"Boston",
    "charlie":"Chicago",
    "delta":"Denver",
    "echo":"Easy",
    "foxtrot":"Frank"
  };

  result = lookup[val];


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

// Change this value to test
phoneticLookup("charlie");
Aron Rightious
@arightious
Jan 17 2016 01:51 UTC
@alanbuchanan only reason i didn't do that is it is above this line :-)
// Only change code below this line
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:51 UTC
Yeah just tried that too and it passed
Rory Smith
@alanbuchanan
Jan 17 2016 01:51 UTC
yeah :point_up: January 17, 2016 1:45 AM
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:51 UTC
@arightious Sometimes it feels good to break the rules
Is anyone else having an issue viewing their solutions on their profile?
Aimal
@AimalOfficial
Jan 17 2016 01:59 UTC

hi guys, I have a problem in JS! function convert(celsius) {
// Only change code below this line

// Only change code above this line
if ( typeof fahrenheit !== 'undefined' ) {
return fahrenheit;
} else {
return 'fahrenheit not defined';
}
}

// Change the inputs below to test your code
convert(30);

You are given a variable celsius representing a temperature in Celsius. Create a variable fahrenheit and apply the algorithm to assign it the corresponding temperature in Fahrenheit.
How to solve it?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:01 UTC
function titleCase(str) {
  str = str.split(' ');
  for (var i = 0; i <= str.length - 1; i++){
    str[i] = str[i].split('');
    str[i][0] = str[i][0].toUpperCase();
    for (var o = 1; i < str.length; i++){
      str[i][o] = str[i][o].toLowerCase();
    }
    str[i] = str[i].join('');
  }

  return str.join(' ');
}

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

This returns the TypeError: undefined is not an object (evaluating 'str[i][o].toLowerCase;'

What does that even mean?

stacyHere
@stacyHere
Jan 17 2016 02:01 UTC

I can't figure out how to .push the value onto the end of tracks. Can anyone help me with this?

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

Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:04 UTC
I can't read that too well. Type three backpacks (```), press shift enter, then submit the message
*backticks
Miriam Harwood
@mimharwood
Jan 17 2016 02:05 UTC
I keep getting the error "RangeError: Maximum call stack size exceeded" for the following problem. Any suggestions?

// Example
function ourFunction() {
console.log("Heyya, World");
}

ourFunction();

// Only change code below this line
function myFunction() {
console.log("Hi World");
}

myFunction();

Lance Barney
@lbarney
Jan 17 2016 02:05 UTC
maybe try .push("tracks") instead of Value
@stacyHere
stacyHere
@stacyHere
Jan 17 2016 02:07 UTC
@lbarney Thanks, but that doesn't work for me either.
CamperBot
@camperbot
Jan 17 2016 02:07 UTC
stacyhere sends brownie points to @lbarney :sparkles: :thumbsup: :sparkles:
:star: 262 | @lbarney | http://www.freecodecamp.com/lbarney
Lance Barney
@lbarney
Jan 17 2016 02:08 UTC
hold on @stacyHere i will look up my solution and see if i can point you in the right direction.
stacyHere
@stacyHere
Jan 17 2016 02:08 UTC
// 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 (collection[id][prop] !=="" && collection[id][prop]!=="tracks")
  {
    collection[id][prop]=(value);

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

// Alter values below to test your code
update(5439, "artist", "ABBA");
Ahh now I see how to put the code up, it takes me a minute or 2 but I'll catch on
Lance Barney
@lbarney
Jan 17 2016 02:12 UTC
@stacyHere look into else if statements
iokonokh
@iokonokh
Jan 17 2016 02:14 UTC
// Example
var ourArr = [ 9, 10, 11, 12];
var ourTotal = 0;

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

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

// Only change code below this line
var total = 0;
for (var i = 0; i < myArr.length; i ++) {
  total += total[i];
}
what I'm i missing here
this should work
Lance Barney
@lbarney
Jan 17 2016 02:14 UTC
you were right with collection[id][prop].push(value);
stacyHere
@stacyHere
Jan 17 2016 02:16 UTC
@lbarney There mus be something wrong with my if statement, changing to else if's didn't work.
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 02:17 UTC
@iokonokh
for (var i = 0; i < myArr.length; i++) {
  total += myArr[i];
}
Lance Barney
@lbarney
Jan 17 2016 02:17 UTC
@stacyHere try changing them to{ }if else{}
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 02:18 UTC
You need to add the values at position i of myArr to total @iokonokh
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:18 UTC
Hey, how do I make two things happen in a for loop?
for (var o = 0; o < arr[i].length; o++){
Like lets say I want to increase o, but I also want to increase another variable a
at the same time
How would I go about doing this?
wushupork
@wushupork
Jan 17 2016 02:19 UTC
put a++ into the loop
Pandarati
@Pandarati
Jan 17 2016 02:19 UTC
You could just increase a in the for loop
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:19 UTC
Oh.
thanks @wushupork @Pandarati
CamperBot
@camperbot
Jan 17 2016 02:19 UTC
codingducky sends brownie points to @wushupork and @pandarati :sparkles: :thumbsup: :sparkles:
:star: 301 | @pandarati | http://www.freecodecamp.com/pandarati
:star: 296 | @wushupork | http://www.freecodecamp.com/wushupork
Lance Barney
@lbarney
Jan 17 2016 02:20 UTC
@CodingDucky nest your for loops
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:20 UTC
Also how do I tack something onto the end of an array
?
array.push()?
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 02:20 UTC
yes
John Cerpa
@johncerpa
Jan 17 2016 02:20 UTC
hey
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 02:21 UTC
Did that help @iokonokh ?
Pandarati
@Pandarati
Jan 17 2016 02:21 UTC
@CodingDucky Yes you would use array.push();
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:21 UTC
Thank you
Pandarati
@Pandarati
Jan 17 2016 02:22 UTC
@johncerpa Hey :smile:
John Cerpa
@johncerpa
Jan 17 2016 02:22 UTC
@Pandarati :+1:
:hand:
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:25 UTC
function largestOfFour(arr) {
  var newarr = [];
  for (var i = 0; i < arr.length; i++){
    for (var o = 0; o < arr[i].length; o++){
      var num = 0;
      if (arr[i][o] > num) {
        num = arr[i][o];
      }
      newarr.push(num);
    }
  }
  return newarr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Why isn't this working?
It's supposed to return an array consisting of the largest number from each provided sub-array
Pandarati
@Pandarati
Jan 17 2016 02:27 UTC
@CodingDucky You should push and initiate num in the first for-loop. See if that helps
Lance Barney
@lbarney
Jan 17 2016 02:27 UTC
@CodingDucky I would change your var to something besides newarr
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:28 UTC
@lbarney Why?
Lance Barney
@lbarney
Jan 17 2016 02:29 UTC
@CodingDucky just a guess on my part. new has special meaning in JS and if you are going to use newarr it would be newArr under best practices
Jordan
@Nadr0j
Jan 17 2016 02:29 UTC
// Setup
function phoneticLookup(val) {
  var result = "";

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

// Change this value to test
phoneticLookup("charlie");
I'm working on the waypoint "Using objects for lookups". What am I doing wrong? - http://www.freecodecamp.com/challenges/using-objects-for-lookups
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:30 UTC
For the palindromes algorithm, is .join or .split needed? Don't want to waste time going that route and I'm not sure.
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:30 UTC
What I did was remove all capitalisation, spaces, and punctuation
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:30 UTC
@Nadr0j You don't want to just be returning result.
Pandarati
@Pandarati
Jan 17 2016 02:30 UTC
@Nadr0j You are returning a empty string.
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:31 UTC
@Nadr0j I know it says only change code above the line, though. I'm not sure why.
@Pandarati Shouldn't that be removed?
John Cerpa
@johncerpa
Jan 17 2016 02:31 UTC
you're right
Zina Astafyeva
@tragetraje
Jan 17 2016 02:31 UTC
@Nadr0j you should return a value instead
Lance Barney
@lbarney
Jan 17 2016 02:31 UTC
@CodingDucky just looked a little funny to me
stacyHere
@stacyHere
Jan 17 2016 02:31 UTC
@Nadr0j I had to add result=lookup[val];
Jordan
@Nadr0j
Jan 17 2016 02:31 UTC
Is it a bug then?
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:31 UTC
@stacyHere Same. I guess they put the Only add above.. in the wrong place.
@Nadr0j It appears so. I'm glad I ignored that entirely on that part otherwise I would have been pretty frustrated. Yeah, just make it return the value of the lookup.
Zina Astafyeva
@tragetraje
Jan 17 2016 02:32 UTC
can anybody help me with nesting for loops exercise?
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:32 UTC
@tragetraje Sure. What's the issue?
hernc
@hernc
Jan 17 2016 02:32 UTC
@codingHahn yes that worked for me before that. I also tried the && || operators with no luck.
I'm sure your way passed that area now. sorry for late response
Lance Barney
@lbarney
Jan 17 2016 02:32 UTC
can anyone tell me how to get rid of these stupid pop-ups that come in on the side of the chat channel
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:32 UTC
@keccakec str = str.replace(/[^a-z0-9]/g, ''); pops out everything but lowercase alphabets and numbers from str
Jordan
@Nadr0j
Jan 17 2016 02:32 UTC
Thanks to @keccakec @tragetraje @Pandarati!
CamperBot
@camperbot
Jan 17 2016 02:32 UTC
nadr0j sends brownie points to @keccakec and @tragetraje and @pandarati :sparkles: :thumbsup: :sparkles:
:star: 224 | @tragetraje | http://www.freecodecamp.com/tragetraje
:star: 302 | @pandarati | http://www.freecodecamp.com/pandarati
:star: 252 | @keccakec | http://www.freecodecamp.com/keccakec
Pandarati
@Pandarati
Jan 17 2016 02:33 UTC

@Nadr0j I am thinking that the challenge wants you to update the result variable "between the comments"

You should use result = lookup.val;

Zina Astafyeva
@tragetraje
Jan 17 2016 02:33 UTC
@keccakec i don't know how to access the secend nested array when multiplying...
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:33 UTC
Then just check if str is equal to it's reverse (you can reverse str by splitting str into an array, reversing it, then rejoining it.) @keccakec
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 02:33 UTC
^^ @Pandarati is correct
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:33 UTC
@CodingDucky Thanks, I was about to go about splitting and joining the string back up again in an attempt to remove spaces due to lack of understanding on the ^a-z0-9 syntax.
CamperBot
@camperbot
Jan 17 2016 02:33 UTC
keccakec sends brownie points to @codingducky :sparkles: :thumbsup: :sparkles:
:star: 254 | @codingducky | http://www.freecodecamp.com/codingducky
Zina Astafyeva
@tragetraje
Jan 17 2016 02:33 UTC
@keccakec product = product arr[i] "???"
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:33 UTC
yw
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 02:34 UTC
but it should be result = lookup[val];
@Nadr0j
John Cerpa
@johncerpa
Jan 17 2016 02:34 UTC
This message was deleted
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:34 UTC
@tragetraje Link me to the page? I'll see what my solution is so I can get an idea of what you mean.
John Cerpa
@johncerpa
Jan 17 2016 02:34 UTC
This message was deleted
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:35 UTC
@tragetraje Weird, it shows I solved it but it reversed the code back to the beginning. Give me a sec.
@tragetraje Sorry if I'm understanding this incorrectly, but are you having a problem accessing the second array?
Zina Astafyeva
@tragetraje
Jan 17 2016 02:38 UTC
@keccakec got it, it was just product arr[i][j], but thanx anyway...
CamperBot
@camperbot
Jan 17 2016 02:38 UTC
tragetraje sends brownie points to @keccakec :sparkles: :thumbsup: :sparkles:
:star: 253 | @keccakec | http://www.freecodecamp.com/keccakec
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:39 UTC
@tragetraje No problem. Sorry I couldn't be of much help very quickly, JS is new to me and loops are still weird to grasp.
Zina Astafyeva
@tragetraje
Jan 17 2016 02:39 UTC
@keccakec i'mcomplicating things at times by myself when coding :worried:
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:40 UTC
How do I program a function 'end(str, target)' to check if str ends with target?
I was thinking of splitting str (I like splitting), but I wouldn't work if target was more than 1 character long
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:40 UTC
@tragetraje Happens to all of us! haha
You should see how intensely over-complicated I got with the reverse a string challenge.
Michael Beyer
@mbeyer80
Jan 17 2016 02:41 UTC
did freecodecamp do an upgrade to the UI?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:41 UTC
@mbeyer80
yes
Pandarati
@Pandarati
Jan 17 2016 02:41 UTC
@mbeyer80 Yes
Michael Beyer
@mbeyer80
Jan 17 2016 02:41 UTC
I liked the old version
Pandarati
@Pandarati
Jan 17 2016 02:41 UTC
@mbeyer80 Same :P
Michael Beyer
@mbeyer80
Jan 17 2016 02:41 UTC
this new one seems less intuitive
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:41 UTC
I like the version from yesterday
So not the old-old version
But yesterday
John Cerpa
@johncerpa
Jan 17 2016 02:42 UTC
the website is buggy on safari
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:42 UTC
How do I program a function 'end(str, target)' to check if str ends with target?
I was thinking of splitting str (I like splitting), but I wouldn't work if target was more than 1 character long
also @johncerpa I'm on Safari right now, it seems to work fine
Michael Beyer
@mbeyer80
Jan 17 2016 02:42 UTC
hmmmm - I usually do this in chrome - in safari now. Gonna check it out in chrome
Pandarati
@Pandarati
Jan 17 2016 02:42 UTC
@CodingDucky
You can try this:
var newStr = str.substring(str.length - target.length);
if(newStr === target){
console.log("YAY");
}
John Cerpa
@johncerpa
Jan 17 2016 02:43 UTC
@CodingDucky I invited my girlfriend and it was all buggy yesterday
she had to download chrome
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:43 UTC
Just to use FCC
?
John Cerpa
@johncerpa
Jan 17 2016 02:43 UTC
Yes
It worked
Jordan
@Nadr0j
Jan 17 2016 02:43 UTC
Ayo I'm back
sadly
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:43 UTC
Also @Pandarati I would thank you, but unfortunately camperbot is stingy af.
CamperBot
@camperbot
Jan 17 2016 02:43 UTC
codingducky sends brownie points to @pandarati :sparkles: :thumbsup: :sparkles:
:warning: codingducky already gave pandarati points
Michael Beyer
@mbeyer80
Jan 17 2016 02:43 UTC
in chrome n roadmapow. Still liked the older version. Was easier to see my
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:43 UTC
Like that
Jordan
@Nadr0j
Jan 17 2016 02:44 UTC

function test(val) {
  var result = lookup[val];


  var lookup = {
    "alpha":"Adams",
    "bravo":"Boston",
    "charlie":"Chicago",
    "delta":"Denver",
    "echo":"Easy",
    "foxtrot":"Frank",
  };


  return result;
}
I'm confused still. Why doesn't this work?
Michael Beyer
@mbeyer80
Jan 17 2016 02:44 UTC
was easier to see my roadmap
Pandarati
@Pandarati
Jan 17 2016 02:44 UTC
@Nadr0j update result after you initiated lookup(Update result under lookup)
Michael Beyer
@mbeyer80
Jan 17 2016 02:44 UTC
oh well. Cant complain for free training this good :)
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:45 UTC
What @Pandarati said. At the time you're initialising result, lookup hasn't been initialised yet.
So result turns into nothing
Jordan
@Nadr0j
Jan 17 2016 02:45 UTC
@Pandarati ayy that worked. So can the compiler not assign a value to result because it hasn't seen the object yet?
or the browser or whatever
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:46 UTC
Your first answer is correct
Unless you have a seriously messed up browser it should not affect your results on FCC
Jordan
@Nadr0j
Jan 17 2016 02:46 UTC
lol. Alright thanks guys. Big help. This one made my head hurt.
jmesa92
@jmesa92
Jan 17 2016 02:47 UTC
I'm having some trouble with Nesting For Loops
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i = 0; i < multiplyAll.length; i++)
    for(var j = 0; j < multiplyAll.length; j * product)
  // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
I clearly have my for loops wrong, I'm just not sure what to do there
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 02:48 UTC
@Nadr0j it should looks something like :
    "foxtrot": "Frank"
});

result = lookup[val]; 
return result
Jordan
@Nadr0j
Jan 17 2016 02:49 UTC
@KellenKolbeck thanks Kellen. It's working well now.
CamperBot
@camperbot
Jan 17 2016 02:49 UTC
nadr0j sends brownie points to @kellenkolbeck :sparkles: :thumbsup: :sparkles:
John Cerpa
@johncerpa
Jan 17 2016 02:49 UTC
just do it in the same line
CamperBot
@camperbot
Jan 17 2016 02:49 UTC
:star: 222 | @kellenkolbeck | http://www.freecodecamp.com/kellenkolbeck
John Cerpa
@johncerpa
Jan 17 2016 02:49 UTC
return result = lookup[val];
Jordan
@Nadr0j
Jan 17 2016 02:49 UTC
fancy
Pandarati
@Pandarati
Jan 17 2016 02:49 UTC
@jmesa92 trying using
for (var i = 0; i < arr.length; i++){
    for(var j = 0; j < arr.length; j ++){
  // Only change code above this line
 //Then multiply items and push them into an array

}
}
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:51 UTC
function palindrome(str) {
  // Good luck!
  str = str.toLowerCase;
  str = str.replace(/[^a-z0-9]/g, '');
  str = str.split("");
  str = str.reverse();
  str = str.join("");
  if ( str.reverse() === str) {
    return true;
  }
  else if ( str.reverse() !== str){
    return false;
  }
}



palindrome("eye");
.replace isn't a function?
jmesa92
@jmesa92
Jan 17 2016 02:51 UTC
@Pandarati No good, still only returning 1
Susan
@SusanGrattan
Jan 17 2016 02:51 UTC
I'm on Search and Replace. How do I test if the word begins with a capital letter?
Pandarati
@Pandarati
Jan 17 2016 02:52 UTC
@jmesa92 Yes. That wasn't the solution. That was just to point you into the right direction.
Susan
@SusanGrattan
Jan 17 2016 02:52 UTC
I was thinking i could just compare the string to string.toLowerCase but I'm wondering if there is a better approach?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:52 UTC
Check if word.split('')[0] = word.split('')[0].toUpperCase()
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:52 UTC
Example text on mozilla "var newstr = str.replace(/xmas/i, 'Christmas');"
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:52 UTC
Actually use ==
jmesa92
@jmesa92
Jan 17 2016 02:52 UTC
@Pandarati I shoulda known that...
Susan
@SusanGrattan
Jan 17 2016 02:53 UTC
@CodingDucky thank you
CamperBot
@camperbot
Jan 17 2016 02:53 UTC
susangrattan sends brownie points to @codingducky :sparkles: :thumbsup: :sparkles:
:star: 256 | @codingducky | http://www.freecodecamp.com/codingducky
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:53 UTC
Am I misinterpreting how to use .replace?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:53 UTC
yw
matthew3454
@matthew3454
Jan 17 2016 02:53 UTC
I have a question on Quoting Strings with Single Quotes is someone can please help?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:53 UTC
Just ask
about @codingducky
CamperBot
@camperbot
Jan 17 2016 02:53 UTC
:star: 257 | @codingducky | http://www.freecodecamp.com/codingducky
Pandarati
@Pandarati
Jan 17 2016 02:53 UTC
This message was deleted
matthew3454
@matthew3454
Jan 17 2016 02:54 UTC
``var myStr= "This string has 'double quotes' in it. And 'probably' lots of them.";``` this is the code and this: Remove all the backslashes ()
You should have two single quotes ' and four double quotes "
Only remove the backslashes \ used to escape quotes. is the instruction.
var myStr= "This string has 'double quotes' in it. And 'probably' lots of them.";
John Cerpa
@johncerpa
Jan 17 2016 02:55 UTC
This message was deleted
what's wrong?
should be like this
'This string has "double quotes" in it. And "probably" lots of them.'
matthew3454
@matthew3454
Jan 17 2016 02:57 UTC
Okay. What should I do next? @johncerpa
Pandarati
@Pandarati
Jan 17 2016 02:57 UTC
@matthew3454 It wants you to swap the quotes in the string, and use the backslash to "escape" them.
matthew3454
@matthew3454
Jan 17 2016 02:57 UTC
gotcha
var myStr= 'This string has\"double quotes\" in it. And \"probably\" lots of them.'
Pandarati
@Pandarati
Jan 17 2016 02:59 UTC
@matthew3454 Yes :)
John Cerpa
@johncerpa
Jan 17 2016 02:59 UTC
hmmn
it says remove all the backslashes
matthew3454
@matthew3454
Jan 17 2016 02:59 UTC
yes, it didn't work.
John Cerpa
@johncerpa
Jan 17 2016 02:59 UTC
see
no backslashes
Pandarati
@Pandarati
Jan 17 2016 03:00 UTC
@johncerpa Really? What's the name of the challenge?
matthew3454
@matthew3454
Jan 17 2016 03:00 UTC
Quoting Strings with Single Quotes
John Cerpa
@johncerpa
Jan 17 2016 03:00 UTC
var myStr = 'This string has "double quotes" in it. And "probably" lots of them.';
that way
Pandarati
@Pandarati
Jan 17 2016 03:00 UTC
This message was deleted
John Cerpa
@johncerpa
Jan 17 2016 03:01 UTC
he was using double quotes
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:02 UTC
If I delete arr[0], will arr[1] become the new arr[0]?
matthew3454
@matthew3454
Jan 17 2016 03:02 UTC
It still din't work.
Pandarati
@Pandarati
Jan 17 2016 03:03 UTC
@CodingDucky You have to use array.shift();
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:03 UTC
What does array.shift do?
How do I select what to pop out with it?
Pandarati
@Pandarati
Jan 17 2016 03:03 UTC
@matthew3454
The wiki can help you out.
wiki Quoting Strings with Single Quotes
wiki Quoting Strings with Single Quotes
CamperBot
@camperbot
Jan 17 2016 03:04 UTC

:point_right: waypoint quoting strings with single quotes [wiki]

Quoting Strings with Single Quotes

String values in JavaScript may be written with single or double quotes, so long as you start and end with the same type of quote. Unlike some languages, single and double quotes are functionally identical in Javascript.

"This string has \"double quotes\" in it"

The value in using one or the other has to do with the need to escape quotes of the same type. If you have a string with many double quotes, this can be difficult to read and write. Instead, use single quotes:

'This string has "double quotes" in it. And "probably" lots of them.'

:pencil: read more about waypoint quoting strings with single quotes on the FCC Wiki

matthew3454
@matthew3454
Jan 17 2016 03:04 UTC
okay I'll try it
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:04 UTC
wiki array.shift()
CamperBot
@camperbot
Jan 17 2016 03:04 UTC
no wiki entry for: arrayshift
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:04 UTC
damn
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:04 UTC
Thanks
moukhtari
@moukhtari
Jan 17 2016 03:05 UTC
Hi everyone. I'm having a hard time understanding the Card Counting problem
matthew3454
@matthew3454
Jan 17 2016 03:05 UTC
It says only to remove the backslashes used to escape quotes. Everything else is green checkmarked. @Pandarati
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:06 UTC
wiki .shift()
CamperBot
@camperbot
Jan 17 2016 03:06 UTC

:point_right: waypoint manipulate arrays with shift() [wiki]

Manipulate Arrays With shift()

shift() removes the first element unlike pop() which removes the last.

:pencil: read more about waypoint manipulate arrays with shift on the FCC Wiki

Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:06 UTC
tada
there it is
just checking for the article
Is there a way to shift out the first 'n' elements in an array, given n?
John Cerpa
@johncerpa
Jan 17 2016 03:07 UTC
I just checked the exercise and it's okay
Pandarati
@Pandarati
Jan 17 2016 03:12 UTC

@matthew3454 You're suppose to be working with

var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";

Not the example string :P. Silly me.

moukhtari
@moukhtari
Jan 17 2016 03:12 UTC
Oh I figured it out, I should use a switch statement
matthew3454
@matthew3454
Jan 17 2016 03:14 UTC
okay. thanks. Round 5
Pandarati
@Pandarati
Jan 17 2016 03:14 UTC
@matthew3454 Yep so basically it's
var myStr = '<a href="http://www.example.com" target="_blank">Link</a>';
John Cerpa
@johncerpa
Jan 17 2016 03:15 UTC
type javascript
next to the backticks
it looks ugly that way haha
Pandarati
@Pandarati
Jan 17 2016 03:15 UTC
@johncerpa Thanks. Forgot about that
CamperBot
@camperbot
Jan 17 2016 03:15 UTC
pandarati sends brownie points to @johncerpa :sparkles: :thumbsup: :sparkles:
:star: 268 | @johncerpa | http://www.freecodecamp.com/johncerpa
John Cerpa
@johncerpa
Jan 17 2016 03:16 UTC
@Pandarati it's not important haha
@Pandarati just looks better, don't you think?
Pandarati
@Pandarati
Jan 17 2016 03:16 UTC
Yes :)
matthew3454
@matthew3454
Jan 17 2016 03:17 UTC
Sixth time's a charm! @johncerpa
John Cerpa
@johncerpa
Jan 17 2016 03:17 UTC
@matthew3454 :+1: :)
matthew3454
@matthew3454
Jan 17 2016 03:17 UTC
thank you @johncerpa
CamperBot
@camperbot
Jan 17 2016 03:17 UTC
matthew3454 sends brownie points to @johncerpa :sparkles: :thumbsup: :sparkles:
:star: 269 | @johncerpa | http://www.freecodecamp.com/johncerpa
Pandarati
@Pandarati
Jan 17 2016 03:23 UTC
Does anyone know the logic for generating prime number?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:23 UTC
If I recall correctly there's a prime number equation.
What exactly are you trying to do?
wiki Chunky Monkey
CamperBot
@camperbot
Jan 17 2016 03:24 UTC

:point_right: bonfire chunky monkey [wiki]

Explanation

Our goal for this bonfire is to split arr (first argument) into smaller chunks of arrays with the length provided by size (second argument). There are 4 green checks (objectives) our code needs to pass in order to complete this bonfire:

  1. (['a', 'b', 'c', 'd'], 2) is expected to be [['a', 'b'], ['c', 'd']]
  2. ([0, 1, 2, 3, 4, 5], 3) is expected to be [[0, 1, 2], [3, 4, 5]]
  3. ([0, 1, 2, 3, 4, 5], 2) is expected to be [[0, 1], [2, 3], [4, 5]]
  4. ([0, 1, 2, 3, 4, 5], 4) is expected to be [[0, 1, 2, 3], [4, 5]]

Click More information under the bonfire title and read the helpful links if you haven't yet.

:pencil: read more about bonfire chunky monkey on the FCC Wiki

Pandarati
@Pandarati
Jan 17 2016 03:24 UTC
Generate prime number in a range for Bonfire Sum all primes
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:24 UTC
Yeah I don't know how that would work
Maybe make a prime number checker function, get all the numbers in the range, then apply the function on everything in the range, and kick out the ones that aren't prime?
matthew3454
@matthew3454
Jan 17 2016 03:29 UTC
I've got another question on the next waypoint of: Escape Sequences in Strings
Pandarati
@Pandarati
Jan 17 2016 03:30 UTC
@CodingDucky That works but I actually want to write and understand the logic
What is it @matthew3454 ?
matthew3454
@matthew3454
Jan 17 2016 03:33 UTC
var myStr= \\"backslash tab tab carriage-return new-line\\" ; // Change this line
orr29
@orr29
Jan 17 2016 03:33 UTC
anyone done 147 here? "converting celcius to farenheit" how do I assign a var to the value of a function?
matthew3454
@matthew3454
Jan 17 2016 03:33 UTC
I need to: myStr should have the escape sequences for backslash tab tab carriage-return new-line separated by spaces
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 03:34 UTC
var farenheit = function () {}
Pandarati
@Pandarati
Jan 17 2016 03:34 UTC

@orr29

var example = function (){};

Make sure to return a value

John Cerpa
@johncerpa
Jan 17 2016 03:34 UTC
@matthew3454 there's an example on the left side
\t = tab
\r = carriage-return
\n = new line
Pandarati
@Pandarati
Jan 17 2016 03:35 UTC
wiki Escape Sequences in Strings
CamperBot
@camperbot
Jan 17 2016 03:35 UTC

:point_right: waypoint escape sequences in strings [wiki]

Escape Sequences in Strings

Quotes are not the only characters that can be escaped inside a string. Here is a table of common escape sequences:

Code Output
\' single quote
\" double quote
\ backslash
\n new line
\r carriage return
\t tab
\b backspace
\f form feed

Note that the backslash itself must be escaped in order to display as a backslash.

:pencil: read more about waypoint escape sequences in strings on the FCC Wiki

Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 03:35 UTC
Anyone in here completed the "Record Collection" waypoint?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:35 UTC
function chunk(arr, size) {
  var newArray = [];
  for (var i = 0; i < arr.length; i += size) {
    newArray.push(arr.slice(i, i + size));
  }
  return newArr;
}

chunk(["a", "b", "c", "d"], 2);
Why doesn't this work? It's supposed to cut up 'arr' into chunks the length of 'size'
John Cerpa
@johncerpa
Jan 17 2016 03:35 UTC
yes
I have
orr29
@orr29
Jan 17 2016 03:35 UTC
@Pandarati @KellenKolbeck thanx
CamperBot
@camperbot
Jan 17 2016 03:35 UTC
orr29 sends brownie points to @pandarati and @kellenkolbeck :sparkles: :thumbsup: :sparkles:
:star: 223 | @kellenkolbeck | http://www.freecodecamp.com/kellenkolbeck
:star: 303 | @pandarati | http://www.freecodecamp.com/pandarati
Pandarati
@Pandarati
Jan 17 2016 03:35 UTC
@KellenKolbeck Yes
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 03:36 UTC
I have 3 of the 4 completed but struggling to delete empty tracks array
// Setup
var collection = {
    2548: {
      album: "Slippery When Wet",
      artist: "Bon Jovi",
      tracks: [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    2468: {
      album: "1999",
      artist: "Prince",
      tracks: [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    1245: {
      artist: "Robert Palmer",
      tracks: [ ]
    },
    5439: {
      album: "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

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

  return collection;
}
John Cerpa
@johncerpa
Jan 17 2016 03:37 UTC
This message was deleted
This message was deleted
This message was deleted
matthew3454
@matthew3454
Jan 17 2016 03:37 UTC
var myStr= ""\\ \t \t \r \n"" ; // Change this line @Pandarati This is what I tried
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:37 UTC
function chunk(arr, size) {
  var newArray = [];
  for (var i = 0; i < arr.length; i += size) {
    newArray.push(arr.slice(i, i + size));
  }
  return newArr;
}

chunk(["a", "b", "c", "d"], 2);
Why doesn't this work? It's supposed to cut up 'arr' into chunks the length of 'size''.
John Cerpa
@johncerpa
Jan 17 2016 03:38 UTC
@matthew3454 just one double quote
on each side
Pandarati
@Pandarati
Jan 17 2016 03:38 UTC
@matthew3454 You're not escaping the double quotes properly
@KellenKolbeck I'm looking at it now :)
John Cerpa
@johncerpa
Jan 17 2016 03:39 UTC
you don't have to escape any double quotes
matthew3454
@matthew3454
Jan 17 2016 03:39 UTC
alsjdg;aeowng;asnv ;alsdf;lasdf
John Cerpa
@johncerpa
Jan 17 2016 03:39 UTC
I think, I'm not sure
matthew3454
@matthew3454
Jan 17 2016 03:39 UTC
@johncerpa thank you
CamperBot
@camperbot
Jan 17 2016 03:39 UTC
matthew3454 sends brownie points to @johncerpa :sparkles: :thumbsup: :sparkles:
:warning: matthew3454 already gave johncerpa points
matthew3454
@matthew3454
Jan 17 2016 03:39 UTC
@Pandarati thank you
CamperBot
@camperbot
Jan 17 2016 03:39 UTC
matthew3454 sends brownie points to @pandarati :sparkles: :thumbsup: :sparkles:
:star: 304 | @pandarati | http://www.freecodecamp.com/pandarati
John Cerpa
@johncerpa
Jan 17 2016 03:39 UTC
@matthew3454 :) :+1:
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 03:40 UTC
@Pandarati
Ok my result is showing "tracks": [ " " ], this is the one i need to delete
In id 2548
matthew3454
@matthew3454
Jan 17 2016 03:40 UTC
Do I have to set up my GitHub account to receive brownie points?
Pandarati
@Pandarati
Jan 17 2016 03:41 UTC
@KellenKolbeck Sure. I'm still trying to figure your code myself.
@matthew3454 No. You get them when someone mentions you and says thanks :)(Like just now)
CamperBot
@camperbot
Jan 17 2016 03:42 UTC
pandarati sends brownie points to @matthew3454 :sparkles: :thumbsup: :sparkles:
:star: 150 | @matthew3454 | http://www.freecodecamp.com/matthew3454
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 03:43 UTC
I should have refactored before I posted
Pandarati
@Pandarati
Jan 17 2016 03:47 UTC

@KellenKolbeck

if(collection[prop] === ""){
}

To check if a property is empty.
Is this what you needed? :)

Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 03:48 UTC
Yes that worked thanks @Pandarati
CamperBot
@camperbot
Jan 17 2016 03:48 UTC
kellenkolbeck sends brownie points to @pandarati :sparkles: :thumbsup: :sparkles:
:star: 305 | @pandarati | http://www.freecodecamp.com/pandarati
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 03:48 UTC
Just went back to Profile Lookup since I forgot to finish it and moved on yesterday. I'm getting a strange error.
//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 ( i=0; i < contacts.length; i++) {
  var propIndex = contacts[i].indexOf(prop);
  if (contacts[i][0] !== firstName) {
    return "No such contact";
  }
  else if (prop !== contacts[i][propIndex]) {
    return  "No such property";
  }
  else {
    return contacts[i][prop];
  }

}

// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");
It says that I can't use .indexOf that way. Or that it at least isn't a function.
I'm not too familiar with using .indexOf in multidimensional arrays, but shouldn't that still work?
Pandarati
@Pandarati
Jan 17 2016 03:50 UTC
@KellenKolbeck Also to check if a track is empty
if(collection[prop].length === 0){

}
Kimber
@Kimber217
Jan 17 2016 03:50 UTC
hey can someone walk me through "return early pattern for functions?"
John Cerpa
@johncerpa
Jan 17 2016 03:50 UTC
yeah what is it
the condition should be inside the parenthesis
if (condition) {

}
Kimber
@Kimber217
Jan 17 2016 03:51 UTC
should i be using switch or if/else if
John Cerpa
@johncerpa
Jan 17 2016 03:51 UTC
if/else if statements
Kimber
@Kimber217
Jan 17 2016 03:51 UTC
just out of curiousity...how come?
John Cerpa
@johncerpa
Jan 17 2016 03:51 UTC
you should return undefined inside the curly braces
if (condition) {

    return whatever;

}
the instructions says:
Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined.
see the word if
Pandarati
@Pandarati
Jan 17 2016 03:52 UTC
You should check if either one is under 0
John Cerpa
@johncerpa
Jan 17 2016 03:52 UTC
don't give her the answer
let her find out
Kimber
@Kimber217
Jan 17 2016 03:53 UTC
haha yeah that was my goal, thanks @johncerpa - gotta figure this out on my own
CamperBot
@camperbot
Jan 17 2016 03:53 UTC
kimber217 sends brownie points to @johncerpa :sparkles: :thumbsup: :sparkles:
:star: 270 | @johncerpa | http://www.freecodecamp.com/johncerpa
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:53 UTC
How do I check if a given string/number/float is in an array?
Kimber
@Kimber217
Jan 17 2016 03:53 UTC
so i guess i would have said like...
```
if (a >= 0) {
return a}
wait hmm
Abhishek
@AbhiChachan
Jan 17 2016 03:54 UTC
in exercise Counting Cards (204):
not able to return count and "Bet" together
John Cerpa
@johncerpa
Jan 17 2016 03:54 UTC
less than 0
not greater
Kimber
@Kimber217
Jan 17 2016 03:55 UTC
but don't i want greter than 0 to show the value of the number?
Abhishek
@AbhiChachan
Jan 17 2016 03:55 UTC
Screen Shot 2016-01-17 at 9.25.00 am.png
Kimber
@Kimber217
Jan 17 2016 03:55 UTC
meaning shouldn't i be negating those options and having my final option be the undefined return?
John Cerpa
@johncerpa
Jan 17 2016 03:55 UTC
if a or b are less than 0
Abhishek
@AbhiChachan
Jan 17 2016 03:56 UTC
hi anyone there to help?
Kimber
@Kimber217
Jan 17 2016 03:56 UTC
right, but it still wants me to show the numberfs when they're over 0
John Cerpa
@johncerpa
Jan 17 2016 03:56 UTC
hmmn I don't think so
Kimber
@Kimber217
Jan 17 2016 03:56 UTC
oh wait i guess it doesn't
i think imade up my own rule
sorry about that hahaha
John Cerpa
@johncerpa
Jan 17 2016 03:56 UTC
haha it's okay
Pandarati
@Pandarati
Jan 17 2016 03:56 UTC
@CodingDucky Loop through it and have a "if condition" to check
Kimber
@Kimber217
Jan 17 2016 03:57 UTC
okay hmm
John Cerpa
@johncerpa
Jan 17 2016 03:57 UTC
if (condition) {

    return whatever;

}
the condition is if a or b are less than 0
return undefined
Kimber
@Kimber217
Jan 17 2016 03:58 UTC
if (a <= 0) {
  return "undefined";
}
  else if (b <= 0) {
    return "undefined";
  }
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:58 UTC
@Pandarati How about if I have two arrays, and want to check if one is a subset of the other?
John Cerpa
@johncerpa
Jan 17 2016 03:59 UTC
getting close
Abhishek
@AbhiChachan
Jan 17 2016 03:59 UTC
Hi Campers, need some help on an exercise
Kimber
@Kimber217
Jan 17 2016 03:59 UTC
would i use &&>?
John Cerpa
@johncerpa
Jan 17 2016 03:59 UTC
less than 0
Kimber
@Kimber217
Jan 17 2016 03:59 UTC
man idk why i can't figure this out
John Cerpa
@johncerpa
Jan 17 2016 03:59 UTC
just use < instead of <=
Kimber
@Kimber217
Jan 17 2016 03:59 UTC
oh.
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:59 UTC
@Pandarati Just use multiple if statements in a for loop?
John Cerpa
@johncerpa
Jan 17 2016 03:59 UTC
you should also return undefined
without the quotes
Pandarati
@Pandarati
Jan 17 2016 03:59 UTC
@Kimber217 It's saying if "either" of them are true. ;)
Kimber
@Kimber217
Jan 17 2016 03:59 UTC
hmm
oh BOOM shaka lacka
it worked...
John Cerpa
@johncerpa
Jan 17 2016 04:00 UTC
hahaha good :clap:
Kimber
@Kimber217
Jan 17 2016 04:00 UTC
but i don't actually think my code made it so that it was "either"
thankyou @johncerpa :)
John Cerpa
@johncerpa
Jan 17 2016 04:00 UTC
else if
Kimber
@Kimber217
Jan 17 2016 04:00 UTC
and thankyou @Pandarati :D
ok @johncerpa you are really good at explaining things
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 04:01 UTC
separate the thank and the you and see what happens
for both of them
John Cerpa
@johncerpa
Jan 17 2016 04:01 UTC
@Kimber217 no problem :)
Bekzat Omrzakov
@bekza
Jan 17 2016 04:02 UTC
can't figure things out with this question(( Convert Celsius to Fahrenheit convert(0) should return a number
convert(-30) should return a value of -22
convert(-10) should return a value of 14
John Cerpa
@johncerpa
Jan 17 2016 04:03 UTC
paste your code (:
Bekzat Omrzakov
@bekza
Jan 17 2016 04:03 UTC

function convert(celsius) {
// Only change code below this line

// Only change code above this line
if ( typeof fahrenheit !== 'undefined' ) {
return fahrenheit;
} else {
return 'fahrenheit not defined';
}
}

// Change the inputs below to test your code
convert(30);

John Cerpa
@johncerpa
Jan 17 2016 04:04 UTC
help convert celsius to fahrenheit
CamperBot
@camperbot
Jan 17 2016 04:04 UTC

:point_right: checkpoint convert celsius to fahrenheit [wiki]

Details

The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.

You are given a variable celsius representing a temperature in Celsius. Create a variable fahrenheit and apply the algorithm to assign it the corresponding temperature in Fahrenheit.

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

:pencil: read more about checkpoint convert celsius to fahrenheit on the FCC Wiki

Pandarati
@Pandarati
Jan 17 2016 04:04 UTC
@bekza The formulas might come in handy for that challenge
John Cerpa
@johncerpa
Jan 17 2016 04:04 UTC
Celsius times 9/5, plus 32.
Matt
@matthewbcool
Jan 17 2016 04:04 UTC

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

// Only change code below this line

testObj.hat; // Change this line
testObj.shirt; // Change this line
'''

CamperBot
@camperbot
Jan 17 2016 04:04 UTC
:bulb: to format code use backticks! ``` more info
Kimber
@Kimber217
Jan 17 2016 04:04 UTC
okay @johncerpa i just got to the card counting one and i'm...100% lose no clue where to even start...
John Cerpa
@johncerpa
Jan 17 2016 04:05 UTC
help card counting
CamperBot
@camperbot
Jan 17 2016 04:05 UTC
no wiki entry for: card counting
John Cerpa
@johncerpa
Jan 17 2016 04:05 UTC
wiki card count
CamperBot
@camperbot
Jan 17 2016 04:05 UTC
no wiki entry for: card count
John Cerpa
@johncerpa
Jan 17 2016 04:05 UTC
hmmn
Pandarati
@Pandarati
Jan 17 2016 04:05 UTC
wiki format code
Kimber
@Kimber217
Jan 17 2016 04:05 UTC
help counting cards
CamperBot
@camperbot
Jan 17 2016 04:05 UTC

:point_right: checkpoint counting cards [wiki]

Checkpoint: Counting Cards

About Blackjack

In the casino game Blackjack, a player can gain an advantage over the house by keeping track of the relative number of high and low cards remaining in the deck. This is called Card Counting.

Having more high cards remaining in the deck favors the player. Each card is assigned a value according to the table below. When the count is positive, the player should bet high. When the count is zero or negative, the player should bet low.

Value Cards
+1 2, 3, 4, 5, 6
0 7, 8, 9
-1 10, 'J', 'Q', 'K','A'

Instructions

You will write a card counting function. It will receive a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative.

Example Output:

:pencil: read more about checkpoint counting cards on the FCC Wiki

John Cerpa
@johncerpa
Jan 17 2016 04:05 UTC
that thing
Matt
@matthewbcool
Jan 17 2016 04:05 UTC
// Setup var testObj = { "hat": "ballcap", "shirt": "jersey", "shoes": "cleats" }; // Only change code below this line testObj.hat; // Change this line testObj.shirt; // Change this line
John Cerpa
@johncerpa
Jan 17 2016 04:05 UTC
use switch
do you know how to?
Kimber
@Kimber217
Jan 17 2016 04:05 UTC
my beloved swiiitch!
Pandarati
@Pandarati
Jan 17 2016 04:05 UTC
@matthewbcool Try using ``` [shift enter] (3 more ticks here)
John Cerpa
@johncerpa
Jan 17 2016 04:06 UTC
switch(something) {

    case 1:
    case 2:
    case 4:
      do something;
      break;

}
Pandarati
@Pandarati
Jan 17 2016 04:06 UTC
wiki code formatting
CamperBot
@camperbot
Jan 17 2016 04:06 UTC

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Kimber
@Kimber217
Jan 17 2016 04:07 UTC
ya it's
switch(val) {
case 2:
case 3:
case 4:
case 5:
case 6:
return  "+1";
break;
}
or something right
John Cerpa
@johncerpa
Jan 17 2016 04:07 UTC
yes,
you have a
count variable
in your code, don't you
Matt
@matthewbcool
Jan 17 2016 04:07 UTC
var testObj = {
  "hat": "ballcap",
  "shirt": "jersey",
  "shoes": "cleats"
};

// Only change code below this line

testObj.hat;   // Change this line
testObj.shirt;   // Change this line
Kimber
@Kimber217
Jan 17 2016 04:07 UTC
wtf is it talking about with the "global count variable"?
John Cerpa
@johncerpa
Jan 17 2016 04:08 UTC
@matthewbcool testObj.hat should be stored in a variable
my dad is telling me to turn off the computer
I'm sorry @Kimber217
Matt
@matthewbcool
Jan 17 2016 04:08 UTC
@johncerpa thanks
CamperBot
@camperbot
Jan 17 2016 04:08 UTC
matthewbcool sends brownie points to @johncerpa :sparkles: :thumbsup: :sparkles:
:star: 271 | @johncerpa | http://www.freecodecamp.com/johncerpa
Kimber
@Kimber217
Jan 17 2016 04:08 UTC
no worries thanks @johncerpa !
John Cerpa
@johncerpa
Jan 17 2016 04:08 UTC
good night
Kimber
@Kimber217
Jan 17 2016 04:08 UTC
goodnight!
Abhishek
@AbhiChachan
Jan 17 2016 04:09 UTC

Hi, need some help in counting cards exercise - not able to print count and "Bet or Hold" decision together. for the below code, output is hold
var count = 0;

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

}

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

// Only change code above this line
}

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

Matt
@matthewbcool
Jan 17 2016 04:10 UTC
// Setup
var testObj = {
  "hat": "ballcap",
  "shirt": "jersey",
  "shoes": "cleats"
};

// Only change code below this line

var argh = testObj.hat;   // Change this line
var uhhh = testObj.shirt;   // Change this line
still not working
Pandarati
@Pandarati
Jan 17 2016 04:11 UTC
@matthewbcool For this challenge, does it want you to update the properties?
Matt
@matthewbcool
Jan 17 2016 04:11 UTC
@Pandarati it is telling me to just use dot notation to call a specific property
Pandarati
@Pandarati
Jan 17 2016 04:12 UTC
@matthewbcool What's the name of this challenge?
Matt
@matthewbcool
Jan 17 2016 04:12 UTC
Accessing Objects Properties with the Dot Operator
Salad
@Saladg
Jan 17 2016 04:13 UTC
Hi guys,
am having difficulty solving this:
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.

this is the code:
function queue(arr, item) {
// Your code here
testArr.shift();
testArr.push(item);
return testArr.unshift(); // Change this line
}

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

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

Wilson Heres
@hereswilson
Jan 17 2016 04:14 UTC
function palindrome(str) {

  var cleanString=str.replace(/\W/g, '');
  var smallCleanString=cleanString.toLowerCase();
  splitString=smallCleanString.split("");
  rsString=splitString.reverse();
  reversedStr=rsString.join("");
  if(smallCleanString===reversedStr){
    return true;
  }
  else
   return false;

}
palindrome("eye");
This code does not work for palindrome("0_0 (: /-\ :) 0-0"), anyone know why?
Pandarati
@Pandarati
Jan 17 2016 04:14 UTC
@Pandarati Ok, you have it right. Just change the variables back to what they wanted.
Matt
@matthewbcool
Jan 17 2016 04:16 UTC
@Pandarati thanks i got it. it has to have the original variable that was assigned to work
CamperBot
@camperbot
Jan 17 2016 04:16 UTC
matthewbcool sends brownie points to @pandarati :sparkles: :thumbsup: :sparkles:
:star: 307 | @pandarati | http://www.freecodecamp.com/pandarati
Salad
@Saladg
Jan 17 2016 04:16 UTC
Anyone who has an answer?
Bekzat Omrzakov
@bekza
Jan 17 2016 04:16 UTC
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";
Matt
@matthewbcool
Jan 17 2016 04:17 UTC
@Saladg what twas the name of that one again
?
Kimber
@Kimber217
Jan 17 2016 04:17 UTC
@AbhiChachan i'm having trouble with that one too :(
Bekzat Omrzakov
@bekza
Jan 17 2016 04:17 UTC
Remove all the backslashes ()
You should have two single quotes ' and four double quotes "
Kimber
@Kimber217
Jan 17 2016 04:17 UTC
@AbhiChachan any luck?

```var count = 0;

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

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

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

Pandarati
@Pandarati
Jan 17 2016 04:17 UTC
@AbhiChachan You're on the right track
Kimber
@Kimber217
Jan 17 2016 04:18 UTC
ughhh
var count = 0;

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

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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Salad
@Saladg
Jan 17 2016 04:18 UTC
@matthewbcool , its about array manipulation test

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

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

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

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.
Kimber
@Kimber217
Jan 17 2016 04:19 UTC
meant
 if (count >= 0){
  return [count, "Bet"];
  } else {
    return [count, "Hold"];
Matt
@matthewbcool
Jan 17 2016 04:19 UTC
@Kimber217 do you need to return count + " Bet"?
Kimber
@Kimber217
Jan 17 2016 04:20 UTC
guess i don't need the brackets
Abhishek
@AbhiChachan
Jan 17 2016 04:20 UTC

guys figured it out, the below is the right code:
var count = 0;

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

}
var holdorbet;
if (count <= 0){
holdorbet = count + " " + "Hold";
}else {
holdorbet = count + " " + "Bet";
}

return holdorbet;

// Only change code above this line
}

thanks
:)
Kimber
@Kimber217
Jan 17 2016 04:20 UTC
umm..
:/
Abhishek
@AbhiChachan
Jan 17 2016 04:21 UTC
@Kimber217 let me know if that one worked for yo
you
Kimber
@Kimber217
Jan 17 2016 04:21 UTC
i don't want the anwer
*answer
i wanted someone to help me figure out how to find it
so i could actually learn it
lol
Abhishek
@AbhiChachan
Jan 17 2016 04:21 UTC
ohhh
sorry
i can take you through the logic
if you want
Kimber
@Kimber217
Jan 17 2016 04:22 UTC
ya sure
++ is interchangeable with += 1, right? it's just probably more "proper"
right?
(not sure)
Abhishek
@AbhiChachan
Jan 17 2016 04:22 UTC
yes
that is one and the same thing
Kimber
@Kimber217
Jan 17 2016 04:22 UTC
okay so hypothetically i can keep count += 1;
Bekzat Omrzakov
@bekza
Jan 17 2016 04:22 UTC
help! needed! I did everything, nothing happened!
Remove all the backslashes ()
You should have two single quotes ' and four double quotes "
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";
CamperBot
@camperbot
Jan 17 2016 04:22 UTC
no wiki entry for: needed i did everything nothing happened remove all the backslashes you should have two single quotes and four double quotes var mystr a hrefhttpwwwexamplecom target_blanklinka
Bekzat Omrzakov
@bekza
Jan 17 2016 04:22 UTC
task:
Abhishek
@AbhiChachan
Jan 17 2016 04:23 UTC
yes
Kimber
@Kimber217
Jan 17 2016 04:23 UTC
okay @AbhiChachan i don't get this part
var holdorbet;
if (count <= 0){
holdorbet = count + " " + "Hold";
}else {
holdorbet = count + " " + "Bet";
}
ohhh waiat
i see it now
why can't you just do though like count + " Hold";?
**why can't you just do
count + " Hold";
i don't quite understand that
Abhishek
@AbhiChachan
Jan 17 2016 04:25 UTC
because we need to add a space
Kimber
@Kimber217
Jan 17 2016 04:25 UTC
i see
Salad
@Saladg
Jan 17 2016 04:25 UTC
var myStr = '<a href="http://www.example.com" target="_blank">Link</a>';
Abhishek
@AbhiChachan
Jan 17 2016 04:25 UTC
as is the requirement of the exercise
Salad
@Saladg
Jan 17 2016 04:25 UTC
@bekza , try this:
var myStr = '<a href="http://www.example.com" target="_blank">Link</a>';
Anyone with solution to this:
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.

This is the code:
function queue(arr, item) {
// Your code here
testArr.push(item);
testArr.shift();
return testArr.unshift(); // Change this line
}

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

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

Pandarati
@Pandarati
Jan 17 2016 04:28 UTC

@Kimber217

count + " Hold";

That works also.

Kimber
@Kimber217
Jan 17 2016 04:28 UTC
@AbhiChachan why doesn't
  }

  if (count >= 0){
  return count + " " + "Bet";
  } else {
    return count + " " + "Hold";
  }
  // Only change code above this line
}
work?
Abhishek
@AbhiChachan
Jan 17 2016 04:29 UTC
it should be count <=0
instead of count >= 0
Kimber
@Kimber217
Jan 17 2016 04:29 UTC
but if the count is positive, then we would be saying "bet"
Abhishek
@AbhiChachan
Jan 17 2016 04:30 UTC
then mention count >0
instead of count >=0
@Kimber217 we should bet only when it is positive
Kimber
@Kimber217
Jan 17 2016 04:31 UTC
if (count >= 0){
return count + " " + "Bet";
}
else if (count === 0){
return count + " " + "Hold";
}
else {
return count + " " + "Hold";
}
Abhishek
@AbhiChachan
Jan 17 2016 04:32 UTC
the first argument is not true
Kimber
@Kimber217
Jan 17 2016 04:32 UTC
OMG i'm so dumb
i see it!
thankyou @AbhiChachan
Abhishek
@AbhiChachan
Jan 17 2016 04:32 UTC
@Kimber217 you are welcome and you are not dumb. even i am learning :)
Pandarati
@Pandarati
Jan 17 2016 04:32 UTC
@Kimber217 Seperate the "thank" from you so that @AbhiChachan can get brownie points for helping you today :)
CamperBot
@camperbot
Jan 17 2016 04:32 UTC
pandarati sends brownie points to @kimber217 and @abhichachan :sparkles: :thumbsup: :sparkles:
:star: 206 | @abhichachan | http://www.freecodecamp.com/abhichachan
:star: 243 | @kimber217 | http://www.freecodecamp.com/kimber217
Kimber
@Kimber217
Jan 17 2016 04:33 UTC
thank you @AbhiChachan
CamperBot
@camperbot
Jan 17 2016 04:33 UTC
kimber217 sends brownie points to @abhichachan :sparkles: :thumbsup: :sparkles:
:star: 207 | @abhichachan | http://www.freecodecamp.com/abhichachan
Kimber
@Kimber217
Jan 17 2016 04:33 UTC
i keep forgetting to do that :(
Abhishek
@AbhiChachan
Jan 17 2016 04:33 UTC
oh great. what happens with brownie point
points
Kimber
@Kimber217
Jan 17 2016 04:34 UTC
@Pandarati do you work for fcc? you should if you dont :)
help brownie points
CamperBot
@camperbot
Jan 17 2016 04:34 UTC

:point_right: brownie points [wiki]

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

A user profile picture next to a with Brownie Points score

There are three ways you can get Brownie Points:

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

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

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

Salad
@Saladg
Jan 17 2016 04:34 UTC
Am stuck!!
Pandarati
@Pandarati
Jan 17 2016 04:34 UTC
wiki Brownie Points
CamperBot
@camperbot
Jan 17 2016 04:34 UTC

:point_right: brownie points [wiki]

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

A user profile picture next to a with Brownie Points score

There are three ways you can get Brownie Points:

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

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

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

Abhishek
@AbhiChachan
Jan 17 2016 04:35 UTC
ohk
Pandarati
@Pandarati
Jan 17 2016 04:35 UTC
@Kimber217 No, I don't. But thanks :)
CamperBot
@camperbot
Jan 17 2016 04:35 UTC
pandarati sends brownie points to @kimber217 :sparkles: :thumbsup: :sparkles:
:warning: pandarati already gave kimber217 points
Abhishek
@AbhiChachan
Jan 17 2016 04:35 UTC
chalo see ya guys
take care
Kimber
@Kimber217
Jan 17 2016 04:36 UTC
do you code for a living @Pandarati ?
Pandarati
@Pandarati
Jan 17 2016 04:36 UTC
@Kimber217 No. I'm still in highschool :P
Kimber
@Kimber217
Jan 17 2016 04:36 UTC
ughhh
jealous
Pandarati
@Pandarati
Jan 17 2016 04:37 UTC
lol
Abhishek
@AbhiChachan
Jan 17 2016 04:37 UTC
where are you guys from?
@Kimber217 @Pandarati
Kimber
@Kimber217
Jan 17 2016 04:38 UTC
boston
Yasin Yusuf
@YasinYA
Jan 17 2016 04:38 UTC
can anybody help me with this to give a head up http://www.freecodecamp.com/challenges/reverse-a-string#
Kimber
@Kimber217
Jan 17 2016 04:38 UTC
wiki reverse-a-string
CamperBot
@camperbot
Jan 17 2016 04:38 UTC

:point_right: bonfire reverse a string [wiki]

Problem Explanation:

You need to take the string and reverse it so if you had originally 'hello', it will turn into 'olleh'. Because you will need to split it, you will be working with Arrays too.

:pencil: read more about bonfire reverse a string on the FCC Wiki

Yasin Yusuf
@YasinYA
Jan 17 2016 04:39 UTC
let me try that @Kimber217
Abhishek
@AbhiChachan
Jan 17 2016 04:39 UTC
@Kimber217 nice. great place. what do you do for a living?
Kimber
@Kimber217
Jan 17 2016 04:39 UTC
i work in fashion
i basically dress people for a living
it's...not that great
Abhishek
@AbhiChachan
Jan 17 2016 04:40 UTC
sounds great though
Kimber
@Kimber217
Jan 17 2016 04:40 UTC
its not
it actually sucks
hahahaha
it's fun
but the pay is awful
what about you
Abhishek
@AbhiChachan
Jan 17 2016 04:41 UTC
@Kimber217 all over the world, most employees have this qualm. i work in marketing and strategy
Linearcitrus
@Linearcitrus
Jan 17 2016 04:43 UTC
Can anyone help me figure out what's wrong with my code please? This is from the "Testing Objects for Properties".
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  if (myObj.hasOwnProperty(checkProp)) {
    return myObj.checkProp;
  } else {

  return "Not Found";
  }
}

// Test your code by modifying these values
checkObj("gift");
When I run it, it returns nothing. Just blank. No errors, no values
Yasin Yusuf
@YasinYA
Jan 17 2016 04:45 UTC
function checkObj(checkProp) {
  // Your Code Here

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

}
Valerie Rickert
@ValerieR59
Jan 17 2016 04:45 UTC
I am having the same problem @Linearcitrus!!
Yasin Yusuf
@YasinYA
Jan 17 2016 04:46 UTC
@Linearcitrus you were close
that is the solution @ValerieR59 @Linearcitrus
Linearcitrus
@Linearcitrus
Jan 17 2016 04:46 UTC
hmm, doesn't the hasOwnProperty method return a true or false value though?
I'm confused as to why you have to test it against true (i.e. === true)
Valerie Rickert
@ValerieR59
Jan 17 2016 04:47 UTC
Yes but you do not need to check for '!==true'. just use 'else return "Not Found".
Linearcitrus
@Linearcitrus
Jan 17 2016 04:48 UTC
thank you @YasinYA and @ValerieR59
CamperBot
@camperbot
Jan 17 2016 04:48 UTC
linearcitrus sends brownie points to @yasinya and @valerier59 :sparkles: :thumbsup: :sparkles:
:star: 304 | @valerier59 | http://www.freecodecamp.com/valerier59
:star: 253 | @yasinya | http://www.freecodecamp.com/yasinya
Valerie Rickert
@ValerieR59
Jan 17 2016 04:48 UTC
because the 'else' of true will always be 'false'.
Thank you! You helped me also @Linearcitrus !!
CamperBot
@camperbot
Jan 17 2016 04:48 UTC
valerier59 sends brownie points to @linearcitrus :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for linearcitrus
Yasin Yusuf
@YasinYA
Jan 17 2016 04:49 UTC
try it @ValerieR59
NP @Linearcitrus
Micah Bales
@micahbales
Jan 17 2016 04:51 UTC
Hello! I'm having a bit of trouble with my first JSON lesson. Can someone help me figure out what is wrong with my code?
Kimber
@Kimber217
Jan 17 2016 04:54 UTC
wiki introducing javascript object notation
CamperBot
@camperbot
Jan 17 2016 04:54 UTC

: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

Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 04:54 UTC
It looks like closed off the array
Micah Bales
@micahbales
Jan 17 2016 04:55 UTC
Yes, @Kimber217 , that's the code I'm looking at. But when I add my own additional item in the array, I'm getting errors I don't know how to make sense of.
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 04:55 UTC
@micahbales
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1993,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }
  // Add record here

   {
    "artist": "Metallica",
    "title": "Black Album",
    "release_year": "1991",
    "formats": [
    "CD",
    "Vinyl"
    ]
  }
];
Micah Bales
@micahbales
Jan 17 2016 04:57 UTC
@KellenKolbeck the lesson doesn't seem to like that code
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 04:57 UTC
There is still one error with that
Might anyone know why my ' return "Not Found" will not work - it works fine if I comment out the entire 'if' statement.
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 04:57 UTC
There should be a comma after the first object in the array
Micah Bales
@micahbales
Jan 17 2016 04:57 UTC
@KellenKolbeck rather than the semicolon?
@KellenKolbeck when I do that, I get a number of other errors
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 04:59 UTC
@micahbales
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1993,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  },
  // Add record here
   {
    "artist": "Metallica",
    "title": "Black Album",
    "release_year": 1991,
    "formats": [
    "CD",
    "Vinyl"
    ]
  }
];
NemanjaMandic
@NemanjaMandic
Jan 17 2016 04:59 UTC

@AbhiChachan This solution works for me:
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count ++;
break;
case 7:
case 8:
case 9:
count = 0;
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count --;
break;
case 3:
case 2:
case 'A':
case 10:
case 'K':
count--;
break;

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

Abhishek
@AbhiChachan
Jan 17 2016 05:00 UTC
Even this is good
Micah Bales
@micahbales
Jan 17 2016 05:00 UTC
Nice. Thank you, @KellenKolbeck !
CamperBot
@camperbot
Jan 17 2016 05:00 UTC
micahbales sends brownie points to @kellenkolbeck :sparkles: :thumbsup: :sparkles:
:star: 227 | @kellenkolbeck | http://www.freecodecamp.com/kellenkolbeck
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 05:00 UTC
@micahbales In your example you had closed the array before putting the second object in the array. See the difference?
Micah Bales
@micahbales
Jan 17 2016 05:00 UTC
I appreciate you helping me work through that.
I see it. For some reason I thought I needed brackets for each object,
rather than just braces
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 05:01 UTC
Yeah just need [ ] for array, { } for object
Micah Bales
@micahbales
Jan 17 2016 05:01 UTC
Got it. That makes a lot more sense.
Abhishek
@AbhiChachan
Jan 17 2016 05:01 UTC
@NemanjaMandic you have used else if statement and placed the arguments in logical order. This is can be shortened by avoiding elseif statement
Micah Bales
@micahbales
Jan 17 2016 05:02 UTC
With that, I think I'm going to go to bed! Have a great night!
Gaege Root
@GaegeRoot
Jan 17 2016 05:04 UTC
Hello ladies!
Anybody around to provide some insight?
Valerie Rickert
@ValerieR59
Jan 17 2016 05:09 UTC
Ok, so i'm trying to do the next one on myPlants. I thought I had the answer but I'm doing something wrong. Here it is:

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

// Only change code below this line

var secondTree = myPlants.type1.list1; // Change this line

Ok, this copy is showing the wrong stuff: It should be var seondTree = myPlants.type1.lists1. Why is this a problem? I thought it would equal : pine.
Ok...the 1 should be enclosed in square brackets...
NemanjaMandic
@NemanjaMandic
Jan 17 2016 05:11 UTC
@ValerieR59 Yes
Valerie Rickert
@ValerieR59
Jan 17 2016 05:12 UTC
I mean I type square brackets but when I enter from this screen, nothing shows up. Assume brackets around the '1'.
Assuming square brackets around the '1', do you see a problem with this?

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

// Only change code below this line

var secondTree = myPlants.type1.list1; // Change this line

Why is secondTree wrong?
Sorry guys. My copy is not working...Ugh.
Wilson Heres
@hereswilson
Jan 17 2016 05:17 UTC
How do you match only alphanumeric characters excluding underscore with regex?
Herman Fassett
@HermanFassett
Jan 17 2016 05:18 UTC
[\W_] is one way
Wilson Heres
@hereswilson
Jan 17 2016 05:20 UTC
that made it worse...not sure why
I've been using /\W/g
Herman Fassett
@HermanFassett
Jan 17 2016 05:22 UTC
Well ofc /[\W_]/g
Yasin Yusuf
@YasinYA
Jan 17 2016 05:23 UTC
hey @HermanFassett
Herman Fassett
@HermanFassett
Jan 17 2016 05:23 UTC
Hey @YasinYA
Yasin Yusuf
@YasinYA
Jan 17 2016 05:23 UTC

function palindrome(str) {
  // Good luck!

  var regex = /\w+\S[^\d\W]/;
  var result = str.exec(regex);
  if(result == true) {
      alert("nice");
  }
  esle {
       alert("try agian");
  }

};



palindrome("eye");
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 05:23 UTC
Anyone done the "Nesting For Loops" waypoint?
Yasin Yusuf
@YasinYA
Jan 17 2016 05:24 UTC
@HermanFassett can you tell me what is wrong with this code
Wilson Heres
@hereswilson
Jan 17 2016 05:24 UTC
@HermanFassett you're my hero, what did the brackets do?
Yasin Yusuf
@YasinYA
Jan 17 2016 05:24 UTC
@KellenKolbeck yeah
Herman Fassett
@HermanFassett
Jan 17 2016 05:24 UTC
@hereswilson Anything in brackets are treated as or, so say you had [abc] that'd be a or b or c
Yasin Yusuf
@YasinYA
Jan 17 2016 05:24 UTC
what is your problem
Herman Fassett
@HermanFassett
Jan 17 2016 05:25 UTC
@YasinYA well first of "esle"
Gaege Root
@GaegeRoot
Jan 17 2016 05:25 UTC
anyone recently done the "profile lookup" challenge?
Herman Fassett
@HermanFassett
Jan 17 2016 05:25 UTC
And what's str.exec?
Doesn't work on string
Yasin Yusuf
@YasinYA
Jan 17 2016 05:26 UTC
@HermanFassett so do i use match
Herman Fassett
@HermanFassett
Jan 17 2016 05:26 UTC
@YasinYA you could do regex.exec(str) but not sure if it's what you want idk haven't used it much
Wilson Heres
@hereswilson
Jan 17 2016 05:26 UTC
thanks @HermanFassett
CamperBot
@camperbot
Jan 17 2016 05:26 UTC
hereswilson sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 1377 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Necmettin Karakaya
@Necmttn
Jan 17 2016 05:26 UTC
Hey guys,
// 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(value !== "" && prop === "tracks" ){
    collection[id].prop.push(value);
  }else if(value === ""){
    delete collection[id].prop;
  }


  return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");
what i'm missing ?
Yasin Yusuf
@YasinYA
Jan 17 2016 05:27 UTC
@HermanFassett yes it works but how about my regex
Gaege Root
@GaegeRoot
Jan 17 2016 05:27 UTC
You can't reference prop with dot notation in that case
B Manoj Kumar
@bmkmanoj
Jan 17 2016 05:27 UTC
Hi All. We have created recently a GitHub repo for learning JavaScript by examples. Let me your thoughts after you take a look at the content. If you like it, do give it a :star: link: https://github.com/bmkmanoj/js-by-examples
Gaege Root
@GaegeRoot
Jan 17 2016 05:27 UTC
@Necmttn
you must use bracket notation to reference the prop parameter
Yasin Yusuf
@YasinYA
Jan 17 2016 05:28 UTC
am trying to filter out all number ,puncuations, symbols
Gaege Root
@GaegeRoot
Jan 17 2016 05:29 UTC
@Necmttn so it'd be collection[id][prop] not collection[id].prop
Herman Fassett
@HermanFassett
Jan 17 2016 05:29 UTC
@YasinYA well you'll probably want to use str.replace(regex, "") then and your regex will need to change
Yasin Yusuf
@YasinYA
Jan 17 2016 05:30 UTC
ok @HermanFassett thanks
CamperBot
@camperbot
Jan 17 2016 05:30 UTC
yasinya sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 1378 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Necmettin Karakaya
@Necmttn
Jan 17 2016 05:31 UTC
@GaegeRoot earlier i tought is not working example[a][b] . now i see. Thanks mate.
CamperBot
@camperbot
Jan 17 2016 05:31 UTC
necmttn sends brownie points to @gaegeroot :sparkles: :thumbsup: :sparkles:
:star: 79 | @gaegeroot | http://www.freecodecamp.com/gaegeroot
Gaege Root
@GaegeRoot
Jan 17 2016 05:31 UTC
@Necmttn no worries!
Salad
@Saladg
Jan 17 2016 05:35 UTC
golfScore(4, 1) should return "Hole-in-one!"
Jared
@jsayre007
Jan 17 2016 05:35 UTC
Having trouble with the wordBlanks Madlibs section, it says I need to make reference to myNoun, MyAdjective, myAdverb, etc... can someone show me an example of the proper way to write this code? I feel like I've tried every way possible...well, every way except the right way lol
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 05:36 UTC
I don't understand how this nesting for loops waypoint works
Salad
@Saladg
Jan 17 2016 05:36 UTC
@jsayre007 , paste the code
Necmettin Karakaya
@Necmttn
Jan 17 2016 05:39 UTC
``` wiki
Jared
@jsayre007
Jan 17 2016 05:39 UTC

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
var myString = 'this is my' + myNoun + 'that is ' + myAdjective + 'and he ' + myVerb + 'very' + myAdverb;

// Your code above this line
return result;
}

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

Salad
@Saladg
Jan 17 2016 05:41 UTC
@jsayre007 , you should have spaces between the quotes:
result=myNoun+" "+myAdjective+" "+myVerb+" "+myAdverb;
JR Moreau
@jrmoreau
Jan 17 2016 05:41 UTC
Can anyone take a lok at my code for making instances of objects with a constructor function and tell me what I'm missing?

'''var Car = function() {
this.wheels = 4;
this.engines = 1;
this.seats = 1;
};

// Only change code below this line.

var myCar = new Car();
Car.color = "black";
'''

CamperBot
@camperbot
Jan 17 2016 05:41 UTC
:bulb: to format code use backticks! ``` more info
JR Moreau
@jrmoreau
Jan 17 2016 05:42 UTC

```var Car = function() {
this.wheels = 4;
this.engines = 1;
this.seats = 1;
};

// Only change code below this line.

var myCar = new Car();
Car.color = "black";
```

Jared
@jsayre007
Jan 17 2016 05:42 UTC
@Saladg ,
Christopher Ngo
@ingochris
Jan 17 2016 05:42 UTC
Hi
Gaege Root
@GaegeRoot
Jan 17 2016 05:43 UTC
testing this code biznass
JR Moreau
@jrmoreau
Jan 17 2016 05:43 UTC
var Car = function() {
  this.wheels = 4;
  this.engines = 1;
  this.seats = 1;
};

// Only change code below this line.

var myCar = new Car(); 
Car.color = "black";
Gaege Root
@GaegeRoot
Jan 17 2016 05:43 UTC
ahhhhh
Jared
@jsayre007
Jan 17 2016 05:45 UTC
@Saladg lol, thank you so much!! I totally misunderstood that challenge!
CamperBot
@camperbot
Jan 17 2016 05:45 UTC
jsayre007 sends brownie points to @saladg :sparkles: :thumbsup: :sparkles:
:star: 198 | @saladg | http://www.freecodecamp.com/saladg
Christopher Ngo
@ingochris
Jan 17 2016 05:45 UTC
function findLongestWord(str) {

  //var longestWord = 0;
  var longest = 0;
  var arr = str.split(" ");

  for (var i = 0; i < arr.length; i++) {
    if (arr[i].length > longest) {
      //longestWord = arr[i];
      longest = arr[i].length;
    }
    return longest;
  }
}
findLongestWord("May the force be with you");
What's wrong with my for loop?
Justine Yapyuco
@jyapyuco
Jan 17 2016 05:46 UTC
hi, I need some help with "Binary Agents"
the challenge gives a binary string such as: 01000001 01110010 01100101 01101110 00100111
Salad
@Saladg
Jan 17 2016 05:46 UTC
U welcome @jsayre007
Justine Yapyuco
@jyapyuco
Jan 17 2016 05:47 UTC
which you need to convert to english text
the problem is the binary code converts to Chinese if you use fromCharCode
this is my code so far:

```function binaryAgent(str) {

var binaryArray = str.split(" ");
var chineseArray = [];
var utfArray = [];
var engArray = [];

for(i=0;i<binaryArray.length;i++){
chineseArray.push(String.fromCharCode(binaryArray[i]));
}

for(i=0;i<chineseArray.length;i++){
utfArray.push(chineseArray[i].charCodeAt(0));
}

for(i=0;i<utfArray.length;i++){
utfArray[i]=utfArray[i] - 16846;
}

for(i=0;i<utfArray.length;i++) {
engArray[i] = String.fromCharCode(utfArray[i]);
}

return engArray;
}```

oops
function binaryAgent(str) {

  var binaryArray = str.split(" ");
  var chineseArray = [];
  var utfArray = [];
  var engArray = [];

  for(i=0;i<binaryArray.length;i++){
    chineseArray.push(String.fromCharCode(binaryArray[i]));
  }

  for(i=0;i<chineseArray.length;i++){
    utfArray.push(chineseArray[i].charCodeAt(0));
  }

  for(i=0;i<utfArray.length;i++){
    utfArray[i]=utfArray[i] - 16846;
  }

  for(i=0;i<utfArray.length;i++) {
    engArray[i] = String.fromCharCode(utfArray[i]);
  }

  return engArray;
}
I'm not sure what I should be reading on
iokonokh
@iokonokh
Jan 17 2016 06:01 UTC
// Example
var ourArr = [ 9, 10, 11, 12];
var ourTotal = 0;

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

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

// Only change code below this line
var total = 0;
for (var i = 0; i < myArr.length; i ++) {
  total += total[i];
}
Devyn Hedin
@djhedin
Jan 17 2016 06:09 UTC
Anyway able to help out with Profile Lookup? I think I'm getting there but I've stalled
JR Moreau
@jrmoreau
Jan 17 2016 06:10 UTC
@djhedin what's your code?
iokonokh
@iokonokh
Jan 17 2016 06:11 UTC
can someone tell me why my cost doesn't work
Devyn Hedin
@djhedin
Jan 17 2016 06:11 UTC
So far I've managed to get the correct last name but I can't get the prop
function lookUp(firstName, prop){
// Only change code below this line
  for (var i = 0; i < contacts.length; i++) {
    if(contacts[i].firstName == firstName) {
      for(var j = 0; j < contacts[i].length; j++) {
        if(contacts[i][j] == contacts[i][prop]) {
          return contacts[i][prop];
        }
      }
      return contacts[i].lastName;
    }

  }
// Only change code above this line
}
JR Moreau
@jrmoreau
Jan 17 2016 06:13 UTC
@djhedin your first if statement needs an hasOwnP
@djhedin sorry, check this out
  for( var i = 0; i < contacts.length; i++ ){
    if( firstName == contacts[i].firstName ) {
      if( contacts[i].hasOwnProperty( prop ) ) {
        return contacts[i][prop];
      } else {
        return "No such property";
      }
    }
  }
  return "No such contact";
Devyn Hedin
@djhedin
Jan 17 2016 06:15 UTC
@jrmoreau Ok, that makes more sense. Any idea why mine doesn't seem to work correctly?
JR Moreau
@jrmoreau
Jan 17 2016 06:16 UTC
@djhedin the hasOwnProperty means if there's a result for that, it'll go to the next step and show the property. I believe yours would stop there.
Devyn Hedin
@djhedin
Jan 17 2016 06:17 UTC
@jrmoreau Alright, thanks for the help!
CamperBot
@camperbot
Jan 17 2016 06:17 UTC
djhedin sends brownie points to @jrmoreau :sparkles: :thumbsup: :sparkles:
:star: 239 | @jrmoreau | http://www.freecodecamp.com/jrmoreau
NemanjaMandic
@NemanjaMandic
Jan 17 2016 06:22 UTC
Instructions
Use the playerNumber variable to lookup player 16 in testObj using bracket notation.:
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};
I used this. Shouldn't it be correct!?
var playerNumber = testObj1;
var playerNumber = testObj1
Adrian Vela
@AdrianVC
Jan 17 2016 06:23 UTC
Hi i need help with bonfaire Title Case a Sentence
Ken Murphy
@ken-murphy
Jan 17 2016 06:25 UTC
@AdrianVC I am working on that one, too. Maybe we can help each other.
This is what I have
function titleCase(str) {

  str = str.toLowerCase();
  var arr = new Array([]);

  arr = str.split(" ");

  var len = arr.length;

  for ( i = 0; i < len; i++ ) {

    arr[i][0].toUpperCase();

  }

  str = arr.join(" ");


  return str;
}

titleCase("I'm a little tea pot");
I'm getting back : "i'm a little tea pot" so i guess the for statement isn't working
iokonokh
@iokonokh
Jan 17 2016 06:33 UTC
// Example
var ourArr = [ 9, 10, 11, 12];
var ourTotal = 0;

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

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

// Only change code below this line
var total = 0;
for(var i = 0; i < myArr.length; i ++){
  total += total[i];

}
Caleb
@Landenyr
Jan 17 2016 06:35 UTC
@ken-murphy You're trying to change a sub array in your for loop that isn't there. Try creating another array from the characters of the word before you try changing the first character to uppercase.
This message was deleted
iokonokh
@iokonokh
Jan 17 2016 06:38 UTC
any advice foe me?
Ken Murphy
@ken-murphy
Jan 17 2016 06:40 UTC
@Landenyr OK I will give it a try.
Christopher Ngo
@ingochris
Jan 17 2016 06:40 UTC
What's up, @iokonokh ?
iokonokh
@iokonokh
Jan 17 2016 06:40 UTC
i think the is a bug on my waypoint
Ken Murphy
@ken-murphy
Jan 17 2016 06:41 UTC
@Landenyr Actually, how would I do that?
Christopher Ngo
@ingochris
Jan 17 2016 06:41 UTC
It's commented out
Ken Murphy
@ken-murphy
Jan 17 2016 06:42 UTC
@Landenyr This is my array from the split.
blob
Oh I see there's only one array!
Caleb
@Landenyr
Jan 17 2016 06:45 UTC

@ken-murphy The same way you did your first one, just inside your for loop, and then don't forget to join it back to a string.

This is would create a new array out of the word you are on in your for loop:

var newArr = arr[i].split('');
CamperBot
@camperbot
Jan 17 2016 06:45 UTC
:bulb: to format code use backticks! ``` more info
iokonokh
@iokonokh
Jan 17 2016 06:45 UTC
no its not commented out thats just how it formats the code in the chat
Adrian Vela
@AdrianVC
Jan 17 2016 06:50 UTC
I just finish .this is my code ...
@ken-murphy

function titleCase(str)
{
var wor = str.toLowerCase().split(" ");
var tamwor = wor.length;
var letra;
var pala;
for(var i=0;i<tamwor;i++)
{
letra = wor[i].charAt(0).toUpperCase() + wor[i].slice(1).toLowerCase();
wor[i]=letra;
}
pala = wor.join(' ');
return pala;
}

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

Surya Dutt
@SuryaDuttCH
Jan 17 2016 06:52 UTC
can someone explain me the concept of "using objects for lookups"
Ken Murphy
@ken-murphy
Jan 17 2016 06:58 UTC
@AdrianVC Thanks much!
CamperBot
@camperbot
Jan 17 2016 06:58 UTC
ken-murphy sends brownie points to @adrianvc :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for adrianvc
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 07:01 UTC
wiki tolowercase
CamperBot
@camperbot
Jan 17 2016 07:01 UTC

:point_right: js string prototype tolowercase [wiki]

String.prototype.toLowerCase()

The JavaScript method .toLowerCase() returns the same string it was called on, but in all lower case.

Syntax

str.toLowerCase()

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

Sidharth Kriplani
@sidkrip
Jan 17 2016 07:03 UTC

I am having this tiny problem in Basic Javascript "Using Objects for lookups"
` var lookup= {
"alpha": "Adams",
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank"
};

result+=lookup[val];

`

this is the error: phoneticLookup("") should equal undefined .
Aakar Dwivedi
@aakardwivedi
Jan 17 2016 07:04 UTC
I am having a problem with "Record Collection"
H8ToDoThis
@H8ToDoThis
Jan 17 2016 07:05 UTC
@sidkrip Looks like mine, but I didn't use the += I just used =
Aakar Dwivedi
@aakardwivedi
Jan 17 2016 07:05 UTC

// 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 !== "")
{
if(prop != "tracks")
{
id.prop = value;
}
else
{
id.prop.push(value);
}
}
else
delete id.prop;

return collection;
}

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

I can't understand what the question wants us to return
as the collection
Salad
@Saladg
Jan 17 2016 07:10 UTC
Help!:
You will write a card counting function. It will receive a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative. The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.

This is my code:
var count = 0;

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

}

if(count<=1)
{
return "5 Bet";
}
else if(count===0)
{
return "0 Hold";
}
else if(count<0)
{
return "-1 Hold";
}

// Only change code above this line
}

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

Justine Yapyuco
@jyapyuco
Jan 17 2016 07:14 UTC
hi helpjavascript, any advice for me?
function binaryAgent(str) {

  var binaryArray = str.split(" ");
  var chineseArray = [];
  var utfArray = [];
  var engArray = [];

  for(i=0;i<binaryArray.length;i++){
    chineseArray.push(String.fromCharCode(binaryArray[i]));
  }

  for(i=0;i<chineseArray.length;i++){
    utfArray.push(chineseArray[i].charCodeAt(0));
  }

  for(i=0;i<utfArray.length;i++){
    utfArray[i]=utfArray[i] - 16846;
  }

  for(i=0;i<utfArray.length;i++) {
    engArray[i] = String.fromCharCode(utfArray[i]);
  }

  return engArray;
}
I don't know what topic I need to wiki
regarding turning binary into Chinese characters then into English characters
H8ToDoThis
@H8ToDoThis
Jan 17 2016 07:19 UTC
@Saladg So I looked back at my solution, and you've got a lot more stuff at the end then I do. What errors are you getting?
NemanjaMandic
@NemanjaMandic
Jan 17 2016 07:23 UTC
@Saladg
if(count > 0) {
return count + " Bet";
} else {
return count + " Hold";
}
}
H8ToDoThis
@H8ToDoThis
Jan 17 2016 07:23 UTC
@Saladg Count should not equal count for starters
Olawale Akinseye
@brainyfarm
Jan 17 2016 07:24 UTC
@jyapyuco
Found a solution?
Diksha
@Diksha261
Jan 17 2016 07:27 UTC

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

return item; // Change this line
}

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

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

in this i have to add the number at the end of array and remove the first element of array
help me ...
CamperBot
@camperbot
Jan 17 2016 07:28 UTC
no wiki entry for: me out guys
Olawale Akinseye
@brainyfarm
Jan 17 2016 07:32 UTC
@Diksha261
You are yet to write your code.
Necmettin Karakaya
@Necmttn
Jan 17 2016 07:36 UTC
function rot13(str) { // LBH QVQ VG!
  var numbers = [];
  for(var i =0; i < str.length; i++) {
    numbers += ","+ 13 + str.charCodeAt(i);
  }


  return String.fromCharCode(numbers);
}


// Change the inputs below to test
rot13("SERR PBQR PNZC");
how can i speared each charcode ?
Sidharth Kriplani
@sidkrip
Jan 17 2016 07:39 UTC
@H8ToDoThis thanks
CamperBot
@camperbot
Jan 17 2016 07:39 UTC
sidkrip sends brownie points to @h8todothis :sparkles: :thumbsup: :sparkles:
:star: 218 | @h8todothis | http://www.freecodecamp.com/h8todothis
Enosh Shrestha
@eroj333
Jan 17 2016 07:39 UTC
hey guys..... "0_0 (: /-\ :) 0-0" isn't a palindrome but one of the goals is: palindrome("0_0 (: /-\ :) 0-0") should return true...... so what should i do with it
Justine Yapyuco
@jyapyuco
Jan 17 2016 07:40 UTC
@brainyfarm nope, not yet. not sure if this is something that could be solved using Unicode values (reading about it now) or through some translation API
Brian
@sludge256
Jan 17 2016 07:43 UTC
@eroj333 remove all symbols
Olawale Akinseye
@brainyfarm
Jan 17 2016 07:46 UTC
@jyapyuco
Here is hint for you :)
parseInt('1000001', 2) // Gives you 65

String.fromCharCode(65) // Gives you 'A'
Justine Yapyuco
@jyapyuco
Jan 17 2016 07:47 UTC
@Necmttn i think you'll need to decode each letter individually, then concatenate all the decoded letters together
ohhhhhhh
Enosh Shrestha
@eroj333
Jan 17 2016 07:47 UTC
thanks @sludge256 ... solved it
CamperBot
@camperbot
Jan 17 2016 07:47 UTC
:star: 869 | @sludge256 | http://www.freecodecamp.com/sludge256
eroj333 sends brownie points to @sludge256 :sparkles: :thumbsup: :sparkles:
Olawale Akinseye
@brainyfarm
Jan 17 2016 07:47 UTC
yeah @jyapyuco ;)
Justine Yapyuco
@jyapyuco
Jan 17 2016 07:48 UTC
@brainyfarm ohh, so the binary code shouldn't have translated into Chinese characters
oh
wait
ill try it out
Olawale Akinseye
@brainyfarm
Jan 17 2016 07:48 UTC
Okay @jyapyuco :)
Justine Yapyuco
@jyapyuco
Jan 17 2016 07:48 UTC
@brainyfarm thanks for the hint
CamperBot
@camperbot
Jan 17 2016 07:48 UTC
jyapyuco sends brownie points to @brainyfarm :sparkles: :thumbsup: :sparkles:
:star: 1080 | @brainyfarm | http://www.freecodecamp.com/brainyfarm
Olawale Akinseye
@brainyfarm
Jan 17 2016 07:48 UTC
Let me know how it goes @jyapyuco :)
Sidharth Kriplani
@sidkrip
Jan 17 2016 07:49 UTC
Testing objects for properties, error is that checkProp is not defined. here is the code:
function checkObj(checkProp) { // Your Code Here if(myObj.hasOwnProperty(checkProp)) { return myObj[checkprop]; } else if (!myObj.hasOwnProperty(checkProp)) { return "Not found"; } }
Justine Yapyuco
@jyapyuco
Jan 17 2016 07:52 UTC
@brainyfarm just finished the challenge, thanks man
CamperBot
@camperbot
Jan 17 2016 07:52 UTC
jyapyuco sends brownie points to @brainyfarm :sparkles: :thumbsup: :sparkles:
:warning: jyapyuco already gave brainyfarm points
rphares @rphares waves at @brainyfarm
Olawale Akinseye
@brainyfarm
Jan 17 2016 07:53 UTC
This message was deleted
@Necmttn .map might do what you want.
You still have some tweaking to do though
function rot13(str) { // LBH QVQ VG!
  var numbers = [];
  for(var i =0; i < str.length; i++) {
    numbers.push(13 + str.charCodeAt(i));
  }

  return numbers.map(function(each){
   return String.fromCharCode(each)
  }).join("")


}
// Change the inputs below to test
rot13("SERR PBQR PNZC");
Hey @rphares
Good morning and welcome back :)
Diksha
@Diksha261
Jan 17 2016 07:54 UTC

function queue(arr, item) {
// Your code here
queue.push([4]);
var newArray = queue.shift();
return newArray; // Change this line
}

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

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

now what next i should do?
rphares
@rphares
Jan 17 2016 07:55 UTC
thanks, @brainyfarm :blush:
CamperBot
@camperbot
Jan 17 2016 07:55 UTC
rphares sends brownie points to @brainyfarm :sparkles: :thumbsup: :sparkles:
:star: 1081 | @brainyfarm | http://www.freecodecamp.com/brainyfarm
Aakar Dwivedi
@aakardwivedi
Jan 17 2016 07:55 UTC

@aakardwivedi
// 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 !== "")
{
if(prop != "tracks")
{
id.prop = value;
}
else
{
id.prop.push(value);
}
}
else
delete id.prop;

return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");
I can't understand what the question wants us to return
as the collection

@brainyfarm can u help?
Necmettin Karakaya
@Necmttn
Jan 17 2016 07:56 UTC

@brainyfarm i follow @jyapyuco idea,

function rot13(str) { // LBH QVQ VG!
  var decoded = "";
  for(var i =0; i < str.length; i++) {
    var char = 13 + str.charCodeAt(i);
    decoded += String.fromCharCode(char);

  }


  return decoded;
}


// Change the inputs below to test
rot13("SERR PBQR PNZC");

it's give me string result but not even closer to what i expect :)

`R__-]0....

it's something like this.

:D
Justine Yapyuco
@jyapyuco
Jan 17 2016 07:58 UTC
@Necmttn oh, i think you might have to tweak for some cases
@Necmttn like spaces
@Necmttn or if you go above the last letter of the alphabet
Olawale Akinseye
@brainyfarm
Jan 17 2016 08:01 UTC
@Diksha261 First you push in item to the array and you return what you shifted from the array :smile:
.
Rodrigo Fierro R.
@rodrigofierro
Jan 17 2016 08:01 UTC
Hi, is this room specific to Profile Lookup?
or just general Help.
Olawale Akinseye
@brainyfarm
Jan 17 2016 08:02 UTC
You can ask your questions here @rodrigofierro :)
@aakardwivedi
Could you format your code and tell what error you are getting?
Diksha
@Diksha261
Jan 17 2016 08:03 UTC
queue.push([4]);
var newArray = queue.shift();
return newArray;
i did it already
Rodrigo Fierro R.
@rodrigofierro
Jan 17 2016 08:03 UTC
thank you... I'm actually looking for a clue... I'm working on Profile Lookup. function lookUp(firstName, prop){ // Only change code below this line if (contacts.hasOwnProperty(firstName)) { if (contacts[firstName][prop].hasOwnProperty(prop)) { return contacts[firstName][prop]; } else { return "No such property"; } return "No such contact"; } // Only change code above this line }
Olawale Akinseye
@brainyfarm
Jan 17 2016 08:04 UTC
Format properly @rodrigofierro
Kyle Christian
@kylechristian77
Jan 17 2016 08:04 UTC
@brainyfarm you have to test for the return values of charAt to be between like 65 and 91 (cant remember exact numbers).
Olawale Akinseye
@brainyfarm
Jan 17 2016 08:04 UTC
explain format
CamperBot
@camperbot
Jan 17 2016 08:04 UTC

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Olawale Akinseye
@brainyfarm
Jan 17 2016 08:04 UTC

@brainyfarm you have to test for the return values of charAt to be between like 65 and 91 (cant remember exact numbers).

Wrong tag @kylechristian77 ?

Rodrigo Fierro R.