These are chat archives for FreeCodeCamp/HelpJavaScript

17th
Jan 2016
iokonokh
@iokonokh
Jan 17 2016 00:00
I was ChemE which was much easier than this stuff
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 17 2016 00:00
@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
@KaanMasters I got an AA from a crappy for-profit school, totally worthless in real life haha
re4ect
@re4ect
Jan 17 2016 00:02
@alanbuchanan I still don't see what I'm not suppose to edit.
Jon Grant
@jong649
Jan 17 2016 00:02
@rpmullig I'll check out what I did; that one was really confusing for me
wushupork
@wushupork
Jan 17 2016 00:04
@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
@rpmullig yup, that is the trick
what @wushupork said
rphares
@rphares
Jan 17 2016 00:09
@re4ect , let's give it one last go
paste what you have so far, please :blush:
wushupork
@wushupork
Jan 17 2016 00:09
WB @rphares :)
iokonokh
@iokonokh
Jan 17 2016 00:09
yes ChemE was hard but i understood it
Satchmo37
@Satchmo37
Jan 17 2016 00:10
Bonfire: Where art thou?
CamperBot
@camperbot
Jan 17 2016 00:10

: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
hint
CamperBot
@camperbot
Jan 17 2016 00:10
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
iokonokh
@iokonokh
Jan 17 2016 00:10
i think writing a term paper is hard
rphares
@rphares
Jan 17 2016 00:10
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
rphares sends brownie points to @wushupork :sparkles: :thumbsup: :sparkles:
:star: 294 | @wushupork | http://www.freecodecamp.com/wushupork
iokonokh
@iokonokh
Jan 17 2016 00:14
// 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
@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
@re4ect what code do you have so far?
Jason
@jimillett
Jan 17 2016 00:19
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
check out the last comment, @jimillett :)
Jon Grant
@jong649
Jan 17 2016 00:21
@jimillett do what last comment asks
Jason
@jimillett
Jan 17 2016 00:21
I tried removing the console log line
it doesn't help
rphares
@rphares
Jan 17 2016 00:21
which one? :)
Jason
@jimillett
Jan 17 2016 00:25
I have tried removing both console logs separately and neither one lets me pass it
Rory Smith
@alanbuchanan
Jan 17 2016 00:25
@jimillett what error message is it?
rphares
@rphares
Jan 17 2016 00:26
if it's maximum stack...
Jason
@jimillett
Jan 17 2016 00:26
no error, the output just shows myVar text of "test"
Rory Smith
@alanbuchanan
Jan 17 2016 00:27
@jimillett i copy and pasted your code and it passes
try clearing cache
Jason
@jimillett
Jan 17 2016 00:27
? how do you do that?
Jon Grant
@jong649
Jan 17 2016 00:27
@jimillett ctrl+F5
Jon Grant
@jong649
Jan 17 2016 00:28
@jimillett or what @alanbuchanan linked haha
rphares
@rphares
Jan 17 2016 00:29
(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
That did it
Jon Grant
@jong649
Jan 17 2016 00:29
@jimillett awesome
rphares
@rphares
Jan 17 2016 00:29
awesome,
but intriguing :)
Jason
@jimillett
Jan 17 2016 00:30
Thanks @jong649 @alanbuchanan
CamperBot
@camperbot
Jan 17 2016 00:30
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
@rphares i'm not sure. lots of bizarre little things like that in the challenges :smirk_cat:
rphares
@rphares
Jan 17 2016 00:30
good to know
iokonokh
@iokonokh
Jan 17 2016 00:31
// 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
@iokonokh collection[id] is { album: 'ABBA Gold' }
@iokonokh so collection[id][prop] doesn't exist
Jill
@ghjal
Jan 17 2016 00:34
Anyone know why all my old code is gone when I click on earlier map sections?
Rory Smith
@alanbuchanan
Jan 17 2016 00:35
@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
Oh, good! Thanks.
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 00:43
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
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
@KellenKolbeck you want == not =
Jon Grant
@jong649
Jan 17 2016 00:44
@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
What is the JS JSON function to find if the property exsists within the variable
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 00:45
hahhaha I can't believe I did that. @alanbuchanan thanks
CamperBot
@camperbot
Jan 17 2016 00:45
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
This message was deleted
Rory Smith
@alanbuchanan
Jan 17 2016 00:45
@KellenKolbeck you could also use a switch
@rpmullig Object.hasOwnProperty for object keys
Jon Grant
@jong649
Jan 17 2016 00:45
@rpmullig .hasOwnProp()
@rpmullig oops, yeah, .hasOwnProperty()
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 00:46
Yeah I know I like my if's though. Just had a brainfart.
Bobby Mulligan
@rpmullig
Jan 17 2016 00:47
thanks @jong649
CamperBot
@camperbot
Jan 17 2016 00:47
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
This message was deleted
Bobby Mulligan
@rpmullig
Jan 17 2016 00:48
thanks @alanbuchanan
CamperBot
@camperbot
Jan 17 2016 00:48
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
This message was deleted
CamperBot
@camperbot
Jan 17 2016 00:50
:bulb: to format code use backticks! ``` more info
Rory Smith
@alanbuchanan
Jan 17 2016 00:51
@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
Yeah that is definitely cleaner and easier to read
Rich Cordero
@corderophilosophy
Jan 17 2016 00:51
@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
This message was deleted
CamperBot
@camperbot
Jan 17 2016 00:54
:bulb: to format code use backticks! ``` more info
Hadrien Lepoutre
@H-L
Jan 17 2016 00:56
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
//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
@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
@H-L there's a little problem with that string
Rich Cordero
@corderophilosophy
Jan 17 2016 00:59
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
@H-L \b isn't a backslash
Hadrien Lepoutre
@H-L
Jan 17 2016 01:00
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
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
@H-L read them super carefully
Rich Cordero
@corderophilosophy
Jan 17 2016 01:01
@SareenCoder it's the double pipe ||
Rory Smith
@alanbuchanan
Jan 17 2016 01:01
@SareenCoder ||
Sumant Sareen
@SareenCoder
Jan 17 2016 01:01
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
@SareenCoder you have to hit shift and backslash
Rory Smith
@alanbuchanan
Jan 17 2016 01:02
@SareenCoder no it's the pipe, not two capital i's
Hadrien Lepoutre
@H-L
Jan 17 2016 01:02
@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
@alanbuchanan Ok thank you for the hint :D
CamperBot
@camperbot
Jan 17 2016 01:03
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
Thanks Alan
It worked haha
And Kellen for the effort
!
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:04
np
Anyone else having issues with viewing solutions on their profile?
Hadrien Lepoutre
@H-L
Jan 17 2016 01:07
I'm such a bad reader ahah
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:09
@H-L It's always the little things
Hadrien Lepoutre
@H-L
Jan 17 2016 01:09
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
?
Can you post it again?
Hadrien Lepoutre
@H-L
Jan 17 2016 01:10
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
I think you might just be missing ;
Rory Smith
@alanbuchanan
Jan 17 2016 01:13
and the spaces...
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:13
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
The code above is the return statement, not the JS itself... Ok i try it !
Eureka
!!
rocket
@rengas
Jan 17 2016 01:15
hi Guys! I also having same problem.
Hadrien Lepoutre
@H-L
Jan 17 2016 01:15
@KellenKolbeck thanks ! It was the spaces afterall ahah
CamperBot
@camperbot
Jan 17 2016 01:15
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
@H-L Like I said it always seems to be the little things...
Rory Smith
@alanbuchanan
Jan 17 2016 01:15
@H-L it'll be the semicolon as well
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 17 2016 01:15
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
Details, little details... anyway see you later and thanks again for your help ;)
Rory Smith
@alanbuchanan
Jan 17 2016 01:17
@KaanMasters charCodeAt returns a number
wushupork
@wushupork
Jan 17 2016 01:17
@KaanMasters that table is in hexadecimal, charCodeAt uses decimal
Kaan Erermis, PPE (Professional Pizza Eater)
@KaanMasters
Jan 17 2016 01:17
fromCharCode my bad
wushupork
@wushupork
Jan 17 2016 01:17
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
so you're telling me to use unicode i have to conver from hexadecimal to decimal
wushupork
@wushupork
Jan 17 2016 01:18
no
just use decimal
Morenar
@Morenar
Jan 17 2016 01:18
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
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
@Morenar can you post your code so far?
@1jstrong what have you got so far?
Morenar
@Morenar
Jan 17 2016 01:19
in a extra chat or direct here
Rory Smith
@alanbuchanan
Jan 17 2016 01:19
here
wiki format
CamperBot
@camperbot
Jan 17 2016 01:20

