These are chat archives for FreeCodeCamp/HelpJavaScript

17th
Mar 2017
jacob
@bjh2012
Mar 17 2017 00:01
@JLuboff so, if the function is testing the object for a value, how can the parameter be the value of the object it is testing?
thunderbuns
@thunderbuns
Mar 17 2017 00:02

@Manish-Giri that helped but two thirds of the lesson are still wrong. function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (i = 0; i < arr.length; i++) {
for (f = 0; f < arr[i].length; f++){
product *= arr[i][j];
}
}
// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6]]);

Manish Giri
@Manish-Giri
Mar 17 2017 00:03
@thunderbuns for (f = 0; f < arr[i].length; f++){
the variable here is f
arr[i][j];
and here it's j
jacob
@bjh2012
Mar 17 2017 00:03
@JLuboff .hasOwnProperty() returns true or false if the property is found or not
Jason Luboff
@JLuboff
Mar 17 2017 00:03
@thunderbuns Ya sorry, order of operations are off and index name
@bjh2012 becuase the parameter gets the value to test. But I gotta go
thunderbuns
@thunderbuns
Mar 17 2017 00:04
Ha that was the problem thanks @Manish-Giri and @JLuboff
CamperBot
@camperbot
Mar 17 2017 00:04
thunderbuns sends brownie points to @manish-giri and @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 1182 | @jluboff |http://www.freecodecamp.com/jluboff
:star2: 4780 | @manish-giri |http://www.freecodecamp.com/manish-giri
jacob
@bjh2012
Mar 17 2017 00:07
@Manish-Giri ```
var myObj = {
gift:"pony";
Aj Broman
@Bromana
Mar 17 2017 00:08
When creating private properties in an object do I still use var or do I switch to let ?
Manish Giri
@Manish-Giri
Mar 17 2017 00:09
@Bromana you can use either, but you might get a warning in the fcc editor with let..
@bjh2012 is that all of your code?
Aj Broman
@Bromana
Mar 17 2017 00:09
Ah ok, I was JW. Yeah ik fcc hates let const
Alex Harrison
@alexharrison-js
Mar 17 2017 00:09
I’m trying to do an algorithm challenge but i used a while loop and now my browser tab crashes everytime I try to open the challenge. Any ideas?
i tried restarting the browser
Aj Broman
@Bromana
Mar 17 2017 00:09
Here’s your cookies: TY @Manish-Giri
CamperBot
@camperbot
Mar 17 2017 00:09
bromana sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4781 | @manish-giri |http://www.freecodecamp.com/manish-giri
Alex Harrison
@alexharrison-js
Mar 17 2017 00:09
still freakin out
Manish Giri
@Manish-Giri
Mar 17 2017 00:09
@alexharrisonmusic run=disable
add this to the URL
Peter
@peterfiorito
Mar 17 2017 00:10
@bjh2012 you should apply myObj.hasOwnProperty with the parameter you are going to be testing. I Used a conditional to return the array in case it found the property being tested and else return not found. I kind of gave you the answer without showing the code bc I guess it would defeat the purpose of the exercise. Hope it helps!
Alex Harrison
@alexharrison-js
Mar 17 2017 00:10
thank you
Manish Giri
@Manish-Giri
Mar 17 2017 00:10
@Bromana :+1:
Alex Harrison
@alexharrison-js
Mar 17 2017 00:10
@Manish-Giri thank you
CamperBot
@camperbot
Mar 17 2017 00:10
alexharrisonmusic sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4782 | @manish-giri |http://www.freecodecamp.com/manish-giri
Alex Harrison
@alexharrison-js
Mar 17 2017 00:11
@Manish-Giri how do i tag it on it’s not happening when i do https://www.freecodecamp.com/challenges/chunky-monkey/run=disable
jacob
@bjh2012
Mar 17 2017 00:12
@peterfiorito thanks, i'm stil lost. i'll keep trying.
Alex Harrison
@alexharrison-js
Mar 17 2017 00:13
@Manish-Giri Thank you for the help!
CamperBot
@camperbot
Mar 17 2017 00:13
alexharrisonmusic sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:warning: alexharrisonmusic already gave manish-giri points
Manish Giri
@Manish-Giri
Mar 17 2017 00:13
@bjh2012 post your code here..
jacob
@bjh2012
Mar 17 2017 00:14
@Manish-Giri i reset it to start over. i have nothing now
thunderbuns
@thunderbuns
Mar 17 2017 00:17
I am having a hard time understand how I am supposed to lookup someone's profile in the lesson "Profile Lookup" could you guys help me?
Manish Giri
@Manish-Giri
Mar 17 2017 00:17

@thunderbuns

how I am supposed to lookup someone's profile

not sure what this means
isaac820
@isaac820
Mar 17 2017 00:17
Am stuck with error 1:Convert the assignments for a, b, and c to use the += operator var a += 15;
var b += 26;
var c += 19;
Aj Broman
@Bromana
Mar 17 2017 00:20
what about it @isaac820
a = a + 15 is the equivalent of a += 15
if that’s what you meant
thunderbuns
@thunderbuns
Mar 17 2017 00:22
@Manish-Giri have you done the lesson in javascript called "profile lookup"?
Aj Broman
@Bromana
Mar 17 2017 00:22
it’s a shorthand
Conrad Kay
@conradkay
Mar 17 2017 00:22
Im on a roll! 5 algorithms done in just the past hour.
Aj Broman
@Bromana
Mar 17 2017 00:22
awesome job @conradkay keep it up
Mostafa Masri
@thefakeweed
Mar 17 2017 00:22
hey need help here https://www.freecodecamp.com/challenges/profile-lookup#?solution=z%0A%2F%2FSetup%0Avar%20contacts%20%3D%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Akira%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Laine%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220543236543%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Pizza%22%2C%20%22Coding%22%2C%20%22Brownie%20Points%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Harry%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Potter%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220994372684%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Hogwarts%22%2C%20%22Magic%22%2C%20%22Hagrid%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Sherlock%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Holmes%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220487345643%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Intriguing%20Cases%22%2C%20%22Violin%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Kristian%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Vos%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%22unknown%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Javascript%22%2C%20%22Gaming%22%2C%20%22Foxes%22%5D%0A%20%20%20%20%7D%0A%5D%3B%0A%0A%0Afunction%20lookUpProfile(firstName%2C%20prop)%7B%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0A%0A%2F%2F%20Only%20change%20code%20above%20this%20line%0A%7D%0A%0A%2F%2F%20Change%20these%20values%20to%20test%20your%20function%0AlookUpProfile(%22Akira%22%2C%20%22likes%22)%3B%0A
i dont know how to start need help pls
thunderbuns
@thunderbuns
Mar 17 2017 00:24
@mml3b I need help with that lesson as well.
Mostafa Masri
@thefakeweed
Mar 17 2017 00:25
oh hello :p !
thunderbuns
@thunderbuns
Mar 17 2017 00:25
hi
Manish Giri
@Manish-Giri
Mar 17 2017 00:25
@thunderbuns yes
ivorygrant
@ivorygrant
Mar 17 2017 00:26

hi everyone working on Objects for lookups, i feel i'm way off base here and would appreciate a suggestion in the right direction:
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {

"alpha": "Adams",
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank",
"": undefined

};

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

isaac820
@isaac820
Mar 17 2017 00:27
@Bromana am still getting error
thunderbuns
@thunderbuns
Mar 17 2017 00:27
@Manish-Giri then go back to that lesson and you will see what I mean.
Manish Giri
@Manish-Giri
Mar 17 2017 00:27
@thunderbuns I know that lesson very well, and I don't know what you mean.
Mostafa Masri
@thefakeweed
Mar 17 2017 00:27
@thunderbuns what are we gonna do about the profile lookup challenge
Manish Giri
@Manish-Giri
Mar 17 2017 00:28
@ivorygrant you're 50% there...
Mostafa Masri
@thefakeweed
Mar 17 2017 00:28
it's frustrating
Manish Giri
@Manish-Giri
Mar 17 2017 00:28
@ivorygrant you just need to lookup the value of the val property from lookup and assign it to result.
thunderbuns
@thunderbuns
Mar 17 2017 00:28
@ivorygrant why do you have a line of undefined code
@mml3b not a clue
ivorygrant
@ivorygrant
Mar 17 2017 00:29
@thunderbuns if there is no value return undefined
thunderbuns
@thunderbuns
Mar 17 2017 00:30
@Manish-Giri I mean how do you look up someone profile form the var contacts
Mostafa Masri
@thefakeweed
Mar 17 2017 00:30
with if /else statements if ?

Use a for loop to cycle through the contacts list.

try to solve the problem now
:speech_balloon: Hint: 2

Use a nested if statement to first check if the firstName matches, and then checks if the prop matches.

try to solve the problem now
:speech_balloon: Hint: 3

Leave your return "No such contact" out of the for loop as a final catch-all.

try to solve the problem now

thats what i saw on github
@thunderbuns
thunderbuns
@thunderbuns
Mar 17 2017 00:31
@ivorygrant you don't need a line for undefined if the object is not defined the code will say so o its own
ivorygrant
@ivorygrant
Mar 17 2017 00:32
@thunderbuns gotcha
thunderbuns
@thunderbuns
Mar 17 2017 00:32
hmmm thanks @mml3b
CamperBot
@camperbot
Mar 17 2017 00:32
thunderbuns sends brownie points to @mml3b :sparkles: :thumbsup: :sparkles:
:cookie: 219 | @mml3b |http://www.freecodecamp.com/mml3b
thunderbuns
@thunderbuns
Mar 17 2017 00:35
@ivorygrant do you still need help
?
ivorygrant
@ivorygrant
Mar 17 2017 00:35
@thunderbuns I do but I think i'm close, will let you know if i need it. Thanks
CamperBot
@camperbot
Mar 17 2017 00:35
ivorygrant sends brownie points to @thunderbuns :sparkles: :thumbsup: :sparkles:
:cookie: 162 | @thunderbuns |http://www.freecodecamp.com/thunderbuns
darkstylazz
@darkstylazz
Mar 17 2017 00:38
hey guys!, can anyone help me with the golf code? I really don't get it D:
Mostafa Masri
@thefakeweed
Mar 17 2017 00:39
ok so guys look what i've done so far i know it's terrible and some of you might kill me but im trying

//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 lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i < contacts.list; i++){
}
{if firstName="Harry"
return Harry;
if prop="Laine";
return Laine;
else
return "No such contact";
if prop="";
return "No such property";

}

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");

Seth
@sethdcd
Mar 17 2017 00:40
hi all, can i use indexOf with an object, and use it to search a key of that object?
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 00:41
@sethdcd .hasOwnProperty() will probably be better
Seth
@sethdcd
Mar 17 2017 00:41
@HeebieGeeBee ah gotcha, thanks man!
CamperBot
@camperbot
Mar 17 2017 00:41
sethdcd sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1078 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Seth
@sethdcd
Mar 17 2017 00:42
i'm butchering the hell out of this roman numeral converter but it's coming together!
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 00:42
@sethdcd didnt know there were any objects in that challenge
markup2.gif
Seth
@sethdcd
Mar 17 2017 00:43
@HeebieGeeBee i don't have one, but i was thinking it might consolidate some of my code... we'll see, like i said BUTCHERING lol
Mostafa Masri
@thefakeweed
Mar 17 2017 00:44
anyone ??
ivorygrant
@ivorygrant
Mar 17 2017 00:44

hmmm maybe i'm still not seeing. updated code:
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",

};

var myResult = lookup.val;

result = myResult;

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

HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 00:44
@mml3b youre not meant to be hardcoding the function like that
and it didnt ask you to return any names did it
@ivorygrant val is a parameter not a string
Mostafa Masri
@thefakeweed
Mar 17 2017 00:45

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

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

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

HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 00:45
and making that myResult variable seems a bit redundant
@mml3b yes
Mostafa Masri
@thefakeweed
Mar 17 2017 00:46
what do i have to do now ?
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 00:46
youre looking to return the prop value if the contact whos firstname is a match has the property prop
if the first name is a match but that contact doesnt have the property prop thenreturn no such property
if after looking through all the contacts no match for the first name was found, return no such contact
Mostafa Masri
@thefakeweed
Mar 17 2017 00:48
im confused , can you show me what ur saying in an example
and what about the loop ? iss it correct
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 00:48
not really without telling you how to do it
if (contacts[i].firstName === firstName) {
     if(contacts[i].hasOwnProperty(prop) {..........
bit of hint @mml3b
Mostafa Masri
@thefakeweed
Mar 17 2017 00:55
what is the value of first name and prop ?
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 00:55
@mml3b why does it matter?
Mostafa Masri
@thefakeweed
Mar 17 2017 00:55
i think i have to return it
if both r true
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 00:56
you have to return the property value if both are try
but it doesnt matter what that property value actually is
ivorygrant
@ivorygrant
Mar 17 2017 00:56

hmmm still not seeing it:

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"

};

result = lookup.result;

// Only change code above this line
return result;

Mostafa Masri
@thefakeweed
Mar 17 2017 00:57
then what do i type to return if i it doesnt really matter whats the value is
Miguel Vasquez
@mivasquez386
Mar 17 2017 00:57
hi all
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 00:57
you using the parameters
like return contacts[i][prop]
@ivorygrant lookup[val]
ivorygrant
@ivorygrant
Mar 17 2017 00:59
@HeebieGeeBee TY. I'll probably have to do this one again as I didn't get it right away
CamperBot
@camperbot
Mar 17 2017 00:59
ivorygrant sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1079 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Mostafa Masri
@thefakeweed
Mar 17 2017 01:03

//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 lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i < contacts.length; i++) {

if (contacts[i].firstName===firstName)
if (contacts[i].hasOwnProperty(prop) {
return contacts[i][prop] ;
} else {
return "No such property";
}
}
}
return "No such contact";

    }

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");

@HeebieGeeBee
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:04
@mml3b check your syntax
Stephen James
@sjames1958gm
Mar 17 2017 01:07
@mml3b Always use {} for you if so you can tell where things begin and end
@mml3b Count your } vs. {
Mostafa Masri
@thefakeweed
Mar 17 2017 01:08
thx @sjames1958gm
CamperBot
@camperbot
Mar 17 2017 01:08
mml3b sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6205 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Mostafa Masri
@thefakeweed
Mar 17 2017 01:09

//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 lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i < contacts.length; i++) {

if (contacts[i].firstName===firstName){
if (contacts[i].hasOwnProperty(prop)) {
return contacts[i][prop] ;
} else {
return "No such property";
}

    }

}
return "No such contact";

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");

Gersho
@Gersho
Mar 17 2017 01:10

Hi, i've done the falsy bouncer challenge
(Remove all falsy values from an array.
Falsy values in JavaScript are false, null, 0, "", undefined, and NaN.)


function bouncer(arr) {



  function myFilter(item) {
  if (item !== false || item !== null || item !==0 || item !=="" || item !==undefined|| !isNaN) { 
    return item;
  }

    return;

}


var filtered = arr.filter(myFilter);

  return filtered;
}

bouncer([7, "ate", "", false, 9, null, undefined, NaN]);

it works fine but i wanted your opinion about how does it fit with what's considered good practice withni the coding community.

Sergey Lukin
@not-a-cylon
Mar 17 2017 01:10
@HeebieGeeBee lol did you record yourself?
guess that saves time in the long run.
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:11
@not-a-cylon took a video snippet for the gif yeah
Gersho
@Gersho
Mar 17 2017 01:11
@HeebieGeeBee fun gif, a bit too big in my opinion but it's probably gitter's fault anyway
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:11
@Gersho some random things there
@Gersho and its probably not working how you think its working
theres also a Boolean function in written into javascript htat does what youre trying to do with you myFilter function btw
Gersho
@Gersho
Mar 17 2017 01:14
well it cleared the challenge, and it's supposed to return an array filtered (removing the listed data types)
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:15
@Gersho yup
Gersho
@Gersho
Mar 17 2017 01:15
they're the ones that suggested using array.filter in the instructions
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:15
but do you know why?
@Gersho yeah the filter is fine
Gersho
@Gersho
Mar 17 2017 01:15
why what ?
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:16
@Gersho why its filtering out the elements of the array
isaac820
@isaac820
Mar 17 2017 01:16
pls i need your help am stuck here for like two hour a = a + 15;
b = b + 26;
c = c + 19;
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:16
baring in mind that the filter function takes a function in its callback thats meant to return a boolean expression
isaac820
@isaac820
Mar 17 2017 01:16
You should use the += operator for each variable
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:17
@isaac820 a = a + 15; is the same as a += 15
it wants you to use the second type
Gersho
@Gersho
Mar 17 2017 01:17
@HeebieGeeBee it's supposed to return boolean ? i taught it returned the value being currently scanned
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:18
@Gersho yes so the filter filters out everything that it passes into its callback function and gets a return of false with
Joseph
@revisualize
Mar 17 2017 01:18
Hi.
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:18
@revisualize yo
Seth
@sethdcd
Mar 17 2017 01:19
welp! i got it, but i have to imagine if i tried this outside of the FCC workspace it probably wouldn't work lol
function convertToRoman(num) {

  var numKey = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000];
  var romanKey = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', 'M', 'MM', 'MMM'];

  var convertNum = String(num);
  var number = convertNum.split('');
  var final = [];

  if (number.length === 1) {

    var one = number[0];
    one = numKey.indexOf(Number(one));
    one = romanKey[one];
    final.push(one);

  } else if (number.length === 2) {

    var ten = number[0] + '0';
    ten = numKey.indexOf(Number(ten));
    ten = romanKey[ten];
    final.push(ten);

    var tenOne = number[1];
    tenOne = numKey.indexOf(Number(tenOne));
    tenOne = romanKey[tenOne];
    final.push(tenOne);

  } else if (number.length === 3) {

    var hundo = number[0] + '0' + '0';
    hundo = numKey.indexOf(Number(hundo));
    hundo = romanKey[hundo];
    final.push(hundo);

    var hundoTen = number[1]  + '0';
    hundoTen = numKey.indexOf(Number(hundoTen));
    hundoTen = romanKey[hundoTen];
    final.push(hundoTen);    

    var hundoTenOne = number[2];
    hundoTenOne = numKey.indexOf(Number(hundoTenOne));
    hundoTenOne = romanKey[hundoTenOne];
    final.push(hundoTenOne); 

  } else if (number.length === 4) {

    var thou = number[0] + '0' + '0' + '0';
    thou = numKey.indexOf(Number(thou));
    thou = romanKey[thou];
    final.push(thou);

    var thouHundo = number[1] + '0' + '0';
    thouHundo = numKey.indexOf(Number(thouHundo));
    thouHundo = romanKey[thouHundo];
    final.push(thouHundo);    

    var thouHundoTen = number[2] + '0';
    thouHundoTen = numKey.indexOf(Number(thouHundoTen));
    thouHundoTen = romanKey[thouHundoTen];
    final.push(thouHundoTen);  

    var thouHundoTenOne = number[3];
    thouHundoTenOne = numKey.indexOf(Number(thouHundoTenOne));
    thouHundoTenOne = romanKey[thouHundoTenOne];
    final.push(thouHundoTenOne);      
  }
  return final.join('');
}
convertToRoman(36);
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:19
@sethdcd thats thorough
Gersho
@Gersho
Mar 17 2017 01:19
i'm getting lost, guess i'll go back read the doc ^ ^
Seth
@sethdcd
Mar 17 2017 01:19
@HeebieGeeBee lol, there has to be a more concise way
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:20

@Gersho

  function myFilter(item) {
  if (item !== false || item !== null || item !==0 || item !=="" || item !==undefined|| !isNaN) { 
    return item;
  }

    return;

}

so why do you think this is either returning true or false?

isaac820
@isaac820
Mar 17 2017 01:20
@HeebieGeeBee a += 15 am getting error
Seth
@sethdcd
Mar 17 2017 01:20
@HeebieGeeBee i'm just happy i figured it out without looking at the answer albeit a bit sloppy
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:20
@isaac820 show all your code
@sethdcd whateverworks
well done
ctal
@ctal
Mar 17 2017 01:21
Hi, I'm working on the Seek and Destroy challenge. I'm trying to use filter on an array, but getting a false is not a function TypeError
Gersho
@Gersho
Mar 17 2017 01:21
well, the way i made it, it should return either (item) (the value of the array being tested) or noting if the if check fails (so undefined ? or null ?)
Joseph
@revisualize
Mar 17 2017 01:22
@ctal Do you understand that return causes the function to halt
Gersho
@Gersho
Mar 17 2017 01:22
yes
Joseph
@revisualize
Mar 17 2017 01:22
@ctal Do you realize that var filteredArray = arguments[0]; is the same as arr?
Gersho
@Gersho
Mar 17 2017 01:23
i was about to start that one, i think i'll go back to read the doc, wouldn't want spoilers :P
thanks @HeebieGeeBee
CamperBot
@camperbot
Mar 17 2017 01:23
gersho sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1080 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
isaac820
@isaac820
Mar 17 2017 01:24

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

// Only modify code below this line
a = a + 15;
b = b + 26;
c = c + 19;

Joseph
@revisualize
Mar 17 2017 01:24
@Gersho Which lesson were you working on?
Gersho
@Gersho
Mar 17 2017 01:24
@revisualize i'm about to start seek and detroy :)
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:24
@Gersho just something to maybe think about
@isaac820 what did i say to you earlier?
Gersho
@Gersho
Mar 17 2017 01:24
but i prefer to start alone and ask later rather than having a first idea :3
isaac820
@isaac820
Mar 17 2017 01:24
@HeebieGeeBee instruction: Convert the assignments for a, b, and c to use the += operat
Joseph
@revisualize
Mar 17 2017 01:25
@Gersho GOOD LUCK!
juni
@junipberry
Mar 17 2017 01:25
guys, I'm in the Fahrenheit to Celsius section
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:26
a = a + 15 is the same as a += 15 and they want you to use the second way for all the variables
Joseph
@revisualize
Mar 17 2017 01:26
@junipberry Okay. What have you done?
ctal
@ctal
Mar 17 2017 01:26
@revisualize var filteredArray[0] being the same as arr makes sense, I'm guessing you can define the arguments in the function if you want to, but you can also refer to it using arguments, right?
@revisualize I removed the return from inside the for loop (since I want everything in the for loop to happen before I return the finished array)
juni
@junipberry
Mar 17 2017 01:27
I get how to convert it. But its not clear what I "algorithm" I have to apply to it
ctal
@ctal
Mar 17 2017 01:27
But I still don't understand why my notEqualFilter is false (or at least that's how I interpret the error)
Tono
@2hands10fingers
Mar 17 2017 01:28
Can anyone explain to me why I can't setup matter.js correctly? lol
A010
@A010
Mar 17 2017 01:29
Hi guys why is the challenge Seek and Destroy is so hard, I spent so much time on it and still can't figure it out, please can someone help explaining it to me?
Rich De Francesco
@FriscoBoston
Mar 17 2017 01:29
Hello, I finished coding the Golf Game. I'm able to return the correct results by updating the arguments but I'm still seeing x's on the argument lines under "run tests" section. I've also checked the code on GitHub and it is identical. Is this a bug or am I doing something wrong?
Manish Giri
@Manish-Giri
Mar 17 2017 01:29
@FriscoBoston which game?
Rich De Francesco
@FriscoBoston
Mar 17 2017 01:30
The Golf Code game
EthanEFung
@EthanEFung
Mar 17 2017 01:30
@FriscoBoston what did you write?
Manish Giri
@Manish-Giri
Mar 17 2017 01:30
@FriscoBoston show your code..
Rich De Francesco
@FriscoBoston
Mar 17 2017 01:30

function golfScore(par, strokes) {
// Only change code below this line
if (strokes == 1){
return "Hole-in-One!";
}else if (strokes <= par -2){
return "Eagle";
}else if (strokes == par -1){
return "Birdie";
}else if (strokes == par){
return "Par";
}else if (strokes == par + 1){
return "Bogey";
}else if (strokes == par + 2){
return "DoubleBogey";
}else {
return "GoHome!";
}
// Only change code above this line
}

// Change these values to test
golfScore(1, 1);

HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:30
@2hands10fingers how are you trying to set it up
Manish Giri
@Manish-Giri
Mar 17 2017 01:30
@FriscoBoston "GoHome!"; a space here maybe?
juni
@junipberry
Mar 17 2017 01:31
I wrote convertToF=30*(9/5)+32
Manish Giri
@Manish-Giri
Mar 17 2017 01:31
check the instructions.
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:31
and the double bogey
Joseph
@revisualize
Mar 17 2017 01:31
@FriscoBoston Text needs to be EXACT! Hole-in-one!
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 01:32
@2hands10fingers if you dont say how youre trying to set it up, how we gonna know what you might be doing wrongg
ctal
@ctal
Mar 17 2017 01:36
Is there an issue with filtering an array inside the loop that causes problems?
juni
@junipberry
Mar 17 2017 01:42
is it wrong if I write var Celsius= 30*(9/5)=32;
*+32;
EthanEFung
@EthanEFung
Mar 17 2017 01:47
@ctal do you have an example?
Spyrantis Theodoros
@thodorisanta
Mar 17 2017 01:49

i cant make the SESSION and PAUSE button to be exactly on top of the numbers (25 and 5)...can someone help me please :P

http://codepen.io/oshikurou/pen/zZogbx

Tono
@2hands10fingers
Mar 17 2017 01:53
@HeebieGeeBee sorry. Driving home. I'll brb
I receive the following error: TypeError: false is not a function
ctal
@ctal
Mar 17 2017 02:03
Ah, I figured it out. By putting my function as notEqualFilter() instead of notEqualFilter inside filter, I was calling the function, returning false, and passing that to filter (instead of passing the function)
EthanEFung
@EthanEFung
Mar 17 2017 02:07
@ctal I'm probably not the person you would want to ask that question to. But if I'm not mistaken, you've assigned filterValues to the first position in the array arguments, but your first for loop initiates in the second place holder of the array. Was that intentional?
Gersho
@Gersho
Mar 17 2017 02:09
i just spend 30+mins working on some code assuming
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
was a multi layered array >_>
meh
EthanEFung
@EthanEFung
Mar 17 2017 02:09
@ctal I'm sorry, I read that wrong, filteredArraytakes the first position in the array ```arguments.
ctal
@ctal
Mar 17 2017 02:12
@Ethanefung Thanks, I actually figured out what I was doing. I was trying to assign filteredArray to the first position in the array of arguments, since the first position of the array is an array. I cleaned up my language and it worked. My other problem was not assigning the filtered array to anything
CamperBot
@camperbot
Mar 17 2017 02:12
ctal sends brownie points to @ethanefung :sparkles: :thumbsup: :sparkles:
:cookie: 243 | @ethanefung |http://www.freecodecamp.com/ethanefung
ivorygrant
@ivorygrant
Mar 17 2017 02:20
is there a way to view a solution to completed exercise? sometimes I need to refer to back and half the time it's there half it's not
heenabegum167
@heenabegum167
Mar 17 2017 02:22
Concatenating Strings with Plus Operator : my code
var myStr = "This is the start." + "This is the end.";
it doesnot pass me to next challenge
ivorygrant
@ivorygrant
Mar 17 2017 02:26
@heenabegum167 it might be a spacing issue, add a space after . in "this is the start."
ctal
@ctal
Mar 17 2017 02:26
@ivorygrant The freeCodeCamp wiki has a guide for most algorithm challenges with hints and a solution: https://forum.freecodecamp.com/c/wiki
heenabegum167
@heenabegum167
Mar 17 2017 02:27
thank you so much it worked! @ivorygrant
CamperBot
@camperbot
Mar 17 2017 02:27
heenabegum167 sends brownie points to @ivorygrant :sparkles: :thumbsup: :sparkles:
:cookie: 206 | @ivorygrant |http://www.freecodecamp.com/ivorygrant
ctal
@ctal
Mar 17 2017 02:27
I personally find it more helpful to struggle through, even if it's for something I've solved before, though, because it helps it stick more for me
ivorygrant
@ivorygrant
Mar 17 2017 02:29

@ctal agreed with that approach. I'm on the testing objects for properties and i can't seem to return for the property "not found"

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

function checkObj(checkProp) {
// Your Code Here

myObj.hasOwnProperty("gift");
myObj.hasOwnProperty("pet");
myObj.hasOwnProperty("house");

return myObj[checkProp];

}

i know i did it before so i figured to check that before asking
Karan Nandha
@karann7
Mar 17 2017 02:30

function findLongestWord(str) {
  //Spliting the string into Array of words
  var splitStr = str.split(" ")

  //.replace(/\^A-Z+0-9+/gi, ""); add this code to ignore all non apha chars.
  //A loop to go through the sentence
  for(var i = 0; i < splitStr.length; i++) {

  //Find the higest number in the sentence
    var listOfWords = splitStr[i] + " " +splitStr[i].length;
    console.log(listOfWords);
}
}

findLongestWord("Your brother is my best friend and my Dog too");
Hello, I am trying to find the highest number in the array. I have an array made already, and I Am displaying the count of characters and the value itself.
I have trie Math.max but i can't seem to find a way to figure out the highest number.
Joseph
@revisualize
Mar 17 2017 02:34
@karannandha You need a new variable.
eyesore-
@eyesore-
Mar 17 2017 02:34
@karannandha I think you are confused on what splitStr is
Joseph
@revisualize
Mar 17 2017 02:34
@karannandha You'll need variable to store the longest word .. Or you can store the length of the longest word. Then it is just a comparison.
@ivorygrant You need to create an IF statement. .hasOwnProperty() returns a boolean value that you can use in your if condition.
Roxroy
@roxroy
Mar 17 2017 02:38
@karannandha, first split the sentence into words. Then split each word into letters. Count each letters and keep track of the one that is longest.
Karan Nandha
@karann7
Mar 17 2017 02:40
okay thank you everyone very much!
Roxroy
@roxroy
Mar 17 2017 02:40
@karannandha , check back and let me know how it's going
oscar carrillo
@oscarrillo90
Mar 17 2017 02:41
function nextInLine(arr, item) {
  // Your code here

  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
How do i Write a function nextInLine 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 nextInLine function should then return the element that was removed.
Roxroy
@roxroy
Mar 17 2017 02:43
@oscarrillo90 , the key is using he arguments object, check out https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/arguments
ivorygrant
@ivorygrant
Mar 17 2017 02:44

@revisualize
return myObj.hasOwnProperty();

if (myObj.hasOwnProperty() == true) {

i get the return part, but the IF statement not sure how to set up
plus i need to consider the property not just if its true or false
so it returns pony and kitten
Kelvin Maués
@kelvinmaues
Mar 17 2017 02:47
function whatIsInAName(collection, source) {
  var arr = [];
  for (var i = 0; i < collection.length; i++) {
      for (var collectionKey in collection[i]) {
        for (var nameKey in source) {
          if (collection[i][collectionKey] == source[nameKey]) {
              arr.push(collection[i]);
          }
        }
      }
    }
  console.log(arr)
  return arr
}

whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
// should return [{ first: "Tybalt", last: "Capulet" }]
whatIsInAName([{ "a": 1 }, { "a": 1 }, { "a": 1, "b": 2 }], { "a": 1 });
// should return [{ "a": 1 }, { "a": 1 }, { "a": 1, "b": 2 }]
whatIsInAName([{ "a": 1, "b": 2 }, { "a": 1 }, { "a": 1, "b": 2, "c": 2 }], { "a": 1, "b": 2 });
// should return [{ "a": 1, "b": 2 }, { "a": 1, "b": 2, "c": 2 }]
Folks, I need some help. I'm trying to solve this algorithms for hours, but I struggle in logical. The last test is going wrong, because it is adding all the objects twice for each key-value in the source object. You can copy and paste to run the code to see the results.
oscar carrillo
@oscarrillo90
Mar 17 2017 02:48
@roxroy i still dont understand
Kelvin Maués
@kelvinmaues
Mar 17 2017 02:49
@oscarrillo90 I will help you with it giving the right tools
Joseph
@revisualize
Mar 17 2017 02:49
@ivorygrant You have to pass an argument to .hasOwnProperty()
@ivorygrant You did that here: myObj.hasOwnProperty("gift"); You're passing the string "gift" to the method .hasOwnProperty()
@ivorygrant What if instead of passing the string you passed a variable or the parameter.
oscar carrillo
@oscarrillo90
Mar 17 2017 02:50
@kelvinmaues my problem is the second to last code display
Joseph
@revisualize
Mar 17 2017 02:51
@ivorygrant .hasOwnProperty() ONLY returns a boolean value (true / false)
@ivorygrant You need other programming logic to return the object property value.
c0d0er
@c0d0er
Mar 17 2017 02:51
does anybody know why my bar chart code cannot show correct position of amount? right now the amount is shown under the bar chart, but it should be shown as tooltip by the cursor, the code lines are 46-49, http://codepen.io/c0d0er/pen/qrjwGg?editors=0011
ivorygrant
@ivorygrant
Mar 17 2017 02:51
ok I think i follow, let me see what i can do
Kelvin Maués
@kelvinmaues
Mar 17 2017 02:52
@oscarrillo90
To append or add an item to end of an array
https://www.freecodecamp.com/challenges/manipulate-arrays-with-push
to remove an item from the beggining of an array
https://www.freecodecamp.com/challenges/manipulate-arrays-with-shift
oscar carrillo
@oscarrillo90
Mar 17 2017 03:01
@kelvinmaues what am i doing wrong?
function nextInLine(arr, item) {
  nextInLine.push(arr);
  removedFromNextInLine = nextInLine.shift();// Your code here

  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
ivorygrant
@ivorygrant
Mar 17 2017 03:01

@revisualize ok this is what I came up with
return myObj[checkProp];

if (checkProp !== undefined){
return checkProp;

}
else{
return "Not Found";
}

return myObj[checkProp];


    if (checkProp !== undefined){
    return checkProp;
  }
   else{
     return "Not Found";
   }
Joseph
@revisualize
Mar 17 2017 03:01
@ivorygrant What happened to .hasOwnProperty()?
@ivorygrant If you return anything below that return will NEVER be reached.
Kelvin Maués
@kelvinmaues
Mar 17 2017 03:03
@oscarrillo90 let me see it
ivorygrant
@ivorygrant
Mar 17 2017 03:03
well i figured to pass through the value, and then check if it exists
Joseph
@revisualize
Mar 17 2017 03:03
@oscarrillo90 nextInLine is the function name
@oscarrillo90 The parameters are arr and item
@ivorygrant It will not.
@ivorygrant Look. You're leaving out code too.
ivorygrant
@ivorygrant
Mar 17 2017 03:05

@revisualize you're right, i'll paste the whole thing:
```
function checkObj(checkProp) {
// Your Code Here

myObj.hasOwnProperty("gift");
myObj.hasOwnProperty("pet");
myObj.hasOwnProperty("house");

if (checkProp !== undefined){
return checkProp;

}
else{
return "Not Found";
}

}

function checkObj(checkProp) {
  // Your Code Here

  myObj.hasOwnProperty("gift");
  myObj.hasOwnProperty("pet");
  myObj.hasOwnProperty("house");

    if (checkProp !== undefined){
    return checkProp;
  }
   else{
     return "Not Found";
   } 

}
Srijan
@srijan1709
Mar 17 2017 03:05
Hi
Kelvin Maués
@kelvinmaues
Mar 17 2017 03:05
@oscarrillo90
function nextInLine(arr, item) {
  arr.push(item);
  arr.shift();// Your code here
  console.log(arr);
  return arr;  // Change this line
}

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

// Display Code
nextInLine(testArr, 6)
Joseph
@revisualize
Mar 17 2017 03:05
@ivorygrant Let me show you what I think you're doing:
function checkObj(checkProp) {
    return myObj[checkProp];
    // if this is what you're doing.. Once the return statement above is reached the function HALTS.

    if (checkProp !== undefined){
        return checkProp;
    } else {
     return "Not Found";
   } 
}
Srijan
@srijan1709
Mar 17 2017 03:05
Truncate a string
oscar carrillo
@oscarrillo90
Mar 17 2017 03:06
@kelvinmaues
function nextInLine(arr, item) {
  nextInLine.push(arr);
  removedFromNextInLine = nextInLine.shift();// Your code here

  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Joseph
@revisualize
Mar 17 2017 03:06
@ivorygrant What happened to THIS: if (myObj.hasOwnProperty() == true) { ???
Srijan
@srijan1709
Mar 17 2017 03:06
function truncateString(str, num) {
// Clear out that junk in your trunk
// str="A-tisket a-tasket A green and yellow basket";
//num="A-tisket a-tasket A green and yellow basket".length;
if(num<=3){
str=str.substr(0,num)+"...";
}
else
str=str.substr(0,num-3)+"...";
return str;
}
Joseph
@revisualize
Mar 17 2017 03:06
@oscarrillo90 Again, nextInLine is not an array. It is a function. In fact it is the function NAME.
ivorygrant
@ivorygrant
Mar 17 2017 03:07
@revisualize I didn't think that was correct, because it telling me its true doesn't help me identify if it's a pony or kitten
just that it exists
Joseph
@revisualize
Mar 17 2017 03:07
@kelvinmaues You're not supposed to be returning the arr you're supposed to be returning the element removed from the array.
Srijan
@srijan1709
Mar 17 2017 03:07
function is failing for truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length) should return "A-tisket a-tasket A green and yellow basket".
truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2) should return "A-tisket a-tasket A green and yellow basket".
truncateString("A-", 1) should return "A...".
any help?
Joseph
@revisualize
Mar 17 2017 03:07
@ivorygrant Do you realize that if statements only run based upon true or false?
ivorygrant
@ivorygrant
Mar 17 2017 03:07
yes
Joseph
@revisualize
Mar 17 2017 03:08
@ivorygrant
// generic if statement
    if (evaluation) { // << what's in here needs to evaluate to true or false
        return "truth"; // true stuff
    } else {
        return "lies"; // false stuff
    }
Kelvin Maués
@kelvinmaues
Mar 17 2017 03:09
@revisualize Oh totally! Sorry, let me see it again!
Srijan
@srijan1709
Mar 17 2017 03:10
Hey
Joseph
@revisualize
Mar 17 2017 03:11
@ivorygrant Does that make sense?
Kelvin Maués
@kelvinmaues
Mar 17 2017 03:12
@oscarrillo90
function nextInLine(arr, item) {
  arr.push(item);
  var value = arr.shift();// Your code here
  console.log(value);
  return value;  // Change this line
}

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

// Display Code
nextInLine(testArr, 6)
ivorygrant
@ivorygrant
Mar 17 2017 03:12

@revisualize Yes, I think i'm much closer now
```
function checkObj(checkProp) {
// Your Code Here

myObj.hasOwnProperty("gift");
myObj.hasOwnProperty("pet");
myObj.hasOwnProperty("house");

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

Joseph
@revisualize
Mar 17 2017 03:12
@ivorygrant Delete these lines:
myObj.hasOwnProperty("gift");
myObj.hasOwnProperty("pet");
myObj.hasOwnProperty("house");
ivorygrant
@ivorygrant
Mar 17 2017 03:14
i added those because I thought i had to first check each property?
oscar carrillo
@oscarrillo90
Mar 17 2017 03:14
@kelvinmaues thank you!
CamperBot
@camperbot
Mar 17 2017 03:14
oscarrillo90 sends brownie points to @kelvinmaues :sparkles: :thumbsup: :sparkles:
:cookie: 276 | @kelvinmaues |http://www.freecodecamp.com/kelvinmaues
Kelvin Maués
@kelvinmaues
Mar 17 2017 03:14
@oscarrillo90 you're welcome
Joseph
@revisualize
Mar 17 2017 03:15
function nextInLine(arr, item) {
  arr.push(item);
  return arr.shift();
}
Kelvin Maués
@kelvinmaues
Mar 17 2017 03:15
@revisualize it's a good option too, without so many lines of code (Y)
Joseph
@revisualize
Mar 17 2017 03:16
function nextInLine (arr, item) { return arr.push(item), arr.shift(); }
function nextInLine (arr, item) { return arr.concat(item).shift(); }
Joseph
@revisualize
Mar 17 2017 03:22
@ivorygrant How are you doing?
ivorygrant
@ivorygrant
Mar 17 2017 03:23
@revisualize still not getting it.
deleted those lines as you said. re read instructions. this is what i have currently:
Joseph
@revisualize
Mar 17 2017 03:24
@ivorygrant What do you have?
ivorygrant
@ivorygrant
Mar 17 2017 03:24
function checkObj(checkProp) {
  // Your Code Here

  if (myObj.hasOwnProperty() === true) {
    return checkProp;
  }
  else {
    return "Not Found";
  }
Joseph
@revisualize
Mar 17 2017 03:25
@ivorygrant Okay. What do you think you need to put inside of myObj.hasOwnProperty()?
@ivorygrant What is checkProp?
ivorygrant
@ivorygrant
Mar 17 2017 03:25
i tried passing through checkProp
Joseph
@revisualize
Mar 17 2017 03:25
@ivorygrant Show me what you tried.
ivorygrant
@ivorygrant
Mar 17 2017 03:25
function checkObj(checkProp) {
  // Your Code Here

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

}
Joseph
@revisualize
Mar 17 2017 03:26
@ivorygrant That change you made.. Is correct.
@ivorygrant Your return statement is incorrect.
the0ffh
@the0ffh
Mar 17 2017 03:27
Hello!
Did you guys play with clip-path animations?
Joseph
@revisualize
Mar 17 2017 03:27
@ivorygrant How do you access an object property value with a variable?
the0ffh
@the0ffh
Mar 17 2017 03:27
mine goes nuts at one point :/
Joseph
@revisualize
Mar 17 2017 03:27
@the0ffh FreeCodeCamp/HelpJavaScript Get help on our basic JavaScript and Algorithms Challenges.
ivorygrant
@ivorygrant
Mar 17 2017 03:27
@revisualize ok i see the error, i need to specify the value.
the0ffh
@the0ffh
Mar 17 2017 03:28
otoh i think it might be related to my 'brilliant' js skills.. mind taking a look?
Matthew
@IMDBLM
Mar 17 2017 03:28
I'm having trouble understanding Nesting for Loops. Using the example I thought I would be iterating through everything, but when I try to multiply I'm not passing.

function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i = 0; i < arr.Length; i++) {
    for (var j = 0; j < arr[i].length; j++) {
      product = (arr[i] * arr[j]);
    }
  }

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Manish Giri
@Manish-Giri
Mar 17 2017 03:29
@IMDBLM product = (arr[i] * arr[j]);
Joseph
@revisualize
Mar 17 2017 03:29
@IMDBLM You don't understand how to access sub-array elements.
Manish Giri
@Manish-Giri
Mar 17 2017 03:29
this bit is slightly off.
@IMDBLM
Matthew
@IMDBLM
Mar 17 2017 03:30
I'll read it, thanks @revisualize
CamperBot
@camperbot
Mar 17 2017 03:30
imdblm sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3534 | @revisualize |http://www.freecodecamp.com/revisualize
the0ffh
@the0ffh
Mar 17 2017 03:30
@revisualize yes, i can read. ty.
CamperBot
@camperbot
Mar 17 2017 03:30
the0ffh sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3535 | @revisualize |http://www.freecodecamp.com/revisualize
Matthew
@IMDBLM
Mar 17 2017 03:31
Riiiiiiiight. Already.
Jim
@JLOSS1
Mar 17 2017 03:31
hey whats up anybody got a second? having trouble with 'Introducing Else Statements' in basic algorithms
Joseph
@revisualize
Mar 17 2017 03:31
@IMDBLM How's things now?
Manish Giri
@Manish-Giri
Mar 17 2017 03:32
@JLOSS1 what's the problem?
Matthew
@IMDBLM
Mar 17 2017 03:32
@revisualize I'm going to read the whole thing before I go back. But that first couple of lines I realized what you meant
Jim
@JLOSS1
Mar 17 2017 03:32
@Manish-Giri Here is my code
```
Joseph
@revisualize
Mar 17 2017 03:33
// generic if statement
    if (evaluation) { // << what's in here needs to evaluate to true or false
        return "truth"; // true stuff
    } else {
        return "lies"; // false stuff
    }
Jim
@JLOSS1
Mar 17 2017 03:33
function confirmEnding(str, target) {
  var string = (str);
  var lastLetter = string[string.length - 1];
  var letter = (target);
  if (lastLetter == letter) {
    return true;
  }
    else {
      return false;
    }
}

confirmEnding("Jim", "m");
Joseph
@revisualize
Mar 17 2017 03:34
@JLOSS1 Your problem is that target isn't always just 1 character.
Manish Giri
@Manish-Giri
Mar 17 2017 03:35
@JLOSS1 there are other test cases which check with target being more than 1 letter...
your code will fail those.
Jim
@JLOSS1
Mar 17 2017 03:35
ahh. okay. back to google for me. thanks @revisualize @Manish-Giri
CamperBot
@camperbot
Mar 17 2017 03:35
jloss1 sends brownie points to @revisualize and @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4784 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 3536 | @revisualize |http://www.freecodecamp.com/revisualize
ivorygrant
@ivorygrant
Mar 17 2017 03:37
function checkObj(checkProp) {
  // Your Code Here

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

}
@revisualize TY!
CamperBot
@camperbot
Mar 17 2017 03:37
ivorygrant sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3537 | @revisualize |http://www.freecodecamp.com/revisualize
ivorygrant
@ivorygrant
Mar 17 2017 03:38
i feel the difficulty curve went up tremendously with these last few exercises
Joseph
@revisualize
Mar 17 2017 03:42
@ivorygrant === true not needed.
@ivorygrant It keeps going up.
ivorygrant
@ivorygrant
Mar 17 2017 03:42
so just '== true' is ok?
the0ffh
@the0ffh
Mar 17 2017 03:42
Let me start again. When the css classes responsible for animation are being added/removed using jquery, the huge wild mess appears. Chrome inspector shows that something is causing a strange add/remove loop for the above which I am unable to locate. Could you take a look? I am blind :/
Manish Giri
@Manish-Giri
Mar 17 2017 03:43
@ivorygrant just if (myObj.hasOwnProperty(checkProp))
Matthew
@IMDBLM
Mar 17 2017 03:44

@revisualize I read your post and the comment left by someone else and came to this, which is also wrong.


function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i = 0; i < arr.Length; i++) {
    for (var j = 0; j < arr[i].length; j++) {
      product = (product * (arr[0] * arr[1] * arr[2]));
    }
  }

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

I also tried arr[0][0][1] and so on.

HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 03:45
@IMDBLM why do you think youre doing nested loops?
Matthew
@IMDBLM
Mar 17 2017 03:46
@HeebieGeeBee I don't follow. It's a nested loops challenge and I believed myself to be setting that up according to the example.
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 03:47
but for what purpose
Joseph
@revisualize
Mar 17 2017 03:47
@IMDBLM Let me ask you a questoin.
Matthew
@IMDBLM
Mar 17 2017 03:47
To multiply the values in the subarrays
Joseph
@revisualize
Mar 17 2017 03:48
@IMDBLM If I have this: arr = [[1,2],[3,4],[5,6,7]]; What is arr[0]?
Matthew
@IMDBLM
Mar 17 2017 03:48
1,2
Joseph
@revisualize
Mar 17 2017 03:48
@IMDBLM Can you multiply 1 by an array [1,2] ?
Jason
@itsallupo
Mar 17 2017 03:49
Hello.
Matthew
@IMDBLM
Mar 17 2017 03:50
@revisualize No, which is why I also tried to arr[0][0][1] because I thought the same. I need it to actually multiple each value
Joseph
@revisualize
Mar 17 2017 03:50
@IMDBLM If you have arr = [[1,2],[3,4],[5,6,7]] what is arr[0][0][1] ?
Matthew
@IMDBLM
Mar 17 2017 03:50
Oooooh
Jason
@itsallupo
Mar 17 2017 03:50
This is a pretty confusing way of getting help.
Joseph
@revisualize
Mar 17 2017 03:51
@itsallupo It is?
Matthew
@IMDBLM
Mar 17 2017 03:51
@revisualize arr[0][0][1] is techinally nothing, if I'm following correctly.
G-4-R-Y
@G-4-R-Y
Mar 17 2017 03:51
Hey guys, why isn't this a function and how can i get this to work?
function palindrome(str) {
  // Good luck!
  return (str.replace(/\W/g, "").toLowerCase() == str.replace(/\W/g, "").toLowerCase().reverse());  
}



palindrome("eye");
Joseph
@revisualize
Mar 17 2017 03:52
@IMDBLM You're correct . It is nothing.
Jason
@itsallupo
Mar 17 2017 03:52
Yeah. Do you just type a question in and hope someone bothers to respond to it?
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 03:52
@G-4-R-Y youre missing underscores from your regex, and reverse doesnt act upon strings
Matthew
@IMDBLM
Mar 17 2017 03:52
@itsallupo Don't hope. They will, for sure.
Joseph
@revisualize
Mar 17 2017 03:52
@itsallupo Yes.
Matthew
@IMDBLM
Mar 17 2017 03:53
@itsallupo rather I've never not been helped, and I'm seriously confused presently
G-4-R-Y
@G-4-R-Y
Mar 17 2017 03:53
@HeebieGeeBee how can i check if they're a palindrome then? (thanks for the undersores thing :D)
Jason
@itsallupo
Mar 17 2017 03:53
Okay, maybe not confusing then. Different for sure though
Joseph
@revisualize
Mar 17 2017 03:53
@G-4-R-Y What is \W?
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 03:53
@G-4-R-Y well how do you reverse a string?
Joseph
@revisualize
Mar 17 2017 03:54
@itsallupo What else do you want? To post your question on a forum and hope that someone responds? Or post your question into a chat and hope that someone responds?
G-4-R-Y
@G-4-R-Y
Mar 17 2017 03:54
ill turn it to an array then reverse it?
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 03:54
@G-4-R-Y sounds good, but remember to join it too
G-4-R-Y
@G-4-R-Y
Mar 17 2017 03:54
@revisualize it stands for [^0-9a-zA-Z_] (saw it in google, lul)
@HeebieGeeBee sure, thanks!!
CamperBot
@camperbot
Mar 17 2017 03:54
g-4-r-y sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1081 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Joseph
@revisualize
Mar 17 2017 03:55
@G-4-R-Y And you need to remove all non-alphanumeric characters. ... Isn't _ not an alpha nor a numeric character?
Matthew
@IMDBLM
Mar 17 2017 03:55
@revisualize Ok so I could just do arr[0][0] * arr[0][1] and so forth but that doesn't meet a modular code right? It's not really expandable.
Not without manually having to add, I mean
Joseph
@revisualize
Mar 17 2017 03:56
@IMDBLM What about using the variables i and j???
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 03:56
@IMDBLM what do you think product and the nested loops are for?
G-4-R-Y
@G-4-R-Y
Mar 17 2017 03:56
@revisualize yeah... Ill figure another way lol
Jason
@itsallupo
Mar 17 2017 03:56
@revisualize You're right.
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 03:56
@G-4-R-Y its not drastically different you just need to add underscores to the regex
Joseph
@revisualize
Mar 17 2017 03:57
@itsallupo So, Do you actually happen to have a question? Or are you just here to complain about the process? Because, I've kind of been waiting for that question.
Cory Hoban
@Khaladin
Mar 17 2017 03:58
I'm stuck on https://www.freecodecamp.com/challenges/caesars-cipher, was wondering if I could get some help
``

function rot13(str) { // LBH QVQ VG!..... split the string into an array loop in the array

  var newStr = str.split(" ");
  var cipher = [];
  var letter = [];
  var splitCipher = [];
  for (i = 0; i < newStr.length; i++) {
    for (j = 0; j < newStr[i].length; j++) {
      var add = newStr[i].charCodeAt(j);

      if (add >= 65 && add <= 77) {
        cipher.push(add + 13);
      } else if (add >= 78 && add <= 90) {
        cipher.push(add - 13);
      } else {
        cipher.push(add);
      }

    }

    //use chunky monkey to figure out how to split the array up
    // trying to use multidimensional array to split the array into sub arrays

  }
  for (i = 0; i < cipher.length; i++){

    letter.push(cipher.fromCharCode(i));

    } 

  // for (k = 0; k < newStr[i].length; k += newStr[i].length) {
  //    splitCipher.push(cipher.slice(k, newStr[k].length));
  // }

  return cipher;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
Jason
@itsallupo
Mar 17 2017 03:58
I wasn't complaining
G-4-R-Y
@G-4-R-Y
Mar 17 2017 03:59
@HeebieGeeBee okay
Cory Hoban
@Khaladin
Mar 17 2017 03:59
some of my code is commented out because it wasn't working
Manish Giri
@Manish-Giri
Mar 17 2017 03:59

@IMDBLM the only thing you need to know is that the number of indices you need is equal to the number of arrays (or sub arrays) in your array.
so, if you have just one main array, like

var numbers = [1,2,3,4];

you can access any element from it with just one index

numbers[2]; //3

now, if you add a sub array to numbers, like so

var numbers = [1, 2, [3,4, 5], 6];

if you want the number 1, that will still be just one index, because it's a regular number - numbers[0]
but if you want to get the number 4, then you need another index - first index to get to position 2 in numbers, because the third element of numbers is the array [3,4,5].
And then just treat [3 ,4 ,5] as a regular array - to get the number 4 which is at position 1, you'd need [1] to numbers[2], so

numbers[2][1]; //4
Joseph
@revisualize
Mar 17 2017 03:59
@itsallupo Sorry, I must be mistaken then.
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:00
@Khaladin you seem to be complicating things a bit
Cory Hoban
@Khaladin
Mar 17 2017 04:01
@HeebieGeeBee I don't know how else to do it
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:01
you just need to look at every character determine its character code, then change the value of of its character code depending on where ti falls in the alphabet
whilst ignoring special characters like spaces and exclamation marks
Cory Hoban
@Khaladin
Mar 17 2017 04:02
@HeebieGeeBee so could I just use one for and if loop then?
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:03
i woulda thought one loop would be enough
if you want to use a loop to iterate
Cory Hoban
@Khaladin
Mar 17 2017 04:03
once it's split don't I need a second for loop to access those values?
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:04
does it take a loop to split a string?
Cory Hoban
@Khaladin
Mar 17 2017 04:04
no I split the string before I lopped
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:04
then what would the first loop be for?
Jason Luboff
@JLuboff
Mar 17 2017 04:05
Just waking up or never went to sleep? @HeebieGeeBee
Cory Hoban
@Khaladin
Mar 17 2017 04:05
[SERR][PBQR][PNZC]
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:05
@JLuboff no sleep yet
@Khaladin maybe you could just split it into an array of letters
Jason Luboff
@JLuboff
Mar 17 2017 04:05
Dang.
Cory Hoban
@Khaladin
Mar 17 2017 04:05
so the first loop would access newStr[0] = [SERR]
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:06
why do you need an array of words?
Cory Hoban
@Khaladin
Mar 17 2017 04:06
lol I don't know thats just where my mind went
@HeebieGeeBee thanks for the tip i think I'll be able to get it now
CamperBot
@camperbot
Mar 17 2017 04:06
khaladin sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1082 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:06
seems like youre making extra work
Cory Hoban
@Khaladin
Mar 17 2017 04:06
but still why isn't my fromCharCode working on line 28
im pretty new at this
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:07
@Khaladin read the documentation for it again
youre not using the function properly
Cory Hoban
@Khaladin
Mar 17 2017 04:07
can I add String.prototype?>
i've tried a bunch of things
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:07
its String.fromCharCode()
Sourabh Rangdal
@sourabhrangdal
Mar 17 2017 04:08
help
challenge : Testing Objects for Properties
I want to understand this Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found"
Cory Hoban
@Khaladin
Mar 17 2017 04:08
so I need to cenoveert it to a string and then use from Char Code is what your saying
Matthew
@IMDBLM
Mar 17 2017 04:09
@revisualize ok. So I'm still not totally sure but I'm beginning to better understand the function of i and j after a 3rd read through your doc. i is the array length, and j is the sub length, which will change depending on the subarray.
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:09
@Khaladin no you need to use the String keyword
with the capital S
Cory Hoban
@Khaladin
Mar 17 2017 04:10
I feel like I've tried that
G-4-R-Y
@G-4-R-Y
Mar 17 2017 04:11

@HeebieGeeBee I'm feeling retarded for not remembering this, but why isn't this working? lol

```

str.split("").reverse().join("");
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:11
@Khaladin well i isnt the character code either
@G-4-R-Y how do you know it isnt?
Aj Broman
@Bromana
Mar 17 2017 04:12
Can someone take a look at my code to see if it needs refactoring?
G-4-R-Y
@G-4-R-Y
Mar 17 2017 04:12
it's returning "hello", not "olleh"
Noobincoding
@Noobincoding
Mar 17 2017 04:12
javas.JPG
what is this? how can we solve it?
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:12
@G-4-R-Y well areyou assigning it to a variable?
Aj Broman
@Bromana
Mar 17 2017 04:13
@G-4-R-Y you need to clone the array
Manish Giri
@Manish-Giri
Mar 17 2017 04:13
@Noobincoding just follow the camelCase notation
to fix the variable names
Aj Broman
@Bromana
Mar 17 2017 04:13
@G-4-R-Y I had the same problem earlier :’)
Noobincoding
@Noobincoding
Mar 17 2017 04:13
what is camelCAse notation?
Cory Hoban
@Khaladin
Mar 17 2017 04:13
@HeebieGeeBee I don't get it, then how do I put a charCode in there?
Aj Broman
@Bromana
Mar 17 2017 04:14
let myArr = [1, 2, 3, 4];
let cloneArr = myArr.split(‘’).reverse.join(‘’);
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:14
@Khaladin charCodeAt maybe?
G-4-R-Y
@G-4-R-Y
Mar 17 2017 04:14
@HeebieGeeBee no... i have to return it as a string, won't it work using it as a string?
@Bromana how do i clone it? lol
Aj Broman
@Bromana
Mar 17 2017 04:14
read above ^^
G-4-R-Y
@G-4-R-Y
Mar 17 2017 04:14
oh, thanks
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:15
@G-4-R-Y strings are immutable
those metods only return a value they dont change the variable str
Cory Hoban
@Khaladin
Mar 17 2017 04:15
@HeebieGeeBee so charCodeAt[i]?
G-4-R-Y
@G-4-R-Y
Mar 17 2017 04:15
@HeebieGeeBee oh, i see.
if i want to return it as a string, how do i turn the variable into a string again later?
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:16
@Khaladin str.charCodeAt(i) or whatever
Joseph
@revisualize
Mar 17 2017 04:16
@IMDBLM If I have an array: var arr = [ ["a"] , ["b","c"] , ["d","e","f"] , ["g","h","i","k"] ]; How do you access "b"?
Matthew
@IMDBLM
Mar 17 2017 04:16
arr[1][0]
Joseph
@revisualize
Mar 17 2017 04:16
@IMDBLM How do you access "e"?
Matthew
@IMDBLM
Mar 17 2017 04:17
arr[2][1]
Joseph
@revisualize
Mar 17 2017 04:17
@IMDBLM How do you access "i"?
Aj Broman
@Bromana
Mar 17 2017 04:17

Gary if that doesn’t work, just do this:

let myArr = [‘cat’, ‘dog’, ‘guerrilla’];
let cloneArr = myArr;
cloneArr = cloneArr.split(‘’).reverse().join(‘’);

I’m not 100% on the routine cause I’ve been doing a hundred things since then but something like that x)

HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:17
@Khaladin mdn is a very good site for finding out how all the methods work
Matthew
@IMDBLM
Mar 17 2017 04:17
arr[3][2] @revisualize
Joseph
@revisualize
Mar 17 2017 04:18
@IMDBLM Do you notice how one number was counting upward as I stepped through the array elements?
Cory Hoban
@Khaladin
Mar 17 2017 04:18
@HeebieGeeBee I've looked for a long time now I've been stuck on this problem for 3 days
G-4-R-Y
@G-4-R-Y
Mar 17 2017 04:18
@Bromana just made it work like this:
  var a = str.split("").reverse().join("");
  return a;
Aj Broman
@Bromana
Mar 17 2017 04:18
:D <3
Matthew
@IMDBLM
Mar 17 2017 04:18
@revisualize because you're moving along the subarrys
Aj Broman
@Bromana
Mar 17 2017 04:18
Good job <3
G-4-R-Y
@G-4-R-Y
Mar 17 2017 04:18
@Bromana thanks for the help!
CamperBot
@camperbot
Mar 17 2017 04:18
g-4-r-y sends brownie points to @bromana :sparkles: :thumbsup: :sparkles:
:cookie: 216 | @bromana |http://www.freecodecamp.com/bromana
Joseph
@revisualize
Mar 17 2017 04:18
@IMDBLM What if that was a variable ... maybe like i?
@IMDBLM What if accessing the sub-array element was a variable like .. I don't know ... j?
Aj Broman
@Bromana
Mar 17 2017 04:19
The same as he posted before Joseph
arr[i][j]
Joseph
@revisualize
Mar 17 2017 04:20
@Bromana Where did he post that?
Aj Broman
@Bromana
Mar 17 2017 04:20
or arr[0][9001]
arr2 @ 00:17
3 min ago :P
Matthew
@IMDBLM
Mar 17 2017 04:21
@revisualize I appreciate sarcasm, don't get me wrong. But when I do product = (product * (arr[i][j])); it's wrong. So then I say I'm just missing other multiplications
Aj Broman
@Bromana
Mar 17 2017 04:21
Matthew can you repost your code?
Joseph
@revisualize
Mar 17 2017 04:22
@IMDBLM Wait that's wrong? That shouldn't be wrong.
Aj Broman
@Bromana
Mar 17 2017 04:22
I can take a look over ( not a guarantee I’ll know )
Matthew
@IMDBLM
Mar 17 2017 04:22
@revisualize I get 1
Jason Luboff
@JLuboff
Mar 17 2017 04:22
That's a lot of parenthesis
Joseph
@revisualize
Mar 17 2017 04:22
@IMDBLM Can we see the whole function?
ays10
@ays10
Mar 17 2017 04:22
some help is appreciated for "Using Objects for Lookups". Built the table but am lost on how to make the function phoneticLookup(val) work.
Matthew
@IMDBLM
Mar 17 2017 04:23
@revisualize @Bromana

function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i = 0; i < arr.Length; i++) {
    for (var j = 0; j < arr[i].length; j++) {
      product = (product * (arr[i][j]));
    }
  }

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Aj Broman
@Bromana
Mar 17 2017 04:23
look at your capitals
Jason Luboff
@JLuboff
Mar 17 2017 04:23
Lower case your l in length
Aj Broman
@Bromana
Mar 17 2017 04:23
lol :D
Matthew
@IMDBLM
Mar 17 2017 04:23
OMG
Joseph
@revisualize
Mar 17 2017 04:23
@IMDBLM Length
Aj Broman
@Bromana
Mar 17 2017 04:23
Gawp @IMDBLM
Ggwp*
:shipit:
Matthew
@IMDBLM
Mar 17 2017 04:24
@Bromana more like rekt.
Aj Broman
@Bromana
Mar 17 2017 04:24
haha :) we all do that stuff
Joseph
@revisualize
Mar 17 2017 04:24
@ays10 Got code?
Aj Broman
@Bromana
Mar 17 2017 04:24
My mac loves to caps my stuff :B
Edgar Pan
@edgaryp
Mar 17 2017 04:25
Hi, does anybody know why $session stays as 00:01 when setInterval finishes? And The $break has the same setInterval but it goes back an integer?
http://codepen.io/edgaryp/pen/evgRVe
ays10
@ays10
Mar 17 2017 04:25
Yeah. How do I share it?
Matthew
@IMDBLM
Mar 17 2017 04:25
So that was my first code. Then I got all wonky and confused and I started doing other things thinking I was wrong, and it turns out I just like capital letters. :-D
Aj Broman
@Bromana
Mar 17 2017 04:26
protip: jshint
I think it checks for errors like that.
Ernest L. Phillips
@ernest-phillips
Mar 17 2017 04:26

Having spot of trouble on this early challenge for escape sequences. ```
var myStr = "FirstLine\nSecondLine\rThirdLine"; // Change this line

```

Aj Broman
@Bromana
Mar 17 2017 04:26
Ok what about it @blulew77
Ernest L. Phillips
@ernest-phillips
Mar 17 2017 04:27
Can't get the newlines to work
Jason Luboff
@JLuboff
Mar 17 2017 04:27
You need to escape your backslashes
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:27
return str.split("").map(i => i.charCodeAt(0) > 65 ? String.fromCharCode(((i.charCodeAt(0)-65)%26) + 13)+65) : String.fromCharCode(i.charCodeAt(0)).join("");
will this work for casears cipher?
Jason Luboff
@JLuboff
Mar 17 2017 04:28
Did you try it? Lol
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:29
nah just wrote it just now
Jim
@JLOSS1
Mar 17 2017 04:29
Okay. I'm back. 'Still on Confirm the ending.' I am getting confused and think im overcomplicating this. could someone point me to what I could possibly be doing wrong with this code that I have?
 function confirmEnding(str, target) {
  //for the first string
  var firstString = str.split("");
  var idk = firstString[firstString.length - 1];
  var lastFirstThing = idk.slice(Math.max(idk.length - str, 0));
  //for the second string
  var nextString = target.split("");
  var lastNextString = nextString[nextString.length - 1];
  var final = lastNextString.slice(Math.max(lastNextString.length - target, 0));
  if (lastFirstThing == final) {
    return true;
  }
    else {
      return false;
    }
}

confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification");
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:29
kinda busy was hoping someone else would
Aj Broman
@Bromana
Mar 17 2017 04:29
\r is just a carriage return
Jason Luboff
@JLuboff
Mar 17 2017 04:29
I'm on mobile so...it already sucks
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:30
grr one sec then
Aj Broman
@Bromana
Mar 17 2017 04:30
if you wanted all three on sep lines, use \n //newline
I think carriage return only brings the cursor to the front of the line? idek tbh I’ve never had to use \r
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:32
getting lost in paranthesis
Joseph
@revisualize
Mar 17 2017 04:32
@JLOSS1 Question .. You know target has a .length and you can just get the negative (-) of that .length
Jason Luboff
@JLuboff
Mar 17 2017 04:32
I wish mobile Gitter didn't blow so much
Aj Broman
@Bromana
Mar 17 2017 04:32

Anyway back to what I came here for…..

Can someone see if my code can be refactored in a more efficient way?

 function findLongestWord(str) {
  str = str.split(' ');
  let bigWord = 0;
  str.forEach(function(word){
    if (word.length > bigWord){
        bigWord = word.length;
    }
  });
return bigWord;
}

findLongestWord("The quick brown fox jumped over the lazy dog”);
Jim
@JLOSS1
Mar 17 2017 04:33
@revisualize okay. that makes sense for that.
Joseph
@revisualize
Mar 17 2017 04:33
@JLOSS1
var str = 'abcdefghij';

console.log('(1, 2): '   + str.substr(1, 2));   // '(1, 2): bc'
console.log('(-3, 2): '  + str.substr(-3, 2));  // '(-3, 2): hi'
console.log('(-3): '     + str.substr(-3));     // '(-3): hij'    // when I was doing this lesson.. Something about this line stood out to me.
Aj Broman
@Bromana
Mar 17 2017 04:34
(I give up trying to mark)
This message was deleted
Joseph
@revisualize
Mar 17 2017 04:34
@HeebieGeeBee So, I have a project where I'm going to try and use https://pannellum.org/
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:35
very nice
Jim
@JLOSS1
Mar 17 2017 04:35
@revisualize oh shoot. I was looking at that on mdn earlier. forgot all about it. appreciate ya.
Traek Wells
@TraekWells
Mar 17 2017 04:36
can anyone tell me why this wouldn’t return the sum of all values in an array?
function addNumbers(numbers) {
  //numbers is an array of integers.
  //add all of the integers and return the value
  var count;
  for (var i = 0; i < numbers.length; i++) {
    count += numbers[i];
  }
  return count;
}
G-4-R-Y
@G-4-R-Y
Mar 17 2017 04:36

one last question, whats the usage of "^" in this:

a.replace(/[^a-z0-9]/g, " ")

?
Do I have to use "^" to select a group of characters or smth?

Aj Broman
@Bromana
Mar 17 2017 04:37
set count to 0 and try again
if its returning NaN which it does for me sometimes IDK y
lol
Traek Wells
@TraekWells
Mar 17 2017 04:37
@Bromana oh my god… lol. Thanks man. smh
CamperBot
@camperbot
Mar 17 2017 04:37
traekwells sends brownie points to @bromana :sparkles: :thumbsup: :sparkles:
:cookie: 217 | @bromana |http://www.freecodecamp.com/bromana
Aj Broman
@Bromana
Mar 17 2017 04:37
heh np traek GL coding
Traek Wells
@TraekWells
Mar 17 2017 04:37
im struggling over here
lol
thanks though
Aj Broman
@Bromana
Mar 17 2017 04:37
same dude
I’m struggling every day
haha
Traek Wells
@TraekWells
Mar 17 2017 04:38
lol
Jason Luboff
@JLuboff
Mar 17 2017 04:38
Because without assigning a value to a variable, it will be undefined (or null, can't remember which)
Traek Wells
@TraekWells
Mar 17 2017 04:38
yeah, that seems weird to me
Aj Broman
@Bromana
Mar 17 2017 04:38
but careful in the future if you’re doing things like factorials or whatever. don’t always want that to be 0
lol
Joseph
@revisualize
Mar 17 2017 04:40
@HeebieGeeBee I'm going to try and take some 360 photos and turn them into little photo tours.
Jeremy
@JeremyAntonoff
Mar 17 2017 04:40
can someone help me
Aj Broman
@Bromana
Mar 17 2017 04:41
post away @JToddFL
Btw nice pic of the skyway bridge?
Jeremy
@JeremyAntonoff
Mar 17 2017 04:41
I came up with my own solution then researched what others came up with on this
Aj Broman
@Bromana
Mar 17 2017 04:41
(I’m in the bay too)
:D
Jeremy
@JeremyAntonoff
Mar 17 2017 04:41
function mutation(arr) {
  var first = arr[0].toLowerCase();
  var second = arr[1].toLowerCase().split('');
  var all2in1 = function(a, b) { return a && first.indexOf(b) !== -1 };
  return second.reduce(all2in1, true);
}
really
thats awesome
Aj Broman
@Bromana
Mar 17 2017 04:41
Yep, oldsmar
Jeremy
@JeremyAntonoff
Mar 17 2017 04:41
im in st pete
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:42
@revisualize wow sweet
Aj Broman
@Bromana
Mar 17 2017 04:42
haha nice, you ever go to any of the iron yard meet ups?
Jeremy
@JeremyAntonoff
Mar 17 2017 04:42
yep just started lol
some nice people there
Aj Broman
@Bromana
Mar 17 2017 04:42
also I’m not too good with reduce yet so I can’t help ya
Yeah I was there for orientation, that place is awesome and the staff is super cool
Jeremy
@JeremyAntonoff
Mar 17 2017 04:42
did you sign up?
i was gonna go to that but was out of town
Aj Broman
@Bromana
Mar 17 2017 04:43
I got declined for all the loans I needed and I missed this cohort
Jeremy
@JeremyAntonoff
Mar 17 2017 04:43
how far are you on freecodecamp
Aj Broman
@Bromana
Mar 17 2017 04:43
Not too far, I only use FCC as a secondary source when I’m burned out on my main one
Jeremy
@JeremyAntonoff
Mar 17 2017 04:43
whats your main one?
Aj Broman
@Bromana
Mar 17 2017 04:43
Treehouse
Jeremy
@JeremyAntonoff
Mar 17 2017 04:43
aww
and you dont think you can learn on your own without a bootcamp?
Traek Wells
@TraekWells
Mar 17 2017 04:44
ok now I’m trying to add words from an array to a new string
function wordsToSentence(words) {
  //words is an array of strings
  //return a string that is all of the words concatenated together
  //spaces need to be between each word
  //example: ['Hello', 'world!'] -> 'Hello world!'
  var newStr = '';
  for (var i = 0; i < words.length; i++) {
    newStr = words[i].push(' ');
  }
  return newStr;
}
help?
Aj Broman
@Bromana
Mar 17 2017 04:44
I’m doing an OK job, I just get lost and I don’t really know anybody around to talk to in person
Traek Wells
@TraekWells
Mar 17 2017 04:44
lol
Aj Broman
@Bromana
Mar 17 2017 04:44
Which I think would be super advantageous
gimme a sec traek ill take a look
Traek Wells
@TraekWells
Mar 17 2017 04:45
sure
thanks
Jeremy
@JeremyAntonoff
Mar 17 2017 04:45
I feel like if you dedicated yourself to the same amount of time as a bootcamp you could prob achieve the same goals. I looked into bootcamps as well
Aj Broman
@Bromana
Mar 17 2017 04:45
Whoa my dude, what is that return statement lol
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:45
return str.split("").map(i => i.charCodeAt(0) > 64 ? String.fromCharCode((((i.charCodeAt(0)-65) + 13)%26)+65) : String.fromCharCode(i.charCodeAt(0))).join("");
k that did it @JLuboff
Aj Broman
@Bromana
Mar 17 2017 04:45
Yeah, I spend like ~10-12hr a day learning
Traek Wells
@TraekWells
Mar 17 2017 04:46
not sure actually
Aj Broman
@Bromana
Mar 17 2017 04:46
for the past 3mo or so
Traek Wells
@TraekWells
Mar 17 2017 04:46
it’s not like that in my editor
i’ts commented out
Aj Broman
@Bromana
Mar 17 2017 04:46
oh ok lol
Jeremy
@JeremyAntonoff
Mar 17 2017 04:46
and you dont feel job ready yet?
thats a lot of time
Aj Broman
@Bromana
Mar 17 2017 04:46
I do
very much so
Jeremy
@JeremyAntonoff
Mar 17 2017 04:46
i mean as a junior dev
Jason Luboff
@JLuboff
Mar 17 2017 04:46
@HeebieGeeBee nice good job. Now go get some sleep, I know I am haha
Aj Broman
@Bromana
Mar 17 2017 04:46
But I’m afraid to go, I have impostor syndrome like a b**
HeebieGeeBee
@HeebieGeeBee
Mar 17 2017 04:46
im up for a while yet
Jeremy
@JeremyAntonoff
Mar 17 2017 04:47
dont you think landing a job right now would be a lot more worthwhile then a bootcamp
Aj Broman
@Bromana
Mar 17 2017 04:47
Ok Traek go research the toString method, and or the .split() .join() methods
Jeremy
@JeremyAntonoff
Mar 17 2017 04:47
esp being paid to learn instead of paying out 10-15k
Jason Luboff
@JLuboff
Mar 17 2017 04:47
@HeebieGeeBee you're a crazy one
Aj Broman
@Bromana
Mar 17 2017 04:47
For sure, but as I said man I’m just not confident to do it! I know SO much but I can’t really do anything IDK
I feel like I know so much anyways ;P
Front end ^
Traek Wells
@TraekWells
Mar 17 2017 04:48
@Bromana will do. thanks
CamperBot
@camperbot
Mar 17 2017 04:48
traekwells sends brownie points to @bromana :sparkles: :thumbsup: :sparkles:
:warning: traekwells already gave bromana points
Aj Broman
@Bromana
Mar 17 2017 04:48
there’s also the .concat() method
Jeremy
@JeremyAntonoff
Mar 17 2017 04:48
did you build a portfolio with some projects yet?
Aj Broman
@Bromana
Mar 17 2017 04:48
I dont wanna give away cause it’ll ruin the learning x)
Jonathan Marx Domah
@marxcom
Mar 17 2017 04:48
@TraekWells try initializing count to 0.
Aj Broman
@Bromana
Mar 17 2017 04:49
Yeah that’s the thing too, I dunno what to even put in a portfolio
What, a todo list in vanilla and jquery? It feels so blah haha
Jeremy
@JeremyAntonoff
Mar 17 2017 04:49
well im in the same boat as you brother
trying to land a job in the next few months
Aj Broman
@Bromana
Mar 17 2017 04:49
We’ll both make it
Jeremy
@JeremyAntonoff
Mar 17 2017 04:49
and not sure wether to keep going at it on my own or do a bootcamp
Aj Broman
@Bromana
Mar 17 2017 04:50
One sec jer
ivorygrant
@ivorygrant
Mar 17 2017 04:50
what bootcamps have you guys looked into
Jeremy
@JeremyAntonoff
Mar 17 2017 04:50
iron yard, app academy, devmountain, hack reactor for me
ivorygrant
@ivorygrant
Mar 17 2017 04:50
yea i've looked at AA and devmountain
i'm considering the community college plus FCC route
i don't see too much downside to that and it would be cheaper all around
Aj Broman
@Bromana
Mar 17 2017 04:51
CC is waaay too slow paced imo
I’m in a CS program and it’s just super mediocre lol
Jeremy
@JeremyAntonoff
Mar 17 2017 04:51
i already have an unrelated bachelors
hoping thats fine
if i can prove my worth
Rudy Hernandez
@rudolphh
Mar 17 2017 04:52
@Bromana i agree, but if you have no computer science experience its good to have.
Aj Broman
@Bromana
Mar 17 2017 04:52
btw @JToddFL I sent you a PM
Very true
Experience/portfolio > Degree
But Degree > nothing
ivorygrant
@ivorygrant
Mar 17 2017 04:52
what do you mean by super mediocre? classmates, professor?
Rudy Hernandez
@rudolphh
Mar 17 2017 04:53
definitely greater than, i can vouch for that lol
ivorygrant
@ivorygrant
Mar 17 2017 04:53
i was thinking CC for the social factor
Jeremy
@JeremyAntonoff
Mar 17 2017 04:53
do meetups
seriously
Rudy Hernandez
@rudolphh
Mar 17 2017 04:53
@ivorygrant better off going to meetups and such with people that have like-minded goals
Jeremy
@JeremyAntonoff
Mar 17 2017 04:53
tahts where you will make most of your connections
ivorygrant
@ivorygrant
Mar 17 2017 04:53
i see
Aj Broman
@Bromana
Mar 17 2017 04:54
^^^^
Jeremy
@JeremyAntonoff
Mar 17 2017 04:54
ive only been to two or three since i just found out about them and met so many people already
ivorygrant
@ivorygrant
Mar 17 2017 04:54
the ones through the FCC facebook page?
Rudy Hernandez
@rudolphh
Mar 17 2017 04:54
or on meetup.com
Matthew
@IMDBLM
Mar 17 2017 04:54
I had to clear my browser cache and all my previous work was lost. Might go back through all the JS again right now.
ivorygrant
@ivorygrant
Mar 17 2017 04:54
@rudolphh thanks rudy
CamperBot
@camperbot
Mar 17 2017 04:54
:warning: The user instance is not valid. Details: username User already exists (value: "rudolphh"); username is not unique (value: "rudolphh").
ivorygrant sends brownie points to @rudolphh :sparkles: :thumbsup: :sparkles:
Aj Broman
@Bromana
Mar 17 2017 04:55
or meetup app if you have a smartphone (hoping you do) xD
super convenient
Jeremy
@JeremyAntonoff
Mar 17 2017 04:55
yep meetup.com
is your best bet
people will be more than willing to help and give you advice about cc etc..
ivorygrant
@ivorygrant
Mar 17 2017 04:57
i see, yea i did a masters in accounting...had no idea how mundane it would be to work in a cpa firm :lol:
i'm still trying to get into the mindset that, people learn all this through their own and not like a cpa where you have to work and be supervised under someone
Rudy Hernandez
@rudolphh
Mar 17 2017 05:00
@ivorygrant np. well learning this stuff is just sort of a new frontier. it lacks much of the structure that many formal educational subjects have.
ivorygrant
@ivorygrant
Mar 17 2017 05:01
@rudolphh I agree completely, it's totally new for me
Rudy Hernandez
@rudolphh
Mar 17 2017 05:02
you become more of a researcher than simply a student right off the bat; the hats are interchangeable.
freeCodeCamp provides great guidance though
welcome, happy coding, and get going on those challenges as time permits.
Jason
@itsallupo
Mar 17 2017 05:06
I'm having a problem with the Counting Cards lesson, I'm not even sure where to start.
Sourabh Rangdal
@sourabhrangdal
Mar 17 2017 05:07
challenge : Testing Objects for Properties
help: i want to understand the code, i tried and done the challenge but still want to understand the connection. can anyone explain please
try 1:
function checkObj(checkProp) {
  // Your Code Here
 myObj = checkObj;
 checkObj.hasOwnProperty("gift");
}

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

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

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

try 5:
function checkObj(checkProp) {
  // Your Code Here
 if (myObj.hasOwnProperty(checkProp) === true) {
   return myObj[checkProp];
 } else {
   return "Not Found";
 }
}
Rudy Hernandez
@rudolphh
Mar 17 2017 05:07
@itsallupo i believe you were just taught about switch statements. i'd start there.
Jason
@itsallupo
Mar 17 2017 05:09
I'm not sure how to increment/decrement the global 'count' variable.
Ryan Steen
@Rsteen76
Mar 17 2017 05:09
uniteUnique([1, 2, 3], [5, 2, 1, 4], [2, 1], [6, 7, 8]);
uniteUnique([[1, 2, 3], [5, 2, 1, 4], [2, 1], [6, 7, 8]]);
Joseph
@revisualize
Mar 17 2017 05:09
@sourabhrangdal I like how you walked through everything you tried. ... How can I help?
GreenTreeMee
@GreenTreeMee
Mar 17 2017 05:09
Can anyone give me simple javascript projects list using html5,css and javascript apart from FCC ?
Ryan Steen
@Rsteen76
Mar 17 2017 05:10
I was wondering about the above statements. My code works with the second one but not the first. It seems the first doesn't pass all the values to the function.
GreenTreeMee
@GreenTreeMee
Mar 17 2017 05:10
One of the project i can think my own is to build an mp3 or video player that runs into the browser
Rudy Hernandez
@rudolphh
Mar 17 2017 05:10
@itsallupo what have you got so far?
don't say nothing. do anything, and go from there.
GreenTreeMee
@GreenTreeMee
Mar 17 2017 05:11
@revisualize :+1: Im looking into it. It seems interesting !
Sourabh Rangdal
@sourabhrangdal
Mar 17 2017 05:11
@revisualize thank your for replying Joseph, i re-read the previous challenges, tried more than 5 times with options and information. finally it works, but i am not satisfied because i didn't understand how the connection
CamperBot
@camperbot
Mar 17 2017 05:11
sourabhrangdal sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3538 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Mar 17 2017 05:12
@sourabhrangdal Would you like for me to break it down for you?
Sourabh Rangdal
@sourabhrangdal
Mar 17 2017 05:13
@revisualize it will be great and will appreciate your time please,
Joseph
@revisualize
Mar 17 2017 05:13
@sourabhrangdal Give me about 5 minutes.
Sourabh Rangdal
@sourabhrangdal
Mar 17 2017 05:13
sure please @revisualize
Rudy Hernandez
@rudolphh
Mar 17 2017 05:15
@itsallupo i think you know how to increment and decrement (count++ or count--) but you're going to have to do it only for certain 'case'(s). hope that's all you need ;)
Joseph
@revisualize
Mar 17 2017 05:24

@sourabhrangdal

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

With this code you have a function declaration of: function checkObj(checkProp) { }
The function name is checkObj and the parameter for the function is checkProp.
When you make the function call: checkObj("pet");
You are calling the function by name and passing the argument of "pet" to the parameter checkProp as the value.
So, the value of checkProp is now a string "pet" You're now checking if the object myObj has a property of checkProp which is the value of "pet".
If it does have an object property of "pet" it will return true as the method return.
Because if statements work off of a boolean value of true or false

    if (condition) {    // evaluates to true or false
        return "truth"; // true stuff
    } else {
        return "lies"; // false stuff
    }

Now because in this case the object myObj does have an object property of "pet" the .hasOwnProperty() method call will return true and true will be evaluated in you if condition to see if it is true. Which it is. Therfore the true statement block is exectuted.
In your functions if true block you have the statement of return myObj[checkProp]; Now checkProp has the value of "pet" ... So, return myObj["pet"]; ... It will then access the object myObj for the value of the value of the "pet" property. Which I belive is a string of "kitten". And that is of course sent back to the function caller as a value.

Jeremy
@JeremyAntonoff
Mar 17 2017 05:28
@revisualize can u help me ral quick
Joseph
@revisualize
Mar 17 2017 05:28
Only if it is ral quick.
Jeremy
@JeremyAntonoff
Mar 17 2017 05:28
lol
this is so completely stupid and i know i can do filter with this but i still dont understand why my code wont work here
function bouncer(arr) {
  var a = arr.join(" ")
  var splitArray = a.split(" ");
  var array = [];
  for (x = 0; x < splitArray.length; x++) {
    if (splitArray[x] !== false || splitArray[x] !== null || splitArray[x] !== 0 || splitArray[x] !== "" || splitArray[x] !== undefined || splitArray[x] !== NaN) {
      array.push(splitArray[x]);

    }
  }

  // Don't show a false ID to this bouncer.
  return array;
}

bouncer([7, "ate", "", false, 9]);
Joseph
@revisualize
Mar 17 2017 05:29
@JToddFL Can I not answer your question by asking a different question?
Sourabh Rangdal
@sourabhrangdal
Mar 17 2017 05:29
@revisualize i really appreciate your time Joseph and detail explanation. one question, i'm a beginner and curious the way i resolve it is the only way or is there any other way to do it
Ogundele Olumide
@Lumexralph
Mar 17 2017 05:30
@JToddFL you're not filtering NaN
Joseph
@revisualize
Mar 17 2017 05:30
@sourabhrangdal Yes.
Jeremy
@JeremyAntonoff
Mar 17 2017 05:30
im not?
Joseph
@revisualize
Mar 17 2017 05:30
@JToddFL NaN === NaN // false
Ogundele Olumide
@Lumexralph
Mar 17 2017 05:30
@JToddFL what's this splitArray[x] !== NaN ?
Jeremy
@JeremyAntonoff
Mar 17 2017 05:30
even if i take that out it doesnt work though
Ogundele Olumide
@Lumexralph
Mar 17 2017 05:30
@revisualize Hey Bro!
Joseph
@revisualize
Mar 17 2017 05:30
NaN !== NaN doesn't work.
Jeremy
@JeremyAntonoff
Mar 17 2017 05:31
i deleted that completely
Ogundele Olumide
@Lumexralph
Mar 17 2017 05:31
@JToddFL look at what @revisualize showed you
@JToddFL splitArray[x] is each value in the array which means at some point it will be NaN, how will you do that?
Sourabh Rangdal
@sourabhrangdal
Mar 17 2017 05:32
@revisualize ok so the way i resolve it was easy code to understand or difficult code to understand
@revisualize brb
Jeremy
@JeremyAntonoff
Mar 17 2017 05:32
hmmmm
Danny Romero
@dannyk08
Mar 17 2017 05:32
hello people
Jeremy
@JeremyAntonoff
Mar 17 2017 05:33
i have no idea
its my first time dealing with NaN
Ogundele Olumide
@Lumexralph
Mar 17 2017 05:33
@JToddFL we all have a first time :smile:
Danny Romero
@dannyk08
Mar 17 2017 05:33
for #225, do we want to ignore decimal numbers? if that is the case the result of the second test array would be 540, not 54 which is the expected answer
Jeremy
@JeremyAntonoff
Mar 17 2017 05:34
im guessing from looking up boolean objects
you test it by doing
isNaN(NaN);
Ogundele Olumide
@Lumexralph
Mar 17 2017 05:34
@JToddFL splitArray[x] is that NaN...... how do you do NaN !== NaN
Joseph
@revisualize
Mar 17 2017 05:34

@sourabhrangdal You could solve that like this:

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

Or Like this:

function checkObj(checkProp) {
 if (myObj.hasOwnProperty(checkProp)) {
   return myObj[checkProp];
 } else {
   return "Not Found";
 }
}

Which is actually better. Because .hasOwnProperty() returns true or false so doing the === true is redundant.
You could even solve it like this:

function checkObj(checkProp) {
 return (myObj.hasOwnProperty(checkProp)) ? myObj[checkProp] : "Not Found";
}

All three of those solutions do the same thing. I think the most readable is the second or the third one. But, you have to know what a ternary operator is and so do the other developers looking at your code.

Ogundele Olumide
@Lumexralph
Mar 17 2017 05:35
@JToddFL i use either Number.isNaN(val) that filters string too or NaN !==NaN
Danny Romero
@dannyk08
Mar 17 2017 05:35
please ignore my question guys
no sarcasm intended, I just ran my function again and it passed.. for some reason it didn't run correctly the first time.. weird
Jeremy
@JeremyAntonoff
Mar 17 2017 05:36
@Lumexralph I appreciate it. Why is my code not filtering any of that out when it pushes to the array
Ogundele Olumide
@Lumexralph
Mar 17 2017 05:37
@JToddFL because you're meant to do splitArray[x] !== splitArray[x] to filter NaN or Number.isNaN(splitArray[x])
Jeremy
@JeremyAntonoff
Mar 17 2017 05:38
it wont filter out
false
or ""
either though
Ogundele Olumide
@Lumexralph
Mar 17 2017 05:38
@JToddFL you don't need to join and split arr as you did above...just use the for loop and the empty array
Jeremy
@JeremyAntonoff
Mar 17 2017 05:39
still doesn't filter at all
any of those values
GreenTreeMee
@GreenTreeMee
Mar 17 2017 05:40
@revisualize Sir, You're awesome! The post!! thanks : )))
CamperBot
@camperbot
Mar 17 2017 05:40
greentreemee sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3539 | @revisualize |http://www.freecodecamp.com/revisualize
Jor
@joreyesl
Mar 17 2017 05:40
@JToddFL its because you are using ||. You don't want it to be any of those values so use &&
Danny Romero
@dannyk08
Mar 17 2017 05:40
thanks @01kapils, that's a very elegant solution btw
CamperBot
@camperbot
Mar 17 2017 05:40
dannyk08 sends brownie points to @01kapils :sparkles: :thumbsup: :sparkles:
:cookie: 115 | @01kapils |http://www.freecodecamp.com/01kapils
Ogundele Olumide
@Lumexralph
Mar 17 2017 05:42
@JToddFL show your code adding @joreyesl suggestion
Joseph
@revisualize
Mar 17 2017 05:42
@GreenTreeMee Which post?
Jeremy
@JeremyAntonoff
Mar 17 2017 05:42
awww
that makes sense
GreenTreeMee
@GreenTreeMee
Mar 17 2017 05:44
@revisualize "Every time you build a to-do list app, a puppy " !
:+1:
Joseph
@revisualize
Mar 17 2017 05:44
@GreenTreeMee Oh.. Yeah.
@GreenTreeMee There's also JavaScript30
GreenTreeMee
@GreenTreeMee
Mar 17 2017 05:45
@revisualize Awesome! Just checked in! what I want is to build things using Jquery,Js and maybe Ajax!!! : )
Does it use Vanilla.js?
Okay,Im checking it Sir !! :+1:
GreenTreeMee
@GreenTreeMee
Mar 17 2017 05:50
Wow!! downloaded the list! Thanks a lot! @revisualize :+1: :+1:
CamperBot
@camperbot
Mar 17 2017 05:50
greentreemee sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: greentreemee already gave revisualize points
Joseph
@revisualize
Mar 17 2017 05:50
@GreenTreeMee If you download it you can't see when I update it.
GreenTreeMee
@GreenTreeMee
Mar 17 2017 05:51
@revisualize Followed you Sir! :+1:
: )
Thanks!!
Jeremy
@JeremyAntonoff
Mar 17 2017 05:51
@revisualize it wont filter out null either
Joseph
@revisualize
Mar 17 2017 05:52
@JToddFL Can I ask a question?
Jeremy
@JeremyAntonoff
Mar 17 2017 05:52
yes
Joseph
@revisualize
Mar 17 2017 05:52
@JToddFL If there was a method already built into JavaScript that does exactly what you're trying to build was in JavaScript ... Would you use it?
Jeremy
@JeremyAntonoff
Mar 17 2017 05:53
yes lol
Joseph
@revisualize
Mar 17 2017 05:54
@JToddFL Do you realize that all of this:
splitArray[x] !== false || splitArray[x] !== null || splitArray[x] !== 0 || splitArray[x] !== "" || splitArray[x] !== undefined || splitArray[x] !== NaN
Could actually be written with https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean
@JToddFL Which is actually linked on the challenge page.
Jeremy
@JeremyAntonoff
Mar 17 2017 05:56
@revisualize yes i know and i saw that. I was just trying to understand why the code i had does not work. Trying to understand things better
Jor
@joreyesl
Mar 17 2017 05:57
did you make the suggested changes? Is it filtering some things now?
Jeremy
@JeremyAntonoff
Mar 17 2017 05:57
@joreyesl yes only wont pass the las two test and i think it still has to do with how i did the NaN
Drew Alcazar
@OtakuDrew
Mar 17 2017 05:58
Hey guys for this part im not sure what im missing here, but i think i has something do with my lookup not getting the parameter or something. Could someone help me out?

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

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

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

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

