These are chat archives for FreeCodeCamp/HelpJavaScript

27th
Jun 2017
Stephen James
@sjames1958gm
Jun 27 2017 00:01 UTC
@koder3 yes
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:02 UTC
maybe
¿
Rahime walker
@BigReef
Jun 27 2017 00:02 UTC
yo
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:02 UTC
@BigReef Greetings
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 00:02 UTC
@sjames1958gm I got through those challenges just fine. I just can't seem to use all those elements correctly in this challenge :(
koder3
@koder3
Jun 27 2017 00:02 UTC
@sjames1958gm thanks. works. btw is my approach right for this algorithm challenge (arguments optional). i think im gonna write all my code in that function d. is that okay? because any thing i write outside it gives me addTogether()... is not a function @sjames1958gm
CamperBot
@camperbot
Jun 27 2017 00:02 UTC
koder3 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7916 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
surferpilgrim
@surferpilgrim
Jun 27 2017 00:03 UTC
I'm doing the mutation challenge can someone point out whats wrong with my code

function mutation(arr) {
  arr.toLowerCase();
var result = arr[0].indexOf(arr[1]);
if(result!==-1){
  return false;
} else return true;
}

mutation(["hello", "hey"]);
Stephen James
@sjames1958gm
Jun 27 2017 00:03 UTC
@LinoliuMKnifE You need to return the value from shift
so store it into a variable. As in:
var removedFromMyArray = myArray.shift();
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 00:04 UTC
okay
Stephen James
@sjames1958gm
Jun 27 2017 00:04 UTC
@surferpilgrim It is each individual letter of arr[1] not the whole thing (and you will need to lower case both strings)
Moisés Man
@moigithub
Jun 27 2017 00:04 UTC
@surferpilgrim strings methods return a NEW string
u NOT doing anything with the value returned by toLowerCase
Ednor
@ednor
Jun 27 2017 00:05 UTC
Hello everyone, can anyone help me ?
Stand in Line chapter
Stephen James
@sjames1958gm
Jun 27 2017 00:05 UTC
@surferpilgrim arr is an array, so arr.toLowerCase() will not work
Ednor
@ednor
Jun 27 2017 00:05 UTC
"Stand in Line" challenge
I am lost
koder3
@koder3
Jun 27 2017 00:05 UTC
@sjames1958gm is my approach right for this algorithm challenge (arguments optional). i think im gonna write all my code in that function d. is that okay? because any thing i write outside it gives me addTogether()... is not a function
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:05 UTC
@ednor sure, join the queue. :p
Ednor
@ednor
Jun 27 2017 00:06 UTC
@kumquatfelafel ok, thank you
CamperBot
@camperbot
Jun 27 2017 00:06 UTC
ednor sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 334 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 00:06 UTC
so punny
Guderian Raborg
@hypercuber
Jun 27 2017 00:06 UTC
how do you use <br> in console.log again?
for (var i = 0; i < 10; i++) {
  if (i === 3) {
    break;
  }
  console.log('The number is ' + i + '<br>');
}
Stephen James
@sjames1958gm
Jun 27 2017 00:06 UTC
@koder3 You need to have code outside that function that tests for parameters being numbers,
only return that function if the first parameter is a number and there is only one parameter
if there are two parameters then return the sum (if they are both numbers)
@hypercuber \n is new line
@hypercuber But each console.log should be a new line
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:08 UTC
@LinoliuMKnifE So where are we at. Are there certain aspects that confusing you?
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 00:08 UTC

function nextInLine(arr, item) {
// Your code here
var testArr = [1,2,3,4,5];
var removedFromTestArr = testArr.shift();
testArr.push();
return testArr.shift(); // Change this line
}

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

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

Ming Zhu
@chocobrownie
Jun 27 2017 00:08 UTC
Hi I have a question regarding the following code:The first line replaces all "apple" with "pinapple" and the second line only replaces the first "apple" that appears. I wonder what does new RegExp("apple",'g') do?
str=str.replace(new RegExp("apple",'g'),"pinapple");
str=str.replace("apple","pinapple");
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 00:08 UTC
this is what I'm looing at now
@kumquatfelafel
koder3
@koder3
Jun 27 2017 00:08 UTC
@sjames1958gm how do i check if theres two parameters everything returns typeerror: addTogether(...) is not a function
Stephen James
@sjames1958gm
Jun 27 2017 00:09 UTC
@LinoliuMKnifE We told you to NOT use testArr inside the function only arr and item.
delete those first two lines and replace the last two with arr
@koder3 arguments.length
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:09 UTC
@LinoliuMKnifE close. Get rid of testArr in your function (those first two lines can go), and use the default "arr"
Nancy O'Connor
@NancyOConnor
Jun 27 2017 00:09 UTC
hi all! I'm new to js and am working on making a hangman game for class. would anyone be able to look over my code from time to time as I get stuck?
Jean-Paul Sauve
@jp-sauve
Jun 27 2017 00:10 UTC

why's my linter so down on immediately executing functions?

sObj = new (function () {
        "use strict";
        this.url = endPoint;
        this.action = actionProp;
        this.list = listProp;
        this.srsearch = srsearchProp;
    })();

it tells me to get rid of "new" because it's awkward, and to put the final () in between the previous }) but then I get an error.

koder3
@koder3
Jun 27 2017 00:10 UTC
function addTogether() {
return arguments.length

}

addTogether(2)(8)
this returns an error
Moisés Man
@moigithub
Jun 27 2017 00:10 UTC
@koder3 part of instructions says.. if u have only 1 argument.. u must return a function
that will "catch" the second set of () ...which will clear the error
Ednor
@ednor
Jun 27 2017 00:10 UTC