: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
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
@Morenar trees is the second element of the myPlants array. how would you call that?
Jason W Strong
@1jstrong
Jan 17 2016 01:21
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
@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

<// 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
@1jstrong what have you tried so far?
wushupork
@wushupork
Jan 17 2016 01:24
@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
sorry...am stuck. Don't know where to begin.
Rory Smith
@alanbuchanan
Jan 17 2016 01:25
@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
ahhh... .pop and .push. Thanks All!
Morenar
@Morenar
Jan 17 2016 01:26
@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
This message was deleted
wushupork
@wushupork
Jan 17 2016 01:27
@alanbuchanan yes, he doesn't need pop
Jason W Strong
@1jstrong
Jan 17 2016 01:27
Thanks much Alan B.!
Rory Smith
@alanbuchanan
Jan 17 2016 01:28
woops sorry - you don't need pop i should've said
@1jstrong
Bakari Holmes
@bakarih
Jan 17 2016 01:32
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
@bakarih that passes
Bakari Holmes
@bakarih
Jan 17 2016 01:33
Getting: RangeError: Maximum call stack size exceeded
Huh?
wushupork
@wushupork
Jan 17 2016 01:33
@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
@wushupork you can return arr.shift()
wushupork
@wushupork
Jan 17 2016 01:34
@alanbuchanan Really? because I've had more people complain about that :) (I never tried it)
kelly
@kwhms
Jan 17 2016 01:35
Hello - stuck on Quoting Strings with Single Quotes challenge.
Bakari Holmes
@bakarih
Jan 17 2016 01:35
@alanbuchanan that did it! Thanks!
CamperBot
@camperbot
Jan 17 2016 01:35
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
@kwhms what did you try?
kelly
@kwhms
Jan 17 2016 01:36

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
Is there anyone who can help point me in the right direction with Profile Lookup?
wushupork
@wushupork
Jan 17 2016 01:37
@alanbuchanan thanks, learn something new every day
CamperBot
@camperbot
Jan 17 2016 01:37
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
@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
@wushupork me too :smile_cat:
Morenar
@Morenar
Jan 17 2016 01:38
@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
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
cool, the tests are pretty finnicky like that,
(worth every penny though)
kelly
@kwhms
Jan 17 2016 01:40
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

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
@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
@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
@Morenar you could open a github issue if you feel the instructions were too vague
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:42
has anyone completed the "Using Objects for Lookups"?
Linearcitrus
@Linearcitrus
Jan 17 2016 01:42
I'm stuck on the "Using Objects for Lookups" checkpoint. Having trouble understanding where to start
Aron Rightious
@arightious
Jan 17 2016 01:43
@KellenKolbeck & @Linearcitrus look at my question LOL
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:43
haha I didn't even see this ^. The example is not very good
Aron Rightious
@arightious
Jan 17 2016 01:43
no it isn't, not for what is being asked.
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:43
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
@arightious your code is really close to passing
wushupork
@wushupork
Jan 17 2016 01:44
@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
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
// 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
Hey guys, would array[0-9} work to select the 1st to 10th index of an array?
stacyHere
@stacyHere
Jan 17 2016 01:48
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
@iokonokh you have a typo
iokonokh
@iokonokh
Jan 17 2016 01:48
oh
wushupork
@wushupork
Jan 17 2016 01:48
"track" should be "tracks"
stacyHere
@stacyHere
Jan 17 2016 01:48
@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
@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
thanks @wushupork
CamperBot
@camperbot
Jan 17 2016 01:49
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
@KellenKolbeck that's what i did
Aron Rightious
@arightious
Jan 17 2016 01:49
@KellenKolbeck & @Linearcitrus 1) get your lookup table right 2) change the return result
yup got it
Rory Smith
@alanbuchanan
Jan 17 2016 01:50
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
awesome! thanks guys
wushupork
@wushupork
Jan 17 2016 01:50
@alanbuchanan that's what i did
Linearcitrus
@Linearcitrus
Jan 17 2016 01:50
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
@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
Yeah just tried that too and it passed
Rory Smith
@alanbuchanan
Jan 17 2016 01:51
yeah :point_up: January 17, 2016 1:45 AM
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 01:51
@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

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

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
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
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
maybe try .push("tracks") instead of Value
@stacyHere
stacyHere
@stacyHere
Jan 17 2016 02:07
@lbarney Thanks, but that doesn't work for me either.
CamperBot
@camperbot
Jan 17 2016 02:07
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
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
// 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
@stacyHere look into else if statements
iokonokh
@iokonokh
Jan 17 2016 02:14
// 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
you were right with collection[id][prop].push(value);
stacyHere
@stacyHere
Jan 17 2016 02:16
@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
@iokonokh
for (var i = 0; i < myArr.length; i++) {
  total += myArr[i];
}
Lance Barney
@lbarney
Jan 17 2016 02:17
@stacyHere try changing them to{ }if else{}
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 02:18
You need to add the values at position i of myArr to total @iokonokh
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:18
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
put a++ into the loop
Pandarati
@Pandarati
Jan 17 2016 02:19
You could just increase a in the for loop
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:19
Oh.
thanks @wushupork @Pandarati
CamperBot
@camperbot
Jan 17 2016 02:19
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
@CodingDucky nest your for loops
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:20
Also how do I tack something onto the end of an array
?
array.push()?
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 02:20
yes
John Cerpa
@johncerpa
Jan 17 2016 02:20
hey
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 02:21
Did that help @iokonokh ?
Pandarati
@Pandarati
Jan 17 2016 02:21
@CodingDucky Yes you would use array.push();
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:21
Thank you
Pandarati
@Pandarati
Jan 17 2016 02:22
@johncerpa Hey :smile:
John Cerpa
@johncerpa
Jan 17 2016 02:22
@Pandarati :+1:
:hand:
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:25
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
@CodingDucky You should push and initiate num in the first for-loop. See if that helps
Lance Barney
@lbarney
Jan 17 2016 02:27
@CodingDucky I would change your var to something besides newarr
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:28
@lbarney Why?
Lance Barney
@lbarney
Jan 17 2016 02:29
@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
// 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
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
What I did was remove all capitalisation, spaces, and punctuation
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:30
@Nadr0j You don't want to just be returning result.
Pandarati
@Pandarati
Jan 17 2016 02:30
@Nadr0j You are returning a empty string.
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:31
@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
you're right
Zina Astafyeva
@tragetraje
Jan 17 2016 02:31
@Nadr0j you should return a value instead
Lance Barney
@lbarney
Jan 17 2016 02:31
@CodingDucky just looked a little funny to me
stacyHere
@stacyHere
Jan 17 2016 02:31
@Nadr0j I had to add result=lookup[val];
Jordan
@Nadr0j
Jan 17 2016 02:31
Is it a bug then?
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:31
@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
can anybody help me with nesting for loops exercise?
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:32
@tragetraje Sure. What's the issue?
hernc
@hernc
Jan 17 2016 02:32
@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
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
@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
Thanks to @keccakec @tragetraje @Pandarati!
CamperBot
@camperbot
Jan 17 2016 02:32
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