Ogundele Olumide
@Lumexralph
Mar 17 2017 05:58
@JToddFL you need to change splitArray to arr which is the array
Jor
@joreyesl
Mar 17 2017 05:58
@JToddFL post your updated code?
Drew Alcazar
@OtakuDrew
Mar 17 2017 05:59
instructions: Convert the switch statement into a lookup table called lookup. Use it to lookup val and assign the associated string to the result variable.
Jeremy
@JeremyAntonoff
Mar 17 2017 05:59

function bouncer(arr) {
  var splitArray = arr;
  var array = [];
  for (x = 0; x < splitArray.length; x++) {
    if (splitArray[x] !== false && splitArray[x] !== null && splitArray[x] !== 0 && splitArray[x] !== "" && splitArray[x] !== undefined && isNaN(false)) {
       array.push(splitArray[x]);

    }
  }

  // Don't show a false ID to this bouncer.
  return array;
}

bouncer([1, null, NaN, 2, undefined])
Ogundele Olumide
@Lumexralph
Mar 17 2017 05:59
@OtakuDrew use val to access the lookup object and assign the value to result
Joseph
@revisualize
Mar 17 2017 05:59
@OtakuDrew Objects are key value pairs.
@OtakuDrew Also:
Your function has declared and initialized the variable result to "". You are not modifying result and your function is returning result. Ergo, you're returning "". You need to modify result to be the value of the property from the object that you created.
Ogundele Olumide
@Lumexralph
Mar 17 2017 06:00
@JToddFL Number.isNaN(splitArray[ x ])
Drew Alcazar
@OtakuDrew
Mar 17 2017 06:00
@Lumexralph what does "tp" mena
mean
Ogundele Olumide
@Lumexralph
Mar 17 2017 06:01
@OtakuDrew oh.. sorry typo
Jeremy
@JeremyAntonoff
Mar 17 2017 06:01
@Lumexralph it says number is not defined
Ogundele Olumide
@Lumexralph
Mar 17 2017 06:01
@JToddFL i used the Number object not number
Drew Alcazar
@OtakuDrew
Mar 17 2017 06:02
@revisualize also im trying to modify "result" in the lookup
Jeremy
@JeremyAntonoff
Mar 17 2017 06:02
@Lumexralph now it comes back with [null]
Ogundele Olumide
@Lumexralph
Mar 17 2017 06:02
@OtakuDrew remember how to use a variable to access an object?
@JToddFL show your code
Joseph
@revisualize
Mar 17 2017 06:03
@OtakuDrew You're actually not.
Jeremy
@JeremyAntonoff
Mar 17 2017 06:03