function nextInLine(arr, item) {
// Your code here
var testArr = [1,2,3,4,5];
var removedFromTestArr = testArr.shift();
testArr.push();
return testArr.shift(); // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 1)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Thanks for the solution, but I don't really undertand how you have found it

Stephen James
@sjames1958gm
Jun 27 2017 00:10 UTC
@koder3 you need to test arguments.length
if arguments.length == 1 and arguments[0] is a number then return a function
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 00:10 UTC

@kumquatfelafel function nextInLine(arr, item) {
// Your code here
arr = [1,2,3,4,5];
var removedFromArr = arr.shift();
return arr.shift(); // Change this line
}

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

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

looking better?
koder3
@koder3
Jun 27 2017 00:11 UTC
@moigithub how do i check if i have only 1 argument?
Moisés Man
@moigithub
Jun 27 2017 00:11 UTC
read what @sjames1958gm wrote above :point_up: 26 de junio de 2017 19:10 @koder3
Ednor
@ednor
Jun 27 2017 00:11 UTC
@LinoliuMKnifE sure ! Now I see some functions
Moisés Man
@moigithub
Jun 27 2017 00:11 UTC
@LinoliuMKnifE every shift() calls.. removes 1 element
soo u actually removing 2 values....
also instructions says add item to the end of the array.. <-- u need to do that first
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:12 UTC

@LinoliuMKnifE do not initialize arr. arr will have the value passed into it from the call.

the call : console.log(nextInLine(testArr, 3)); // more specifically, the call is only the nextInLine() portion.

Jean-Paul Sauve
@jp-sauve
Jun 27 2017 00:12 UTC
@moigithub there's an arguments object passed in.
Stephen James
@sjames1958gm
Jun 27 2017 00:12 UTC
@LinoliuMKnifE you deleted the wronglines, you need to just have the push and the shift left
koder3
@koder3
Jun 27 2017 00:12 UTC
@sjames1958gm if i cant return arguments.length, how does the if work?
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 00:12 UTC
@kumquatfelafel & @sjames1958gm I'll have to return to this later I have to go to work now.
Stephen James
@sjames1958gm
Jun 27 2017 00:12 UTC
@ednor Only use arr and item inside the function
@LinoliuMKnifE ok. good luck.
@koder3 Re-read the instructions on what to return, nowhere does it say return the number of parameters
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:14 UTC
@LinoliuMKnifE here may be some more information on functions. https://www.w3schools.com/js/js_functions.asp
koder3
@koder3
Jun 27 2017 00:14 UTC
@sjames1958gm alright. thanks a lot for the help. ill sleep as it is 4:14am. bye sorry if i annoyed you.
CamperBot
@camperbot
Jun 27 2017 00:14 UTC
koder3 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: koder3 already gave sjames1958gm points
Stephen James
@sjames1958gm
Jun 27 2017 00:14 UTC
@koder3 You did not. get some sleep
Ednor
@ednor
Jun 27 2017 00:15 UTC

@kumquatfelafel function nextInLine(arr, item) {
// Your code here
arr = [1,2,3,4,5];
var removedFromArr = arr.shift();
return arr.shift(); // Change this line
}

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

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

console.log("After: " + JSON.stringify(testArr));

sorry !
Ming Zhu
@chocobrownie
Jun 27 2017 00:16 UTC
Repost: Hi I have a question regarding the following code:The first line replaces all "apple" with "pinapple" and the second line only replaces the first "apple" that appears. I wonder what does new RegExp("apple",'g') do?
str=str.replace(new RegExp("apple",'g'),"pinapple");
str=str.replace("apple","pinapple");
Kervtuza
@Kervtuza
Jun 27 2017 00:16 UTC
hey guys, I am working on the Show The Local Weather challenge, so far I have successfully found my longitude and latitude and thought I was successful connecting to the DarkSky api but can't seem to display any info from the json object...any ideas? https://codepen.io/Kervtuza/pen/RgLzyP
Ednor
@ednor
Jun 27 2017 00:16 UTC
@ednor Only use arr and item inside the function, any example please ?
surferpilgrim
@surferpilgrim
Jun 27 2017 00:16 UTC
@sjames1958gm like this ?

function mutation(arr) {
  var count = 0;
  var pos = arr.indexOf(arr[1]);
  while(pos !==-1){
    count++;
   pos =arr.indexOf(arr[0],pos+1);
  }

}

mutation(["hello", "hey"]);
Ednor
@ednor
Jun 27 2017 00:17 UTC
@sjames1958gm any example please ?
koder3
@koder3
Jun 27 2017 00:17 UTC
@sjames1958gm ive never seen a closure before nor do i understand those pages on MDN. i spent 2 hours reading about currying and closures, but i understood nothing related to the challenge. it still enrages me that fcc provides sometimes provides really less help in some challenges, but it is still far far better then all coding tutorial sites, in my opinion.
Stephen James
@sjames1958gm
Jun 27 2017 00:18 UTC
@ednor You need to recall the challenges for pop, push, shift, unshift, here there two of these will be used.
you will add item to the end of arr then remove the first value of arr
Murrium
@Murrium123
Jun 27 2017 00:18 UTC
@Murrium123
I am seriously struggling with the Fahrenheit conversion
please help!
Moisés Man
@moigithub
Jun 27 2017 00:18 UTC
u need to check if EACH character of "hey" is on "hello" @surferpilgrim
Stephen James
@sjames1958gm
Jun 27 2017 00:18 UTC
@surferpilgrim No
You need to look for the letter/characters of arr[1] in arr[0]
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:18 UTC

@ednor @surferpilgrim provides an example. See how he doesn't even mention "hello" or "hey" once in his code. What he does use, however, is "arr". the array ["hello", "hey"] has been passed into the variable arr when he calls the mutation function like so.

mutation(["hello", "hey"]);

José Alves
@zeph7
Jun 27 2017 00:18 UTC

I'm on the No Repeats Please, still trying to figure out how to do it when I run into this test.

permAlone("aabb") should return 8.

Well...it's said that it mustn't repeat a char to do the permutation. I think the possible transmutations for those characters are [abab,baba,abab,baba]. Which means 4 possible, but the answer suggest a 8 as answer. The 8 would be possible if you consider [aabb,bbaa,aabb,bbaa]. Am I correct about this?

Moisés Man
@moigithub
Jun 27 2017 00:19 UTC
@Murrium123 u need to ASSIGN the formula provided on the instructions to fahrenheit variable
fahrenheit = a + b *1 +2 /3 :point_left: whatever the formula is
Murrium
@Murrium123
Jun 27 2017 00:19 UTC
Hey, how do you do the whole converting celsius to fahrenheit thing?
Stephen James
@sjames1958gm
Jun 27 2017 00:19 UTC
@koder3 A closure means that the function d that you create and return has access to the variables that were in scope inside the function when it was returned.
Murrium
@Murrium123
Jun 27 2017 00:19 UTC
@moigithub Thanks you
CamperBot
@camperbot
Jun 27 2017 00:19 UTC
murrium123 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3434 | @moigithub |http://www.freecodecamp.com/moigithub
Stephen James
@sjames1958gm
Jun 27 2017 00:20 UTC
@zeph7 aa is different than aa where the two a's are different in the string. str[0] is treated as separate from str[1] when counting permutations
koder3
@koder3
Jun 27 2017 00:20 UTC
@sjames1958gm thanks. see you later. bye
CamperBot
@camperbot
Jun 27 2017 00:20 UTC
koder3 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: koder3 already gave sjames1958gm points
Guderian Raborg
@hypercuber
Jun 27 2017 00:20 UTC
@sjames1958gm thanks
CamperBot
@camperbot
Jun 27 2017 00:20 UTC
hypercuber sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7917 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Baibhav Gautam
@baibhavx
Jun 27 2017 00:21 UTC
Hey guys just finished my Pomodoro Clock Project. Feel free to give any feedback and suggestions. I would also like to add animation like the example project but I wasn't able to figure it out. I'd appreciate any help with that too.
https://codepen.io/baibhavx/full/KqXBwW/
Ming Zhu
@chocobrownie
Jun 27 2017 00:23 UTC
Repost: Hi I have a question regarding the following code:The first line replaces all "apple" with "pinapple" and the second line only replaces the first "apple" that appears. I wonder what does new RegExp("apple",'g') do?
str=str.replace(new RegExp("apple",'g'),"pinapple");
str=str.replace("apple","pinapple");
Stephen James
@sjames1958gm
Jun 27 2017 00:24 UTC
@chocobrownie When the first parameter to replace is a string it only replaces the first match
Ming Zhu
@chocobrownie
Jun 27 2017 00:25 UTC
@sjames1958gm Yes but what does the new RegExp("apple",'g') do? How does it work
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:25 UTC
@ednor Notice that in your code, one of the lines says "modify to test". The reason for this is that here is where you are passing in values to your function nextInLine. It is here where you are actually calling, or invoking, your function. Where you are saying "run these lines of code inside my nextInLine function using these values, please".
Ming Zhu
@chocobrownie
Jun 27 2017 00:25 UTC
Using this method it replaces all "apple"
Stephen James
@sjames1958gm
Jun 27 2017 00:25 UTC
@chocobrownie Since you have the "g" flag, that says replace all matches
Ming Zhu
@chocobrownie
Jun 27 2017 00:25 UTC
For the second line it replaces the first appearance like you described
Stephen James
@sjames1958gm
Jun 27 2017 00:26 UTC
@chocobrownie Remove the "g" flag and only the first would be replaced
Ming Zhu
@chocobrownie
Jun 27 2017 00:26 UTC
what does "new RegExp()" mean then, is it necessary in this case? @sjames1958gm
Ednor
@ednor
Jun 27 2017 00:27 UTC
Thanks @kumquatfelafel
CamperBot
@camperbot
Jun 27 2017 00:27 UTC
ednor sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:warning: ednor already gave kumquatfelafel points
Stephen James
@sjames1958gm
Jun 27 2017 00:27 UTC
@chocobrownie It creates a regex object. You could do str.replace(/apple/g, "pineapple");
Ednor
@ednor
Jun 27 2017 00:28 UTC
Thanks @sjames1958gm
CamperBot
@camperbot
Jun 27 2017 00:28 UTC
ednor sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7918 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Fidencio
@pogiako35
Jun 27 2017 00:28 UTC
Hi everyone...How are you?
Ming Zhu
@chocobrownie
Jun 27 2017 00:28 UTC
@sjames1958gm Got it, I have an additional question. Is there any method I could implement Regex into an if statement? Like if("a"==(an uppercase regular expression code block))
José Alves
@zeph7
Jun 27 2017 00:29 UTC
@sjames1958gm I wrote down possible results. I'm getting somewhere. Tks.
Stephen James
@sjames1958gm
Jun 27 2017 00:29 UTC
@chocobrownie there is test for Regex and match for strings
@zeph7 :+1:
Ming Zhu
@chocobrownie
Jun 27 2017 00:30 UTC
@sjames1958gm Oh nice, how do I test it?
Stephen James
@sjames1958gm
Jun 27 2017 00:31 UTC
@chocobrownie test will return true/false - check the docs on MDN
Ming Zhu
@chocobrownie
Jun 27 2017 00:31 UTC
@sjames1958gm Yes sir, thanks
CamperBot
@camperbot
Jun 27 2017 00:31 UTC
chocobrownie sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7919 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:38 UTC
chocobrownie sends brownie points
@chocobrownie It's like what you were made to do :o
:p
Ednor
@ednor
Jun 27 2017 00:39 UTC
@kumquatfelafel , any of your 2 examples work. ;(
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:40 UTC
@ednor I... quite frankly don't remember most of what I did. But what the person we were helping before you did will not work.
@ednor what's your code looking like?
Kervtuza
@Kervtuza
Jun 27 2017 00:41 UTC
freeCodeCamp/freeCodeCamp#15464 this article says the Show Local Weather app is no longer possible because of a change on codepen as of June 2, 2017....is this true?
Ednor
@ednor
Jun 27 2017 00:44 UTC

@ednor what's your code looking like?

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

Gulsvi
@gulsvi
Jun 27 2017 00:45 UTC
@Kervtuza No, it isn't true. You just have to use APIs that support HTTPS - like Dark Sky, Apixu, and Weather Underground.
Kervtuza
@Kervtuza
Jun 27 2017 00:46 UTC
@SkyC0der oh okay! I just can't seem to connect to the Dark Sky API, must just be my code.
Gulsvi
@gulsvi
Jun 27 2017 00:46 UTC
@Kervtuza You'll have to use JSONP to talk to that service - or a CORS proxy.
Frank Cho
@fcho90
Jun 27 2017 00:47 UTC
Can someone help me with the Word Blanks challenge? not sure what its asking for
Gulsvi
@gulsvi
Jun 27 2017 00:47 UTC
(dataType: 'jsonp' with $.ajax)
Kervtuza
@Kervtuza
Jun 27 2017 00:47 UTC
@SkyC0der Thanks, ill try to look into that!
CamperBot
@camperbot
Jun 27 2017 00:47 UTC
kervtuza sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1845 | @skyc0der |http://www.freecodecamp.com/skyc0der
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:47 UTC
@ednor So we want to add an item to the end of the array, then remove and return an item from the beginning, right?
Ednor
@ednor
Jun 27 2017 00:48 UTC
@kumquatfelafel , I have found the solution on @sjames1958gm FCC profile, he has declared any variable.
 // Your code here
  arr.push(item);

  return arr.shift();  // Change this line
Kervtuza
@Kervtuza
Jun 27 2017 00:49 UTC
@SkyC0der I used crossorigin.me and it worked! Thank you, again!
CamperBot
@camperbot
Jun 27 2017 00:49 UTC
kervtuza sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:warning: kervtuza already gave skyc0der points
luccifer00
@luccifer00
Jun 27 2017 00:49 UTC
Hi there! I am on this challenge, and i pass it, but i am not sure if i a doit in the proper way!! Any advice to improve the code??
'''
CamperBot
@camperbot
Jun 27 2017 00:50 UTC
:bulb: to format code use backticks! ``` more info
luccifer00
@luccifer00
Jun 27 2017 00:50 UTC
`
function confirmEnding(str, target) {
 str=str.split("").reverse().join("");
 target=target.split("").reverse().join("");
  var len = target.length;
  if (str.substr(0, len) == target) {
  return true;  
  }
 else return false;
}

confirmEnding("Open sesame", "same");
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 00:51 UTC
hi guys...i just did the 1st challenge of the algorithms, i did this (and it was correct) but i think there should be a cleaner way to do this
function reverseString(str) {
   str = str.split("");
   str = str.reverse();
   str = str.join("");
  return str;
}

reverseString("hello");
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:51 UTC
@ednor hahaha. Well I suppose that is one way to find answer. But it's also important to understand a bit about what is going on. Here are some links talking about different functions that will remove or add items from array, as well as one that talks a bit about functions in general.
https://www.w3schools.com/js/js_functions.asp
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop
Manish Giri
@Manish-Giri
Jun 27 2017 00:52 UTC
@mauriciodeleonc return str.split("").reverse().join("");
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:52 UTC
^ a bit cleaner. :p
Manish Giri
@Manish-Giri
Jun 27 2017 00:52 UTC
lol
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 00:53 UTC
oh haha yeah... forgot that i could stick them together
thanks @Manish-Giri
CamperBot
@camperbot
Jun 27 2017 00:53 UTC
mauriciodeleonc sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6124 | @manish-giri |http://www.freecodecamp.com/manish-giri
Ednor
@ednor
Jun 27 2017 00:53 UTC

@ednor hahaha. Well I suppose that is one way to find answer. But it's also important to understand a bit about what is going on. Here are some links talking about different functions that will remove or add items from array, as well as one that talks a bit about functions in general.
https://www.w3schools.com/js/js_functions.asp
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop

You are right, but sometimes answers come by practicing.

luccifer00
@luccifer00
Jun 27 2017 00:53 UTC
@mauriciodeleonc you shold get in one line.... like ``` str= str.split("").reverse().join(");
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 00:54 UTC
yep, thanks @luccifer00
CamperBot
@camperbot
Jun 27 2017 00:54 UTC
mauriciodeleonc sends brownie points to @luccifer00 :sparkles: :thumbsup: :sparkles:
:cookie: 243 | @luccifer00 |http://www.freecodecamp.com/luccifer00
luccifer00
@luccifer00
Jun 27 2017 00:54 UTC
🙌
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:55 UTC
@ednor true. Many different ways to learn and get better. :)
luccifer00
@luccifer00
Jun 27 2017 00:55 UTC
@Manish-Giri can you take a look into my code??
Manish Giri
@Manish-Giri
Jun 27 2017 00:56 UTC
@luccifer00 challenge URL?
Ednor
@ednor
Jun 27 2017 00:56 UTC
@ednor true. Many different ways to learn and get better. :)
;)
luccifer00
@luccifer00
Jun 27 2017 00:57 UTC
@Manish-Giri here is it
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:58 UTC
@luccifer00 That challenge url is... :laughing:
luccifer00
@luccifer00
Jun 27 2017 00:58 UTC
Ups , is not that url... sorry
kumquatfelafel
@kumquatfelafel
Jun 27 2017 00:59 UTC
@luccifer00 np. Thanks. Gave me a good laugh
luccifer00
@luccifer00
Jun 27 2017 01:01 UTC
@kumquatfelafel @Manish-Giri Here is the right one is about
Nrupen
@inrupen
Jun 27 2017 01:01 UTC

Seek and Destroy ??

//jshint esversion: 6
function isFoundInArray(value) {
  return this != value;
}
function destroyer(arr) {
  // Remove all the values
  var args = [...arguments];
  var arrayToDestroy = args.shift();

  //since we shift()-ed args, which is a destructive operation, it now is an array with just the values to filter by.
  for (var i = 0; i<args.length;i++) {
    var filterBy = args[i];
    //argument passed to filter() after callback sets 'this' in the callback function.
    arrayToDestroy = arrayToDestroy.filter(isFoundInArray,filterBy);
  }
  return arrayToDestroy;
}

destroyer([7,8,9,10,1,3], 3,8, 9);

is there a way without this keyword?
or any1 can give me a better solution?

luccifer00
@luccifer00
Jun 27 2017 01:01 UTC
Sorry i am with the mobile
luccifer00
@luccifer00
Jun 27 2017 01:02 UTC
@kumquatfelafel @Manish-Giri Is about confirm the ending ----that is the rigth one!! , if u want i can paste the code again...
Nrupen
@inrupen
Jun 27 2017 01:03 UTC
@sandsbe would like to discuss!
@sandsbe seek n destroy!
Dan Couper
@DanCouper
Jun 27 2017 01:04 UTC
@luccifer00 re your confirm the ending: return str.slice(-target.length) === target; is a much easier way of doing it (that's the whole body of the function)
kumquatfelafel
@kumquatfelafel
Jun 27 2017 01:05 UTC
@luccifer00 So when you split, reverse, and join both those strings, it is a bit overkill
Manish Giri
@Manish-Giri
Jun 27 2017 01:05 UTC
@luccifer00
function confirmEnding(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  return str.slice(-target.length) === target;

}
kumquatfelafel
@kumquatfelafel
Jun 27 2017 01:05 UTC
@DanCouper provides a nice solution here
Manish Giri
@Manish-Giri
Jun 27 2017 01:05 UTC
this is what I did
oh well
Binh
@jonhnguyen190692
Jun 27 2017 01:05 UTC
FirstLine
\SecondLine\
ThirdLine
var myStr="FirstLine\n\SecondLine\ThirdLine\r";
It error myStr should have encoded text with the proper escape sequences and no spacing.
kumquatfelafel
@kumquatfelafel
Jun 27 2017 01:06 UTC
And @Manish-Giri provides the same solution, but in a fancy black code box with quote included.
luccifer00
@luccifer00
Jun 27 2017 01:07 UTC
I am learning alone with freecodecamp.... i didnt read nothing about .slice , but the way for freecamp was
to use .substr or substring, right??
Raymond Igle
@r-igle
Jun 27 2017 01:07 UTC
@jonhnguyen190692 I see two chars that you haven't escaped ...guess which ones?
Dan Couper
@DanCouper
Jun 27 2017 01:08 UTC
sorry @Manish-Giri 😔
Moisés Man
@moigithub
Jun 27 2017 01:09 UTC
return str.substr(-target.length) === target; @luccifer00
Dan Couper
@DanCouper
Jun 27 2017 01:09 UTC
@luccifer00
kumquatfelafel
@kumquatfelafel
Jun 27 2017 01:09 UTC
An example of substr return str.substr(-target.length) === target;
Manish Giri
@Manish-Giri
Jun 27 2017 01:09 UTC
@luccifer00 you can use substr as well
get the length of the target string
stick a - in front to count from the back
and use it on str
Dan Couper
@DanCouper
Jun 27 2017 01:10 UTC

If you give slice one argument, it takes a chunk of the string from the index you give it to the end of the string, eg:

"hello".slice(2)
"llo"
If you give it a negative number, it counts back from the end of the string, and takes from there to the end:
"hello".slice(-3)
"llo"

luccifer00
@luccifer00
Jun 27 2017 01:10 UTC
@DanCouper @kumquatfelafel @Manish-Giri .... ok i will search and read about .slice, and rigth now i am
Moisés Man
@moigithub
Jun 27 2017 01:10 UTC
return str.substring(str.length-target.length) === target;
M-C-Haker
@M-C-Haker
Jun 27 2017 01:11 UTC
anyone willing to break this down for me? I've understood so far what's going on and I was able to get the right answer, but i'm mostly trying to understand what the final-expression i++ is doing 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][j]); } } // Only change code above this line return product; }
luccifer00
@luccifer00
Jun 27 2017 01:12 UTC
gonna study the @moigithub code, thats the better way for sure! Lol thanks, i will read about that "-", becouse i didnt read it before!! Thanks everyone!
CamperBot
@camperbot
Jun 27 2017 01:12 UTC
luccifer00 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3435 | @moigithub |http://www.freecodecamp.com/moigithub
Dan Couper
@DanCouper
Jun 27 2017 01:12 UTC
@luccifer00 :+1: basically, you just need to grab the same number of characters as target.length from the end of the string, and check if they're the same - converting it to an array is overkill, as there are a few string methods designed to do that
Moisés Man
@moigithub
Jun 27 2017 01:13 UTC
minus/substraction ?? .length property return a number
10 - 3 //result 7 @luccifer00
Dan Couper
@DanCouper
Jun 27 2017 01:15 UTC
Yeah, -target.length is, if target is say 4 characters long, just -4, is not anything special @luccifer00
Ednor
@ednor
Jun 27 2017 01:15 UTC
I have a very important question
When I was studying Accountant, we knew from the beginning that we wouldn't have to do all calculations manually because QuickBooks in Accpac exist. Is this the same came for JS ? Will we have to code everytime ?
Dan Couper
@DanCouper
Jun 27 2017 01:15 UTC
Ummmm
Well there are math libraries I suppose
Would depend entirely on what you wanted to calculate but I would tentatively say generally you need to code a lot of it
Ednor
@ednor
Jun 27 2017 01:17 UTC
Friends and campers, CODING IS HARD
Binh
@jonhnguyen190692
Jun 27 2017 01:17 UTC
Escape Sequences in Strings
FirstLine
\SecondLine\
ThirdLine
var myStr="FirstLine\n\SecondLine\n\rThirdLine"; // Change this line
Error line : myStr should have encoded text with the proper escape sequences and no spacing.
kumquatfelafel
@kumquatfelafel
Jun 27 2017 01:19 UTC
@ednor outside of accounting, it still depends on what you are trying to do. There are lots of functions out there or oft used solutions to common problems, but you may find yourself having to handle certain things that are unique to your situation... or you may want to modify someone else's solution to a certain problem... etc. Depends.
Moisés Man
@moigithub
Jun 27 2017 01:20 UTC
reread instructions.. u have a extra n @jonhnguyen190692
>
var myStr="FirstLine\n\\SecondLine\\n\rThirdLine"; // Change this line
.....................................................................:point_up:
Na-Ya
@Na-Ya
Jun 27 2017 01:20 UTC
Hey everyone, I am working on the wikipedia viewer project and I'm finally starting to understand this api sandbox but I'm stuck
jmockbee
@jmockbee
Jun 27 2017 01:20 UTC
Hi all ,
Na-Ya
@Na-Ya
Jun 27 2017 01:20 UTC
Can anyone help me with a question?
kumquatfelafel
@kumquatfelafel
Jun 27 2017 01:21 UTC
hey
@moigithub :o
Magic moving finger!
jmockbee
@jmockbee
Jun 27 2017 01:21 UTC
I am in escaped sequences in strings var myStr; 'FirstLine \n"newline backslash"\n
\SecondLine\r "backslash"\r
ThirdLine \"carriage-return\"'; // Change this line
this is what i think they are asking for ,it is not working.
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 01:22 UTC
function palindrome(str) {
  var newStr = str.replace(/d+/g, "");
  var lowerCase = str.toLowerCase();
  var backwards = lowerCase.reverse();
  if (lowerCase == backwards) {
    return true;
  } else {
    return false;
  }  
}



palindrome("eye");
Raymond Igle
@r-igle
Jun 27 2017 01:22 UTC
@jonhnguyen190692 they give you the answer in pseudo. Everything you see in red text is to be replaced with the sequence from the provided chart
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 01:22 UTC
can someone tell me why the false is not working?
(i know i dont have to write it, but its just to see if it worked)
Moisés Man
@moigithub
Jun 27 2017 01:22 UTC
lowercase is a string...
reverse only works for arrays @mauriciodeleonc
Na-Ya
@Na-Ya
Jun 27 2017 01:22 UTC
I'm trying to get the api sandbox results to return the url for each search result
I can only get the url for the main title
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 01:23 UTC
oh okay
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 01:23 UTC
is there a way to do the reverse() but for strings? or do i have to make my string an array?
Moisés Man
@moigithub
Jun 27 2017 01:23 UTC
@mauriciodeleonc also u should keep numbers... remove only NON alphanumeric chars
Ednor
@ednor
Jun 27 2017 01:23 UTC
@kumquatfelafel , I have learned PHP in the past; now I am an advanced WP user, and when it's necessary (as you said), I go to the source code and operate some changes.
CamperBot
@camperbot
Jun 27 2017 01:23 UTC
jonhnguyen190692 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3436 | @moigithub |http://www.freecodecamp.com/moigithub
jmockbee
@jmockbee
Jun 27 2017 01:24 UTC
@mauriciodeleonc how do you display your screen?
Na-Ya
@Na-Ya
Jun 27 2017 01:24 UTC
@mauriciodeleonc reverse only works on arrays
Moisés Man
@moigithub
Jun 27 2017 01:24 UTC
@mauriciodeleonc yep.. convert to array.. reverse.. n reconvert back to string
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 01:24 UTC
@jmockbee you use 3 of => `
3 up and 3 down
for example
Moisés Man
@moigithub
Jun 27 2017 01:25 UTC
```
code here
```
Na-Ya
@Na-Ya
Jun 27 2017 01:25 UTC
anyone have a moment to chat about the wikipedia api?
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 01:25 UTC
hahaha yeah, as @moigithub did it
Binh
@jonhnguyen190692
Jun 27 2017 01:25 UTC
@moigithub thanks it correct :)
CamperBot
@camperbot
Jun 27 2017 01:25 UTC
jonhnguyen190692 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:warning: jonhnguyen190692 already gave moigithub points
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 01:26 UTC
@moigithub about the challenge, thanks
CamperBot
@camperbot
Jun 27 2017 01:26 UTC
mauriciodeleonc sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3437 | @moigithub |http://www.freecodecamp.com/moigithub
jmockbee
@jmockbee
Jun 27 2017 01:26 UTC
@mauriciodeleonc thankyou
CamperBot
@camperbot
Jun 27 2017 01:26 UTC
jmockbee sends brownie points to @mauriciodeleonc :sparkles: :thumbsup: :sparkles:
:cookie: 243 | @mauriciodeleonc |http://www.freecodecamp.com/mauriciodeleonc
kumquatfelafel
@kumquatfelafel
Jun 27 2017 01:27 UTC
@camperbot I'll never send you my brownie points. Not a single one!
CamperBot
@camperbot
Jun 27 2017 01:27 UTC
kumquatfelafel sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star2: 3350 | @camperbot |http://www.freecodecamp.com/camperbot
Moisés Man
@moigithub
Jun 27 2017 01:30 UTC
FirstLine newline backslashSecondLine backslash carriage-returnThirdLine
:point_up: part of the instructions... u need to REPLACE those words in black with
their correspondant escape sequence
ie.. newline is \n
soo it should be
FirstLine \n backslashSecondLine backslash carriage-returnThirdLine
@jmockbee
once u replaced em all.. u need to ASSIGN that string (surround everything on quotes)
to myStr variable
jmockbee
@jmockbee
Jun 27 2017 01:32 UTC
ok let me work on that
@moigithub ok let me work on that
Nathaniel Suchy
@nsuchy
Jun 27 2017 01:35 UTC
I was legit about to ask a question
and realized
I made
a
typo
luccifer00
@luccifer00
Jun 27 2017 01:38 UTC
@moigithub i get the slice and the substr, but i cant get at at all:return str.substring(str.length -target.length) === target; I understand that the start str.length is the num of all the character of str, and the -target.length is when substring stops(not including the las number.... i think i get the logic, but i am not pretty sure... i am on the track??
luccifer00
@luccifer00
Jun 27 2017 01:39 UTC
not including the *last number i mean
Yang Lu
@Luyang2016
Jun 27 2017 01:40 UTC
var Car = function() {
  // this is a private variable
  var speed = 10;

  // these are public methods
  this.accelerate = function(change) {
    speed += change;
  };

  this.decelerate = function() {
    speed -= 5;
  };

  this.getSpeed = function() {
    return speed;
  };
};

var Bike = function() {
  var gear=9;
  this.getGear=function(a){

  };





};

var myCar = new Car();

var myBike = new Bike();
This is Make Object Properties Private in basic javascript, the task is to make "gear" a private property and use two public methods two get and set the value of "gear".
I have no idea how to do this···
Devinder Thakur
@DevinderThakur
Jun 27 2017 01:40 UTC

my codes.............................function trueOrFalse(wasThatTrue){
if(wasThatTrue){
return "yes,that was true";
}
return "No,that was false";

}
trueOrFalse(true);
trueOrFalse(false);

Manish Giri
@Manish-Giri
Jun 27 2017 01:40 UTC
@DevinderThakur check for capitalization
return "yes,that was true";
kumquatfelafel
@kumquatfelafel
Jun 27 2017 01:41 UTC
@DevinderThakur and that all spaces needed are there. If the string doesn't match exactly it will mark you wrong.
Moisés Man
@moigithub
Jun 27 2017 01:41 UTC

lets say..

var str = "hello";
var target = "lo";

str.length will give u 5
target.length will give 2
translating this str.substring(str.length -target.length) === target;
will be.. str.substring(5-2) === target;
"hello".substring(3) will return lo
@luccifer00

Tristan Michael Lawrence
@tr1s
Jun 27 2017 01:42 UTC
var a;
var b = 2;
.. i'm stuck on the second one
Devinder Thakur
@DevinderThakur
Jun 27 2017 01:42 UTC
thanks @kumquatfelafel
CamperBot
@camperbot
Jun 27 2017 01:42 UTC
devinderthakur sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 335 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
Devinder Thakur
@DevinderThakur
Jun 27 2017 01:43 UTC
thanks @Manish-Giri
CamperBot
@camperbot
Jun 27 2017 01:43 UTC
:star2: 6125 | @manish-giri |http://www.freecodecamp.com/manish-giri
devinderthakur sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
Tristan Michael Lawrence
@tr1s
Jun 27 2017 01:43 UTC
they made vars full names and then all of a sudden made them 1 letter and didn't explain :/
luccifer00
@luccifer00
Jun 27 2017 01:43 UTC
all rigth!! @moigithub very clear explication!! 👍🙌🙌
Tristan Michael Lawrence
@tr1s
Jun 27 2017 01:44 UTC

// Setup
var a;
var b = 2;

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

What am i doing wrong with the last line?
kumquatfelafel
@kumquatfelafel
Jun 27 2017 01:45 UTC
b is assigned to a --> a = b;
a is assigned to b --> b = a;
BlackTiger
@BlackTigerRoar
Jun 27 2017 01:49 UTC
@tr1s depends on what you are trying to do. you want assign value b to a or value a to b. If it's b to a, then what you have it's correct
kumquatfelafel
@kumquatfelafel
Jun 27 2017 01:49 UTC
@tr1s you also don't need to use "var" with those guys again (a = 7 and b = 7 would be fine, though they actually don't want "b = 7" explicitly). It looks like you understand from last line that variables can be used not only on the left hand side of =, but also on the right hand side, which is great. You just mixed up what gets assigned into what.
Tristan Michael Lawrence
@tr1s
Jun 27 2017 01:52 UTC
it says assign the contents of a to b
BlackTiger
@BlackTigerRoar
Jun 27 2017 01:53 UTC
@tr1s so it's b = a , you are assigning value a to b
Tristan Michael Lawrence
@tr1s
Jun 27 2017 01:54 UTC
ugh it was as simple as that... and backwards -_-
also the syntax colours were not triggering in the program so i thought it was wrong
thanks!
kumquatfelafel
@kumquatfelafel
Jun 27 2017 01:55 UTC
though yeah, your solution should look similar to this.
// Setup
var a;
var b = 2;

// Only change code below this line
a = 7;
b = a;
Tristan Michael Lawrence
@tr1s
Jun 27 2017 01:56 UTC
wow that's not what i did but it still said i was correct
I had var a = 7, var b= 7, and b = a;
lol
Frank Cho
@fcho90
Jun 27 2017 01:57 UTC
can someone help with the Word Blanks challenge?
I'm not understanding what its asking me to do
kumquatfelafel
@kumquatfelafel
Jun 27 2017 01:57 UTC
@tr1s I figured probably would which why showed this. Just notice, when we make a 7, it can be used to assign the value of 7 to b.
Diego Mayer
@Chrono79
Jun 27 2017 01:58 UTC
@fcho90 read mad libs link and review Constructing string with variables challenge
You have to build a string using all 4 function parameters (myNoun, my Adjective, etc) plus some filler words and/or spaces
Tristan Michael Lawrence
@tr1s
Jun 27 2017 01:58 UTC
ok thank you @kumquatfelafel
CamperBot
@camperbot
Jun 27 2017 01:58 UTC
tr1s sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 336 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
Frank Cho
@fcho90
Jun 27 2017 01:59 UTC
do i just assign the string to a new variable?
Diego Mayer
@Chrono79
Jun 27 2017 01:59 UTC
@fcho90 your function already has a var that it returns, use that var
Frank Cho
@fcho90
Jun 27 2017 02:00 UTC
ok ill take another shot at it. thank you.
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:01 UTC
@tr1s np. though yeah, your solution wasn't necessarily "wrong", just a little more complicated than needed to be ;)
Liz
@NoleGirl411
Jun 27 2017 02:02 UTC
I cannot get past the Profile Lookup challenge. Can someone help?
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:02 UTC
@NoleGirl411 yup
Liz
@NoleGirl411
Jun 27 2017 02:05 UTC
//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];

function lookUpProfile(firstName, prop) {
// Only change code below this line

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

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "address");
Thomas Magnus
@tmag298
Jun 27 2017 02:05 UTC
Can anyone help me with the "Using Objects for Lookups" challenge?
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:05 UTC
@tmag298 yup
I think my issue is that the returned value of whatever is invoked isn't assigned to the result variable but I don't know how to set it equal to this
Liz
@NoleGirl411
Jun 27 2017 02:06 UTC
@kumquatfelafel So, it always returns "No such contact" except
"Akira", "address" which returns "No such property." It's like the for loop isn't working
Thomas Magnus
@tmag298
Jun 27 2017 02:06 UTC
(( if that made any sense ))
Diego Mayer
@Chrono79
Jun 27 2017 02:06 UTC
@tmag298 show your code
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:07 UTC

@NoleGirl411

return contacts[i][prop]; // Perfect! A lot of people miss this ;)

vv this bit is a problem though.

for () {
.
.
.
  else {
      return "No such contact";
   }
}
Thomas Magnus
@tmag298
Jun 27 2017 02:07 UTC

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

// Only change code below this line

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

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

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

how do I get it so the background is black like above?
Diego Mayer
@Chrono79
Jun 27 2017 02:08 UTC
@tmag298 you have to set result value before your function returns it
"": "undefined" <- delete this
```js
your code
```
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:08 UTC
@NoleGirl411 so return is a bit similar to break in that it will immediately take you out of the for loop, with the additional characteristic that it will take you out of the entire function and return whatever value you tell it to return.
Thomas Magnus
@tmag298
Jun 27 2017 02:09 UTC
how do I set the result value equal to whatever the object returns though? Do I just set it equal to the object?
like lookup = result?
Diego Mayer
@Chrono79
Jun 27 2017 02:09 UTC
@tmag298 no, assignation goes from right to left
Review this one: https://www.freecodecamp.com/challenges/accessing-objects-properties-with-variables
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:10 UTC
@NoleGirl411 So the question is, will a setup like this ever not return something on the first iteration? vvv
for() { //assume there's stuff inside parentheses
  if (a)
    return "something";
  else
    return "something else";
}
Liz
@NoleGirl411
Jun 27 2017 02:12 UTC
@kumquatfelafel Thanks! I think I get it now. I took the return out of the for loop. So, when one of the conditions inside the loop are met, and a value is returned, the return outside of the for loop won't run?
CamperBot
@camperbot
Jun 27 2017 02:12 UTC
nolegirl411 sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 337 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:12 UTC
@NoleGirl411 perfect! yup. As soon as executes return statement, the function is over, so to speak.
Liz
@NoleGirl411
Jun 27 2017 02:13 UTC
@kumquatfelafel Thank you, thank you, thank you. I've been stuck on this forever.
CamperBot
@camperbot
Jun 27 2017 02:13 UTC
nolegirl411 sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:warning: nolegirl411 already gave kumquatfelafel points
A'ishah Amatullah
@aishahhope
Jun 27 2017 02:13 UTC
I'm having trouble with one of the beginning JS tests - it says 'a should be assigned to b with =' and i have
a = 7;
b = 7;
a = b;
but it's not passing the test even though i have a = b;
can anyone help?
Diego Mayer
@Chrono79
Jun 27 2017 02:13 UTC
@aishahhope assignation goes from right to left
A'ishah Amatullah
@aishahhope
Jun 27 2017 02:13 UTC
...oh!
thanks!
Diego Mayer
@Chrono79
Jun 27 2017 02:13 UTC
b = 7; delete this one too
A'ishah Amatullah
@aishahhope
Jun 27 2017 02:14 UTC
okay
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:14 UTC
@NoleGirl411 np. You caught on fast. It made me feel almost useful :p

@NoleGirl411 though yeah, as a general rule of thumb in this kind of scenario... you'll often see something like

for() { //again, assume something inside parentheses
  if (a)
    return something;
}
return somethingElse;

Which is how you handled it. The "else" here is kind of implied.

BlackTiger
@BlackTigerRoar
Jun 27 2017 02:20 UTC
Anyone can help me look at my code for problem "Seek and Destroy Incomplete "
function destroyer(arr) {
  // Remove all the values
  var argumentLength = arguments.length;
  var i = 1;
  var result = [];


  arr.filter(function(value){
    while (i < argumentLength){
       if (value != argumentLength[i]){
         return value;
       }  
  }
  });


}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Diego Mayer
@Chrono79
Jun 27 2017 02:20 UTC
@BlackTigerRoar argumentLength is a number, it hasn't a length property, so doing argumentLength[i] will not work
pablovvb
@pablovvb
Jun 27 2017 02:22 UTC
so, can someone help me out? I've tried with filter, delete, and I'm tempted to go with a switch instead, but maybe I'm missing something out. My whole problem is whatever I try, I just can't filter non-alphanumeric elements from the array. Here:
function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  var arr2 = arr;
  for (i = 0; i > arr.length; i++) { 
    if (arr[i].typeof !== string || arr[i].typeof !== number || arr[i] ===0 ) {
  arr2[i] = arr.filter(i);
}
  }
return arr2;  
}
bouncer([7, "ate", "", false, 9]);
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:22 UTC
@pablovvb see above ;)
BlackTiger
@BlackTigerRoar
Jun 27 2017 02:22 UTC
@Chrono79 ahhh, true! Thank you. Let me rethink about it. Thank you for always helping me out!
CamperBot
@camperbot
Jun 27 2017 02:22 UTC
blacktigerroar sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4428 | @chrono79 |http://www.freecodecamp.com/chrono79
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:22 UTC
oh. that one..
Diego Mayer
@Chrono79
Jun 27 2017 02:22 UTC
@pablovvb try filter and boolean
pablovvb
@pablovvb
Jun 27 2017 02:22 UTC
I'll check it out!
intcreate
@intcreate
Jun 27 2017 02:23 UTC
can anyone help me with this
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:23 UTC
@pablovvb thought you were referring to different challenge. My fault for preemptively trying to answer. see @Chrono79 reply. Sorry. Felt like I was on a roll and nothing could go wrong haha
A'ishah Amatullah
@aishahhope
Jun 27 2017 02:24 UTC
Okay, with this one it's telling me quotient is declared twice, but I only see once:
var quotient = 4.4/2.0;
can anyone shed some light?
intcreate
@intcreate
Jun 27 2017 02:25 UTC
this is suppose to mutiply by its factorial but its always outputing 0 help https://codepen.io/anon/pen/awVNYy?editors=1112
Diego Mayer
@Chrono79
Jun 27 2017 02:25 UTC
we're not lanterns :P, but, about what? @aishahhope
A'ishah Amatullah
@aishahhope
Jun 27 2017 02:26 UTC
hehehehe
about why i'm getting the error that this is declaring quotient twice:
var quotient = 4.4/2.0;
Diego Mayer
@Chrono79
Jun 27 2017 02:26 UTC
@intcreate if you initialize result as 0...
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:26 UTC
@aishahhope could you post full code? Not entirely sure of question here
A'ishah Amatullah
@aishahhope
Jun 27 2017 02:26 UTC
that is the full code
Diego Mayer
@Chrono79
Jun 27 2017 02:26 UTC
@aishahhope is there any other var quotient above or below that one?
A'ishah Amatullah
@aishahhope
Jun 27 2017 02:26 UTC
no
maybe it's bugged?
Diego Mayer
@Chrono79
Jun 27 2017 02:27 UTC
challenge name?
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:27 UTC
^
A'ishah Amatullah
@aishahhope
Jun 27 2017 02:27 UTC
Basic JavaScript: Divide one Decimal by Another with JavaScript
i'm in the beta curriculum though
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:27 UTC
@aishahhope got a link?
Diego Mayer
@Chrono79
Jun 27 2017 02:28 UTC
@aishahhope it works for me
A'ishah Amatullah
@aishahhope
Jun 27 2017 02:28 UTC
huh, weird.
reset, it's working now
Diego Mayer
@Chrono79
Jun 27 2017 02:29 UTC
:+1:
A'ishah Amatullah
@aishahhope
Jun 27 2017 02:29 UTC
thanks! :)
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:31 UTC
@intcreate Haven't looked at fully to guarantee there's nothing else wrong, but...
for(var i = num; i < 1; i--) //say num is 2. What happens?
Diego Mayer
@Chrono79
Jun 27 2017 02:32 UTC

@intcreate see this too:

        var mult = i * i-1;    
        result += mult;

a factorial hasn't sums, only products, you wrote it below: factorial(5) // Suppose to be result of 5x4x3x2x1

Adam Faraj
@adamfaraj
Jun 27 2017 02:36 UTC
anyone here good with AngularJS?
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:40 UTC
I... can find typo's in any language. But I imagine that's probably not what you want. :p
Adam Faraj
@adamfaraj
Jun 27 2017 02:40 UTC
@kumquatfelafel i mean, sorta
haha
<!DOCTYPE html>
<html>

<head>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script>
  <link rel="stylesheet" text="text/css" href="styles/app.css">
</head>

<body ng-app="myApp">

  <div ng-view></div>

  <script type="text/javascript" href="scripts/app.js"></script>
  <script type="text/javascript" href="scripts/controllers/MainController.js"></script>
</body>

</html>
var app = angular.module('myApp',['ngRoute']);

app.config(function($routeProvider){
  $routeProvider.when("/", {
    templateUrl: "views/home.html",
    controller: "MainController"
  })

  .when("/food", {
    templateUrl: "views/food.html"
  })
  .when("/drinks", {
    templateUrl: "views/drinks.html"
  })
  .when("/events", {
    templateUrl: "views/events.html"
  })
  .when("/fun", {
    templateUrl: "views/fun.html"
  })
  .otherwise({redirectTo: "/"})
})
})
<div class="logo__container">
  <a href="index.html"><img src="#" alt="Logo" /></a>
</div>
<div class="menu">
  <nav class="menu__nav">
    <ul class="menu__nav-ul">
      <li class="menu__nav-li"><a href="index.html">Home</a></li>
      <li class="menu__nav-li"><a href="#">Food</a></li>
      <li class="menu__nav-li"><a href="#">Drinks</a></li>
      <li class="menu__nav-li"><a href="#">Events</a></li>
      <li class="menu__nav-li"><a href="#">Fun</a></li>
    </ul>
  </nav>
</div>
<div>
  <h1>{{title}}</h1>
</div>
when i try to start my server it shows me the file paths, not index.html
image.png
glitz20
@glitz20
Jun 27 2017 02:45 UTC
Anyone using alternatives for Cloud 9?
Christopher McCormack
@cmccormack
Jun 27 2017 02:45 UTC
@adamfaraj do you need to add an ng-controller?
Adam Faraj
@adamfaraj
Jun 27 2017 02:46 UTC
@cmccormack my app.config should take care of that...i think?
Christopher McCormack
@cmccormack
Jun 27 2017 02:47 UTC
@adamfaraj no idea :D good luck :p
M-C-Haker
@M-C-Haker
Jun 27 2017 02:47 UTC
Feel like i should be using if/else statements for the profile lookup waypoint, but just came out of for and while loops. Should i be using the if/else statements, for loops or some combination of the two?
Adam Faraj
@adamfaraj
Jun 27 2017 02:47 UTC
@cmccormack appreciate the input
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:49 UTC
.otherwise({redirectTo: "/index.html"} ???
Though I have no clue what I'm talking about really.
Cascarr Alejandro Ihesie
@cascarr
Jun 27 2017 02:50 UTC
Hi guys! please I'm kind of stuck on this.. please I need help

function mutation(arr) {

for (var i = 0; i <= arr.length; i++) {
if (arr[i].indexOf(arr[i]) !== -1) {
return true;
}

}

}

mutation(["hello", "hey"]);

luccifer00
@luccifer00
Jun 27 2017 02:50 UTC
Hi again... i am on this challenge i am lost on return var +sum(sum), i know is not the way, but maybe i am doing wrong form the begining here is my code ```
Adam Faraj
@adamfaraj
Jun 27 2017 02:51 UTC
@kumquatfelafel i tried that. didn't work. but thanks!
CamperBot
@camperbot
Jun 27 2017 02:51 UTC
adamfaraj sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 338 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
Thomas Magnus
@tmag298
Jun 27 2017 02:51 UTC
Can anyone help me with the Using Objects for Lookups challenge please?
luccifer00
@luccifer00
Jun 27 2017 02:51 UTC
function repeatStringNumTimes(str, num) {
 str=str.split(" ").map(function (val){return val +(str+str);}).join("");
  return str;
}

repeatStringNumTimes("abc", 3);
Thomas Magnus
@tmag298
Jun 27 2017 02:51 UTC
I'm still really confused
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 02:51 UTC
function palindrome(str) {
  var nonAlpha = str.replace(/[\W_]+/g," ").split("");
  var backwards = nonAlpha.reverse();
  if (nonAlpha == backwards) {
    return true;
  }
}



palindrome("eye");
im on the palindrome challenge
i get the true but not the false
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:52 UTC
@adamfaraj views/home.html?
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 02:52 UTC
@tmag298 yep
what´s your doubt?
Thomas Magnus
@tmag298
Jun 27 2017 02:53 UTC
@mauriciodeleonc I'm generally confused as to how I assign every key in my list to the result variable
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:53 UTC
@tmag298 sure. post question
Adam Faraj
@adamfaraj
Jun 27 2017 02:54 UTC
@kumquatfelafel right, thats what i got
app.config(function($routeProvider){
  $routeProvider.when("/", {
    templateUrl: "views/home.html",
    controller: "MainController"
  })
Thomas Magnus
@tmag298
Jun 27 2017 02:54 UTC
'''js
CamperBot
@camperbot
Jun 27 2017 02:54 UTC
:bulb: to format code use backticks! ``` more info
Thomas Magnus
@tmag298
Jun 27 2017 02:54 UTC

''' js unction 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"
};

// How do I set all of these values to the result value?
// Only change code above this line
return result;
}

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

CamperBot
@camperbot
Jun 27 2017 02:54 UTC
:bulb: to format code use backticks! ``` more info
Thomas Magnus
@tmag298
Jun 27 2017 02:54 UTC

```js unction 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"
};

// How do I set all of these values to the result value?
// Only change code above this line
return result;
}

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

Adam Faraj
@adamfaraj
Jun 27 2017 02:55 UTC
js unction 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"
};
// How do I set all of these values to the result value?
// Only change code above this line
return result;
}
// Change this value to test
phoneticLookup("charlie");
Diego Mayer
@Chrono79
Jun 27 2017 02:55 UTC
@tmag298 didn't you check the challenge I told you?
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 02:55 UTC
@tmag298 okay so... until now you have what you want which is the result, variable val and a lookup table
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:55 UTC

@adamfaraj thanks.

@tmag298 like this :)
```
code here
```

CamperBot
@camperbot
Jun 27 2017 02:55 UTC
kumquatfelafel sends brownie points to @adamfaraj and @tmag298 :sparkles: :thumbsup: :sparkles:
:cookie: 283 | @adamfaraj |http://www.freecodecamp.com/adamfaraj
:cookie: 205 | @tmag298 |http://www.freecodecamp.com/tmag298
Thomas Magnus
@tmag298
Jun 27 2017 02:55 UTC
@Chrono79 I did and I sort of get the direction you're showing me but am still very confused
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 02:55 UTC
after your lookup table you must reassing a value to "result"
Thomas Magnus
@tmag298
Jun 27 2017 02:55 UTC
thankyou @kumquatfelafel
CamperBot
@camperbot
Jun 27 2017 02:56 UTC
tmag298 sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 339 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
Thomas Magnus
@tmag298
Jun 27 2017 02:56 UTC
but how can you assign every value to result?
Diego Mayer
@Chrono79
Jun 27 2017 02:56 UTC
@tmag298 delete this line "": "undefined"
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:56 UTC
@cascarr sorry, you're not forgotten. :p
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 02:56 UTC
in this "result" you want to write the values that are in your lookup table
result = nameOfTable(val)
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:57 UTC
@cascarr just reposting your code so I can see it.
function mutation(arr) {
  for (var i = 0; i <= arr.length; i++) {
    if (arr[i].indexOf(arr[i]) !== -1) {
      return true;
    }  
  } 
}

mutation(["hello", "hey"]);
Diego Mayer
@Chrono79
Jun 27 2017 02:57 UTC
using parentheses there is confusing @mauriciodeleonc
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 02:57 UTC
this will look into your table for the value written in the function, and then assign it in result
Thomas Magnus
@tmag298
Jun 27 2017 02:57 UTC
@mauriciodeleonc that doesn't work though
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 02:58 UTC
@Chrono79 where? in the challenge of tmag or in mine?
oh im sorry
Diego Mayer
@Chrono79
Jun 27 2017 02:58 UTC
@tmag298 what do you need to use when accessing an object's property with a var?
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 02:58 UTC
it is []
Diego Mayer
@Chrono79
Jun 27 2017 02:58 UTC
:+1:
Thomas Magnus
@tmag298
Jun 27 2017 02:58 UTC
@Chrono79 []
but in this challenge they use () which confuses me
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 02:58 UTC
yep my bad @tmag298
Thomas Magnus
@tmag298
Jun 27 2017 02:59 UTC
they say phoneticLookup("alpha") should equal "Adams"
Diego Mayer
@Chrono79
Jun 27 2017 02:59 UTC
so, try writing a line of code that sets result value using your object and the function parameter @tmag298
Kind of what @mauriciodeleonc wrote up ther, except use brackets instead of parentheses and the right names
kumquatfelafel
@kumquatfelafel
Jun 27 2017 02:59 UTC
@cascarr Alright. So your for loop and your if statement are wrong.
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:00 UTC
@Chrono79 ...can you give me hand with this?

function palindrome(str) {
  var nonAlpha = str.replace(/[\W_]+/g," ").split("");
  var backwards = nonAlpha.reverse();
  if (nonAlpha == backwards) {
    return true;
  }
}



palindrome("eye");
it always gives me true
Diego Mayer
@Chrono79
Jun 27 2017 03:00 UTC
@mauriciodeleonc don't replace for spaces
and you need to compare strings (you can't compare arrays like that)
luccifer00
@luccifer00
Jun 27 2017 03:00 UTC
@adamfaraj really?? So simple!? I was wondering in how to doing with .map, i belive .repeat shouldnt works for strings.... any way, thanks, now i have to thing how to solve the negative problem!
CamperBot
@camperbot
Jun 27 2017 03:00 UTC
luccifer00 sends brownie points to @adamfaraj :sparkles: :thumbsup: :sparkles:
:cookie: 284 | @adamfaraj |http://www.freecodecamp.com/adamfaraj
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:01 UTC
@Chrono79 still gives me true
Cascarr Alejandro Ihesie
@cascarr
Jun 27 2017 03:02 UTC
@kumquatfelafel ok, please what do I do then. Because I have stayed on this particular question for a month. And I'm beginning to think my is not working.
Diego Mayer
@Chrono79
Jun 27 2017 03:02 UTC
see the second line of my previous post
Adam Faraj
@adamfaraj
Jun 27 2017 03:02 UTC
@luccifer00 no worries. MDN is your friend
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:02 UTC
someone told me that once split and reversed i should join ti back with .join so it becomes a string again
but if i do that then it doesnt work
Diego Mayer
@Chrono79
Jun 27 2017 03:02 UTC
why not?
raysam1998
@raysam1998
Jun 27 2017 03:03 UTC
hi please
the loop nesting
where did i go wrong

function multiplyAll(arr) {
var product = 1;

for (var i = 0;i<arr.length;i++)
{
for (var j = 0; j < arr[i].lenght;j++)

        {
         product = product * arr[i][j];}

return product;
}
}

multiplyAll([[1,2],[3,4],[5,6,7]]);

Diego Mayer
@Chrono79
Jun 27 2017 03:03 UTC
@raysam1998 it's length
Also, don't return inside the loops
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:04 UTC
@Chrono79

function palindrome(str) {
  var nonAlpha = str.replace(/[\W_]+/g,"").split("");
  var backwards = nonAlpha.reverse();
  backwards = backwards.join("");
  if (nonAlpha == backwards) {
    return true;
  }
}



palindrome("eye");
raysam1998
@raysam1998
Jun 27 2017 03:04 UTC
the i loop or the j loop
gonna try again ty
Diego Mayer
@Chrono79
Jun 27 2017 03:04 UTC
neither
@mauriciodeleonc nonAlpha is still an array
don't split nonAlpha, leave it as a string
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:06 UTC
but if nonAlpha is inside of backwards then why changin it directly like that doesnt change nonAlpha?
@Chrono79 if i leave it as a string the .reverse doesnt work because it only works with arrays
Joseph
@revisualize
Jun 27 2017 03:06 UTC
@mauriciodeleonc Is...
["h","e","l","l","o"] === "hello"
Diego Mayer
@Chrono79
Jun 27 2017 03:06 UTC
@mauriciodeleonc backwards and nonAlpha are equal when you do this: var backwards = nonAlpha.reverse(); because nonAlpha is mutated by reverse
Either chain methods or assign nonAlpha to backwards and work with it
Joseph
@revisualize
Jun 27 2017 03:07 UTC
@mauriciodeleonc Maybe you should spit somewhere else then.
kumquatfelafel
@kumquatfelafel
Jun 27 2017 03:07 UTC

@cascarr Let us consider the first iteration of your for loop. i is, at this time, 0.

if (arr[0].indexOf(arr[0]) !== -1) {

arr[0] is "hello". So it searches for "hello" in the String "hello". Which it inevitably finds. And returns true. But let's suppose it didn't for a moment.

Now we'll consider what happens in the second iteration. i is now 1.

if (arr[i].indexOf(arr[1])!== -1) {

arr[1] is "hi". So it searches for "hi" in the String "hi". Which it also inevitably finds.

mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:09 UTC
now its telling me that nonAlpha.join(""); is not a function haha
rip

function palindrome(str) {
  var nonAlpha = str.replace(/[\W_]+/g,"");
  var backwards = nonAlpha.split("").reverse();
  backwards = nonAlpha.join("");
  if (nonAlpha == backwards) {
    return true;
  }
}



palindrome("eye");
Joseph
@revisualize
Jun 27 2017 03:09 UTC
@mauriciodeleonc https://repl.it/JDNH/0
kumquatfelafel
@kumquatfelafel
Jun 27 2017 03:09 UTC
@cascarr What you are essentially doing here is saying "if x = x, return true."
Joseph
@revisualize
Jun 27 2017 03:09 UTC
@mauriciodeleonc Where's false?
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:11 UTC
when the word is not the same both backwards and forward
Joseph
@revisualize
Jun 27 2017 03:11 UTC
@Chrono79 :wave:
@mauriciodeleonc You don't have a return for false.
luccifer00
@luccifer00
Jun 27 2017 03:11 UTC

```
function repeatStringNumTimes(str, num) {
var negativeErr = "";
while (num>=1){
str=str.repeat(num);
return str;
}
return negativeErr;
}

repeatStringNumTimes("abc", -3);
``` @adamfaraj. Is this the proper way to pass it?? Or there are other methods?? Thanks

CamperBot
@camperbot
Jun 27 2017 03:11 UTC
luccifer00 sends brownie points to @adamfaraj :sparkles: :thumbsup: :sparkles:
:warning: luccifer00 already gave adamfaraj points
Joseph
@revisualize
Jun 27 2017 03:12 UTC
@luccifer00 There is never a "proper way".
luccifer00
@luccifer00
Jun 27 2017 03:12 UTC
function repeatStringNumTimes(str, num) {
  var negativeErr = "";
  while (num>=1){
 str=str.repeat(num);
  return str;
  }
  return negativeErr;
}

repeatStringNumTimes("abc", -3);
Diego Mayer
@Chrono79
Jun 27 2017 03:12 UTC
@revisualize :wave:
@luccifer00 what is the loop for? With a return inside it's only an if in disguise
luccifer00
@luccifer00
Jun 27 2017 03:13 UTC
@revisualize sure??? I think when less code better, or when the logic its more clear also better...
kumquatfelafel
@kumquatfelafel
Jun 27 2017 03:14 UTC
function mutation(arr) {
  for (var i = 0; i <= arr.length; i++) {
    if (arr[i].indexOf(arr[i]) !== -1) {
      return true;
    }  
  } 
}

mutation(["hello", "hey"]);
So, to summarize, instead of this ^ where you search a string for itself, you want to search the first string for the characters of the second string. Or something along those lines.
@cascarr
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:14 UTC
@revisualize i added return for false, and now all that were true are now false
im not sure what im doing wrong
Joseph
@revisualize
Jun 27 2017 03:15 UTC
@mauriciodeleonc Show code
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:15 UTC

function palindrome(str) {
  var nonAlpha = str.replace(/[\W_]+/g,"").split("");
  var backwards = nonAlpha.reverse();
  backwards = backwards.join("");
  if (nonAlpha == backwards) {
    return true;
  } else {
    return false;
  }
}



palindrome("eye");
Joseph
@revisualize
Jun 27 2017 03:15 UTC
@mauriciodeleonc You changed a BUNCH.
luccifer00
@luccifer00
Jun 27 2017 03:16 UTC
@Chrono79 hehe, maybe is better use a boolean or a conditional.... its my mind, when i said: ok while num is upper or equal to 1, so repeat. But i should change while, for when!
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:16 UTC

@Chrono79
```

function palindrome(str) {
var nonAlpha = str.replace(/[\W_]+/g,"").split("");
var backwards = nonAlpha.reverse();
backwards = backwards.join("");
if (nonAlpha == backwards) {
return true;
}
}

palindrome("eye");

```

Joseph
@revisualize
Jun 27 2017 03:16 UTC
@mauriciodeleonc Why is the .split() back up on the nonAlpha line?
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:16 UTC
thats how i had it originally and how you have it in the link you sent
Joseph
@revisualize
Jun 27 2017 03:17 UTC
@mauriciodeleonc Well... the other code was more correct.
kumquatfelafel
@kumquatfelafel
Jun 27 2017 03:17 UTC
@mauriciodeleonc Does 'a' === 'A'?
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:18 UTC
@revisualize

function palindrome(str) {
  var nonAlpha = str.replace(/[\W_]+/g,"");
  var backwards = nonAlpha.split("").reverse();
  backwards = nonAlpha.join("");
  if (nonAlpha == backwards) {
    return true;
  } else {
    return false;
  }
}



palindrome("eye");
you mean like this?
@kumquatfelafel are you asking me if in the code a === A or if i know if a === A? haha
if you´re talking about the code then nope, it does not yet
BlackTiger
@BlackTigerRoar
Jun 27 2017 03:19 UTC
Anyone know why my code is not working?
function destroyer(arr) {
  // Remove all the values
  arr.filter(function(value){
    for (var i = 1; i < value.length; i++){
      if (value != arguments[i]){
         return value;

      }
    }
  });

  console.log(arr);
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Joseph
@revisualize
Jun 27 2017 03:19 UTC
@mauriciodeleonc That's the most correct code I've seen from you.
kumquatfelafel
@kumquatfelafel
Jun 27 2017 03:19 UTC
@mauriciodeleonc alright. So long as you're aware it will be a problem.
Joseph
@revisualize
Jun 27 2017 03:20 UTC
@BlackTigerRoar The arguments for the destroyer function are different than the arguments for the anonymous function in .filter()
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:21 UTC
@kumquatfelafel if i add the .toLowerCase() it shows me an error saying "nonAlpha.join("") is not a function
BlackTiger
@BlackTigerRoar
Jun 27 2017 03:23 UTC
@revisualize arr.filter(function(value) , is this consider as anonymous function?
kumquatfelafel
@kumquatfelafel
Jun 27 2017 03:23 UTC
@mauriciodeleonc Where did you have the .toLowerCase()?
@mauriciodeleonc also, .join is an Array function, not a String function.
surferpilgrim
@surferpilgrim
Jun 27 2017 03:27 UTC
I can't figure out what's wrong with my code(i don't want the answer)
function mutation(arr) {
var valueOne = arr[0].split("");
  var valueTwo = arr[1].split(""); 
  for(var i= 0;i<valueOne.length;i++){
if(valueTwo.indexOf(valueOne[i])===-1){
  return true;
   } else 
   return false;
}

}
mutation(["hello", "hey"]);
Joseph
@revisualize
Jun 27 2017 03:29 UTC
@BlackTigerRoar Yes.
@BlackTigerRoar Wait.
@BlackTigerRoar No.
kumquatfelafel
@kumquatfelafel
Jun 27 2017 03:29 UTC

@surferpilgrim Say I have a for loop...

for(var i = 0; var i < 10; i++) {
  return true;
}

How many times is return true executed?

Joseph
@revisualize
Jun 27 2017 03:29 UTC
@BlackTigerRoar The anonymous function is the function(value) { } part.
Aaron Robbins
@FREExM1ND
Jun 27 2017 03:29 UTC
having trouble with "increment"
BlackTiger
@BlackTigerRoar
Jun 27 2017 03:30 UTC
@revisualize hmmm, okay, I'll think about it. I felt that I spent an hour and half, and no progress lol
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:31 UTC
@kumquatfelafel .split makes string into array . reverse only works wiht arrays and .join transforms array intro string right?
and toLowerCase only works with strings
kumquatfelafel
@kumquatfelafel
Jun 27 2017 03:32 UTC
@mauriciodeleonc .split returns an array of the characters in the string. It doesn't actually change the string itself. Look where you're storing that array.
Joseph
@revisualize
Jun 27 2017 03:32 UTC
@BlackTigerRoar That lesson took me about 20 hours to solve.
BlackTiger
@BlackTigerRoar
Jun 27 2017 03:33 UTC
@revisualize Now you made me feel a little bit better lol
Joseph
@revisualize
Jun 27 2017 03:33 UTC
@BlackTigerRoar Of course, I didn't ask for help for most of it.
@BlackTigerRoar Try running this somewhere:
 [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18].filter(function (el , index , arr) { 
      console.log("Value of el is: " + el);
      console.log("Element being processed: " + arguments[0])
      console.log("Index of the element: " + arguments[1]);
      console.log("All Arguments:")
      console.log(arguments);
      console.log("---------")
      return el % 2 === 0;
   }
  );
Mai Thinh
@mthinh
Jun 27 2017 03:33 UTC

function chunkArrayInGroups(arr, size) {
// Break it up

}

chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2);
Do I need for loop for this challenge?

BlackTiger
@BlackTigerRoar
Jun 27 2017 03:33 UTC
@revisualize I am so attempting to just google it, but gonna try it for some more times
kumquatfelafel
@kumquatfelafel
Jun 27 2017 03:34 UTC
@mauriciodeleonc but yes, you can then use reverse and join on an array... Providing you're actually using them on an array. Pay close attention to the variables that you're using, and what you're doing with them.
Joseph
@revisualize
Jun 27 2017 03:35 UTC
@BlackTigerRoar Or you could run that code that I posted in www.repl.it
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:38 UTC

function palindrome(str) {
  var nonAlpha = str.replace(/[\W_]+/g,"");  //okay so here, we replace all the non-aplhanumeric characters with nothing
  var backwards = nonAlpha.toLowerCase().split("").reverse(); //here is where im confused
// here we take the string stored in nonAlpha which should be all alphanumeric
// we change that to lower case letters and then we split it (making it an array)
//and then we reverse the order of the letters in that array
  backwards = nonAlpha.join("");
  if (nonAlpha == backwards) {
    return true;
  } else {
    return false;
  }
}



palindrome("eye");
okaaaaay
i didnt notice something
```

function palindrome(str) {
  var nonAlpha = str.replace(/[\W_]+/g,"");  //okay so here, we replace all the non-aplhanumeric characters with nothing
  var backwards = nonAlpha.toLowerCase().split("").reverse(); //here is where im confused
// here we take the string stored in nonAlpha which should be all alphanumeric
// we change that to lower case letters and then we split it (making it an array)
//and then we reverse the order of the letters in that array
  backwards = backwards.join("");
  if (nonAlpha == backwards) {
    return true;
  } else {
    return false;
  }
}



palindrome("eye");
```
okay ignore the first one
Diego Mayer
@Chrono79
Jun 27 2017 03:39 UTC
@mauriciodeleonc do the toLowerCase before the replace, so both are lowercased
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:39 UTC
adhfjladfaljdkfmdklfmas
@Chrono79 thank you very much hahaha
CamperBot
@camperbot
Jun 27 2017 03:39 UTC
mauriciodeleonc sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4429 | @chrono79 |http://www.freecodecamp.com/chrono79
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:40 UTC
@revisualize @kumquatfelafel thank you to you too
CamperBot
@camperbot
Jun 27 2017 03:40 UTC
mauriciodeleonc sends brownie points to @revisualize and @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 340 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
:star2: 4274 | @revisualize |http://www.freecodecamp.com/revisualize
BlackTiger
@BlackTigerRoar
Jun 27 2017 03:41 UTC
@revisualize Thanks! Need sometimes to process it
CamperBot
@camperbot
Jun 27 2017 03:41 UTC
blacktigerroar sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4275 | @revisualize |http://www.freecodecamp.com/revisualize
hotavneesh
@hotavneesh
Jun 27 2017 03:46 UTC
can some1 make me undrstand what this challenge wants
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.
mauriciodeleonc
@mauriciodeleonc
Jun 27 2017 03:47 UTC
@hotavneesh you´ll want to use .shift and .push
.push to put the item at the end of your array and .shift to take the first one out
hotavneesh
@hotavneesh
Jun 27 2017 03:47 UTC
i got that bit but do i need to give arguments first
kumquatfelafel
@kumquatfelafel
Jun 27 2017 03:49 UTC

@hotavneesh they provide arguments when they call the function.

You're provided one function call near the bottom so you can play around with testing different values if you want.

hotavneesh
@hotavneesh
Jun 27 2017 03:49 UTC
lemme try thanks for help
Joseph
@revisualize
Jun 27 2017 03:49 UTC
@mauriciodeleonc Did you solve your challenge?
surferpilgrim
@surferpilgrim
Jun 27 2017 03:50 UTC
@kumquatfelafel 10 times
Joseph
@revisualize
Jun 27 2017 03:51 UTC
@surferpilgrim Incorrect.
@surferpilgrim
The return statement ends function execution and specifies a value to be returned to the function caller.
Syntax
return [[expression]];
expression
The expression to return. If omitted, undefined is returned instead.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return
kumquatfelafel
@kumquatfelafel
Jun 27 2017 03:51 UTC

@surferpilgrim It was a bit of a trick question, but important concept. This

for (var i = 0; i < 10; i++) {
  return true;
}

will return true only once.

Joseph
@revisualize
Jun 27 2017 03:52 UTC
@surferpilgrim Once a return statement is invoke.. It HALTS the whole function.. Including the loop.
kumquatfelafel
@kumquatfelafel
Jun 27 2017 03:53 UTC
@surferpilgrim Now take another look at your code. Can it get past the first iteration of for loop? Careful... after all, this might be a trick question too, so be sure of your answer. ;)
Tricia
@patricia07
Jun 27 2017 03:58 UTC

is this right var lastName = "Lovelace";

// Only change code below this line
var secondToLastLetterOfLastName = lastName[lastName.length -6];

jaizon
@jaizon
Jun 27 2017 03:59 UTC
Hello all, Ihave aproblem loading json with json files with jquery, it seems that it is loading so slow so that my functions can't acess the data and I when I use a setTimeout() arroun all myfunctionsit works alright, should I be worried?
kumquatfelafel
@kumquatfelafel
Jun 27 2017 03:59 UTC
last name length is 8. 8 - 6 is 2. lastName[0] is first letter of last name.
@patricia07
actually, disregard what I said. I'm sure someone will correct me, but I think this is my cue to sleep.
Or maybe, I wasn't wrong. Don't even know at this point. G'night
Thomas Magnus
@tmag298
Jun 27 2017 04:05 UTC
Can anyone help me with a general question about Java?
Ken Haduch
@khaduch
Jun 27 2017 04:05 UTC
@jaizon - if you are using some function like getJSON, there is a callback function that you have to provide that is triggered when the data is returned to you. You cannot reliably use setTimeout and always expect that the data is there when you want to read it. Not having any other insight into your code, that is what I would say is what you should be looking into - the callback function and how to use it.
@tmag298 - Java?
Thomas Magnus
@tmag298
Jun 27 2017 04:06 UTC
@khaduch indeed
Ken Haduch
@khaduch
Jun 27 2017 04:06 UTC
@tmag298 - well, this is the "javascript" forum... but you can ask.
jaizon
@jaizon
Jun 27 2017 04:06 UTC
@khaduch ok, ty, I'll look into callback functions:)
CamperBot
@camperbot
Jun 27 2017 04:06 UTC
jaizon sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3044 | @khaduch |http://www.freecodecamp.com/khaduch
kumquatfelafel
@kumquatfelafel
Jun 27 2017 04:07 UTC
@surferpilgrim just... before I go, the answer to my question was no. Your code(at least from before) would not get to second iteration of for loop
pablovvb
@pablovvb
Jun 27 2017 04:08 UTC
@kumquatfelafel no problem. I've read and re-read, and I'm still stuck on it, though. Three hours and counting :/
kumquatfelafel
@kumquatfelafel
Jun 27 2017 04:08 UTC
@pablovvb I don't remember what this is in reference to.
@pablovvb oh right. falsy bouncer
pablovvb
@pablovvb
Jun 27 2017 04:08 UTC
yeah. I zoned out reading and trying :P
surferpilgrim
@surferpilgrim
Jun 27 2017 04:09 UTC
@revisualize thanks
CamperBot
@camperbot
Jun 27 2017 04:09 UTC
surferpilgrim sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4276 | @revisualize |http://www.freecodecamp.com/revisualize
kumquatfelafel
@kumquatfelafel
Jun 27 2017 04:15 UTC
@pablovvb so yeah. The solution to this one... I don't trust myself to say much here without giving the surprise away (too tired). But you're going to love it.
pablovvb
@pablovvb
Jun 27 2017 04:16 UTC
@kumquatfelafel so this is one of those you tend to get stuck into, and the answer was always in front of you?
jfrancismccormick
@jfrancismccormick
Jun 27 2017 04:16 UTC
on the C to F challenge how do I step it through from -30, -20, 0, 20, 30? my code so far:
var celcius = -30;
celcius = celcius + 20;
fahrenheit = 9/5 * celcius + 32;
pablovvb
@pablovvb
Jun 27 2017 04:17 UTC
this is my logic so far, not close enough yet to the answer
function bouncer(arr) {
  // Don't show a false ID to this bouncer.

  //so, I'm supposed to use both filter and boolean in order to filter out all
  //non-alphanumeric elements. My problems are:
  // a) all of it looks like is done at the same time.
  // How do I break it down into several steps? and 
  //b) how do I use the boolean properties in this search?
  //1. if arr(x) === non-alphanumeric,
  //1.1 to search for non-alphanumeric, I must look into its boolean properties,
  //1.2 and then make it an if statement (most probably nested in a for loop)
  //2. filter arr(x) from arr. this would look like arr.filter(x), right?

    var arr2 = arr;
for (i = 0; i > arr.length; i++) {
  if (arr[i] ===true) {
}
  else {
    arr2.filter(i);
  }
}
return arr2;  
}
bouncer([7, "ate", "", false, 9]);
fdemaa
@fdemaa
Jun 27 2017 04:20 UTC
do i have to use a loop in the mutation algorithms, to check the index of the strings?
Thomas Magnus
@tmag298
Jun 27 2017 04:21 UTC

@khaduch why is it that some variables have to be defined but others not?

this is my logic so far, not close enough yet to the answer
```
function bouncer(arr) {
// Don't show a false ID to this bouncer.

//so, I'm supposed to use both filter and boolean in order to filter out all
//non-alphanumeric elements. My problems are:
// a) all of it looks like is done at the same time.
// How do I break it down into several steps? and
//b) how do I use the boolean properties in this search?
//1. if arr(x) === non-alphanumeric,
//1.1 to search for non-alphanumeric, I must look into its boolean properties,
//1.2 and then make it an if statement (most probably nested in a for loop)
//2. filter arr(x) from arr. this would look like arr.filter(x), right?

var arr2 = arr;

for (i = 0; i > arr.length; i++) {
if (arr[i] ===true) {
}
else {
arr2.filter(i);
}
}
return arr2;
}
bouncer([7, "ate", "", false, 9]);
```

^^^ did not mean to type that at all
sorry to the chat
kumquatfelafel
@kumquatfelafel
Jun 27 2017 04:25 UTC

@pablovvb Okay. So here's an important line in filter description.

filter() calls a provided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a value that coerces to true.

HD
@feedblender
Jun 27 2017 04:25 UTC
okay so i'm on the beginning stages of JS and this code got the correct solution but I feel like there must be a way to streamline the spaces?
theVar = "The";
spaceVar = " "
result = theVar + spaceVar + myAdjective + spaceVar + myNoun + spaceVar + myAdverb + spaceVar + myVerb;
kumquatfelafel
@kumquatfelafel
Jun 27 2017 04:26 UTC
pablovvb
@pablovvb
Jun 27 2017 04:26 UTC
@tmag298 do you mean I don't define arr? arr is defined as the thing you type at the end, next to bouncer: bouncer([7, "ate", "", false, 9])
I'll check it out! thanks for pointing out the direction!! @kumquatfelafel
CamperBot
@camperbot
Jun 27 2017 04:27 UTC
pablovvb sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 341 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
dascreator
@dascreator
Jun 27 2017 04:27 UTC
Hello all, I am having a hard time wrapping my head around this one...' what type of expression do I need to create to return a "if this is false, return "undefined"'

Instructions

Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined.

Hint
Remember that undefined is a keyword , not a string.

fdemaa
@fdemaa
Jun 27 2017 04:28 UTC
@dascreator return ; ?
M-C-Haker
@M-C-Haker
Jun 27 2017 04:29 UTC

someone please help: `
//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){
if (contacts.hasOwnProperty(firstName) && contacts.hasOwnProperty(prop)) {
return contacts[prop];
}
else if (contacts.hasOwnProperty(firstName) !== true) {
return "No such contact";
}
return "No such property";
// Only change code above this line
}

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

kumquatfelafel
@kumquatfelafel
Jun 27 2017 04:29 UTC
@fdemaa this will work, as will return undefined;
M-C-Haker
@M-C-Haker
Jun 27 2017 04:29 UTC
I believe my problem is with the first if statement. i can't seem to figure out how to get past the property and get the code to access the value and see if they match
fdemaa
@fdemaa
Jun 27 2017 04:30 UTC
@kumquatfelafel hi bro!
kumquatfelafel
@kumquatfelafel
Jun 27 2017 04:30 UTC
ack! I'm getting dragged back in :laughing:
Night this time for real
@fdemaa hi bye :p
fdemaa
@fdemaa
Jun 27 2017 04:30 UTC
:+1: !
dascreator
@dascreator
Jun 27 2017 04:30 UTC
@kumquatfelafel @fdemaa I don't think that will fly as it states it is not a string?
Abhishek Tiwari
@fillopfy
Jun 27 2017 04:31 UTC
@M-C-Haker use nested ifs, first check contact name and then check property name using hasOwnProperty method
dascreator
@dascreator
Jun 27 2017 04:32 UTC
nevermind, that worked! Thanks @fdemaa @kumquatfelafel
CamperBot
@camperbot
Jun 27 2017 04:32 UTC
dascreator sends brownie points to @fdemaa and @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 296 | @fdemaa |http://www.freecodecamp.com/fdemaa
:cookie: 342 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
fdemaa
@fdemaa
Jun 27 2017 04:32 UTC
@dascreator cool!
@M-C-Haker you should check if firstName is an actual firstname, and also if the prop exist with hasown property, also you dont need your else if statement
M-C-Haker
@M-C-Haker
Jun 27 2017 04:33 UTC
@fillopfy i know i've done them but i can't seem to find the waypoint to see syntax, etc..
Abhishek Tiwari
@fillopfy
Jun 27 2017 04:34 UTC
@M-C-Haker you have done wrong way
Thomas Magnus
@tmag298
Jun 27 2017 04:34 UTC
Why is it some variables have to be defined while others do not? For example, why doesn't count have to be defined in the following script?
function cc(card) {
// Only change code below this line
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
break;
}
if (count > 0){
return count + " Bet";
} else {
return count + " Hold";
}
// Only change code above this line
}
cc(2); cc(3); cc(7); cc('K
fdemaa
@fdemaa
Jun 27 2017 04:34 UTC
your problem is the else if and also some returns are incorrect
@M-C-Haker
M-C-Haker
@M-C-Haker
Jun 27 2017 04:34 UTC
@fillopfy as in don't use if else at all?
BlackTiger
@BlackTigerRoar
Jun 27 2017 04:34 UTC
Same problem, more question....
M-C-Haker
@M-C-Haker
Jun 27 2017 04:35 UTC
@fdemaa lol the else if statement is the only thing fcc is showing that i have correct atm
Abhishek Tiwari
@fillopfy
Jun 27 2017 04:35 UTC
@M-C-Haker you need to nested ifs, first use if to check contacts name, then inside that if, check property name and then return property name,
M-C-Haker
@M-C-Haker
Jun 27 2017 04:36 UTC
@fillopfy ok i know you're correct. can you point me to waypoint number so i can review the syntax??
@fillopfy i'm looking on the map and don't see it anywhere!
fdemaa
@fdemaa
Jun 27 2017 04:37 UTC
@M-C-Hacker you don't need it, and also you need a loop to iterate through the contacts.. it will never work without a loop
Abhishek Tiwari
@fillopfy
Jun 27 2017 04:37 UTC
@M-C-Haker i didnt understood what you are saying
BlackTiger
@BlackTigerRoar
Jun 27 2017 04:37 UTC

If I do below, I can get [1, 3, 1, 3]

function destroyer(arr) {
  // Remove all the values

  // convert the arguments to an array.
  var argumentsArray = Array.from(arguments);

  // remove the first index in the arguments array, which is an array.
  argumentsArray = argumentsArray.slice(1, arguments.length);

  var result = arr.filter(function(val){ 
    if (val != 2){
      return val;
    }

  });

  console.log(result);
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

But if I add for loop, and loop through the value like below:


function destroyer(arr) {
  // Remove all the values

  // convert the arguments to an array.
  var argumentsArray = Array.from(arguments);

  // remove the first index in the arguments array, which is an array.
  argumentsArray = argumentsArray.slice(1, arguments.length);

  var result = arr.filter(function(val){ 
    for (var i = 0; i < argumentsArray.length; i++){
      if (val != argumentsArray[i])
        return val;
    }

  });

  console.log(result);
}

I got nothing change.

M-C-Haker
@M-C-Haker
Jun 27 2017 04:38 UTC
@fillopfy how is it suppose to look? i.e. if () { if () } return xyz
;
Abhishek Tiwari
@fillopfy
Jun 27 2017 04:39 UTC
@M-C-Haker if(contacts.firstName===firstName){}
then in curly braces
M-C-Haker
@M-C-Haker
Jun 27 2017 04:41 UTC
@fillopfy if (contacts.firstName === firstName) {
if (contacts.hasOwnProperty(prop)) }
return contacts[prop]; ?
Abhishek Tiwari
@fillopfy
Jun 27 2017 04:41 UTC
@M-C-Haker if(contacts.hasOwnProperty(prop)){return contacts[prop]}
Jason Spence
@sfrjrs
Jun 27 2017 04:41 UTC
I know this is supposed to return the values, but for now I'm just logging them and it works in codepen, but fails in freeCodeCamp editor.
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]); 
    }
    if(contacts[i].firstName !== firstName) {
      console.log('No such contact'); 
    }
    if(contacts[i].hasOwnProperty(prop) !== true) {
      console.log('No such property');
    }
  }
// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Harry", "likes");
CamperBot
@camperbot
Jun 27 2017 04:41 UTC
:bulb: to format code use backticks! ``` more info
Abhishek Tiwari
@fillopfy
Jun 27 2017 04:42 UTC
@M-C-Haker and then return No such property and then in last return no such contact
fdemaa
@fdemaa
Jun 27 2017 04:43 UTC
@sfrjrs you dont need the second and third if, just return with an else no such property, close the loop and return no such contact
Shawshank
@code2shank
Jun 27 2017 04:44 UTC


function golfScore(par, strokes) {
  // Only change code below this line
  if (1==strokes){
    return "Hole-in-one!";
  } else if (strokes <= (par - 2)){
    return "Eagle";
  } else if (strokes == (par -1)){
    return "Birdie";
  } else if (strokes == par) {
    return "Par";
  } else if (strokes == (par+1)){
    return "Bogey";
  } else if (strokes == (par+2)){
    return "Double Bogey";
  } else if (stroke >= (par+3)){
    return "Go Home!";
  }
  // Only change code above this line
}

// Change these values to test
golfScore(5, 4);
Go Home!
is not working
whats the issue?

golfScore(4, 1) should return "Hole-in-one!"
golfScore(4, 2) should return "Eagle"
golfScore(5, 2) should return "Eagle"
golfScore(4, 3) should return "Birdie"
golfScore(4, 4) should return "Par"
golfScore(1, 1) should return "Hole-in-one!"
golfScore(5, 5) should return "Par"
golfScore(4, 5) should return "Bogey"
golfScore(4, 6) should return "Double Bogey"
golfScore(4, 7) should return "Go Home!"
golfScore(5, 9) should return "Go Home!"
i got everything working except for Go Home!
oh i see it now
nevrmind
i didnt types strokes
CallMeOrange
@EgnaroDev
Jun 27 2017 04:47 UTC
@code2shank Did you pass?
Shawshank
@code2shank
Jun 27 2017 04:47 UTC
yes
M-C-Haker
@M-C-Haker
Jun 27 2017 04:47 UTC
@fillopfy i see what you're saying and i'm almost there but not sure where i'm wrong

function lookUpProfile(firstName, prop){

if (contacts.firstName === firstName) {
if (contacts.hasOwnProperty(prop)){
return contacts[prop];
}
return "No such contact";
}
return "No such property";
// Only change code above this line
}

CallMeOrange
@EgnaroDev
Jun 27 2017 04:47 UTC
@code2shank ok I was going to say that you should use switch statements but forget it :/
fdemaa
@fdemaa
Jun 27 2017 04:48 UTC
You need a loop that will never work
Shawshank
@code2shank
Jun 27 2017 04:48 UTC
i'm not on switch yet
the var name on the last conditional was in correct
in-correct
M-C-Haker
@M-C-Haker
Jun 27 2017 04:49 UTC
@fdemaa me?
fdemaa
@fdemaa
Jun 27 2017 04:49 UTC
yes
you have to iterate thourh the contact listh with a loop
M-C-Haker
@M-C-Haker
Jun 27 2017 04:50 UTC
@fdemaa that's what i was thinking originally, but have only used numbers so far so I wasn't sure. Guess you can set i = to words?
Jason Spence
@sfrjrs
Jun 27 2017 04:51 UTC
@fdemaa like this?
@fdemaa
    if(contacts[i].firstName === firstName && contacts[i].hasOwnProperty(prop)) {
      return contacts[i][prop];
    } else {
      return 'No such property';
    }

    if(contacts[i].firstName !== firstName) {
      return 'No such contact';
    }
fdemaa
@fdemaa
Jun 27 2017 04:53 UTC
@sfrjrs you dont need the last if, just return no such contact, outside the loop , as a final catch all
Jason Spence
@sfrjrs
Jun 27 2017 04:53 UTC
got it
fdemaa
@fdemaa
Jun 27 2017 04:53 UTC
:+1:
Abhishek Tiwari
@fillopfy
Jun 27 2017 04:54 UTC
@M-C-Haker the code is correct but you need to put this syntact to be repeated ,, and thus need a loop for it
@M-C-Haker use a for loop for that
Jason Spence
@sfrjrs
Jun 27 2017 04:54 UTC
@fdemaa argg, still not working
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)) {
      return contacts[i][prop];
    } else {
      return 'No such property';
    }

    return 'No such contact';

  }
// Only change code above this line
}
fdemaa
@fdemaa
Jun 27 2017 04:55 UTC
close the loop
above the final return
put a }
Jason Spence
@sfrjrs
Jun 27 2017 04:55 UTC
outside the for lookp
Abhishek Tiwari
@fillopfy
Jun 27 2017 04:56 UTC

@M-C-Haker for(var i=0;i<contacts.length;i++)
{

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

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

}

return "No such contact";

like this one

fdemaa
@fdemaa
Jun 27 2017 04:56 UTC
@sfrjrs
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)) {
      return contacts[i][prop];
    } else {
      return 'No such property';
    }
/// here put two }}
    return 'No such contact';

  }
// Only change code above this line
}
M-C-Haker
@M-C-Haker
Jun 27 2017 04:57 UTC
@sfrjrs yeah i is not defined?
Abhishek Tiwari
@fillopfy
Jun 27 2017 04:57 UTC
for(var i=0;i<contacts.length;i++)
    {

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

    }
  return "No such contact";
fdemaa
@fdemaa
Jun 27 2017 04:58 UTC
@sfrjrs close the else, the first if, and the loop .. and then you return No such contact
Miguel Vasquez
@mivasquez386
Jun 27 2017 04:59 UTC
hi room!
fdemaa
@fdemaa
Jun 27 2017 04:59 UTC
hola miguel
Miguel Vasquez
@mivasquez386
Jun 27 2017 04:59 UTC
have a question with the "Drop it" challenge
code works but fails when trying to validate one of the specific tests
Jason Spence
@sfrjrs
Jun 27 2017 05:00 UTC
@fdemaa @fillopfy thank you guys
CamperBot
@camperbot
Jun 27 2017 05:00 UTC
sfrjrs sends brownie points to @fdemaa and @fillopfy :sparkles: :thumbsup: :sparkles:
:cookie: 288 | @fillopfy |http://www.freecodecamp.com/fillopfy
:cookie: 297 | @fdemaa |http://www.freecodecamp.com/fdemaa
Miguel Vasquez
@mivasquez386
Jun 27 2017 05:00 UTC
here is my code
```
function dropElements(arr, func) {
  // Drop them elements.

  while(!func(arr[0])) {
    arr.shift();
  }

  return arr;
}