@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
@keccakec i don't know how to access the secend nested array when multiplying...
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:33
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
^^ @Pandarati is correct
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:33
@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
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
@keccakec product = product arr[i] "???"
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:33
yw
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 02:34
but it should be result = lookup[val];
@Nadr0j
John Cerpa
@johncerpa
Jan 17 2016 02:34
This message was deleted
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:34
@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
This message was deleted
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:35
@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
@keccakec got it, it was just product arr[i][j], but thanx anyway...
CamperBot
@camperbot
Jan 17 2016 02:38
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
@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
@keccakec i'mcomplicating things at times by myself when coding :worried:
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:40
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
@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
did freecodecamp do an upgrade to the UI?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:41
@mbeyer80
yes
Pandarati
@Pandarati
Jan 17 2016 02:41
@mbeyer80 Yes
Michael Beyer
@mbeyer80
Jan 17 2016 02:41
I liked the old version
Pandarati
@Pandarati
Jan 17 2016 02:41
@mbeyer80 Same :P
Michael Beyer
@mbeyer80
Jan 17 2016 02:41
this new one seems less intuitive
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:41
I like the version from yesterday
So not the old-old version
But yesterday
John Cerpa
@johncerpa
Jan 17 2016 02:42
the website is buggy on safari
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:42
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
hmmmm - I usually do this in chrome - in safari now. Gonna check it out in chrome
Pandarati
@Pandarati
Jan 17 2016 02:42
@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
@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
Just to use FCC
?
John Cerpa
@johncerpa
Jan 17 2016 02:43
Yes
It worked
Jordan
@Nadr0j
Jan 17 2016 02:43
Ayo I'm back
sadly
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:43
Also @Pandarati I would thank you, but unfortunately camperbot is stingy af.
CamperBot
@camperbot
Jan 17 2016 02:43
codingducky sends brownie points to @pandarati :sparkles: :thumbsup: :sparkles:
:warning: codingducky already gave pandarati points
Michael Beyer
@mbeyer80
Jan 17 2016 02:43
in chrome n roadmapow. Still liked the older version. Was easier to see my
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:43
Like that
Jordan
@Nadr0j
Jan 17 2016 02:44

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
was easier to see my roadmap
Pandarati
@Pandarati
Jan 17 2016 02:44
@Nadr0j update result after you initiated lookup(Update result under lookup)
Michael Beyer
@mbeyer80
Jan 17 2016 02:44
oh well. Cant complain for free training this good :)
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:45
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
@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
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
lol. Alright thanks guys. Big help. This one made my head hurt.
jmesa92
@jmesa92
Jan 17 2016 02:47
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
@Nadr0j it should looks something like :
    "foxtrot": "Frank"
});