function bouncer(arr) {
  var splitArray = arr;
  var array = [];
  for (x = 0; x < splitArray.length; x++) {
    if (splitArray[x] !== false && splitArray[x] !== null && splitArray[x] !== 0 && splitArray[x] !== "" && splitArray[x] !== undefined && Number.isNaN(splitArray[x])) {
       array.push(splitArray[x]);

    }
  }

  // Don't show a false ID to this bouncer.
  return array;
}

bouncer([1, null, NaN, 2, undefined])
Jor
@joreyesl
Mar 17 2017 06:03
@JToddFL isNaN() is not advisable because it does some value coercion inside. Use Number.isNaN() as @Lumexralph suggested. Also remember that you want it NOT true. You need a !
Joseph
@revisualize
Mar 17 2017 06:03
@OtakuDrew With your code you'd need to call the object property.
Jeremy
@JeremyAntonoff
Mar 17 2017 06:04
@joreyesl i need a !? where i dont understand
Drew Alcazar
@OtakuDrew
Mar 17 2017 06:05
@revisualize honestly im just looking for the answer, ill understand it if i just see what im missing, i believe im just missing something, this section doesnt explain lookup statements that well
Ogundele Olumide
@Lumexralph
Mar 17 2017 06:05
@JToddFL in addition to @joreyesl suggestion you can also do splitArray[x] !== splitArray[x]
Jor
@joreyesl
Mar 17 2017 06:05
@JToddFL !Number.isNaN because it returns true when the argument passed is NaN
Joseph
@revisualize
Mar 17 2017 06:05
@OtakuDrew I'm sorry, I don't give away answers.
Drew Alcazar
@OtakuDrew
Mar 17 2017 06:06
@revisualize thing is you are just saying what i already know
Ogundele Olumide
@Lumexralph
Mar 17 2017 06:06
@OtakuDrew why don't you take a lil time to understand? i already told you what to do though can't go beyond that
Drew Alcazar
@OtakuDrew
Mar 17 2017 06:06
@revisualize my og code was already trying to change the result if you actually read it
Jeremy
@JeremyAntonoff
Mar 17 2017 06:07
@joreyesl thanks
CamperBot
@camperbot
Mar 17 2017 06:07
jtoddfl sends brownie points to @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 614 | @joreyesl |http://www.freecodecamp.com/joreyesl
Joseph
@revisualize
Mar 17 2017 06:07
@OtakuDrew Objects are supposed to be key value pairs.
Jeremy
@JeremyAntonoff
Mar 17 2017 06:07
@Lumexralph thanks
CamperBot
@camperbot
Mar 17 2017 06:07
jtoddfl sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1327 | @lumexralph |http://www.freecodecamp.com/lumexralph
Drew Alcazar
@OtakuDrew
Mar 17 2017 06:07
@revisualize and what does that mean?
Ogundele Olumide
@Lumexralph
Mar 17 2017 06:07
@OtakuDrew you're to return the value of property name held by val parameter in the lookup object
Joseph
@revisualize
Mar 17 2017 06:08
@OtakuDrew Here is a sample object that I use for explaining stuff.
var myFriend = {
        "firstName": "Happy",
        "lastName": "Feet",
        "number": "-i",
        "likes": ["rhythm", "dancing", "soul"]
    }