dropElements([1, 2, 3, 7, 4], function(n) {return n > 3;});
but fails when i try:
dropElements([1, 2, 3, 4], function(n) {return n > 5;}) should return [].
M-C-Haker
@M-C-Haker
Jun 27 2017 05:01 UTC
@fillopfy that one doesn't work I believe it has to use the && operator
Miguel Vasquez
@mivasquez386
Jun 27 2017 05:01 UTC
it says warning of infinite loop. any idea why?
Abhishek Tiwari
@fillopfy
Jun 27 2017 05:02 UTC
@M-C-Haker how can it not work, i checked it, its working
for(var i=0;i<contacts.length;i++)
    {

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

    }
  return "No such contact";
@M-C-Haker this code
M-C-Haker
@M-C-Haker
Jun 27 2017 05:03 UTC
@fillopfy you are right, i'm not sure where i had it wrong, it does work thank you!
CamperBot
@camperbot
Jun 27 2017 05:03 UTC
m-c-haker sends brownie points to @fillopfy :sparkles: :thumbsup: :sparkles:
:cookie: 289 | @fillopfy |http://www.freecodecamp.com/fillopfy
Abhishek Tiwari
@fillopfy
Jun 27 2017 05:04 UTC
@M-C-Haker both will work, && and without &&, because && means both codition must be true while in nested ifs, it has to be the same, both should be true
Johnny Meza
@XLpacman805
Jun 27 2017 05:10 UTC
@mivasquez386 it's an infinite loop because the while loop never receives a true condition for the function.
Bashir Harrell
@bookofbash
Jun 27 2017 05:11 UTC