result = lookup[val]; 
return result
Jordan
@Nadr0j
Jan 17 2016 02:49
@KellenKolbeck thanks Kellen. It's working well now.
CamperBot
@camperbot
Jan 17 2016 02:49
nadr0j sends brownie points to @kellenkolbeck :sparkles: :thumbsup: :sparkles:
John Cerpa
@johncerpa
Jan 17 2016 02:49
just do it in the same line
CamperBot
@camperbot
Jan 17 2016 02:49
:star: 222 | @kellenkolbeck | http://www.freecodecamp.com/kellenkolbeck
John Cerpa
@johncerpa
Jan 17 2016 02:49
return result = lookup[val];
Jordan
@Nadr0j
Jan 17 2016 02:49
fancy
Pandarati
@Pandarati
Jan 17 2016 02:49
@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
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
@Pandarati No good, still only returning 1
Susan
@SusanGrattan
Jan 17 2016 02:51
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
@jmesa92 Yes. That wasn't the solution. That was just to point you into the right direction.
Susan
@SusanGrattan
Jan 17 2016 02:52
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
Check if word.split('')[0] = word.split('')[0].toUpperCase()
Kevin Elser
@CoffeeCodeKevin
Jan 17 2016 02:52
Example text on mozilla "var newstr = str.replace(/xmas/i, 'Christmas');"
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:52
Actually use ==
jmesa92
@jmesa92
Jan 17 2016 02:52
@Pandarati I shoulda known that...
Susan
@SusanGrattan
Jan 17 2016 02:53
@CodingDucky thank you
CamperBot
@camperbot
Jan 17 2016 02:53
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
Am I misinterpreting how to use .replace?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:53
yw
matthew3454
@matthew3454
Jan 17 2016 02:53
I have a question on Quoting Strings with Single Quotes is someone can please help?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:53
Just ask
about @codingducky
CamperBot
@camperbot
Jan 17 2016 02:53
:star: 257 | @codingducky | http://www.freecodecamp.com/codingducky
Pandarati
@Pandarati
Jan 17 2016 02:53
This message was deleted
matthew3454
@matthew3454
Jan 17 2016 02:54
``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
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
Okay. What should I do next? @johncerpa
Pandarati
@Pandarati
Jan 17 2016 02:57
@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
gotcha
var myStr= 'This string has\"double quotes\" in it. And \"probably\" lots of them.'
Pandarati
@Pandarati
Jan 17 2016 02:59
@matthew3454 Yes :)
John Cerpa
@johncerpa
Jan 17 2016 02:59
hmmn
it says remove all the backslashes
matthew3454
@matthew3454
Jan 17 2016 02:59
yes, it didn't work.
John Cerpa
@johncerpa
Jan 17 2016 02:59
see
no backslashes
Pandarati
@Pandarati
Jan 17 2016 03:00
@johncerpa Really? What's the name of the challenge?
matthew3454
@matthew3454
Jan 17 2016 03:00
Quoting Strings with Single Quotes
John Cerpa
@johncerpa
Jan 17 2016 03:00
var myStr = 'This string has "double quotes" in it. And "probably" lots of them.';
that way
Pandarati
@Pandarati
Jan 17 2016 03:00
This message was deleted
John Cerpa
@johncerpa
Jan 17 2016 03:01
he was using double quotes
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:02
If I delete arr[0], will arr[1] become the new arr[0]?
matthew3454
@matthew3454
Jan 17 2016 03:02
It still din't work.
Pandarati
@Pandarati
Jan 17 2016 03:03
@CodingDucky You have to use array.shift();
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:03
What does array.shift do?
How do I select what to pop out with it?
Pandarati
@Pandarati
Jan 17 2016 03:03
@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