@OtakuDrew that object has 4 keys each with values.
Drew Alcazar
@OtakuDrew
Mar 17 2017 06:09
@revisualize correct
@revisualize i know that
Joseph
@revisualize
Mar 17 2017 06:09
@OtakuDrew the object property "firstName" has the value of "Happy"
Drew Alcazar
@OtakuDrew
Mar 17 2017 06:10
@revisualize ok im not new to coding, i get the gist of sytax
Michaël Nde T.
@nt-michael
Mar 17 2017 06:11
Hi
good morning
I have been observing a very weird problem on CodePen
devpaaji
@devpaaji
Mar 17 2017 06:12
var myFunction = new Function("x", "y", "return x * y"); 
console.log( typeof myFunction); // logs Function and not object?
Drew Alcazar
@OtakuDrew
Mar 17 2017 06:12
@revisualize im just asking how my functions parameter can interact with my lookup object.
devpaaji
@devpaaji
Mar 17 2017 06:12
@Lumexralph
Michaël Nde T.
@nt-michael
Mar 17 2017 06:12
it doesn't run Javascript
I think it's a bug
Joseph
@revisualize
Mar 17 2017 06:12
@OtakuDrew a parameter is used just like a variable.
devpaaji
@devpaaji
Mar 17 2017 06:12
var myRegExp = new RegExp('\\bt[a-z]+\\b'); 
console.log( typeof myRegExp); // logs object
Michaël Nde T.
@nt-michael
Mar 17 2017 06:13
cuz I worked it out on other IDE and it was ok
Joseph
@revisualize
Mar 17 2017 06:13