Hi All, I am having trouble getting my Wikipedia Viewer data from the api to show on the page. Can someone point me in the right direction? Im at my wits end.

https://codepen.io/bookofbash/pen/werQYd?editors=0010

M-C-Haker
@M-C-Haker
Jun 27 2017 05:12 UTC
blob
@fdemaa i was did a little copypasta because i wanted to see it in action with the && operator and this is giving me a syntax error. any idea why?
Manish Giri
@Manish-Giri
Jun 27 2017 05:12 UTC
it's pointing it out for you
@M-C-Haker
note where the last bracket on line 40 ends
and where it's matched
Miguel Vasquez
@mivasquez386
Jun 27 2017 05:13 UTC
@XLpacman805 thank you. let me do some more research.
CamperBot
@camperbot
Jun 27 2017 05:13 UTC
mivasquez386 sends brownie points to @xlpacman805 :sparkles: :thumbsup: :sparkles:
:cookie: 308 | @xlpacman805 |http://www.freecodecamp.com/xlpacman805
M-C-Haker
@M-C-Haker
Jun 27 2017 05:14 UTC
blob
@Manish-Giri even when i take it away
doesn't show correct on fcc
Zack
@CrowsVeldt
Jun 27 2017 05:14 UTC
@bookofbash I'll try to take a look
Manish Giri
@Manish-Giri
Jun 27 2017 05:15 UTC
@M-C-Haker split line 35 into a nested if
Johnny Meza
@XLpacman805
Jun 27 2017 05:15 UTC
@mivasquez386 try running this code and see what outputs `var arr2 = []; console.log(arr2[0] > 5); if that returns false then that explains your infinite loop
Manish Giri
@Manish-Giri
Jun 27 2017 05:15 UTC
if matching first name - 
a. if prop match - 
b. else -
M-C-Haker
@M-C-Haker
Jun 27 2017 05:15 UTC
@Manish-Giri yeah i think it has to be nested, i just wanted to point that out to op
Manish Giri
@Manish-Giri
Jun 27 2017 05:15 UTC
@M-C-Haker
Bashir Harrell
@bookofbash
Jun 27 2017 05:16 UTC
@CrowsVeldt very much appreciated.
Zack
@CrowsVeldt
Jun 27 2017 05:19 UTC
@bookofbash in order to simply display the results to the page, all that was missing is:
```
M-C-Haker
@M-C-Haker
Jun 27 2017 05:19 UTC
@Manish-Giri i like how they just throw you right into the wolves with that one! no indication that we are going to be using loops with objects and then all the sudden an object in an array and it's fair game. good looking out though thanks
CamperBot
@camperbot
Jun 27 2017 05:19 UTC
m-c-haker sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6126 | @manish-giri |http://www.freecodecamp.com/manish-giri
nikhilpatel87
@nikhilpatel87
Jun 27 2017 05:20 UTC
How in the world do you guys remember all the various JS methods? I went through the JS section on FCC and felt like I had a good grasp on it, but now that I'm on the algorithms sections, I feel lost. Generally, I have the right idea in my mind, but completely blank out on where to begin applying the idea or even how to construct it correctly
Miguel Vasquez
@mivasquez386
Jun 27 2017 05:20 UTC
@XLpacman805 result is false as expected
Zack
@CrowsVeldt
Jun 27 2017 05:20 UTC
@bookofbash sorry, having trouble typing today