: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
okay I'll try it
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:04
wiki array.shift()
CamperBot
@camperbot
Jan 17 2016 03:04
no wiki entry for: arrayshift
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:04
damn
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:04
Thanks
moukhtari
@moukhtari
Jan 17 2016 03:05
Hi everyone. I'm having a hard time understanding the Card Counting problem
matthew3454
@matthew3454
Jan 17 2016 03:05
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
wiki .shift()
CamperBot
@camperbot
Jan 17 2016 03:06

: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
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
I just checked the exercise and it's okay
Pandarati
@Pandarati
Jan 17 2016 03:12

@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
Oh I figured it out, I should use a switch statement
matthew3454
@matthew3454
Jan 17 2016 03:14
okay. thanks. Round 5
Pandarati
@Pandarati
Jan 17 2016 03:14
@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
type javascript
next to the backticks
it looks ugly that way haha
Pandarati
@Pandarati
Jan 17 2016 03:15
@johncerpa Thanks. Forgot about that
CamperBot
@camperbot
Jan 17 2016 03:15
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
@Pandarati it's not important haha
@Pandarati just looks better, don't you think?
Pandarati
@Pandarati
Jan 17 2016 03:16
Yes :)
matthew3454
@matthew3454
Jan 17 2016 03:17
Sixth time's a charm! @johncerpa
John Cerpa
@johncerpa
Jan 17 2016 03:17
@matthew3454 :+1: :)
matthew3454
@matthew3454
Jan 17 2016 03:17
thank you @johncerpa
CamperBot
@camperbot
Jan 17 2016 03:17
matthew3454 sends brownie points to @johncerpa :sparkles: :thumbsup: :sparkles:
:star: 269 | @johncerpa | http://www.freecodecamp.com/johncerpa
Pandarati
@Pandarati
Jan 17 2016 03:23
Does anyone know the logic for generating prime number?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:23
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

: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
Generate prime number in a range for Bonfire Sum all primes
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:24
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
I've got another question on the next waypoint of: Escape Sequences in Strings
Pandarati
@Pandarati
Jan 17 2016 03:30
@CodingDucky That works but I actually want to write and understand the logic
What is it @matthew3454 ?
matthew3454
@matthew3454
Jan 17 2016 03:33
var myStr= \\"backslash tab tab carriage-return new-line\\" ; // Change this line
orr29
@orr29
Jan 17 2016 03:33
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
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
var farenheit = function () {}
Pandarati
@Pandarati
Jan 17 2016 03:34

@orr29

var example = function (){};

Make sure to return a value

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

: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
Anyone in here completed the "Record Collection" waypoint?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:35
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
yes
I have
orr29
@orr29
Jan 17 2016 03:35
@Pandarati @KellenKolbeck thanx
CamperBot
@camperbot
Jan 17 2016 03:35
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
@KellenKolbeck Yes
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 03:36
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
This message was deleted
This message was deleted
This message was deleted
matthew3454
@matthew3454
Jan 17 2016 03:37
var myStr= ""\\ \t \t \r \n"" ; // Change this line @Pandarati This is what I tried
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:37
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
@matthew3454 just one double quote
on each side
Pandarati
@Pandarati
Jan 17 2016 03:38
@matthew3454 You're not escaping the double quotes properly
@KellenKolbeck I'm looking at it now :)
John Cerpa
@johncerpa
Jan 17 2016 03:39
you don't have to escape any double quotes
matthew3454
@matthew3454
Jan 17 2016 03:39
alsjdg;aeowng;asnv ;alsdf;lasdf
John Cerpa
@johncerpa
Jan 17 2016 03:39
I think, I'm not sure
matthew3454
@matthew3454
Jan 17 2016 03:39
@johncerpa thank you
CamperBot
@camperbot
Jan 17 2016 03:39
matthew3454 sends brownie points to @johncerpa :sparkles: :thumbsup: :sparkles:
:warning: matthew3454 already gave johncerpa points
matthew3454
@matthew3454
Jan 17 2016 03:39
@Pandarati thank you
CamperBot
@camperbot
Jan 17 2016 03:39
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
@matthew3454 :) :+1:
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 03:40
@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
Do I have to set up my GitHub account to receive brownie points?
Pandarati
@Pandarati
Jan 17 2016 03:41
@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
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
I should have refactored before I posted
Pandarati
@Pandarati
Jan 17 2016 03:47