@OtakuDrew
Parameters are used just like variables. So, inside of the function you can use celsius JUST like any other variable.
If I have this code:

function addThree (num) {
    var result;
    result = num + 3;
    return result;
}

So, when we make the function call of:

addThree(10);

You're calling the function addThree You're also passing a value 10 as an argument.
In the function declaration of function addThree (num) { You see that there is a parameter defined of num
When we do addThree(10) then the value of the parameter num is passed the argument value of ... 10
Then if you follow the code through.. result = num + 3; ... and we know the value of num is 10.
Therefore, if we follow through the function we end up with ... result = 10 + 3; then result = 13; then we return the result.

@OtakuDrew So, from knowing that.. How do you access object property values with variables?
Salwa Khan Brahimi
@salwabrahimi
Mar 17 2017 06:17
Hi guys, I need help on a simple task which I got confused on
Joseph
@revisualize
Mar 17 2017 06:18
@salwabrahimi Sup?
Michaël Nde T.
@nt-michael
Mar 17 2017 06:18
Hi @salwabrahimi
Drew Alcazar
@OtakuDrew
Mar 17 2017 06:18
@revisualize you set a variable equal to the property name?
Michaël Nde T.
@nt-michael
Mar 17 2017 06:18
please to help
what's the issue @salwabrahimi
Joseph
@revisualize
Mar 17 2017 06:18
@OtakuDrew But, that variable has already been set.
Salwa Khan Brahimi
@salwabrahimi
Mar 17 2017 06:19
hey, how exactly do i show you what im stuck on? lol this is the first time I am using this chatroom for help
Bryan Reese
@breese8009
Mar 17 2017 06:19
donno if any one can help but i keep getting a 404 error and it says local host page not found with this link below...http://localhost:3000/calback.html#token:WVPl2D36sUI2qjPEuSJJdmqL7PZIRxaveRmr5wCu,callback:_500pxCallback79671998
Salwa Khan Brahimi
@salwabrahimi
Mar 17 2017 06:19

// Setup
var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];