@bookofbash

add:

Miguel Vasquez
@mivasquez386
Jun 27 2017 05:21 UTC
@nikhilpatel87 know how you feel. It took me a while to get back to studying.
Zack
@CrowsVeldt
Jun 27 2017 05:21 UTC
$(".result-container").html(json);
Bashir Harrell
@bookofbash
Jun 27 2017 05:22 UTC
@CrowsVeldt oh wow really?
Zack
@CrowsVeldt
Jun 27 2017 05:22 UTC
@bookofbash (the missing part was the 'json' parameter) add that to the else of your `submitFn
yeah
Try it out
Johnny Meza
@XLpacman805
Jun 27 2017 05:23 UTC
@mivasquez386 good, now it's up to you think of a way that might stop the infinite loop from occuring. If you get stuck let me know but I think you can do it.
Zack
@CrowsVeldt
Jun 27 2017 05:23 UTC
Wow, my fingers just don't want to type today :/
@nikhilpatel87 Yeah, honestly it just takes (a shit ton of) practice
Bashir Harrell
@bookofbash
Jun 27 2017 05:24 UTC
@CrowsVeldt Thank you, I guess I just needed another set of eyes. Now I just need it to format correctly, and I am pretty sure I can figure that out.
CamperBot
@camperbot
Jun 27 2017 05:24 UTC
bookofbash sends brownie points to @crowsveldt :sparkles: :thumbsup: :sparkles:
:cookie: 294 | @crowsveldt |http://www.freecodecamp.com/crowsveldt
Zack
@CrowsVeldt
Jun 27 2017 05:25 UTC
I'm starting to get to the point where I usually remember what I need
Johnny Meza
@XLpacman805
Jun 27 2017 05:25 UTC
@nikhilpatel87 Practice. I used to struggle with the arr.map() method but now I understand it. I also like to have the MDN JS documentation open when writing code.
Zack
@CrowsVeldt
Jun 27 2017 05:25 UTC
I second MDN
Best resource on the web ATM
Johnny Meza
@XLpacman805
Jun 27 2017 05:26 UTC
Yup. I go to W3 schools I'm having trouble understanding something, and then to MDN when I want good examples and more info.
Zack
@CrowsVeldt
Jun 27 2017 05:26 UTC
@bookofbash You're very welcome! I can't tell you how many times that's happened to me, your brain gets so used to seeing it it starts blanking out the details.
mattr12
@mattr12
Jun 27 2017 05:27 UTC
Has anyone here completed the "Chunky Monkey" challenge? I am not sure why my code is wrong--it's only working for some of the tests.
Tai Jones
@taiJones00
Jun 27 2017 05:27 UTC
var someProp = "propName";
var myObj = {
propName: "Some Value"
}
myObj[someProp]; // "Some Value"
Why is propName in the variable not in quotes
It's set like a variable but shouldn't it match the string set to the value of someProp
nikhilpatel87
@nikhilpatel87
Jun 27 2017 05:34 UTC
i go to mdn and other resources, but it's frustrating when I cna't figure it out on my own after going through the JS sections on FCC
CallMeOrange
@EgnaroDev
Jun 27 2017 05:34 UTC
How does math.random() work?
Say 1.1, why does it return 0.49...I know it return 0 instead of 1
nikhilpatel87
@nikhilpatel87
Jun 27 2017 05:35 UTC
math.random generates up to .99, i believe
CallMeOrange
@EgnaroDev
Jun 27 2017 05:36 UTC
oh right... random...
It will change every time I run
nikhilpatel87
@nikhilpatel87
Jun 27 2017 05:36 UTC
yea exactly
CallMeOrange
@EgnaroDev
Jun 27 2017 05:36 UTC
@nikhilpatel87 thanks, you made me realize
CamperBot
@camperbot
Jun 27 2017 05:36 UTC
mctwodigitzero sends brownie points to @nikhilpatel87 :sparkles: :thumbsup: :sparkles:
:cookie: 242 | @nikhilpatel87 |http://www.freecodecamp.com/nikhilpatel87
CallMeOrange
@EgnaroDev
Jun 27 2017 05:37 UTC

function randomFraction() {

var a = 1.1;
var b = Math.random() * a;

  return b;

}
nikhilpatel87
@nikhilpatel87
Jun 27 2017 05:37 UTC
you can provide a min or max
CallMeOrange
@EgnaroDev
Jun 27 2017 05:37 UTC
var b = Math.random() * a; and var b = Math.random(a) works same way?
@nikhilpatel87 I haven't learn that yet
nikhilpatel87
@nikhilpatel87
Jun 27 2017 05:38 UTC
ooh okay -- scratch that for now
CallMeOrange
@EgnaroDev
Jun 27 2017 05:38 UTC
Oh I see like in Algebra, () * a = ()a, and (a) just multiply it inside?
mostafa khaled
@mostafa5aled
Jun 27 2017 05:39 UTC
hello
please i don't understand this "myStr should have encoded text with the proper escape sequences and no spacing."
https://www.freecodecamp.com/challenges/escape-sequences-in-strings
the first challenge
i have did this
var myStr = "FirstLine\\n SecondLine \r \ThirdLine";// Change this line
CallMeOrange
@EgnaroDev
Jun 27 2017 05:39 UTC
or they dont work same way but still return randomly?
nikhilpatel87
@nikhilpatel87
Jun 27 2017 05:41 UTC
hopefully someone else can give you better advice, but I don't think you need to put the a inside the ()
just ()*a
Mirza Arslan
@arslan555
Jun 27 2017 05:42 UTC

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

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.

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


surferpilgrim
@surferpilgrim
Jun 27 2017 05:42 UTC
I'm tryna figure out what's wrong with my for loop
function mutation(arr) {
var valueOne = arr[0].split("");
  var valueTwo = arr[1].split("");
  for(var i =0;valueOne.length;i++){
    for(var j =0;j<valueOne[i].length;j++){
if(valueTwo.indexOf(valueOne[i])===-1){

  return true;
   } else 

   return false;
    }
  }
}
mutation(["hello", "hey"]);
CallMeOrange
@EgnaroDev
Jun 27 2017 05:42 UTC
@nikhilpatel87 yeah you are right
First, I put it inside () for first time so I was clueless.., then next challenge you have to do () * a
Mirza Arslan
@arslan555
Jun 27 2017 05:43 UTC
I ma totally balnk about it how to solve it
Manish Giri
@Manish-Giri
Jun 27 2017 05:43 UTC
@surferpilgrim you have a return inside the for, that will terminate the function in the first match itself.
mostafa khaled
@mostafa5aled
Jun 27 2017 05:43 UTC
please i don't understand this "myStr should have encoded text with the proper escape sequences and no spacing."
https://www.freecodecamp.com/challenges/escape-sequences-in-strings
the first challenge
i have did this
var myStr = "FirstLine\\n SecondLine \r \ThirdLine";// Change this line
is there anybody to help me
thanks in advance
nikhilpatel87
@nikhilpatel87
Jun 27 2017 05:44 UTC
@MCTwoDigitZero awesome! you'll get the hang of those tidbits as you progress further. you'll make tons of errors but that's the only way to learn
Miguel Vasquez
@mivasquez386
Jun 27 2017 05:44 UTC
@mattr12 i did that one a while ago, I had to refer to my notes.. :)
Manish Giri
@Manish-Giri
Jun 27 2017 05:44 UTC
@arslan555 there are two steps in that challenge -
  1. add the number item to the end of the array arr
  2. remove the first element from the array arr and return it.
    The two functions - .push() and .shift() would be helfpul.
CallMeOrange
@EgnaroDev
Jun 27 2017 05:45 UTC
@Manish-Giri Can you do it without these functions?
Mirza Arslan
@arslan555
Jun 27 2017 05:45 UTC
var myStr = "FirstLine\n \\ SecondLine \\r ThirdLine"; @mostafa5aled
mostafa khaled
@mostafa5aled
Jun 27 2017 05:46 UTC
@arslan555 thank you mr.Mirza
CamperBot
@camperbot
Jun 27 2017 05:46 UTC
mostafa5aled sends brownie points to @arslan555 :sparkles: :thumbsup: :sparkles:
:cookie: 64 | @arslan555 |http://www.freecodecamp.com/arslan555
Manish Giri
@Manish-Giri
Jun 27 2017 05:46 UTC
@MCTwoDigitZero maybe, I never tried..
CallMeOrange
@EgnaroDev
Jun 27 2017 05:46 UTC
I see
@arslan555 You are not supposed to give out answers..
Well at least its just basic
Mirza Arslan
@arslan555
Jun 27 2017 05:47 UTC
@Manish-Giri thank you.
CamperBot
@camperbot
Jun 27 2017 05:47 UTC
arslan555 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6127 | @manish-giri |http://www.freecodecamp.com/manish-giri
jaizon
@jaizon
Jun 27 2017 05:48 UTC
How wouldI set a callback in this example?
var myJson;
var weather;
$.getJSON( "http://ip-api.com/json", function( data ) {
    myJson = data;
    $.getJSON( "http://api.openweathermap.org/data/2.5/weather?lat=" + myJson.lat + "&lon=" + myJson.lon + "&appid=305d9458ed8308746072a28e793b45f5", function( json ) {
        weather = json;
    });
});
Pieter Stokkink
@forkerino
Jun 27 2017 05:48 UTC
@jaizon you already have two of them
Second argument of getJSON
surferpilgrim
@surferpilgrim
Jun 27 2017 05:52 UTC
@Manish-Giri I took return out of the for loop, but my for loop still has issues
function mutation(arr) {
var valueOne = arr[0].split("");
  var valueTwo = arr[1].split("");
  for(var i =0;valueOne.length;i++){
    for(var j =0;j<valueOne[i].length;j++);}

if(valueTwo.indexOf(valueOne)===-1){

  return true;
   } else 

   return false;


}
mutation(["hello", "hey"]);
Manish Giri
@Manish-Giri
Jun 27 2017 05:53 UTC
@surferpilgrim so now what is your for loop doing?
Pieter Stokkink
@forkerino
Jun 27 2017 05:54 UTC
...iterations....
surferpilgrim
@surferpilgrim
Jun 27 2017 05:55 UTC
@Manish-Giri it's saying valueOne[i] is undefined
jaizon
@jaizon
Jun 27 2017 05:55 UTC
@forkerino So what exactly is wrong here?
$('document').ready(function() {
    var myJson;
    var weather;
    $.getJSON( "http://ip-api.com/json", function( data ) {
        myJson = data;
        $.getJSON( "http://api.openweathermap.org/data/2.5/weather?lat=" + myJson.lat + "&lon=" + myJson.lon + "&appid=305d9458ed8308746072a28e793b45f5", function( json ) {
            weather = json;
        });
    });
    $('#city').text(weather.name);
    $('#lati').text(weather.coord.lat);
    $('#long').text(weather.coord.lon);
    $('#cloud').text(weather.clouds.all + '%');
    $('#weather-main').text(weather.main.temp);
});
it returns that "myJson" is undefined
Pieter Stokkink
@forkerino
Jun 27 2017 05:56 UTC
@jaizon you only have the data inside the callback.
Manish Giri
@Manish-Giri
Jun 27 2017 05:56 UTC
@surferpilgrim http://jsbin.com/?js,console
write your JS code here, put some console.log statements and try to see what the value of your variables are..
Pieter Stokkink
@forkerino
Jun 27 2017 05:57 UTC
@jaizon so you have to use your data inside the callback function. Outside it they're undefined
On my phone, so cannot really type everything out...
jaizon
@jaizon
Jun 27 2017 05:59 UTC
@forkerino ok, ty for the help, I'll try and figure it out the rest :)
CamperBot
@camperbot
Jun 27 2017 05:59 UTC
jaizon sends brownie points to @forkerino :sparkles: :thumbsup: :sparkles:
:star2: 2771 | @forkerino |http://www.freecodecamp.com/forkerino
surferpilgrim
@surferpilgrim
Jun 27 2017 05:59 UTC
@Manish-Giri i keep getting errors, my variables are fine I turn them into an array of letters so i can loop through them
Manish Giri
@Manish-Giri
Jun 27 2017 06:00 UTC
@surferpilgrim did you try jsbin?
surferpilgrim
@surferpilgrim
Jun 27 2017 06:00 UTC
@Manish-Giri yeah
Manish Giri
@Manish-Giri
Jun 27 2017 06:00 UTC
so what are the errors?
surferpilgrim
@surferpilgrim
Jun 27 2017 06:01 UTC
@Manish-Giri
this is what the console reads
"error"
"@liqurilusu.js:31:1
l</b.render/<@https://static.jsbin.com/js/prod/runner-4.0.4.min.js:1:13848
k</a.use/<@https://static.jsbin.com/js/prod/runner-4.0.4.min.js:1:10792
"
"error"
"@liqurilusu.js:31:1
l</b.render/<@https://static.jsbin.com/js/prod/runner-4.0.4.min.js:1:13848
k</a.use/<@https://static.jsbin.com/js/prod/runner-4.0.4.min.js:1:10792
"
"error"
"@liqurilusu.js:31:1
l</b.render/<@https://static.jsbin.com/js/prod/runner-4.0.4.min.js:1:13848
k</a.use/<@https://static.jsbin.com/js/prod/runner-4.0.4.min.js:1:10792
"
"error"
"mutation@liqurilusu.js:20:18
@liqurilusu.js:32:1
l</b.render/<@https://static.jsbin.com/js/prod/runner-4.0.4.min.js:1:13848
k</a.use/<@https://static.jsbin.com/js/prod/runner-4.0.4.min.js:1:10792
"
"error"
"mutation@liqurilusu.js:20:18
@liqurilusu.js:32:1
l</b.render/<@https://static.jsbin.com/js/prod/runner-4.0.4.min.js:1:13848
k</a.use/<@https://static.jsbin.com/js/prod/runner-4.0.4.min.js:1:10792
"
"error"
"mutation@liqurilusu.js:20:18
@liqurilusu.js:32:1
l</b.render/<@https://static.jsbin.com/js/prod/runner-4.0.4.min.js:1:13848
k</a.use/<@https://static.jsbin.com/js/prod/runner-4.0.4.min.js:1:10792
"
Manish Giri
@Manish-Giri
Jun 27 2017 06:04 UTC
this is what I get
df.png
Pieter Stokkink
@forkerino
Jun 27 2017 06:05 UTC
@surferpilgrim at this point your loops do nothing. One of the returns should be inside it, including an if that checks if the current letter is in the first string.
Kelechi Chinaka
@ke1echi
Jun 27 2017 06:06 UTC
hi guys
can .map() b used on a 2d array?
Manish Giri
@Manish-Giri
Jun 27 2017 06:06 UTC
yes
Pieter Stokkink
@forkerino
Jun 27 2017 06:07 UTC
@kelechichinaka you may have to use 2 .maps
Kelechi Chinaka
@ke1echi
Jun 27 2017 06:07 UTC
ok @forkerino
Manish Giri
@Manish-Giri
Jun 27 2017 06:08 UTC
board.map((row, rowPos) => {
   row.map(cell, cellPos) => {
    ...
 }
}
this was from my Game of life
Kelechi Chinaka
@ke1echi
Jun 27 2017 06:08 UTC
nice @Manish-Giri
Mai Thinh
@mthinh
Jun 27 2017 06:10 UTC
Does I have to use for loop for CHUNKY MONEY challenge pls?
Pieter Stokkink
@forkerino
Jun 27 2017 06:11 UTC
@mthinh you don't have to, but most solutions do.
You could use a .reduce too
Shawshank
@code2shank
Jun 27 2017 06:15 UTC

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){
  var results;
  for(var i =0; i<contacts.length; i++){
    for(var j=0; j<contacts[i].length;j++){
    if(contacts.firstName == firstName && contacts.hasOwnProperty[prop]){ 

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

  }
}
Profile Lookup Help!
Pieter Stokkink
@forkerino
Jun 27 2017 06:16 UTC
@code2shank what happens if the first name doesn't match?
Shawshank
@code2shank
Jun 27 2017 06:17 UTC
no such contact
should be shown
Pieter Stokkink
@forkerino
Jun 27 2017 06:17 UTC
Why should that be?
Shawshank
@code2shank
Jun 27 2017 06:18 UTC
umm, the question stipulates so
Long Nguyen
@longnt80
Jun 27 2017 06:18 UTC
@code2shank contacts.firstName will be undefined
Pieter Stokkink
@forkerino
Jun 27 2017 06:18 UTC
I'd think you would have to look at all contacts before saying that.
@code2shank
Shawshank
@code2shank
Jun 27 2017 06:19 UTC
so Do i check if this undefined instead?
Pieter Stokkink
@forkerino
Jun 27 2017 06:19 UTC
Also, .hasOwnProperty is a function... needs ()
Shawshank
@code2shank
Jun 27 2017 06:19 UTC
oh
Pieter Stokkink
@forkerino
Jun 27 2017 06:19 UTC
@code2shank one of the returns should be outside the loop
Long Nguyen
@longnt80
Jun 27 2017 06:19 UTC

@code2shank

so Do i check if this undefined instead?

no there's no such thing as contacts.firstName in the object

contacts[0].firstName can return something
Shawshank
@code2shank
Jun 27 2017 06:20 UTC
oh
yes
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:20 UTC
I need help with the Stand in Line Challenge
Shawshank
@code2shank
Jun 27 2017 06:20 UTC
thanks long
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:20 UTC

function nextInLine(arr, item) {
// Your code here
var removedFromArr = arr.shift();
arr.push();
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, 0)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

This is where I am at so far
Pieter Stokkink
@forkerino
Jun 27 2017 06:21 UTC
@LinoliuMKnifE .push first
And return the element you removed
Long Nguyen
@longnt80
Jun 27 2017 06:22 UTC
@code2shank also, with j<contacts[i].length, j will always be 0
because contacts[i] is an object, which its length is always 1
Shawshank
@code2shank
Jun 27 2017 06:22 UTC
really?
hmmm
i have to review arrays of arrays again
Long Nguyen
@longnt80
Jun 27 2017 06:23 UTC
array has length, object only has length =1
you can only access object with properties
not by index
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:24 UTC

function nextInLine(arr, item) {
// Your code here
arr.push();
arr.shift();
var removedFromArr = arr.shift();

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

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

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

like that @forkerino ??
Shawshank
@code2shank
Jun 27 2017 06:26 UTC
@longnt80 So whats the best way of looping through objects via its properties?
Pieter Stokkink
@forkerino
Jun 27 2017 06:26 UTC
@LinoliuMKnifE only .shift once
Shawshank
@code2shank
Jun 27 2017 06:26 UTC
@longnt80 the challenges didnt help in this regard
Long Nguyen
@longnt80
Jun 27 2017 06:27 UTC
@code2shank you already know the property in this challenge, no need to loop through the object
CallMeOrange
@EgnaroDev
Jun 27 2017 06:28 UTC

var randomNumberBetween0and19 = Math.floor(Math.random() * 20);

function randomWholeNum() {

  var a = 10;

  return Math.floor(Math.random() * a);
}
Manish Giri
@Manish-Giri
Jun 27 2017 06:28 UTC
@code2shank for..in is the general way, btw.
CallMeOrange
@EgnaroDev
Jun 27 2017 06:28 UTC

Why didnt this work for

You should have multiplied the result of Math.random by 10 to make it a number that is between zero and nine.

It does return 0 to 9 so why?
Long Nguyen
@longnt80
Jun 27 2017 06:28 UTC
@code2shank
you don't need the second loop
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:28 UTC
@forkerino

function nextInLine(arr, item) {
// Your code here
arr.push();
arr.shift()
var removedFromArr = arr.shift();

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, 1)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

better??
still not working
Shawshank
@code2shank
Jun 27 2017 06:29 UTC
mmm ok i will try it out
thanks @longnt80 and @Manish-Giri
CamperBot
@camperbot
Jun 27 2017 06:29 UTC
code2shank sends brownie points to @longnt80 and @manish-giri :sparkles: :thumbsup: :sparkles:
:cookie: 412 | @longnt80 |http://www.freecodecamp.com/longnt80
:star2: 6128 | @manish-giri |http://www.freecodecamp.com/manish-giri
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:29 UTC
im stumped as to why it's not working :(
CallMeOrange
@EgnaroDev
Jun 27 2017 06:29 UTC
@LinoliuMKnifE add something to arr.push()
missing semicolon for arr.shift() and that is not all
@LinoliuMKnifE if you have arr.push() what do you want to push?
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:31 UTC
the item in the function
CallMeOrange
@EgnaroDev
Jun 27 2017 06:31 UTC
@LinoliuMKnifE which item? add that item to arr.push()
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:32 UTC
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.
that is the task of the challenge
CallMeOrange
@EgnaroDev
Jun 27 2017 06:32 UTC
@LinoliuMKnifE yeah I didnt ask for instructions..
Which item?
do you want to add to arr.push()
You need to have something inside ()
for push method
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:33 UTC
I want whatever's being input as the 'item' in the function to be 'pushed' to the end of the array

arr.push(item);
arr.shift();
var removedFromArr = arr.shift();

return item; //Change this line
}

CallMeOrange
@EgnaroDev
Jun 27 2017 06:33 UTC
@LinoliuMKnifE oh you meant item parameter... sorry I thought you meant "item"
My bad
Good now lets work on arr.shift
How do you return the parameter that was removed?
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:34 UTC
.unshift??
CallMeOrange
@EgnaroDev
Jun 27 2017 06:34 UTC
@LinoliuMKnifE no .shift is fine
@LinoliuMKnifE unshift add something in front of parameters
@LinoliuMKnifE So what does .shift() do?
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:35 UTC
removes the element in the '0' position of an array
and stores it
in a variable
Manish Giri
@Manish-Giri
Jun 27 2017 06:36 UTC
@LinoliuMKnifE you've got shift twice.
CallMeOrange
@EgnaroDev
Jun 27 2017 06:36 UTC
oh yes.. no need for that last shift.. it looked like a comment to me :/
@LinoliuMKnifE You should paste formatted code with ``` around it
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:37 UTC
my bad
CallMeOrange
@EgnaroDev
Jun 27 2017 06:37 UTC
@LinoliuMKnifE actually you dont need that variable that you created
push and shift functions is all you need
Paste your remaining code
Dont worry about formatted code yet
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:38 UTC