@KellenKolbeck

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

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

Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 03:48
Yes that worked thanks @Pandarati
CamperBot
@camperbot
Jan 17 2016 03:48
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
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
@KellenKolbeck Also to check if a track is empty
if(collection[prop].length === 0){

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

}
Kimber
@Kimber217
Jan 17 2016 03:51
should i be using switch or if/else if
John Cerpa
@johncerpa
Jan 17 2016 03:51
if/else if statements
Kimber
@Kimber217
Jan 17 2016 03:51
just out of curiousity...how come?
John Cerpa
@johncerpa
Jan 17 2016 03:51
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
You should check if either one is under 0
John Cerpa
@johncerpa
Jan 17 2016 03:52
don't give her the answer
let her find out
Kimber
@Kimber217
Jan 17 2016 03:53
haha yeah that was my goal, thanks @johncerpa - gotta figure this out on my own
CamperBot
@camperbot
Jan 17 2016 03:53
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
How do I check if a given string/number/float is in an array?
Kimber
@Kimber217
Jan 17 2016 03:53
so i guess i would have said like...
```
if (a >= 0) {
return a}
wait hmm
Abhishek
@AbhiChachan
Jan 17 2016 03:54
in exercise Counting Cards (204):
not able to return count and "Bet" together
John Cerpa
@johncerpa
Jan 17 2016 03:54
less than 0
not greater
Kimber
@Kimber217
Jan 17 2016 03:55
but don't i want greter than 0 to show the value of the number?
Abhishek
@AbhiChachan
Jan 17 2016 03:55
Screen Shot 2016-01-17 at 9.25.00 am.png
Kimber
@Kimber217
Jan 17 2016 03:55
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
if a or b are less than 0
Abhishek
@AbhiChachan
Jan 17 2016 03:56
hi anyone there to help?
Kimber
@Kimber217
Jan 17 2016 03:56
right, but it still wants me to show the numberfs when they're over 0
John Cerpa
@johncerpa
Jan 17 2016 03:56
hmmn I don't think so
Kimber
@Kimber217
Jan 17 2016 03:56
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
haha it's okay
Pandarati
@Pandarati
Jan 17 2016 03:56
@CodingDucky Loop through it and have a "if condition" to check
Kimber
@Kimber217
Jan 17 2016 03:57
okay hmm
John Cerpa
@johncerpa
Jan 17 2016 03:57
if (condition) {

    return whatever;

}
the condition is if a or b are less than 0
return undefined
Kimber
@Kimber217
Jan 17 2016 03:58
if (a <= 0) {
  return "undefined";
}
  else if (b <= 0) {
    return "undefined";
  }
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:58
@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
getting close
Abhishek
@AbhiChachan
Jan 17 2016 03:59
Hi Campers, need some help on an exercise
Kimber
@Kimber217
Jan 17 2016 03:59
would i use &&>?
John Cerpa
@johncerpa
Jan 17 2016 03:59
less than 0
Kimber
@Kimber217
Jan 17 2016 03:59
man idk why i can't figure this out
John Cerpa
@johncerpa
Jan 17 2016 03:59
just use < instead of <=
Kimber
@Kimber217
Jan 17 2016 03:59
oh.
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:59
@Pandarati Just use multiple if statements in a for loop?
John Cerpa
@johncerpa
Jan 17 2016 03:59
you should also return undefined
without the quotes
Pandarati
@Pandarati
Jan 17 2016 03:59
@Kimber217 It's saying if "either" of them are true. ;)
Kimber
@Kimber217
Jan 17 2016 03:59
hmm
oh BOOM shaka lacka
it worked...
John Cerpa
@johncerpa
Jan 17 2016 04:00
hahaha good :clap:
Kimber
@Kimber217
Jan 17 2016 04:00
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
else if
Kimber
@Kimber217
Jan 17 2016 04:00
and thankyou @Pandarati :D
ok @johncerpa you are really good at explaining things
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 04:01
separate the thank and the you and see what happens
for both of them
John Cerpa
@johncerpa
Jan 17 2016 04:01
@Kimber217 no problem :)
Bekzat Omrzakov
@bekza
Jan 17 2016 04:02
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
paste your code (:
Bekzat Omrzakov
@bekza
Jan 17 2016 04:03

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
help convert celsius to fahrenheit
CamperBot
@camperbot
Jan 17 2016 04:04

: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
@bekza The formulas might come in handy for that challenge
John Cerpa
@johncerpa
Jan 17 2016 04:04
Celsius times 9/5, plus 32.
Matt
@matthewbcool
Jan 17 2016 04:04

'''// 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
:bulb: to format code use backticks! ``` more info
Kimber
@Kimber217
Jan 17 2016 04:04
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
help card counting
CamperBot
@camperbot
Jan 17 2016 04:05
no wiki entry for: card counting
John Cerpa
@johncerpa
Jan 17 2016 04:05
wiki card count
CamperBot
@camperbot
Jan 17 2016 04:05
no wiki entry for: card count
John Cerpa
@johncerpa
Jan 17 2016 04:05
hmmn
Pandarati
@Pandarati
Jan 17 2016 04:05
wiki format code
Kimber
@Kimber217
Jan 17 2016 04:05
help counting cards
CamperBot
@camperbot
Jan 17 2016 04:05