// Only change code below this line.
var myData = myArray[0][0];

task is:
"my data should equal to 8"

Joseph
@revisualize
Mar 17 2017 06:19
@salwabrahimi Okay.
Aj Broman
@Bromana
Mar 17 2017 06:20
@salwabrahimi you want to target the value 8
Joseph
@revisualize
Mar 17 2017 06:20
@salwabrahimi I actually have a write up on this.
Drew Alcazar
@OtakuDrew
Mar 17 2017 06:20

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

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

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

// Change this value to test
phoneticLookup("charlie");
In this code im just a little lost on how when i would call the phoneticLookup() function with an argument, how is my lookup object supposed to get the argument

Aj Broman
@Bromana
Mar 17 2017 06:20
What index is it at?
Michaël Nde T.
@nt-michael
Mar 17 2017 06:20
so @salwabrahimi u do this ```
Aj Broman
@Bromana
Mar 17 2017 06:20
Which array index, and what value index
Joseph
@revisualize
Mar 17 2017 06:20
@salwabrahimi My first 36 lines actually cover that idea: Gist by revisualize / FreeCodeCamp - Nesting For Loops.js
Bryan Reese
@breese8009
Mar 17 2017 06:20
$(document).ready(function () {

  _500px.init({
    sdk_key: '04fc9c062bcfc1b769037eaacff4b636d3812cab'
  });

  $('#login').click(function() {
    _500px.login();
  });

  _500px.on('authorization_obtained', function () {

    $('.sign-in-view').hide();
    $('.image-results-view').show();

    if (navigator.geolocation) {
      navigator.geolocation.getCurrentPosition(function(position) {
        var lat = position.coords.latitude;
        var long = position.coords.longitude;



        var radius = '10mi';

        var searchOptions = {
          geo: lat + ',' + long + ',' + radius,
          only: 'Landscapes'
        }

        _500px.api('/photos/search/', searchOptions.geo, function(response) {
         console.log(response);
        });
      });
    }
  });

});
Salwa Khan Brahimi
@salwabrahimi
Mar 17 2017 06:20
i'm not sure :( lol
Michaël Nde T.
@nt-michael
Mar 17 2017 06:20
@salwabrahimi to show ur code, once u type that, hit enter
devpaaji
@devpaaji
Mar 17 2017 06:21
@revisualize
Salwa Khan Brahimi
@salwabrahimi
Mar 17 2017 06:21

// Setup
var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];

// Only change code below this line.
var myData = myArray[0][0];

Aj Broman
@Bromana
Mar 17 2017 06:21

for example: let lotsOfAnimals = [[‘cat’, ‘dog’, ‘fish’, ‘zebra’], [‘fish’, superman’, ‘amazing animal’]]

DOG would be located at lotsOfAnimals[0][1]

devpaaji
@devpaaji
Mar 17 2017 06:21
var myFunction = new Function("x", "y", "return x * y"); 
console.log( typeof myFunction); // logs Function and not object?
Joseph
@revisualize
Mar 17 2017 06:22

@OtakuDrew Okay first off...

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

Should actually be

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

Because.. Objects should be key value pairs. I think I said that 4 times now.

Drew Alcazar
@OtakuDrew
Mar 17 2017 06:22
@revisualize like how when you put a switch statement in a function you can do this : function whatever (val) { case (val) { case 2 :return "yes" break;}};
Michaël Nde T.
@nt-michael
Mar 17 2017 06:22
@salwabrahimi u hav a multidimensional array
Drew Alcazar
@OtakuDrew
Mar 17 2017 06:23
ok @revisualize after i change that
Salwa Khan Brahimi
@salwabrahimi
Mar 17 2017 06:23
@nt-michael can you private message me? this chat is a bit messy! thanks :)
CamperBot
@camperbot
Mar 17 2017 06:23
:cookie: 268 | @nt-michael |http://www.freecodecamp.com/nt-michael
salwabrahimi sends brownie points to @nt-michael :sparkles: :thumbsup: :sparkles:
Joseph
@revisualize
Mar 17 2017 06:23
@OtakuDrew Come on.. really?
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"
  };

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

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

With this code: function phoneticLookup(val) { } you have a function declaration with a function name of phoneticLookup and a parameter val.
When you make the function call: phoneticLookup("charlie"); You are calling the function by name and passing the argument of "charlie" to the function parameter of val as a value.
You'll need to use bracket notation to access your object (lookup) property value. Note: Parameters are used inside of your function just like variables.
You need to assign the value of the object property to the variable result.
Then when your function phoneticLookup returns result it will return the correct object property value.

So, when you do lookup[val]; you're accessing the lookup with the parameter val that has a value of "charlie" and to get the object property value of "Chicago".
With result = lookup[val]; You're assigning that object property value to the variable result. Then you're returning result.

Drew Alcazar
@OtakuDrew
Mar 17 2017 06:23
@revisualize how would i then change the result with lookup
Joseph
@revisualize
Mar 17 2017 06:23
@OtakuDrew Here's your answer.
Markus Kiili
@Masd925
Mar 17 2017 06:24
@revisualize Good morning.
Drew Alcazar
@OtakuDrew
Mar 17 2017 06:24
thank you @revisualize that was all i wanted, much faster this way and now i get it
Joseph
@revisualize
Mar 17 2017 06:24
@Masd925 Good evening.
CamperBot
@camperbot
Mar 17 2017 06:24
otakudrew sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3541 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Mar 17 2017 06:25
@OtakuDrew Do you really?
@Masd925 Hey.. Have you had breakfast yet? Do you need someone to chew your food for you?
devpaaji
@devpaaji
Mar 17 2017 06:25
@Masd925 hello
Markus Kiili
@Masd925
Mar 17 2017 06:26
@revisualize Sure. My teeth are not what they were 40 years ago.
Joseph
@revisualize
Mar 17 2017 06:26
@Masd925 :trollface:
hehehe
I need to get my ass to bed.
devpaaji
@devpaaji
Mar 17 2017 06:27
var myFunction = new Function("x", "y", "return x * y"); 
console.log( typeof myFunction); // logs Function and not object?
@Masd925
Markus Kiili
@Masd925
Mar 17 2017 06:28
@revisualize Did you crack the Object.length puzzle?
Joseph
@revisualize
Mar 17 2017 06:28
@Masd925 Nope. All I did was two google searches and I gave up.
devpaaji
@devpaaji
Mar 17 2017 06:28
var myRegExp = new RegExp('\\bt[a-z]+\\b'); 


console.log( typeof myRegExp); // logs object
Markus Kiili
@Masd925
Mar 17 2017 06:29
@revisualize Do you wan't the answer?
Joseph
@revisualize
Mar 17 2017 06:29
Sure.
Will it help me understand other parts of JavaScript better?
Markus Kiili
@Masd925
Mar 17 2017 06:31
@revisualize Object is the constructor function of objects. It has one parameter that holds the passed value to objectify (you can see that on ECMAScript standard or MDN). In JS, function's length property tells the number of parameters. Therefore Object.length is 1.
Joseph
@revisualize
Mar 17 2017 06:34
So... Object.length is getting the .length parameter passed to Object and returning the .length of that parameter which is itself?
Markus Kiili
@Masd925
Mar 17 2017 06:35
@revisualize Functions length gives the number of parameters on the declaration. For function test (a,b){...} test.length is 2.
@revisualize For object constructor the declarations is just function Object (value) {...}, so there is one parameter that will hold the passed value to objectify.
Shireef Khatab
@shireefkhatab
Mar 17 2017 06:41
Hi all.
what is wrong with this function please
function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++){
if(contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop)){
console.log(contacts[i][prop]);
return contacts[i][prop];
} else if (contacts[i].firstName != firstName){
return "No such contact";
} else if (contacts[i].hasOwnProperty(prop) === false){
return "No such property";
}
}
// Only change code above this line
}
Joseph
@revisualize
Mar 17 2017 06:42
@Masd925 Oh, that's actually quite useful.
@Masd925 Thanks.
CamperBot
@camperbot
Mar 17 2017 06:43
revisualize sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 3603 | @masd925 |http://www.freecodecamp.com/masd925
Robert Arifin
@renkachan
Mar 17 2017 06:48
can someone help me about callback function? i am still confused about that
Markus Kiili
@Masd925
Mar 17 2017 06:49
@renkachan Sure.
Robert Arifin
@renkachan
Mar 17 2017 06:51
@Masd925 okie. I want to run 2 functions. 1 is ajax jquery, 1 is normal function. i want normal function to be completed first before the ajax jquery function run. how to do that? i am not too sure where to place the callback
Markus Kiili
@Masd925
Mar 17 2017 06:54
@renkachan JS code is run line by line. Ajax methods bind a function to the request so that it is run by the browser when the response comes. Only inside the ajax callback, you know that the response has come.
Robert Arifin
@renkachan
Mar 17 2017 06:57
@Masd925 so, i need to put the callback() inside the success function of ajax jquery function?
Markus Kiili
@Masd925
Mar 17 2017 06:58
@renkachan If you wan't something to be run when the response comes, you put it into the callback function.
Saurabh Jha
@saurbh0409
Mar 17 2017 06:59
can anyone help me ?

I am using this code on codepen but I am not getting any response from api-call. But when I use same url in browser it shows response. Please help!

$(document).ready(function(){
$("#button1").on("click",function(){
$.getJSON("https://api.forismatic.com/api/jsonp/", function(json) {
$(".message").html(JSON.stringify(json));
});
});
});

Markus Kiili
@Masd925
Mar 17 2017 07:00
@saurbh0409 Check the browser developer tools console for errors.
Saurabh Jha
@saurbh0409
Mar 17 2017 07:01
is there any problem with code-pen ?
Emmanuel Pierre
@epierr14
Mar 17 2017 07:02
Help please

function palindrome(str) {
  // Good luck!
  var thePalindrome = '';
  str  = str.replace(/[^a-zA-Z0-9]/g, '');
  str = str.toLowerCase ();
  var array = [];
  array = str.split('');
  array = array.reverse();
  thePalindrome = array.join();
  return str === thePalindrome;
}



palindrome("eye");
Markus Kiili
@Masd925
Mar 17 2017 07:03
@epierr14 Split needs an argument here.
And join too.
Nitesh
@nidsnitesh
Mar 17 2017 07:04

''''
function convertToF(celsius) {
var fahrenheit;
// Only change code below this line

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

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

CamperBot
@camperbot
Mar 17 2017 07:04
:bulb: to format code use backticks! ``` more info
Nitesh
@nidsnitesh
Mar 17 2017 07:06
function convertToF(celsius) {
  var fahrenheit;
  // Only change code below this line


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

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

help

Emmanuel Pierre
@epierr14
Mar 17 2017 07:08
Thanks @Masd925
CamperBot
@camperbot
Mar 17 2017 07:08
epierr14 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 3604 | @masd925 |http://www.freecodecamp.com/masd925
Dan Couper
@DanCouper
Mar 17 2017 07:10
@nidsnitesh it tells you the formula for the conversion in the instructions, where is it? That's just the code your given
Emmanuel Pierre
@epierr14
Mar 17 2017 07:13
@nidsnitesh the formula is everything you need to understand the (9/5) and 32
idrees khan
@khanidrees
Mar 17 2017 07:20

function nextInLine(arr, item) {
// Your code here
var shifted=arr[0];
arr.push(item);

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

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

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

why this objective is unchecked
nextInLine([], 1) should return 1
Dan Couper
@DanCouper
Mar 17 2017 07:29
What happens if the array is empty to start off with?
arr.shift() gives you the value you want, it takes the first value off the array and returns it, so just return that. Get rid of shifted
Nitesh
@nidsnitesh
Mar 17 2017 07:35
@DanCouper @epierr14 Thanks Guys
CamperBot
@camperbot
Mar 17 2017 07:35
nidsnitesh sends brownie points to @dancouper and @epierr14 :sparkles: :thumbsup: :sparkles:
:cookie: 245 | @epierr14 |http://www.freecodecamp.com/epierr14
:cookie: 547 | @dancouper |http://www.freecodecamp.com/dancouper
Mario Lukic
@pasuljG
Mar 17 2017 07:49
Hi I still have trouble with Seek and Destroy. Basic Algorithm scripting. My code works for all cases but when I pass in all arguments that are contained in array of first argument. Then it returns last argument instead of empty array..
function destroyer(arr) {
  // Remove all the values
  var args = Array.prototype.slice.call(arguments);
  var saved = [];
  function filterDestroyer(value){
    for (j = 1; j < args.length; j++){
      for (i = 0; i < args[0].length; i++){
        if (args[0][i] === args[j]){
          args[0].splice(i, 1);
        } 
      }
    }
    saved = args[0];
  }
  args[0].filter(filterDestroyer);
  return saved;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3,1);
devpaaji
@devpaaji
Mar 17 2017 07:49
@Masd925
Mario Lukic
@pasuljG
Mar 17 2017 07:49
this will return [1] insted of []
devpaaji
@devpaaji
Mar 17 2017 07:50
var primitiveString1 = "foo"; 
var primitiveString2 = String('foo'); // is this a String Object or primitive
console.log(primitiveString1.toString(), primitiveString2.toString());
@DanCouper
console.log( typeof primitiveString1, primitiveString2); gives string foo
Markus Kiili
@Masd925
Mar 17 2017 07:52
@pasuljG You only need to loop args inside the filter callback. Filter loops arr elements.
value is the arr element being iterated by filter.
@pasuljG Also you are not using the filtered array. Do return arr.filter(filterDestroyer);
Mario Lukic
@pasuljG
Mar 17 2017 07:54
@masd925 tnx!
CamperBot
@camperbot
Mar 17 2017 07:54
pasuljg sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 3605 | @masd925 |http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
Mar 17 2017 07:55
@pasuljG You are using filter to just make side effects. That is confusing to the reader, so you should use forEach for that kind of things.
Dan Couper
@DanCouper
Mar 17 2017 07:55
@devpaaji the String constructor means you're creating a string object. It works almost exactly the same as a primitive string, and it's used by JS to let you do string methods ('mystring'.length for example), JS takes a string, boxes it into a String object, does the method, then unboxes it to a primitive string. Don't use the String constructor directly, there is no need and it will cause subtle bugs.
David Kang
@d-kang
Mar 17 2017 07:57
Does anyone havw any pointers on learning TDD and just started using Mocha today.
devpaaji
@devpaaji
Mar 17 2017 07:58
var primitiveString2 = String('foo');
@DanCouper is this object or primitive as we have not used
new
Filotronik
@Filotronik
Mar 17 2017 08:02
'ello! I have a pretty basic problem concerning the beginning of the Javascript "Learning Route". I am at the task of creating the Celsius to Fahrenheit converter with the input of the convertToF variable. Im not quite sure how to calculate the input, should I try to resolve it with a variable or can I just use plain mathematics?
Markus Kiili
@Masd925
Mar 17 2017 08:03
@Filotronik Parameter celsius holds the passed number. Use it to calculate the value for var fahrenheit = ...
Filotronik
@Filotronik
Mar 17 2017 08:04
But the "var fahrenheit = ..." is already defined, I cant use it twice, do I?
Dan Couper
@DanCouper
Mar 17 2017 08:05
@devpaaji Don't need to use new in this case, that is creating an actual string. JS uses objects for everything so the difference is minimal. As i say, you don't need need to use the String function, it's used internally by JS
@Filotronik 3 options: either change what it's defined as - put the equation after var fahrenheit = or on the line after put fahrenheit = (no var), or get rid of the var fahrenheit and return fahrenheit and just return the equation
The second option is what FCC is expecting you to do
Markus Kiili
@Masd925
Mar 17 2017 08:12
@devpaaji String(); does type coercion to type String, so String('foo'); is a primitive String value.
Filotronik
@Filotronik
Mar 17 2017 08:14
@DanCouper thanks so much! I've actually had some problem in my maths at first so it didnt work out in the beginning..
CamperBot
@camperbot
Mar 17 2017 08:14
filotronik sends brownie points to @dancouper :sparkles: :thumbsup: :sparkles:
:cookie: 548 | @dancouper |http://www.freecodecamp.com/dancouper
Chris Cullen
@123xylem
Mar 17 2017 08:20
//Post Register info into User Var
app.post("/register",function(req,res){
 var newUser=  new User ({username:req.body.username});              //newUser is a new User with name = username of req
    User.register(newUser,req.body.password,function(err,newUser){    //use PP.register method making a new User with newUser VAR. second arg is pasword (encryption)
        if(err){console.log(err)
          return  res.render("register")                          

        }
        else{
            passport.authenticate("local")(req,res,function(){     //if it works accept it with passport.authenticate
                res.redirect("/camps")
            })
        }

    })
})
Hi can someone tell me why YOU Need Passport.authenticate to CREATE a new user?
Isnt authenticate used just to see if you already ARE a user???
alpox
@alpox
Mar 17 2017 08:25
@123xylem User.register you register a new user here. This makes a new user. Then, when the user was sucessfully created, you do passport.authenticate which loggs the user in after the registration.
Chris Cullen
@123xylem
Mar 17 2017 08:29
@alpox ah so this authenticate just says i see user and he is now stored as logged in?
in technical computer language
Emmanuel Pierre
@epierr14
Mar 17 2017 08:29
getting stuck

function largestOfFour(arr) {
  // You can do this!
  var array = [];
  for (var i =0; i<arr.length; i++) {
    arr[i].sort(function(e , f){
      return f - e;
    });
  array[i] = arr[i][0];
    return array;
}
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Chris Cullen
@123xylem
Mar 17 2017 08:30
sorry i dont even know what im asking :) I guess this authenticate just registers u as logged in and the other authenticate checks to see if ur logged in if not so already @alpox
@alpox and thanks
CamperBot
@camperbot
Mar 17 2017 08:30
123xylem sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:cookie: 844 | @alpox |http://www.freecodecamp.com/alpox
Markus Kiili
@Masd925
Mar 17 2017 08:31
@epierr14 Return after the loop block.
alpox
@alpox
Mar 17 2017 08:34
@123xylem Authenticate is just a login actually as you say yourself
NewGismo
@NewGismo
Mar 17 2017 08:37
This code should return [] but it returns [null]
Could someone help me pls?
function bouncer(arr) {

  var arrNew = arr;

  for (var i = 0; i < arr.length; i++) {
    switch (arrNew[i]) {
      case false:
      case null:
      case 0:
      case "":
      case undefined:
      case NaN:
        arrNew.splice(i, 1);
        i -= 1;
    }
  }

  return arrNew;
}

bouncer([false, 0, NaN, null, undefined, ""]);
Greg Duncan
@GregatGit
Mar 17 2017 08:43
@NewGismo you should not be using switch here
@NewGismo
function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  arr = arr.filter(yourFunction);
  return arr;

  function yourFunction(value){
    // write you function here
   // return if value is not falsy
  }
}
idrees khan
@khanidrees
Mar 17 2017 08:46

var count = 0;

function cc(card) {
// Only change code below this line
if((card==2)||(card==3)||(card==4)||(card==5)||(card==6)){
count++;
}else if((card==7)||(card==8)||(card==9)) {
count=count+0;
}else{
count--;
}
if((count==1)||(count== 2)||(count==3)||(count==4)||(count==5)){
return count+" bet";}

// Only change code above this line
}

soln for it
NewGismo
@NewGismo
Mar 17 2017 08:48
@GregatGit Why can't I use switch? It worked for all other falsy values, just not for null.
Theofanis Despoudis
@theodesp
Mar 17 2017 08:49
You can it just looks ugly there are more efficient ways
Greg Duncan
@GregatGit
Mar 17 2017 08:49
@NewGismo that is not how you use a switch - it looks bad - use filter
NewGismo
@NewGismo
Mar 17 2017 08:50
@GregatGit Ok, but let's suppose that I would like to use it. Where is the mistake?
Stephen Miller
@stephenjmiller
Mar 17 2017 08:51
function nextInLine(arr, item) {
  // Your code here
  arr[4] = 10;
  item = arr[0];  
  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
So stuck with this, cannot seem to achieve 'nexInLine([], 1) to return 1
Theofanis Despoudis
@theodesp
Mar 17 2017 08:52
probably where you say i -=1
Markus Kiili
@Masd925
Mar 17 2017 08:52