```function nextInLine(arr, item) {
// Your code here
arr.push(item);
arr.shift();

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, 1)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));```

CamperBot
@camperbot
Jun 27 2017 06:38 UTC
:bulb: to format code use backticks! ``` more info
CallMeOrange
@EgnaroDev
Jun 27 2017 06:38 UTC
``` not '''
CamperBot
@camperbot
Jun 27 2017 06:38 UTC
:bulb: to format code use backticks! ``` more info
CallMeOrange
@EgnaroDev
Jun 27 2017 06:38 UTC
use ``` under esc
and should be like this
'''
code
'''
CamperBot
@camperbot
Jun 27 2017 06:39 UTC
:bulb: to format code use backticks! ``` more info
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:39 UTC
like that??
CallMeOrange
@EgnaroDev
Jun 27 2017 06:39 UTC
yes with ``` right under esc
@LinoliuMKnifE Try with randomly code
blah
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:40 UTC
This message was deleted
CallMeOrange
@EgnaroDev
Jun 27 2017 06:40 UTC
no
'''
code
'''
CamperBot
@camperbot
Jun 27 2017 06:40 UTC
:bulb: to format code use backticks! ``` more info
CallMeOrange
@EgnaroDev
Jun 27 2017 06:40 UTC
Like that but with backticks (```)
Manish Giri
@Manish-Giri
Jun 27 2017 06:40 UTC
@LinoliuMKnifE what are you supposed to return?
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:40 UTC
got it
ill brb
CallMeOrange
@EgnaroDev
Jun 27 2017 06:41 UTC
@Manish-Giri ask him what .shift does..
@LinoliuMKnifE You did it?
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:41 UTC
dont appreciate you making fun of me
im just trying to learn
CallMeOrange
@EgnaroDev
Jun 27 2017 06:41 UTC
@LinoliuMKnifE Im not trying to make fun of you..
John Teixido
@johnnytuxedo
Jun 27 2017 06:41 UTC
hello
can someone help me solve this problem
CallMeOrange
@EgnaroDev
Jun 27 2017 06:42 UTC
@johnnytuxedo Yo
Sure
CallMeOrange
@EgnaroDev
Jun 27 2017 06:42 UTC
Paste your code here
John Teixido
@johnnytuxedo
Jun 27 2017 06:42 UTC
thnks
Shawshank
@code2shank
Jun 27 2017 06:43 UTC
@Manish-Giri is there a way to loop via the key value pairs in JSON with a for loop?
Manish Giri
@Manish-Giri
Jun 27 2017 06:44 UTC
@code2shank Object.keys and Object.values will return you arrays of the object's K-V pairs, which you can then iterate through using a regular for.
But for..in would be much easier, as I said.
Mai Thinh
@mthinh
Jun 27 2017 06:44 UTC

function chunkArrayInGroups(arr, size) {
// Break it up.
var result=[];
for(var i=0; i< arr.length;i=i+size){
result.push(arr.slice(i,size));
}
return result;
}

chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2);

This is my idea. Then this is what I got
[ [0,1],[ ],[ ],[ ],[ ] ]

Where is my mistake pls?
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:45 UTC
im back
Nitin Sahu
@globefire
Jun 27 2017 06:45 UTC
hey guys can anyone help me with the challenge number 154 from JS, i simply can't understand the question
CallMeOrange
@EgnaroDev
Jun 27 2017 06:45 UTC
@LinoliuMKnifE Welcome back, looks like you got formatted code thing
Manish Giri
@Manish-Giri
Jun 27 2017 06:45 UTC
@globefire what's the challenge
CallMeOrange
@EgnaroDev
Jun 27 2017 06:45 UTC
@globefire there is no challenge number and the number you are referring to is how many brownie points you have
Name of the challenge or paste the url of it here
Nitin Sahu
@globefire
Jun 27 2017 06:46 UTC
ohh ok
Pieter Stokkink
@forkerino
Jun 27 2017 06:46 UTC
@mthinh second arg of .slice is the end of the slice, not the size of the slice
Nitin Sahu
@globefire
Jun 27 2017 06:46 UTC
hold on i'll show u the question
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:46 UTC
function nextInLine(arr, item) {
  // Your code here
  arr.push(item);
  arr.shift();

  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, 1)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
thats what i have so far
CallMeOrange
@EgnaroDev
Jun 27 2017 06:46 UTC
@LinoliuMKnifE ok so, what does .shift() do?
Right, you have answer it already.. it remove an item from an array
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:47 UTC
yep
CallMeOrange
@EgnaroDev
Jun 27 2017 06:47 UTC
Then how do you return an item that is removed?
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:47 UTC
I thought it was unshift
CallMeOrange
@EgnaroDev
Jun 27 2017 06:48 UTC
@LinoliuMKnifE unshift means add something front of it
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:48 UTC
gimme a second then to review
Mai Thinh
@mthinh
Jun 27 2017 06:48 UTC
@forkerino yeah , I try to double the size after loop, so that it can slice the right place, but it doesnt work at all
CallMeOrange
@EgnaroDev
Jun 27 2017 06:48 UTC
@LinoliuMKnifE
Mai Thinh
@mthinh
Jun 27 2017 06:49 UTC

@forkerino
function chunkArrayInGroups(arr, size) {
// Break it up.
var result=[];
for(var i=0; i< arr.length;i=i+size){
result.push(arr.slice(i,size));
SIZE=SIZE*2;
}
return result;
}

chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2);

Nitin Sahu
@globefire
Jun 27 2017 06:49 UTC

wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
wordBlanks("cat", "little", "hit", "slowly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).

 ```

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {

var result = "";

// Your code below this line

result = myNoun + myAdjective + myVerb + myAdverb;

// Your code above this line

return result;

}

// Change the words here to test your function

wordBlanks("dog", "big", "ran", "quickly");

​ ```

this is it
Jon Brown
@Jonnyb36
Jun 27 2017 06:49 UTC

Hi! does anyone know how to deal/reference with the second argument when called like below:

addTogether(2)(3) ???

Nitin Sahu
@globefire
Jun 27 2017 06:49 UTC
the above conditions which i m not getting
CallMeOrange
@EgnaroDev
Jun 27 2017 06:49 UTC
@globefire good, how do you add spaces between dog and big?
Nitin Sahu
@globefire
Jun 27 2017 06:50 UTC
hmmm... i'll just make spaces in the function?>
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:50 UTC
This message was deleted
Nitin Sahu
@globefire
Jun 27 2017 06:50 UTC
in wordblanks? @MCTwoDigitZero
CallMeOrange
@EgnaroDev
Jun 27 2017 06:50 UTC
@LinoliuMKnifE no... like I said push and shift is all you need and pop remove last item in arrays
heroiczero
@heroiczero
Jun 27 2017 06:50 UTC
@globefire you need space between your words or it will be one big word
CallMeOrange
@EgnaroDev
Jun 27 2017 06:50 UTC
@globefire what @heroiczero said
You can add spaces in parameters or in variable result
So how do you add spaces?
Nitin Sahu
@globefire
Jun 27 2017 06:51 UTC
i did it but then to the program does not executes successfully
Manish Giri
@Manish-Giri
Jun 27 2017 06:51 UTC
@LinoliuMKnifE return item; - this is from your code
CallMeOrange
@EgnaroDev
Jun 27 2017 06:51 UTC
@globefire What does output say?
Manish Giri
@Manish-Giri
Jun 27 2017 06:51 UTC
what does this line do?
@LinoliuMKnifE
LinoliuMKnifE
@LinoliuMKnifE
Jun 27 2017 06:51 UTC
its a remnant @Manish-Giri
Nitin Sahu
@globefire
Jun 27 2017 06:51 UTC
hold on @MCTwoDigitZero
Manish Giri
@Manish-Giri
Jun 27 2017 06:51 UTC
doesn't matter