: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
that thing
Matt
@matthewbcool
Jan 17 2016 04:05
// 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
use switch
do you know how to?
Kimber
@Kimber217
Jan 17 2016 04:05
my beloved swiiitch!
Pandarati
@Pandarati
Jan 17 2016 04:05
@matthewbcool Try using ``` [shift enter] (3 more ticks here)
John Cerpa
@johncerpa
Jan 17 2016 04:06
switch(something) {

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

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

: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
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
yes,
you have a
count variable
in your code, don't you
Matt
@matthewbcool
Jan 17 2016 04:07
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
wtf is it talking about with the "global count variable"?
John Cerpa
@johncerpa
Jan 17 2016 04:08
@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
@johncerpa thanks
CamperBot
@camperbot
Jan 17 2016 04:08
matthewbcool sends brownie points to @johncerpa :sparkles: :thumbsup: :sparkles:
:star: 271 | @johncerpa | http://www.freecodecamp.com/johncerpa
Kimber
@Kimber217
Jan 17 2016 04:08
no worries thanks @johncerpa !
John Cerpa
@johncerpa
Jan 17 2016 04:08
good night
Kimber
@Kimber217
Jan 17 2016 04:08
goodnight!
Abhishek
@AbhiChachan
Jan 17 2016 04:09

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
// 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
@matthewbcool For this challenge, does it want you to update the properties?
Matt
@matthewbcool
Jan 17 2016 04:11
@Pandarati it is telling me to just use dot notation to call a specific property
Pandarati
@Pandarati
Jan 17 2016 04:12
@matthewbcool What's the name of this challenge?
Matt
@matthewbcool
Jan 17 2016 04:12
Accessing Objects Properties with the Dot Operator
Salad
@Saladg
Jan 17 2016 04:13
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
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
@Pandarati Ok, you have it right. Just change the variables back to what they wanted.
Matt
@matthewbcool
Jan 17 2016 04:16
@Pandarati thanks i got it. it has to have the original variable that was assigned to work
CamperBot
@camperbot
Jan 17 2016 04:16
matthewbcool sends brownie points to @pandarati :sparkles: :thumbsup: :sparkles:
:star: 307 | @pandarati | http://www.freecodecamp.com/pandarati
Salad
@Saladg
Jan 17 2016 04:16
Anyone who has an answer?
Bekzat Omrzakov
@bekza
Jan 17 2016 04:16
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";
Matt
@matthewbcool
Jan 17 2016 04:17
@Saladg what twas the name of that one again
?
Kimber
@Kimber217
Jan 17 2016 04:17
@AbhiChachan i'm having trouble with that one too :(
Bekzat Omrzakov
@bekza
Jan 17 2016 04:17
Remove all the backslashes ()
You should have two single quotes ' and four double quotes "
Kimber
@Kimber217
Jan 17 2016 04:17
@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
@AbhiChachan You're on the right track
Kimber
@Kimber217
Jan 17 2016 04:18
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
@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
meant
 if (count >= 0){
  return [count, "Bet"];
  } else {
    return [count, "Hold"];
Matt
@matthewbcool
Jan 17 2016 04:19
@Kimber217 do you need to return count + " Bet"?
Kimber
@Kimber217
Jan 17 2016 04:20
guess i don't need the brackets
Abhishek
@AbhiChachan
Jan 17 2016 04:20

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
umm..
:/
Abhishek
@AbhiChachan
Jan 17 2016 04:21
@Kimber217 let me know if that one worked for yo
you
Kimber
@Kimber217
Jan 17 2016 04:21
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
ohhh
sorry
i can take you through the logic
if you want
Kimber
@Kimber217
Jan 17 2016 04:22
ya sure
++ is interchangeable with += 1, right? it's just probably more "proper"
right?
(not sure)
Abhishek
@AbhiChachan
Jan 17 2016 04:22
yes
that is one and the same thing
Kimber
@Kimber217
Jan 17 2016 04:22
okay so hypothetically i can keep count += 1;
Bekzat Omrzakov
@bekza
Jan 17 2016 04:22
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
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
task:
Abhishek
@AbhiChachan
Jan 17 2016 04:23
yes
Kimber
@Kimber217
Jan 17 2016 04:23
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
because we need to add a space
Kimber
@Kimber217
Jan 17 2016 04:25
i see
Salad
@Saladg
Jan 17 2016 04:25
var myStr = '<a href="http://www.example.com" target="_blank">Link</a>';
Abhishek
@AbhiChachan
Jan 17 2016 04:25
as is the requirement of the exercise
Salad
@Saladg
Jan 17 2016 04:25
@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

@Kimber217

count + " Hold";

That works also.

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

: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
Am stuck!!
Pandarati
@Pandarati
Jan 17 2016 04:34
wiki Brownie Points
CamperBot
@camperbot
Jan 17 2016 04:34

: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
ohk
Pandarati
@Pandarati
Jan 17 2016 04:35
@Kimber217 No, I don't. But thanks :)
CamperBot
@camperbot
Jan 17 2016 04:35
pandarati sends brownie points to @kimber217 :sparkles: :thumbsup: :sparkles:
:warning: pandarati already gave kimber217 points
Abhishek
@AbhiChachan
Jan 17 2016 04:35
chalo see ya guys
take care
Kimber
@Kimber217
Jan 17 2016 04:36
do you code for a living @Pandarati ?
Pandarati
@Pandarati
Jan 17 2016 04:36
@Kimber217 No. I'm still in highschool :P
Kimber
@Kimber217
Jan 17 2016 04:36
ughhh
jealous
Pandarati
@Pandarati
Jan 17 2016 04:37
lol
Abhishek
@AbhiChachan
Jan 17 2016 04:37
where are you guys from?
@Kimber217 @Pandarati
Kimber
@Kimber217
Jan 17 2016 04:38
boston
Yasin Yusuf
@YasinYA
Jan 17 2016 04:38
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
wiki reverse-a-string
CamperBot
@camperbot
Jan 17 2016 04:38

: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
let me try that @Kimber217
Abhishek
@AbhiChachan
Jan 17 2016 04:39
@Kimber217 nice. great place. what do you do for a living?
Kimber
@Kimber217
Jan 17 2016 04:39
i work in fashion
i basically dress people for a living
it's...not that great
Abhishek
@AbhiChachan
Jan 17 2016 04:40
sounds great though
Kimber
@Kimber217
Jan 17 2016 04:40
its not
it actually sucks
hahahaha
it's fun
but the pay is awful
what about you
Abhishek
@AbhiChachan
Jan 17 2016 04:41
@Kimber217 all over the world, most employees have this qualm. i work in marketing and strategy
Linearcitrus
@Linearcitrus
Jan 17 2016 04:43
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
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
I am having the same problem @Linearcitrus!!
Yasin Yusuf
@YasinYA
Jan 17 2016 04:46
@Linearcitrus you were close
that is the solution @ValerieR59 @Linearcitrus
Linearcitrus
@Linearcitrus
Jan 17 2016 04:46
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
Yes but you do not need to check for '!==true'. just use 'else return "Not Found".
Linearcitrus
@Linearcitrus
Jan 17 2016 04:48
thank you @YasinYA and @ValerieR59
CamperBot
@camperbot
Jan 17 2016 04:48
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
because the 'else' of true will always be 'false'.
Thank you! You helped me also @Linearcitrus !!
CamperBot
@camperbot
Jan 17 2016 04:48
valerier59 sends brownie points to @linearcitrus :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for linearcitrus
Yasin Yusuf
@YasinYA
Jan 17 2016 04:49
try it @ValerieR59
NP @Linearcitrus
Micah Bales
@micahbales
Jan 17 2016 04:51
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
wiki introducing javascript object notation
CamperBot
@camperbot
Jan 17 2016 04:54

: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
It looks like closed off the array
Micah Bales
@micahbales
Jan 17 2016 04:55
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
@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
@KellenKolbeck the lesson doesn't seem to like that code
Kellen Kolbeck
@KellenKolbeck
Jan 17 2016 04:57
There is still one error with that
s
@moksha1
Jan 17 2016 04:57
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
There should be a comma after the first object in the array
Micah Bales
@micahbales
Jan 17 2016 04:57
@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
@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

@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
Even this is good
Micah Bales
@micahbales
Jan 17 2016 05:00
Nice. Thank you, @KellenKolbeck !
CamperBot
@camperbot
Jan 17 2016 05:00
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
@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
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
Yeah just need [ ] for array, { } for object
Micah Bales
@micahbales
Jan 17 2016 05:01
Got it. That makes a lot more sense.
Abhishek
@AbhiChachan
Jan 17 2016 05:01
@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
With that, I think I'm going to go to bed! Have a great night!
Gaege Root
@GaegeRoot
Jan 17 2016 05:04
Hello ladies!
Anybody around to provide some insight?
Valerie Rickert
@ValerieR59
Jan 17 2016 05:09
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
@ValerieR59 Yes
Valerie Rickert
@ValerieR59
Jan 17 2016 05:12
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
How do you match only alphanumeric characters excluding underscore with regex?
Herman Fassett
@HermanFassett
Jan 17 2016 05:18
[\W_] is one way
Wilson Heres
@hereswilson
Jan 17 2016 05:20
that made it worse...not sure why
I've been using /\W/g
Herman Fassett
@HermanFassett
Jan 17 2016 05:22
Well ofc /[\W_]/g
Yasin Yusuf
@YasinYA
Jan 17 2016 05:23
hey @HermanFassett
Herman Fassett
@HermanFassett
Jan 17 2016 05:23
Hey @YasinYA
Yasin Yusuf
@YasinYA
Jan 17 2016 05:23

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
Anyone done the "Nesting For Loops" waypoint?
Yasin Yusuf
@YasinYA
Jan 17 2016 05:24
@HermanFassett can you tell me what is wrong with this code
Wilson Heres
@hereswilson
Jan 17 2016 05:24
@HermanFassett you're my hero, what did the brackets do?
Yasin Yusuf
@YasinYA
Jan 17 2016 05:24
@KellenKolbeck yeah
Herman Fassett
@HermanFassett
Jan 17 2016 05:24
@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
what is your problem
Herman Fassett
@HermanFassett
Jan 17 2016 05:25
@YasinYA well first of "esle"
Gaege Root
@GaegeRoot
Jan 17 2016 05:25
anyone recently done the "profile lookup" challenge?
Herman Fassett
@HermanFassett
Jan 17 2016 05:25
And what's str.exec?
Doesn't work on string
Yasin Yusuf
@YasinYA
Jan 17 2016 05:26
@HermanFassett so do i use match
Herman Fassett
@HermanFassett
Jan 17 2016 05:26
@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
thanks @HermanFassett
CamperBot
@camperbot
Jan 17 2016 05:26
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
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
@HermanFassett yes it works but how about my regex
Gaege Root
@GaegeRoot
Jan 17 2016 05:27
You can't reference prop with dot notation in that case
B Manoj Kumar
@bmkmanoj
Jan 17 2016 05:27
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
@Necmttn
you must use bracket notation to reference the prop parameter
Yasin Yusuf
@YasinYA
Jan 17 2016 05:28
am trying to filter out all number ,puncuations, symbols
Gaege Root
@GaegeRoot
Jan 17 2016 05:29
@Necmttn so it'd be collection[id][prop] not collection[id].prop
Herman Fassett
@HermanFassett
Jan 17 2016 05:29
@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
ok @HermanFassett thanks
CamperBot
@camperbot
Jan 17 2016 05:30
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
@GaegeRoot earlier i tought is not working example[a][b] . now i see. Thanks mate.