These are chat archives for FreeCodeCamp/HelpJavaScript

20th
Jun 2017
Moisés Man
@moigithub
Jun 20 2017 00:00
what should be the result of that ? @monkeyfingerz
longestCommonPrefix("prefontaine always found a way around, also it was his predisposition");
Ogundele Olumide
@Lumexralph
Jun 20 2017 00:00
is there another good site to host the frontend projects for free asides codepen? not a fan of codepen
Moisés Man
@moigithub
Jun 20 2017 00:01
jsbin, jsfiddle, plnker
monkeyfingerz
@monkeyfingerz
Jun 20 2017 00:01
[prefontaine, always,a ,around, also,predisposition] @moigithub
Ogundele Olumide
@Lumexralph
Jun 20 2017 00:01
think I'll go for jsfiddle
Roxroy
@roxroy
Jun 20 2017 00:01
@lauraenria , I not sure how to help, but it seems to be working now from what I am seeing on your calendar.
Ogundele Olumide
@Lumexralph
Jun 20 2017 00:02
@moigithub thanks Bro
CamperBot
@camperbot
Jun 20 2017 00:02
lumexralph sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3382 | @moigithub |http://www.freecodecamp.com/moigithub
Moisés Man
@moigithub
Jun 20 2017 00:02
@monkeyfingerz ok.. i think u will need 2 loops,
probably u though the same by making 2 variables i,k
but it should be handled separatedly (u increasing both at same time)
...sooo 2 loops should work
monkeyfingerz
@monkeyfingerz
Jun 20 2017 00:02
@GregatGit I'm sure there is an easy way to do it. the challenge is from leetcode.
Greg Duncan
@GregatGit
Jun 20 2017 00:02
This message was deleted
@monkeyfingerz why don't you make an easier version of it first.
function findCommonWithPrefix(pref, str) {
  var arr = [];

  return arr;
}
findCommonWithPrefix('pre','prefontaine always found a way around, also it was his predisposition'); // should return ['profontaine', 'predisposition']
monkeyfingerz
@monkeyfingerz
Jun 20 2017 00:07
@moigithub @GregatGit I'm going to try some things. I'll probably be back soon. Thank you very much!
CamperBot
@camperbot
Jun 20 2017 00:07
monkeyfingerz sends brownie points to @moigithub and @gregatgit :sparkles: :thumbsup: :sparkles:
:warning: monkeyfingerz already gave gregatgit points
:warning: monkeyfingerz already gave moigithub points
Monica Parrillo
@monicaparrillo
Jun 20 2017 00:07
After an hour, got it working without jQuery! https://codepen.io/monicaleep/pen/qjrKqG
Coy Sanders
@coymeetsworld
Jun 20 2017 00:10
nice @monicaparrillo I still need to work on removing jQuery too
Monica Parrillo
@monicaparrillo
Jun 20 2017 00:10
I had it working (to the same functionality, so not "working" per se) with jQuery and just deleted it !
luccifer00
@luccifer00
Jun 20 2017 00:10

hi everyone!! i am on Stand in Line level on JS, and i nedd a hint on where to start.....

i am writting:
testArr.push();
testArr.shift();

and read the error msg but i dont know where to go now... any hint ?? a little hint, i want to do my myself!!

Monica Parrillo
@monicaparrillo
Jun 20 2017 00:11
different language entirely it seems
@luccifer00 what error are you getting?
luccifer00
@luccifer00
Jun 20 2017 00:11
nextInLine([2], 1) should return 2
nextInLine([5,6,7,8,9], 1) should return 5
After nextInLine(testArr, 10), testArr[4] should be 10
Coy Sanders
@coymeetsworld
Jun 20 2017 00:11
@luccifer00 you don't want to modify testArr directly
James Patrick Kerrane
@jamesjpk123
Jun 20 2017 00:11
I need help with the challenge "Stand in Line". I'm supposed to "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."
My code is here:
// Your code here
arr.push(item);
arr.pop(item);
return item; // Change this line
Can anyone help me?
Coy Sanders
@coymeetsworld
Jun 20 2017 00:11
you want to modify the array parameter passed into the function
@jamesjpk123 pop doesn't take a parameter, and thats not the right array function to call. You also don't want to return item
luccifer00
@luccifer00
Jun 20 2017 00:12
HAHA i am with @jamesjpk123
James Patrick Kerrane
@jamesjpk123
Jun 20 2017 00:12
lol @luccifer00 this challenge is hard xD
@luccifer00 maybe if you figure it out you can help me xD
@coymeetsworld what should we do?
Coy Sanders
@coymeetsworld
Jun 20 2017 00:13
You both should review the array function challenges you took before
the Manipulate Arrays With x
also perhaps Passing Values to Functions with Arguments, at least for @luccifer00
luccifer00
@luccifer00
Jun 20 2017 00:14
should i add new arrays?? by hand??
Coy Sanders
@coymeetsworld
Jun 20 2017 00:15
no you shouldn't be adding new arrays
the function passes in two arguments, the array and the item to put into the array
you just need to use both of those parameters in your function, no other variables are needed
luccifer00
@luccifer00
Jun 20 2017 00:16
but the code has testarr but i dont know where the items numbers are .... is that normal??
Coy Sanders
@coymeetsworld
Jun 20 2017 00:16
if testArr was the only array that was being modified it would work, but itsn ot
what happens when you call nextInLine([5,6,7,8,9], 1) should return 5 ?
you wouldn't be working with that array at all
you would still be working with testArr
James Patrick Kerrane
@jamesjpk123
Jun 20 2017 00:17
Ok @coymeetsworld i tried doing return item.pop(arr).push(arr); but that didn't work
Coy Sanders
@coymeetsworld
Jun 20 2017 00:17
I would revisit the passing values to functions with arguments
@jamesjpk123 you're going the wrong direction
pop and push are array functions, you can't call them on a number
i.e. item.pop() wont work
dont guess on answers either, try to understand what those functions are doing
luccifer00
@luccifer00
Jun 20 2017 00:18
i think i have tu use shift() to delete the first, and use pop() to add the end number....
Coy Sanders
@coymeetsworld
Jun 20 2017 00:18
review the Manipulate Arrays With challenges to see which functions are the right ones to use
you can see your answers on them if you go to freecodecamp.com/yourusername
Haley Sparger
@hsparg
Jun 20 2017 00:19
function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch (val){
case 1:
console.log("alpha");
break;
case 2:
console.log("beta");
break;
case 3:
console.log("gamma");
break;
case 4:
console.log("delta");
break;
}
can't figure out what I'm doing wrong on this one
Coy Sanders
@coymeetsworld
Jun 20 2017 00:20
@hsparg you don't want to print out to console.log
you need to assign the answer variable to the appropriate value
the case/switch syntax looks ok to me, might be missing default?
Haley Sparger
@hsparg
Jun 20 2017 00:21
oh, of course! thank you @coymeetsworld
CamperBot
@camperbot
Jun 20 2017 00:21
hsparg sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 2829 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Jun 20 2017 00:21
yw
Kervtuza
@Kervtuza
Jun 20 2017 00:23
Hey guys, I am working on the Random Quote Machine challenge in codepen.io. I uploaded a .json file to a public dropbox folder which i am trying to use for my API, but my code doesn't seem to be pulling in the data. Any thoughts? here is the link https://codepen.io/Kervtuza/pen/KqapXr
James Patrick Kerrane
@jamesjpk123
Jun 20 2017 00:30
@Kervtuza it looks like the dropbox folder isn't public. whenever I go to the dropbox folder, I get an error 403 (Access Forbidden)
luccifer00
@luccifer00
Jun 20 2017 00:30

testArr.push(6, 8, 9, 10);
testArr.shift();
testArr.shift();
testArr.shift();
testArr.shift(1);

i am doing that to aproximate to the answer, but i think its not the propoer way lol .... i review , and i dont figure out how to do it....

James Patrick Kerrane
@jamesjpk123
Jun 20 2017 00:30
@Kervtuza can you check to see if it is public?
@Kervtuza The Wikipedia page on Error 403 says that either
Authentication was provided, but the authenticated user is not permitted to perform the requested operation.
or
The operation is forbidden to all users. For example, requests for a directory listing return code 403 when directory listing has been disabled.
Joshua Hoffman
@hoffmanjoshua
Jun 20 2017 00:32

Hi guys i am working on the profile lookup challenge and I have rewritten the code a few times and cant seem to get it right. Here it is, please help if you can:

function lookUpProfile(firstName, prop){
var i = 0;
while (i < contacts.length){
if (contacts[i].firstName && contacts[i].prop){
return firstName + prop;
}
else if(contacts[i].firstName){
return "No such property";
}
else{
return "No such contact";
}
i++;
}
}

Frank McCroy
@fmccroy
Jun 20 2017 00:48
@hoffmanjoshua A common issue is that the Return statement immediately breaks you out of the loop, skipping whatever else was supposed to happen
Joshua Hoffman
@hoffmanjoshua
Jun 20 2017 00:51
@fmccroy how could i construct it without breaking while still looping?
Frank McCroy
@fmccroy
Jun 20 2017 00:52
@hoffmanjoshua Instead of using return, assign values to variables as needed, checking to see what you have outside of the loop. Then at the end you can use the return statement
Joshua Hoffman
@hoffmanjoshua
Jun 20 2017 00:56
@fmccroy Thank you!
CamperBot
@camperbot
Jun 20 2017 00:56
hoffmanjoshua sends brownie points to @fmccroy :sparkles: :thumbsup: :sparkles:
:cookie: 363 | @fmccroy |http://www.freecodecamp.com/fmccroy
David Darby
@AzFalconer
Jun 20 2017 01:05
Can someone explain why I get an "string.fromCharCode is not a funtion" error when I try "return string.fromCharCode(65, 66, 67);" Which I believe should return "ABC"
Frank McCroy
@fmccroy
Jun 20 2017 01:05
@AzFalconer I think I’ve seen String capitalized for that
David Darby
@AzFalconer
Jun 20 2017 01:06
string is just the variable... right? could be "char" or "sentence" or ...
ugh, think you are right...
Frank McCroy
@fmccroy
Jun 20 2017 01:07
@AzFalconer I think it’s more of a function itself.. https://www.w3schools.com/jsref/jsref_fromcharcode.asp
David Darby
@AzFalconer
Jun 20 2017 01:08
Yeah, got it know... just need to figure out how to apply/use with my string variable. Thank you.
Frank McCroy
@fmccroy
Jun 20 2017 01:08
Glad to help!
Momo Johnson
@mo12g13
Jun 20 2017 01:10
@mo12g13
Hello Everyone,
I am in need of some help and maybe someone can help me out. I building a website and want my home page to be similar to this website homepage. Especially, the way the image is being animated along with the text. Any help will be highly appreciated. Is there any Library out there that might be helpful?
https://mavinrecords.com/
David Darby
@AzFalconer
Jun 20 2017 01:10
That was it; can't do myStr.fromCharCode() needs to be myStr = String.fromCharCode()
nunirevolt
@nunirevolt
Jun 20 2017 01:12

Hi everyone. I just started and i have probably a super easy question. function timesFive(num) {
return num * 5;

when i do that, why would it give me 25?

is it getting the number from timesFive?
Sunny Wong
@swong194
Jun 20 2017 01:13
@nunirevolt your function name is timesFive.....num is where the number is coming from
Frank McCroy
@fmccroy
Jun 20 2017 01:13
@nunirevolt Yes. freecodecamp is sending the test values to your code to see if the results turn out correct.
luccifer00
@luccifer00
Jun 20 2017 01:14
@nunirevolt i've done recently, desent care what number you choose, they have a framekorw to do some operations, and the result is the same 5*5
nunirevolt
@nunirevolt
Jun 20 2017 01:14
oh ok, so in reality i would put my number in place of num
luccifer00
@luccifer00
Jun 20 2017 01:14
guys i am completly lost onSTAND IN LINE...
Sunny Wong
@swong194
Jun 20 2017 01:14
@nunirevolt say you did timesFive(200)
@nunirevolt num = 200 so your code would return 200*5
luccifer00
@luccifer00
Jun 20 2017 01:15
may be i am trying stupid things or guessing if i got the answer.... i am lost , is this the way???testArr.push(6);
testArr.push(7);
testArr.push(8);
testArr.push(10);
testArr.shift();
testArr.shift();
testArr.shift();
testArr.shift();
Diego Mayer
@Chrono79
Jun 20 2017 01:15
@luccifer00 review all 4 array manipulation challenges, you need to use 2 of them
no
do you remember Convert Celsius to Fahrenheit?
You only need to add one number and remove one number, there are several tests, but your function will do them one at a time
nunirevolt
@nunirevolt
Jun 20 2017 01:16
oh ok thank you i really appreciate it
Avery Biskup
@fraknard
Jun 20 2017 01:16
feedback please?
luccifer00
@luccifer00
Jun 20 2017 01:16
yes i rembember
Na-Ya
@Na-Ya
Jun 20 2017 01:17
Hi everyone, I am working on the local weather project and I need some help figuring out how to keep jquery from writing over my celcius link
Diego Mayer
@Chrono79
Jun 20 2017 01:18
@luccifer00 See this challenge first: https://www.freecodecamp.com/challenges/passing-values-to-functions-with-arguments
So you understand how a function works
Frank McCroy
@fmccroy
Jun 20 2017 01:18
@Na-Ya Do you mean that it is updating the temperature when you don’t want it to, or something else?
I wanted to target the h3 with the id weather
but not the nested a element
with id converter
Sunny Wong
@swong194
Jun 20 2017 01:19
@nunirevolt np good luck ;]
Diego Mayer
@Chrono79
Jun 20 2017 01:19
push and shift are right, but you need to use them in the right way @luccifer00 , review those challenges too, see what they return
Na-Ya
@Na-Ya
Jun 20 2017 01:19
@fmccroy
Sunny Wong
@swong194
Jun 20 2017 01:20
@Na-Ya the way you wrote the code it will rewrite your celisus symbol
@Na-Ya you mean you have degrees celsius has h3, but it gets rewritten with the number
@Na-Ya you would like for the number just to be added right?
Na-Ya
@Na-Ya
Jun 20 2017 01:21
@swong194 yeah
@swong194 I want it to pull the temperature and keep the link for my celcius symbol
luccifer00
@luccifer00
Jun 20 2017 01:21
@Chrono79 i have to operate with parameters??
Diego Mayer
@Chrono79
Jun 20 2017 01:21
yes
Nick
@WhereIsMikeHawk
Jun 20 2017 01:22
Can anybody help me out with switches
Diego Mayer
@Chrono79
Jun 20 2017 01:22
that's why functions are useful, you write the code and depending on the values passed to them, they return different results
Nick
@WhereIsMikeHawk
Jun 20 2017 01:22
Can't seem to figure out the syntax correctly
Sunny Wong
@swong194
Jun 20 2017 01:22
@Na-Ya would u like a hint or solution?
shelton louis
@louiss0
Jun 20 2017 01:22
function largestOfFour(arr) {
var answer= [];
for (var i= 0; i < arr.length i++) {
var biggestNumber =0;
for (var sI =0; sI<arr[i].length; sI++) { if(arr[i][sI] > biggestNumber ) {
biggestNumber = arr[i][sI];
}
}
answer[1] = biggestNumber
}
// You can do this!
return answer;
}
Diego Mayer
@Chrono79
Jun 20 2017 01:23
@louiss0 you have to return an array with 4 values
Na-Ya
@Na-Ya
Jun 20 2017 01:23
@swong194 I tried seperating the elements so that one is not nested and that worked but I was trying to see if it could work this way with a tweak to the jquery. At this point I am looking for a solution if possible
shelton louis
@louiss0
Jun 20 2017 01:23
Whats going on it keeps saying biggestNumber is used out out of scope
Sunny Wong
@swong194
Jun 20 2017 01:24
@Na-Ya well u can add +"°C" to your javascript
Diego Mayer
@Chrono79
Jun 20 2017 01:24
@louiss0 well, you declare it inside the first for loop, and then you try to access it outside
Sunny Wong
@swong194
Jun 20 2017 01:24
@Na-Ya that is a simple fix so instead of having to add number onto ur html, you will add it on the javascript side
@Na-Ya add the temperature unit on javascript side XD
William Dayton
@Mortichar
Jun 20 2017 01:25
Howdy. I'm on the inventory update challenge. Pretty simple, except I seem to have a small error and I can't find it.
function updateInventory(arr1, arr2) {
    // All inventory must be accounted for or you're fired!
  for(var i = 0; i < arr2.length; i++){
    var containsItem = false;
    for(var j = 0; j < arr1.length; j++){
      if(arr2[j][1] === arr1[i][1]){
        arr1[i][0] += arr2[j][0];
        containsItem = true;
        break;
      }
    }
    if(!containsItem){
      console.log(arr2[i]);
      arr1.push(arr2[i]);
    }
  }
  return arr1.sort(function(a, b){
    return (a[1].toUpperCase() > b[1].toUpperCase());
  });
}
It's within the if(!containsItem)
Cannot read property '1' of undefined.
Na-Ya
@Na-Ya
Jun 20 2017 01:26
@swong194 Hmm that is true, would that still allow me to later update it to a °F by clicking?
Sunny Wong
@swong194
Jun 20 2017 01:26
@Na-Ya this will not affect how you implement a method to swap units
@Na-Ya yeh you can still have a solution where you click a button to switch the temperature
Na-Ya
@Na-Ya
Jun 20 2017 01:26
@swong194 haha you read my mind
@swong194 thanks a lot
CamperBot
@camperbot
Jun 20 2017 01:26
na-ya sends brownie points to @swong194 :sparkles: :thumbsup: :sparkles:
:cookie: 281 | @swong194 |http://www.freecodecamp.com/swong194
Frank McCroy
@fmccroy
Jun 20 2017 01:26
@Na-Ya You will just need to add the Fahrenheit symbol then
Sunny Wong
@swong194
Jun 20 2017 01:27
@Na-Ya I didn't have the unit display on html for mine either, I did however have some string manipulation for the temperature switch
@Na-Ya good luck!
any1 working on the wiki search
im not sure how to start XD
Na-Ya
@Na-Ya
Jun 20 2017 01:28
@swong194 Figuring out how to use this api was the toughest part for me, this part is pretty fun
Diego Mayer
@Chrono79
Jun 20 2017 01:28
@louiss0 you missed one ; before i++ for (var i= 0; i < arr.length i++) {
William Dayton
@Mortichar
Jun 20 2017 01:28
@swong194 build out a basic bootstrap page to put your results, then proceed to waste a few hours trying to figure the wikipedia api out
Sunny Wong
@swong194
Jun 20 2017 01:29
@Na-Ya i got really lucky with the api and what not
luccifer00
@luccifer00
Jun 20 2017 01:29
@Chrono79
Sunny Wong
@swong194
Jun 20 2017 01:29
@Na-Ya the only problem i had was updating the icon to changing weather as I did not read the documentation for it
luccifer00
@luccifer00
Jun 20 2017 01:29
i am ussing this console.log(arr.push() + item);
arr.push(); but i think is not the right way
Sunny Wong
@swong194
Jun 20 2017 01:29
the solution was very simple, i deleted a command and it worked
@Mortichar HAHA
@Mortichar thank you
CamperBot
@camperbot
Jun 20 2017 01:30
swong194 sends brownie points to @mortichar :sparkles: :thumbsup: :sparkles:
:cookie: 296 | @mortichar |http://www.freecodecamp.com/mortichar
Diego Mayer
@Chrono79
Jun 20 2017 01:30
@luccifer00 no, that's why I told you to see the challenges about push and shift again
James Patrick Kerrane
@jamesjpk123
Jun 20 2017 01:30

Ok, I'm still working on the challenge Stand in Line. Here's my code:
function nextInLine(arr, item) {
// Your code here
arr.shift(item);
return arr.push(item); // Change this line
}

I have:
(yes) nextInLine([], 1) should return 1
(no) nextInLine([2], 1) should return 2
(yes) nextInLine([5,6,7,8,9], 1) should return 5
(yes) After nextInLine(testArr, 10), testArr[4] should be 10
I'm wondering how I could fix it. Can I get any help?

Diego Mayer
@Chrono79
Jun 20 2017 01:30
@jamesjpk123 read the instructions again, you're returning the new length of the array, not the number removed, and order matters
Frank McCroy
@fmccroy
Jun 20 2017 01:30
hmm.. that came out wrong: https://www.youtube.com/watch?v=PFrzq01h4m0
Sunny Wong
@swong194
Jun 20 2017 01:30
@fmccroy ahh
dw the linked worked
luccifer00
@luccifer00
Jun 20 2017 01:31
@Chrono79 and i dont know how to doing with the return item... i should change that line, but i dont have any idea of what can i do
Sunny Wong
@swong194
Jun 20 2017 01:31
@fmccroy how are ur projects
@fmccroy i remember u were doing the weather app a few days ago
James Patrick Kerrane
@jamesjpk123
Jun 20 2017 01:32
@Chrono79 Thank you so much! Stuck on this challenge for like an hour!
CamperBot
@camperbot
Jun 20 2017 01:32
jamesjpk123 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4339 | @chrono79 |http://www.freecodecamp.com/chrono79
Frank McCroy
@fmccroy
Jun 20 2017 01:32
@swong194 I finally finished the weather app yesterday. I’ve read the directions for the Wiki app but haven’t started yet (or even looked at the video)
Sunny Wong
@swong194
Jun 20 2017 01:33
i got kinda lazy the past two days
was working on another project
and today i decided to run some errands to get the overwith
Frank McCroy
@fmccroy
Jun 20 2017 01:34
I am trying to read “Eloquent Javascript” when I’m not working on the challenges, but it’s going very slow. Reading this chat room is more interesting right now. :)
Sunny Wong
@swong194
Jun 20 2017 01:35
OOH
i started eloquent javascript
i know how helpful it would be if i finished it
but i have difficulty just sitting down and reading
Adrian Turika
@therealcode
Jun 20 2017 01:39

Hey guys - I'm working on the Card Counting function - and can't seem to have 7,8, or 9 make count = 0... any help please? '
var count = 0;

function cc(card) {
// Only change code below this line
if (card >= 2 && card <= 6) {
count += 1;
}
else if (card === 10 || card === 'J' || 'Q' || 'K' || 'A') {
count -= 1;
}
else if (card === 7||8||9) {
count = count;
}
if (count <= 0) {
return count + " Hold";
}
else {
return count + " Bet";
}
// Only change code above this line
}

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

Adrian Turika
@therealcode
Jun 20 2017 01:40
@Chrono79 do you think I should exand on every possibility or use switch instead?
Diego Mayer
@Chrono79
Jun 20 2017 01:40
no need
Adrian Turika
@therealcode
Jun 20 2017 01:40
Thanks for the link @Chrono79
CamperBot
@camperbot
Jun 20 2017 01:40
therealcode sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4340 | @chrono79 |http://www.freecodecamp.com/chrono79
Frank McCroy
@fmccroy
Jun 20 2017 01:41
@therealcode Just leave that part of the if statement out, it doesn’t change anything
Diego Mayer
@Chrono79
Jun 20 2017 01:41
just write || card == 'Q' || etc. and you don't need the 7, 8 and 9 because count doesn't change
Adrian Turika
@therealcode
Jun 20 2017 01:42
oohhh - ok I'll give that a shot. Thanks @fmccroy & @Chrono79
CamperBot
@camperbot
Jun 20 2017 01:42
therealcode sends brownie points to @fmccroy and @chrono79 :sparkles: :thumbsup: :sparkles:
:cookie: 364 | @fmccroy |http://www.freecodecamp.com/fmccroy
:warning: therealcode already gave chrono79 points
Adrian Turika
@therealcode
Jun 20 2017 01:43
Worked like a charm :) - I guess using '||' the right way helps
Diego Mayer
@Chrono79
Jun 20 2017 01:43
:+1:
Alatha23
@Alatha23
Jun 20 2017 01:49
Struggling with the "Word Blanks" under Basic Java script. Could someone send me their a picture of the solution, please?
luccifer00
@luccifer00
Jun 20 2017 01:50
hey @Chrono79 i've just complete 3/4 levels , but the " nextInLine([5,6,7,8,9], 1) should return 5 " resist to me.... if udont care , i can Pm u to give my code... becouse i dont know if i am doing well, or i find some way whit code to pass it lol
Sunny Wong
@swong194
Jun 20 2017 01:55
@Alatha23 can we see your code first, or answer any questions you may have?
Statler Lewis
@statlerlewis3
Jun 20 2017 01:56

function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
fahrenheit=9/5+32;

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

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

Will Hart
@willhart108
Jun 20 2017 01:56
I'm on the 'Escape sequences in Strings' challenge:
Screen Shot 2017-06-19 at 6.55.10 PM.png
Statler Lewis
@statlerlewis3
Jun 20 2017 01:56
ughh just got into javascript and realllly struggling and getting frustrated lol. any help?
Will Hart
@willhart108
Jun 20 2017 01:57
does my code look correct? the system said okay and lets me move on but it looks funny?
Sunny Wong
@swong194
Jun 20 2017 01:57
@statlerlewis3 do you understand the syntax of the function you are shown?
Statler Lewis
@statlerlewis3
Jun 20 2017 01:58
i put in the fahrenheit=9/5+32.
Will Hart
@willhart108
Jun 20 2017 01:58
@statlerlewis3 same boat bud lol
Statler Lewis
@statlerlewis3
Jun 20 2017 01:58
@willhart108 fricking dying out here
Manish Giri
@Manish-Giri
Jun 20 2017 01:59
@statlerlewis3 you need to use the celsius variable.
After all, that is what you're converting, isn't it?
Will Hart
@willhart108
Jun 20 2017 01:59
var myStr = "FirstLine\n\SecondLine\\rThirdLine"; look correct?
Manish Giri
@Manish-Giri
Jun 20 2017 01:59
@willhart108 it is correct
Sunny Wong
@swong194
Jun 20 2017 01:59
@statlerlewis3 so your function's name is convertToF
@statlerlewis3 so yo call the function, you need to call it by the name (as i would call you by your name)
Will Hart
@willhart108
Jun 20 2017 02:00
@Manish-Giri when the system shows my work it still showed the \n \ and \r.. shouldn't they dissapear?
Manish Giri
@Manish-Giri
Jun 20 2017 02:00
no
Sunny Wong
@swong194
Jun 20 2017 02:01
@statlerlewis3 your function convertToF(celsius), accepts the call convertToF(celsius) where celsius is a variable, this variable will be passed into the function
Manish Giri
@Manish-Giri
Jun 20 2017 02:01
that's the console
Will Hart
@willhart108
Jun 20 2017 02:01
Screen Shot 2017-06-19 at 7.00.55 PM.png
Sunny Wong
@swong194
Jun 20 2017 02:01
@statlerlewis3 so converToF(20) will pass 20 INTO the function
Manish Giri
@Manish-Giri
Jun 20 2017 02:01
it would appear on screen
Sunny Wong
@swong194
Jun 20 2017 02:01
@statlerlewis3 so anywhere your function has the variable celsius it will set it to 20
Will Hart
@willhart108
Jun 20 2017 02:01
oh good lol i didn't want to move on knowing it looked wrong
Sunny Wong
@swong194
Jun 20 2017 02:02
@statlerlewis3 i hope that helps, and also explains why your code doesn't work, it is because you are not using the variable celsius
@statlerlewis3 what you copied and pasted will return fahrenheit as 9/5 +32, you did not use nor convert the input "20"
Will Hart
@willhart108
Jun 20 2017 02:03
@statlerlewis3 i got really caught up on that one too and when i finally got it i was like ffffff i over thought it lol
@statlerlewis3 it starts with: fahrenheit =
Statler Lewis
@statlerlewis3
Jun 20 2017 02:05
@swong194 okay i get that 9/5+32 wont plug in the number i later put in/
Sunny Wong
@swong194
Jun 20 2017 02:06
@statlerlewis3 yes
@statlerlewis3 if i have y=2x+3 and i say x = 2, you would tell me y = 7
in this cause you have something like
Statler Lewis
@statlerlewis3
Jun 20 2017 02:06
but i just dont how to fix it. i cant put celsius in or its a syntax error
Sunny Wong
@swong194
Jun 20 2017 02:07
y = 9/5 +32
oh
hmmm
let me see
Statler Lewis
@statlerlewis3
Jun 20 2017 02:08
ohhhhhhh so fahrenheit = celsius? nope fuck. its module 135. i know there is a super quick fix i literally just am missing something obvious
Sunny Wong
@swong194
Jun 20 2017 02:10
@statlerlewis3 try refreshing the exercise
@statlerlewis3 maybe a bug
@statlerlewis3 you should not get a syntax error if you put celsius within the function
@statlerlewis3 fahrenheit=(9/5)*(celsius)+32; is the solution
Alatha23
@Alatha23
Jun 20 2017 02:12
@swong194 here is my code
Sunny Wong
@swong194
Jun 20 2017 02:12
@statlerlewis3 that is why i tried to make the analogy of y = 9/5 + 32 you just have to put the "x" which is celsius in the exercise for y=9/5 x +32
Alatha23
@Alatha23
Jun 20 2017 02:12

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

  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
Sunny Wong
@swong194
Jun 20 2017 02:13
@Alatha23 ahh
Statler Lewis
@statlerlewis3
Jun 20 2017 02:14
@swong194 ahhh i literally forgot the time sign bewtween 9/5 and celsius. wow.thanks though forthe time
CamperBot
@camperbot
Jun 20 2017 02:14
statlerlewis3 sends brownie points to @swong194 :sparkles: :thumbsup: :sparkles:
:cookie: 282 | @swong194 |http://www.freecodecamp.com/swong194
Sunny Wong
@swong194
Jun 20 2017 02:14
@Alatha23 so even tho you have a string of you did not set it equal to result
@Alatha23 so when result gets returned you still get an empty string
@Alatha23 you need to have result = what you just coded
@statlerlewis3 no problem, good luck
mrgrizzlie33
@mrgrizzlie33
Jun 20 2017 02:17
I am on switches. Any idea what I'm doing wrong?

function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch (caseInSwitch) {
case 1: console.log("alpha"); break;
case 2: console.log("beta"); break;
case 3: console.log("gamma"); break;
case 4: console.log("delta"); break;
}

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

// Change this value to test
caseInSwitch(1);

Moisés Man
@moigithub
Jun 20 2017 02:20
@mrgrizzlie33 caseInSwitch is ur function name..
u should use the parameter name valinstead on ur switch
also .. instead of console.log u should set those values to answer variable.. not console.log
mrgrizzlie33
@mrgrizzlie33
Jun 20 2017 02:21
tried that, doesn't work
Alatha23
@Alatha23
Jun 20 2017 02:23
@swong194 like this
'''
CamperBot
@camperbot
Jun 20 2017 02:23
:bulb: to format code use backticks! ``` more info
Claudio Restifo
@Marmiz
Jun 20 2017 02:23
@mrgrizzlie33 all you are doing is printing in the console and never atually update result.
So even if you have implemented a switch, your function still return answer = ''
Alatha23
@Alatha23
Jun 20 2017 02:24
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  var result = "";
  // Your code below this line
 result = myNoun + "string1" + myAdjective + "string2" myVerb + "string3" + myAdverb "

  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
Moisés Man
@moigithub
Jun 20 2017 02:24
@Alatha23 makesureyourfinalstringhavesomespacesbetweenwordswhenyouconcatenatethem
Alatha23
@Alatha23
Jun 20 2017 02:24
@swong194 i feel like i should be using the += operator somewhere.
mrgrizzlie33
@mrgrizzlie33
Jun 20 2017 02:25
@Marmiz Ok... so then what needs to be changed?
Claudio Restifo
@Marmiz
Jun 20 2017 02:25
@mrgrizzlie33 instead of console.log assign a value to answer
Moisés Man
@moigithub
Jun 20 2017 02:25
@Alatha23 ur code have an extra "
after fix that.. it will result in
dogstring1bigstring2ranstring3quickly <-- see whats missing ?
mrgrizzlie33
@mrgrizzlie33
Jun 20 2017 02:26
oh ok I'll try that @Marmiz
@Marmiz no luck
Moisés Man
@moigithub
Jun 20 2017 02:27
show code again... what u changed ? @mrgrizzlie33
Claudio Restifo
@Marmiz
Jun 20 2017 02:28
@mrgrizzlie33 do you realize that you are passing a function as a parameter to the switch?
switch (caseInSwitch)
mrgrizzlie33
@mrgrizzlie33
Jun 20 2017 02:29

function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch (val) {
case 1: answer ("alpha"); break;
case 2: answer ("beta"); break;
case 3: answer ("gamma"); break;
case 4: answer ("delta"); break;
}

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

// Change this value to test
caseInSwitch(1);

@moigithub
Moisés Man
@moigithub
Jun 20 2017 02:29
@mrgrizzlie33 review HOW to ASSIGN values to variables....
u need to use the assigment operator =
Claudio Restifo
@Marmiz
Jun 20 2017 02:29

@mrgrizzlie33

answer ("alpha")

Is this how you assign values?

mrgrizzlie33
@mrgrizzlie33
Jun 20 2017 02:29
@moigithub Will do
Claudio Restifo
@Marmiz
Jun 20 2017 02:29
if I want a to be equal to 1? how do I write that?
Joseph
@revisualize
Jun 20 2017 02:30
A is now 1
Dih
mrgrizzlie33
@mrgrizzlie33
Jun 20 2017 02:30
I got it now. Thanks @Marmiz and @moigithub I didn't realize that you had to assign cases to the variable. Got it now :thumbsup:
Claudio Restifo
@Marmiz
Jun 20 2017 02:30
>.<
CamperBot
@camperbot
Jun 20 2017 02:30
mrgrizzlie33 sends brownie points to @marmiz and @moigithub :sparkles: :thumbsup: :sparkles:
:cookie: 941 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 3383 | @moigithub |http://www.freecodecamp.com/moigithub
Claudio Restifo
@Marmiz
Jun 20 2017 02:30
@mrgrizzlie33 :+1:
Joseph
@revisualize
Jun 20 2017 02:31
= is the assignment operator.
Sunny Wong
@swong194
Jun 20 2017 02:31
@Alatha23 you can do myNoun +" " +myAdjective ....
Claudio Restifo
@Marmiz
Jun 20 2017 02:31
@revisualize where's your manner:
a please be equal 1
Joseph
@revisualize
Jun 20 2017 02:31
sudo !!
Sunny Wong
@swong194
Jun 20 2017 02:31
@Alatha23 where " " is a space between your words, so you can make a sentence with the given inputs
Claudio Restifo
@Marmiz
Jun 20 2017 02:31
@revisualize
I am Root
Alatha23
@Alatha23
Jun 20 2017 02:32
@moigithub Thanks. I removed it and add a ; . However, it says wordBlanks("","","","") should return a string.
CamperBot
@camperbot
Jun 20 2017 02:32
alatha23 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
Joseph
@revisualize
Jun 20 2017 02:32
It should
CamperBot
@camperbot
Jun 20 2017 02:32
:star2: 3384 | @moigithub |http://www.freecodecamp.com/moigithub
This!
Claudio Restifo
@Marmiz
Jun 20 2017 02:36

@mrgrizzlie33

I didn't realize that you had to assign cases to the variable

mmmh, just to be sure that you get exactly what a switch statement does.
Imagine it exactly like an if else if statement but shorter.
So I can write this:

if ( val == 1) {
 //expression
} else if ( val == 2 ) {
 // other expression
} else if (val >= 3) {
//other expression
}

Or I can make it more "concise" and write:

switch(val){
case 1:
 // same expression I'd write for the first if
break;
case 2:
 // same expression for val == 2
break;
case val >=3:
// same expression for val >=3
break;
}
Alatha23
@Alatha23
Jun 20 2017 02:37
@revisualize Thanks. I understand the infographic, but I'm still confused as to how to implement it.
CamperBot
@camperbot
Jun 20 2017 02:37
alatha23 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4201 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jun 20 2017 02:37
String concatenation.
lmagee001
@lmagee001
Jun 20 2017 02:38
anyone willing to help with this card counting function?
Alatha23
@Alatha23
Jun 20 2017 02:39
@revisualize would I need to concatenate the string with the variables? because that basically what I've done.
mrgrizzlie33
@mrgrizzlie33
Jun 20 2017 02:39
@Marmiz Thanks, that makes sense. I was having a bit of trouble grasping it, but I'm sure I have it now (I've whipped through the next couple of challenges with no issues). I really appreciate the patient help too, thank you. :thumbsup: :thumbsup:
CamperBot
@camperbot
Jun 20 2017 02:39
:warning: mrgrizzlie33 already gave marmiz points
mrgrizzlie33 sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
Joseph
@revisualize
Jun 20 2017 02:39
Show?
I am on my phone.
Alatha23
@Alatha23
Jun 20 2017 02:40
@revisualize
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  var result = "";
  // Your code below this line
 myNoun + "string1" + myAdjective + "string2" myVerb + "string3" + myAdverb;


  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
Joseph
@revisualize
Jun 20 2017 02:40
Your problem.
Spaces
Claudio Restifo
@Marmiz
Jun 20 2017 02:40
@lmagee001 show us what you got :)
Joseph
@revisualize
Jun 20 2017 02:40
You are nt assigning your string to a variable
Alatha23
@Alatha23
Jun 20 2017 02:41
@revisualize between strings or actual code?
how would i assign a string to a variable? is it perhaps the += operator?
Joseph
@revisualize
Jun 20 2017 02:41
"dogstring1bigstring2ranstring3quickly" ... no spaces
Claudio Restifo
@Marmiz
Jun 20 2017 02:45
@Alatha23 you want your result to be = to the string you compose
Allen Kim
@akimbjj77
Jun 20 2017 02:47
hello all, on mutations in fcc
I have to run through 2 words for example , "Alien", "Line", and compare to see if each letter is in the other.
i cant seem to find a way to iterate through eat word, well with a for loop, but how do i compare the letters in the two words?
Alatha23
@Alatha23
Jun 20 2017 02:48
@Marmiz doyou mean i should insert the string i compose here var result = "";
Sunny Wong
@swong194
Jun 20 2017 02:49
any1 know where i can get a slide gallery plug in?
Claudio Restifo
@Marmiz
Jun 20 2017 02:50

@Alatha23 since they ask you to add your code below the variable declaration, no

var result = "";
  // Your code below this line

but you can assign result a new value like:

var a = null
a = 1
@swong194 Bootstrap has one, otherwise JQuery has many.
Probably even more modern stuff like material UI has one
Allen Kim
@akimbjj77
Jun 20 2017 02:52

///function mutation(arr) {
for (i=0; i < arr[0].length; i++) {
arr[0].indexOf(0, )
}
return arr;
}

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

/// hello ///
shoot how do you put iit in black
Alatha23
@Alatha23
Jun 20 2017 02:53
@Marmiz yup, i tried that and no luck. Can you please send me the solution?
Diego Mayer
@Chrono79
Jun 20 2017 02:53
click more info below @akimbjj77
CamperBot
@camperbot
Jun 20 2017 02:53
:bulb: to format code use backticks! ``` more info
angleshero
@angleshero
Jun 20 2017 02:55
hey everybody, could someone assist with the Golf Code challenge on freecodecamp
SirRicc
@SirRicc
Jun 20 2017 02:55
What Types are ~> :&?
Diego Mayer
@Chrono79
Jun 20 2017 02:55
@swong194 try bxslider.js
SirRicc
@SirRicc
Jun 20 2017 02:56
Example :return num % 2 ? "a" : "b"
Claudio Restifo
@Marmiz
Jun 20 2017 02:56

@Alatha23 absolutely not. I won't give you the solution since it's not productive for your learning.
Sometimes you need to struggle... and overcoming those struggles yourself is what makes you a better coder.

Anyway how's your code looking so far?

Diego Mayer
@Chrono79
Jun 20 2017 02:56
@SirRicc that's called ternary operator
SirRicc
@SirRicc
Jun 20 2017 02:57
@Chrono79 thc
@Chrono79 thx
CamperBot
@camperbot
Jun 20 2017 02:57
sirricc sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4341 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Jun 20 2017 02:58
@angleshero show your code
angleshero
@angleshero
Jun 20 2017 02:58

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

return "Change Me";
// Only change code above this line
}

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

Diego Mayer
@Chrono79
Jun 20 2017 02:59
@angleshero all those conditions are wrong
you need to compare strokes against the first column of the table
Alatha23
@Alatha23
Jun 20 2017 02:59

@Marmiz hahaha

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

  // Your code above this line
  return result;
}

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

It runs! @Marmiz and @swong194 thanks guys

CamperBot
@camperbot
Jun 20 2017 02:59
alatha23 sends brownie points to @marmiz and @swong194 :sparkles: :thumbsup: :sparkles:
:cookie: 283 | @swong194 |http://www.freecodecamp.com/swong194
:cookie: 942 | @marmiz |http://www.freecodecamp.com/marmiz
angleshero
@angleshero
Jun 20 2017 02:59
its saying that 5,5 returns bogey and it should be par
Allen Kim
@akimbjj77
Jun 20 2017 02:59
oh like this hello world
angleshero
@angleshero
Jun 20 2017 03:00
@Chrono79 ... ok let me see
Claudio Restifo
@Marmiz
Jun 20 2017 03:00
@Alatha23 :+1:
Allen Kim
@akimbjj77
Jun 20 2017 03:00
can you use commas like that in an if statement?
Diego Mayer
@Chrono79
Jun 20 2017 03:01
no
Allen Kim
@akimbjj77
Jun 20 2017 03:01
dont you need && or ||
??
Diego Mayer
@Chrono79
Jun 20 2017 03:01
yes (not in this case)
Allen Kim
@akimbjj77
Jun 20 2017 03:01
why not in this case? im confused
anybody see my code have any suggestions?
hate being stuck on code for days on the same damn algoritms
angleshero
@angleshero
Jun 20 2017 03:02
@Chrono79 all of the conditions receive green check marks excpet one . Im not sure what you mean they are all wrong.
Allen Kim
@akimbjj77
Jun 20 2017 03:02

```function mutation(arr) {
for (i=0; i < arr[0].length; i++) {
arr[0].indexOf(0, )
}
return arr;
}

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

Diego Mayer
@Chrono79
Jun 20 2017 03:03
@akimbjj77 are we talking about the golf code @angleshero pasted? Only one condition for if
@angleshero do you know what comma operator does?
Allen Kim
@akimbjj77
Jun 20 2017 03:04
function mutation(arr) {
  for (i=0; i < arr[0].length; i++) {
    arr[0].indexOf(0, )
  }
  return arr;
} 

mutation(["hello", "hey"]);
yeah the golf code @Chrono79
angleshero
@angleshero
Jun 20 2017 03:04
@Chrono79 what? if I dont have the comma I get an error
Allen Kim
@akimbjj77
Jun 20 2017 03:04
what are you saying with the comma?
Diego Mayer
@Chrono79
Jun 20 2017 03:04
@akimbjj77 then only one condition per if is needed, that's why you shoudln't use && or || there
Allen Kim
@akimbjj77
Jun 20 2017 03:04
i don't think thats the right syntax
i see, so that's proper code?
Nathanael Milien
@naelmilien
Jun 20 2017 03:05
Hello world! I'm struggling on this Mutations challenge as well :(
Allen Kim
@akimbjj77
Jun 20 2017 03:05
never seen that before
Diego Mayer
@Chrono79
Jun 20 2017 03:05
@angleshero compare strokes aganst the values of the first column, return the values of the second column
Allen Kim
@akimbjj77
Jun 20 2017 03:05
@naelmilien im with you man
been thinking about it in my car and driving and everything still no way so far
BlackTiger
@BlackTigerRoar
Jun 20 2017 03:06
Hello Community, I am not sure what is wrong with my code for 'Profile Lookup'. It made sense to me when I go through step by step, but it won't pass it.
function lookUpProfile(firstName, prop){
// Only change code below this line
  for (var i = 0; i < 4; 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
}
CamperBot
@camperbot
Jun 20 2017 03:06
:bulb: to format code use backticks! ``` more info
Nathanael Milien
@naelmilien
Jun 20 2017 03:06
LOL, same here @akimbjj77
Simranjit Singh
@sim3001
Jun 20 2017 03:06

```var app = angular.module('weatherApp', []);

app.controller('weatherController', function ($scope, $http) {
var vm = $scope;
vm.weatherInfo = {
heading: 'Local Weather'

};
$http.get("http://ip-api.com/json").success(function(data) {
    vm.lat = data.lat;
    vm.lon = data.lon;
    var apiKey = "eb06332116e05a56bef0a3b4b0c45aed";
    var openWeatherUrl = "http://api.openweathermap.org/data/2.5/weather?lat=" + vm.lat + "&lon=" + vm.lon + "&appid=" + apiKey;
    $http.get(openWeatherUrl).success(function (data) {
        vm.description = data.weather[0].description;
        vm.speed = (2.237*data.wind.speed).toFixed(1);
        console.log(vm.speed);
    });
});

});

Diego Mayer
@Chrono79
Jun 20 2017 03:06
@ShenyuSun you return No such contact at the first mismatch
Claudio Restifo
@Marmiz
Jun 20 2017 03:06
@angleshero read the instructions carefully, so far you are checking if par has a value and strokes has another value,
while in the golf code you want to check how's stroke is in realtion with par like:
if strokes is less than par -2 (for example)
Diego Mayer
@Chrono79
Jun 20 2017 03:07
@akimbjj77 @naelmilien you both need to check if all the letters of the second word are present in the first word
angleshero
@angleshero
Jun 20 2017 03:07
@Marmiz ok lets see .
Simranjit Singh
@sim3001
Jun 20 2017 03:07
Hey guys im trying to make a api request with $http.get().success(function) but the console keeps telling me it is not a function can anyone spot whats wrong?
var app = angular.module('weatherApp', []);

app.controller('weatherController', function ($scope, $http) {
    var vm = $scope;
    vm.weatherInfo = {
        heading: 'Local Weather'

    };
    $http.get("http://ip-api.com/json").success(function(data) {
        vm.lat = data.lat;
        vm.lon = data.lon;
        var apiKey = "eb06332116e05a56bef0a3b4b0c45aed";
        var openWeatherUrl = "http://api.openweathermap.org/data/2.5/weather?lat=" + vm.lat + "&lon=" + vm.lon + "&appid=" + apiKey;
        $http.get(openWeatherUrl).success(function (data) {
            vm.description = data.weather[0].description;
            vm.speed = (2.237*data.wind.speed).toFixed(1);
            console.log(vm.speed);
        });
    });
});
Allen Kim
@akimbjj77
Jun 20 2017 03:08
right @Chrono79 , but i can't seem to figure a way to iterate through both and then compare
Nathanael Milien
@naelmilien
Jun 20 2017 03:08
@Chrono79 I have...It's only one of the checkpoint that's giving me problem right now
BlackTiger
@BlackTigerRoar
Jun 20 2017 03:08
@Chrono79 If first name is equal to contacts's first, then do something, else return 'No such contact'. Did I misunderstand something?
Diego Mayer
@Chrono79
Jun 20 2017 03:08
@ShenyuSun yes, you need to keep looking in the list, how would you know if the second contact was the right right if you don't do that?
Andrea Mammoliti
@AndreusSH
Jun 20 2017 03:08
Hi everyone, I am working on the challenge Title Case a Sentence

function titleCase(str) {
var split = str.split(" ");
var upper = str.toUpperCase();

return str ;
}

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

why do I receive the message toUpperCase is not a function
?
Allen Kim
@akimbjj77
Jun 20 2017 03:09
@AndreusSH what do you have to do again on that one>
?
Claudio Restifo
@Marmiz
Jun 20 2017 03:09
@AndreusSH because you're returning str instead of the mutated one:
return str ;
Allen Kim
@akimbjj77
Jun 20 2017 03:10
oh yeah you should return split; right?
John
@jrmusa9
Jun 20 2017 03:10
has anyone completed "Seek and Destroy"?? problem #250
Claudio Restifo
@Marmiz
Jun 20 2017 03:10
@AndreusSH also you are uppercasing str
str.toUpperCase();
instead of the splitted one
Allen Kim
@akimbjj77
Jun 20 2017 03:11
yeah dude, you have to do......
Claudio Restifo
@Marmiz
Jun 20 2017 03:11
@AndreusSH take a moment and think this through... don't writes names headlessly :)
you're almost there
@jrmusa9 what's the issue?
John
@jrmusa9
Jun 20 2017 03:11
cant figure it out...
i got this so far, tried different things... I'm definitely missing the main idea on how to solve this.

function destroyer(arr) {
// Remove all the values
var newArr=[];
var arg=arguments;

arr=arr.filter(function(val)
              {
                 for(var i=1; i<arr.length-1; ++i)
                   {
                       return val !== arg[i];
                   }
              }
             );

return arr;
}

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

Allen Kim
@akimbjj77
Jun 20 2017 03:13
so i think for the mutations, you have to use indexOf() in an if statement somehow where it outputs either a -1 or a positive number or 0
Diego Mayer
@Chrono79
Jun 20 2017 03:13
@akimbjj77 use 1 loop and indexOf
Andrea Mammoliti
@AndreusSH
Jun 20 2017 03:14
@Marmiz that I know, I am just curious why I get this kind of error
Claudio Restifo
@Marmiz
Jun 20 2017 03:14
@jrmusa9 you have a function that passes an array and x arguments after.
first thing first I suggest you to take the arguments and split them into two:
array and the rest.
then all you have to do is simply look into array and filter out the elements that are presents inside all the rest
Andrea Mammoliti
@AndreusSH
Jun 20 2017 03:14
@Marmiz thanks
CamperBot
@camperbot
Jun 20 2017 03:14
andreussh sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:cookie: 944 | @marmiz |http://www.freecodecamp.com/marmiz
Nathanael Milien
@naelmilien
Jun 20 2017 03:14
@Chrono79 I've done all that and I'm still stuck too
Allen Kim
@akimbjj77
Jun 20 2017 03:15
but in what context , i mean how do i use indexOf properely?
Andrea Mammoliti
@AndreusSH
Jun 20 2017 03:15
@Marmiz :)
Diego Mayer
@Chrono79
Jun 20 2017 03:15
show your code @naelmilien
Claudio Restifo
@Marmiz
Jun 20 2017 03:15
@AndreusSH :+1: glad I helped
Allen Kim
@akimbjj77
Jun 20 2017 03:15
yeah show your code @naelmilien
Nathanael Milien
@naelmilien
Jun 20 2017 03:16

function mutation(arr) {
  var idx;

  var splitStr = arr.map(function(str){
    return str.toLowerCase().split('');
  });

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

  //return splitStr[0].indexOf(splitStr[1][i]);
}

mutation(["hello", "hey"]);
Claudio Restifo
@Marmiz
Jun 20 2017 03:16
@jrmusa9 if you look the page suggest Arguments Object as a method, it's great for this purpose of having stored the arguments into one simple array
John
@jrmusa9
Jun 20 2017 03:16
@Marmiz Thanks Claudio, I'll give it a try
CamperBot
@camperbot
Jun 20 2017 03:16
jrmusa9 sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:cookie: 945 | @marmiz |http://www.freecodecamp.com/marmiz
Nathanael Milien
@naelmilien
Jun 20 2017 03:17
I know it's ugly code but that's the closest I've gotten so far
Diego Mayer
@Chrono79
Jun 20 2017 03:17

@naelmilien you don't need the split, indexOf is also a string method

    if ( idx !== -1 ) {
      return true;
    }
    return false;

That'll make your loop run only once

you're only comparing the first letter like that
i <= splitStr[1].length is also wrong, the last letter of a string is at string.length-1
Allen Kim
@akimbjj77
Jun 20 2017 03:18
oh wow, that .map function is nice @naelmilien
Menlam Choden
@menlam
Jun 20 2017 03:19
how to send a variable inside the lookup table\/
Nathanael Milien
@naelmilien
Jun 20 2017 03:22
@Chrono79 It seems to work for every single one of the checkpoint except for one. Plus, if I don't split, doesn't it compare the whole string to another. Like "Mary".indexOf("Aarmy") which would only return false?
Thanks @akimbjj77
CamperBot
@camperbot
Jun 20 2017 03:22
naelmilien sends brownie points to @akimbjj77 :sparkles: :thumbsup: :sparkles:
:cookie: 248 | @akimbjj77 |http://www.freecodecamp.com/akimbjj77
Diego Mayer
@Chrono79
Jun 20 2017 03:23

@naelmilien no

idx = splitStr[0].indexOf(splitStr[1][i]);

splitStr[1] is a string, and splitStr[1][i] is a single char

Allen Kim
@akimbjj77
Jun 20 2017 03:23
thanks @naelmilien
CamperBot
@camperbot
Jun 20 2017 03:23
akimbjj77 sends brownie points to @naelmilien :sparkles: :thumbsup: :sparkles:
:cookie: 251 | @naelmilien |http://www.freecodecamp.com/naelmilien
Menlam Choden
@menlam
Jun 20 2017 03:23
anyone
@naelmilien the one that fails is the one both words start with the same letter but they're not a mutation, am I right?
Nathanael Milien
@naelmilien
Jun 20 2017 03:25
@Chrono79 Maybe I'm misunderstanding something. I thought I split it into several strings of just letters.
David Darby
@AzFalconer
Jun 20 2017 03:25
I probably just need a break... but I'm trying to access an array "array = [2, 3, 2, 3], A, B" ... Shouldn't array[0] return "[2, 3, 2, 3]" and array[1] "A" etc...
abraham anak agung
@padunk
Jun 20 2017 03:25
Hi, is there a method to know length of a number or string? 12345 or '12345' is 5
David Darby
@AzFalconer
Jun 20 2017 03:26
@padunk string.length
Nathanael Milien
@naelmilien
Jun 20 2017 03:26
@Chrono79 the one that failed is mutation(["hello", "hey"])
Diego Mayer
@Chrono79
Jun 20 2017 03:26
@naelmilien exactly, copy and paste your code here: http://www.pythontutor.com/javascript.html#mode=display
See what it does
abraham anak agung
@padunk
Jun 20 2017 03:26
i don't think string have length prototype @AzFalconer
Claudio Restifo
@Marmiz
Jun 20 2017 03:26

@AzFalconer this is not a valid syntax:

array = [2, 3, 2, 3], A, B

what were you trying to achieve?

@padunk yes they do :)
Diego Mayer
@Chrono79
Jun 20 2017 03:27
@Marmiz he's talking about seek and destroy
David Darby
@AzFalconer
Jun 20 2017 03:27
@Marmiz seek & destroy chalange
Diego Mayer
@Chrono79
Jun 20 2017 03:27
use arguments object @AzFalconer
Nathanael Milien
@naelmilien
Jun 20 2017 03:27
@Chrono79 I did...What do I need to watch for?
David Darby
@AzFalconer
Jun 20 2017 03:27
ok...
Claudio Restifo
@Marmiz
Jun 20 2017 03:28
@AzFalconer those are passed as arguments function. You need arguments objects to access them
Diego Mayer
@Chrono79
Jun 20 2017 03:28
see your code only compare the first letter @naelmilien
Nathanael Milien
@naelmilien
Jun 20 2017 03:28
Yes @Chrono79
Allen Kim
@akimbjj77
Jun 20 2017 03:28
@AzFalconer maybe array = [[2, 3, 2, 3], A, B] ???
Nathanael Milien
@naelmilien
Jun 20 2017 03:29
Is splitting it the problem? @Chrono79
Diego Mayer
@Chrono79
Jun 20 2017 03:29

@naelmilien no, I said it wasn't needed, the problem is this:

    if ( idx !== -1 ) {
      return true;
    }
    return false;

That'll make your loop run only once
you're only comparing the first letter like that

Nathanael Milien
@naelmilien
Jun 20 2017 03:30
So I need to iterate with the for loop over the array itself instead? @Chrono79
abraham anak agung
@padunk
Jun 20 2017 03:30
@AzFalconer @Marmiz Thanks , i didn't know that.
CamperBot
@camperbot
Jun 20 2017 03:30
padunk sends brownie points to @azfalconer and @marmiz :sparkles: :thumbsup: :sparkles:
:cookie: 253 | @azfalconer |http://www.freecodecamp.com/azfalconer
:cookie: 946 | @marmiz |http://www.freecodecamp.com/marmiz
Mario Ley Tello
@23marioley
Jun 20 2017 03:30
```

function findLongestWord(str) {
array = str.split(' ');

function hola(val) {
return val.length;
}

var newArray = array.map(hola);

//return str.length;
return Math.max.apply(null, newArray);
}

findLongestWord("Google do a barrel roll");
```
Can somebody tell me if I can optimize my code in any way?

BlackTiger
@BlackTigerRoar
Jun 20 2017 03:30
@Chrono79 Thank you, I got it passed. However, I think that I made it too complicated. Is there a simple way to do this?
function lookUpProfile(firstName, prop){
// Only change code below this line
  var noContact = 0;

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

  if (noContact == 4)
    return "No such contact";
// Only change code above this line
}
CamperBot
@camperbot
Jun 20 2017 03:30
shenyusun sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4342 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Jun 20 2017 03:30
@naelmilien see that code, either way you return something, so it ends the loop and the function there
Nathanael Milien
@naelmilien
Jun 20 2017 03:30
How do I compare all the letters @Chrono79 ?
David Darby
@AzFalconer
Jun 20 2017 03:30
@ShenyuSun what chalange was that?
Mario Ley Tello
@23marioley
Jun 20 2017 03:30
function findLongestWord(str) {
array = str.split(' ');
function hola(val) {
return val.length;
}
var newArray = array.map(hola);
//return str.length;
return Math.max.apply(null, newArray);
}
findLongestWord("Google do a barrel roll");
Diego Mayer
@Chrono79
Jun 20 2017 03:31
you shouldn't return both values inside the loop @naelmilien
BlackTiger
@BlackTigerRoar
Jun 20 2017 03:31
@AzFalconer Profile Lookup
Mario Ley Tello
@23marioley
Jun 20 2017 03:31
Can somebody tell me if I can optimize my code in any way?
Diego Mayer
@Chrono79
Jun 20 2017 03:31
@ShenyuSun don't hardcode the number of contacts
Manish Giri
@Manish-Giri
Jun 20 2017 03:32
@23marioley maybe the number of lines
but the logic is the same
Diego Mayer
@Chrono79
Jun 20 2017 03:32
@23marioley you can chain methods, or use reduce instead of map and Math.max, or use sort
Mario Ley Tello
@23marioley
Jun 20 2017 03:33
@Chrono79 How would you use reduce?
Manish Giri
@Manish-Giri
Jun 20 2017 03:33
return Math.max(... str.split(' ').map(word => word.length))
@23marioley
David Darby
@AzFalconer
Jun 20 2017 03:33
@ShenyuSun this is what I did function lookUpProfile(firstName, prop) {
var i=0;
while (i < contacts.length) {
if (contacts[i].firstName == firstName) {
if (contacts[i][prop]) {return contacts[i][prop];}
else {return "No such property";}
} else {i++;}
}
return "No such contact";
}
Vicky Lai
@vickylai
Jun 20 2017 03:34
Hey all
Diego Mayer
@Chrono79
Jun 20 2017 03:34
@23marioley const findLongestWord = str => str.split(" ").reduce((a, b) => b.length > a ? b.length : a, 0);
Allen Kim
@akimbjj77
Jun 20 2017 03:34
@naelmilien i think he is saying that.....
Manish Giri
@Manish-Giri
Jun 20 2017 03:34
or
return str.split(' ').map(word => word.length).sort((a,b) => b-a)[0]
@23marioley
Allen Kim
@akimbjj77
Jun 20 2017 03:35
since you are using the if statement in your for loop it is returning a true of false for each individual letter, or wait, is that what you are trying to do....=\
Mario Ley Tello
@23marioley
Jun 20 2017 03:35
@Chrono79 what does "=>" means? it's a space?
abraham anak agung
@padunk
Jun 20 2017 03:35
@Manish-Giri what is [0] at the end for?
Diego Mayer
@Chrono79
Jun 20 2017 03:35
@23marioley arrow notation, it's ES6
Manish Giri
@Manish-Giri
Jun 20 2017 03:35
@padunk to pick the first array element.
Nathanael Milien
@naelmilien
Jun 20 2017 03:35
Yes @akimbjj77
Diego Mayer
@Chrono79
Jun 20 2017 03:36
@naelmilien return exits the function, you only want to return early on one of the 2 conditions
BlackTiger
@BlackTigerRoar
Jun 20 2017 03:36
@AzFalconer ahh, thank you! I knew that I over thinking the problem.
CamperBot
@camperbot
Jun 20 2017 03:36
shenyusun sends brownie points to @azfalconer :sparkles: :thumbsup: :sparkles:
:cookie: 254 | @azfalconer |http://www.freecodecamp.com/azfalconer
David Darby
@AzFalconer
Jun 20 2017 03:36
@ShenyuSun How can I post my code so it looks pretty like you did?
Nathanael Milien
@naelmilien
Jun 20 2017 03:36
So don't use return @ @Chrono79 ?
Diego Mayer
@Chrono79
Jun 20 2017 03:36
use only in one case
BlackTiger
@BlackTigerRoar
Jun 20 2017 03:37
@Chrono79 so I was on the right track at the first, I just over thinking the problem somehow... All I need to do was moved 'return "No such contact"; to out side of for loop.
  for (var i = 0; i < 4; i++){
      if (firstName == contacts[i].firstName){
        if (contacts[i].hasOwnProperty(prop)){
          console.log(contacts.length);
          return contacts[i][prop];
        }
        else
          return "No such property";
      }
  }

  return "No such contact";
Nathanael Milien
@naelmilien
Jun 20 2017 03:37
Store it in a variable? @Chrono79
Diego Mayer
@Chrono79
Jun 20 2017 03:37
when you shouldn't keep looking @naelmilien
Mario Ley Tello
@23marioley
Jun 20 2017 03:37
thank you @Chrono79 and @Manish-Giri
CamperBot
@camperbot
Jun 20 2017 03:37
23marioley sends brownie points to @chrono79 and @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4343 | @chrono79 |http://www.freecodecamp.com/chrono79
:star2: 6045 | @manish-giri |http://www.freecodecamp.com/manish-giri
Allen Kim
@akimbjj77
Jun 20 2017 03:37
@naelmilien is that .map function making all the letters in both values in the array lower case right?
BlackTiger
@BlackTigerRoar
Jun 20 2017 03:37
@AzFalconer You add " ''' " at the top and bottom
CamperBot
@camperbot
Jun 20 2017 03:37
:bulb: to format code use backticks! ``` more info
BlackTiger
@BlackTigerRoar
Jun 20 2017 03:37
@AzFalconer sorry I meant " ``` "
Diego Mayer
@Chrono79
Jun 20 2017 03:37
@ShenyuSun :+1: but again, don't hardcode contacts.length
David Darby
@AzFalconer
Jun 20 2017 03:38
function lookUpProfile(firstName, prop) { var i=0; while (i < contacts.length) { if (contacts[i].firstName == firstName) { if (contacts[i][prop]) {return contacts[i][prop];} else {return "No such property";} } else {i++;} } return "No such contact"; }
BlackTiger
@BlackTigerRoar
Jun 20 2017 03:38
@Chrono79 i < 4 can also changed to i < contacts.length so I don't hard code the length. Thank you for the tip
CamperBot
@camperbot
Jun 20 2017 03:38
shenyusun sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:warning: shenyusun already gave chrono79 points
kreuel
@kreuel
Jun 20 2017 03:39
hi guys, for the DIFF TWO ARRAY challenge. Is this similar to Seek and Destroy challenge? Thanks in advice.
Nathanael Milien
@naelmilien
Jun 20 2017 03:39
@akimbjj77 I made an array of strings by splitting it and lowercased it. But @Chrono79 says I don't need to split so I'm about to get rid of it
shalya1
@shalya1
Jun 20 2017 03:39
Finding a Remainder in JavaScript
Claudio Restifo
@Marmiz
Jun 20 2017 03:39
@Chrono79 @Manish-Giri look at them confusing everyone with your fancy ES6 syntax :P :P
shalya1
@shalya1
Jun 20 2017 03:39
?
anyhelp?
BlackTiger
@BlackTigerRoar
Jun 20 2017 03:40

@AzFalconer Do like below, and use shift+enter to switch to next lien.

~ ~ console.log("Hi"); ~ ~

Manish Giri
@Manish-Giri
Jun 20 2017 03:40
@Marmiz :see_no_evil: :stuck_out_tongue:
Diego Mayer
@Chrono79
Jun 20 2017 03:40
@naelmilien you're trying to see if all letters of second word are in first word, right? Then if you don't find a letter, why should you keep looking?
You can return there false, but you should keep looking until the end before you can say true
Claudio Restifo
@Marmiz
Jun 20 2017 03:40
@shalya1 the modulo % operation returns the reminder
Allen Kim
@akimbjj77
Jun 20 2017 03:40
@naelmilien ok
David Darby
@AzFalconer
Jun 20 2017 03:41
function lookUpProfile(firstName, prop) {
  var i=0;
  while (i < contacts.length) {
    if (contacts[i].firstName == firstName) {
      if (contacts[i][prop]) {return contacts[i][prop];}
        else {return "No such property";}
    } else {i++;}
  }
  return "No such contact";
}
shalya1
@shalya1
Jun 20 2017 03:41
used it not working
Claudio Restifo
@Marmiz
Jun 20 2017 03:41
@shalya1 what's your code like?
BlackTiger
@BlackTigerRoar
Jun 20 2017 03:41
@AzFalconer there you go lol
Nathanael Milien
@naelmilien
Jun 20 2017 03:41
If the letter is not there I don't really wanna keep looking @Chrono79
shalya1
@shalya1
Jun 20 2017 03:41
var remainder;
11 % 3 = remainder;
David Darby
@AzFalconer
Jun 20 2017 03:41
@ShenyuSun @camperbot Thank you
CamperBot
@camperbot
Jun 20 2017 03:41
azfalconer sends brownie points to @shenyusun and @camperbot :sparkles: :thumbsup: :sparkles:
:cookie: 216 | @shenyusun |http://www.freecodecamp.com/shenyusun
:star2: 3333 | @camperbot |http://www.freecodecamp.com/camperbot
Ogundele Olumide
@Lumexralph
Jun 20 2017 03:42
@shalya1
4 / 3 = 1 rem 1
5 / 2 =  2 rem 1
7 / 5 = 1 rem 2
11 / 3 = 3 rem 2

what  % does is, it returns that remaining value after division so 
 4 % 3 = 1
5 % 2 = 1
7 % 5 = 2
11 % 3 = 2
Claudio Restifo
@Marmiz
Jun 20 2017 03:42
@shalya1 don't you think is better to assign remider to be 11%3 instead of the opposite?
11 % 3 = remainder;
Diego Mayer
@Chrono79
Jun 20 2017 03:42
@naelmilien so, don't return both true and false inside the loop, one goes inside, the other goes outside
shalya1
@shalya1
Jun 20 2017 03:42
hmmm
heidisdad2
@heidisdad2
Jun 20 2017 03:42
i need to return
oops
shalya1
@shalya1
Jun 20 2017 03:42
@Marmiz thanks
CamperBot
@camperbot
Jun 20 2017 03:42
shalya1 sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:cookie: 947 | @marmiz |http://www.freecodecamp.com/marmiz
heidisdad2
@heidisdad2
Jun 20 2017 03:43
well guys im on a roll solving these riddles
Ogundele Olumide
@Lumexralph
Jun 20 2017 03:43
gggggggggggggm :smiling_imp:
Claudio Restifo
@Marmiz
Jun 20 2017 03:43
@Lumexralph I'll thank you for your effort in explaining the math :)
CamperBot
@camperbot
Jun 20 2017 03:43
marmiz sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1967 | @lumexralph |http://www.freecodecamp.com/lumexralph
heidisdad2
@heidisdad2
Jun 20 2017 03:43
was able to figure this one out but feel this was awful sloppy, does anyone happen to know a more efficient way of doing this
Nathanael Milien
@naelmilien
Jun 20 2017 03:43
I just tried putting one outside of the loop and it still doesn't work @Chrono79 :(
Claudio Restifo
@Marmiz
Jun 20 2017 03:43
oooh almost 2 k :sparkles:
heidisdad2
@heidisdad2
Jun 20 2017 03:43
function truncateString(str, num) {
  // Clear out that junk in your trunk

 if (num<=3){
   str = str.slice(0, num) + "...";

 }else if(str.length>=num-2 && str.length<=num){

 str = str;
 }else 
 {
   str = str.slice(0, (num-3)) + "...";
 }



  return str;
}

truncateString("A-tisket a-tasket A green and yellow basket", 11);
Diego Mayer
@Chrono79
Jun 20 2017 03:44
then you didn't put the right one outside, show your current code
Manish Giri
@Manish-Giri
Jun 20 2017 03:44
@Lumexralph g^gm :smiling_imp:
shalya1
@shalya1
Jun 20 2017 03:44
but its not working
says You should use the % operator @Marmiz
Diego Mayer
@Chrono79
Jun 20 2017 03:45
@heidisdad2 first test num against str.length
Allen Kim
@akimbjj77
Jun 20 2017 03:45
so @Chrono79 , once you use a return in a for loop, it will exit it?
shalya1
@shalya1
Jun 20 2017 03:45
@Lumexralph thanks for the mathematical help :D :D
CamperBot
@camperbot
Jun 20 2017 03:45
shalya1 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1968 | @lumexralph |http://www.freecodecamp.com/lumexralph
Diego Mayer
@Chrono79
Jun 20 2017 03:45
@akimbjj77 yes, it exits the whole function
normally the return goes inside an if (inside teh loop) so it can run more than once
Nathanael Milien
@naelmilien
Jun 20 2017 03:46
function mutation(arr) {
  var idx;

  var splitStr = arr.map(function(str){
    return str.toLowerCase().split('');
  });

  //return splitStr;
  for (var i = 0; i <= splitStr[1].length; i++){
    idx = splitStr[0].indexOf(splitStr[1][i]);
    if ( idx < 0 ) {
      return false;
    }
    //return true;
  }
  return true;

  //return splitStr[0].indexOf(splitStr[1][i]);
}

mutation(["hello", "hey"]);
Ogundele Olumide
@Lumexralph
Jun 20 2017 03:46
@Marmiz is it ? :smirk: it's nothing that's the sad part, if it can be converted to cash or something, you know? :wink:
Nathanael Milien
@naelmilien
Jun 20 2017 03:46
@Chrono79 I still haven't gotten rid of the split tho
Claudio Restifo
@Marmiz
Jun 20 2017 03:46
@shalya1 the challenge expect you to declare var reminder = ...
instead of declaring it empy and assign it later like you did:
var reminder;
reminder = ...
Ogundele Olumide
@Lumexralph
Jun 20 2017 03:46
@shalya1 :+1:
Diego Mayer
@Chrono79
Jun 20 2017 03:47
@naelmilien doesn't it work?
Nathanael Milien
@naelmilien
Jun 20 2017 03:47
It doesn't
Ogundele Olumide
@Lumexralph
Jun 20 2017 03:47
@Manish-Giri how're you?
Nathanael Milien
@naelmilien
Jun 20 2017 03:47
@Chrono79
Diego Mayer
@Chrono79
Jun 20 2017 03:47
I told you i <= splitStr[1].length wasn't right
Allen Kim
@akimbjj77
Jun 20 2017 03:48
oh, so if it is nested inside the If statement then it won't exit the for loop @naelmilien
Nathanael Milien
@naelmilien
Jun 20 2017 03:48
Oh yeah, you did...I just changed it and it worked...billions of thanks @Chrono79
CamperBot
@camperbot
Jun 20 2017 03:48
naelmilien sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4344 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Jun 20 2017 03:48
@akimbjj77 it'll exit the loop, but only when the if condition is true
@naelmilien about the split, simply delete .split("")
Allen Kim
@akimbjj77
Jun 20 2017 03:50
do you need that return in that .map function?
cant you simply do str.toLowerCase?
@diego the for loop or the if statement?
damn this is hard
Nathanael Milien
@naelmilien
Jun 20 2017 03:51
@akimbjj77 The map function is not needed at all
Just lowercase it
Diego Mayer
@Chrono79
Jun 20 2017 03:52
@akimbjj77 you could work with arr[0] and arr[1]
Nathanael Milien
@naelmilien
Jun 20 2017 03:52
My code was just too long for no reason lol
takeo33
@takeo33
Jun 20 2017 03:52

hi!! sorry i dont get it: / Setup
var outerWear = "T-Shirt";

function myOutfit() {
// Only change code below this line
var local="sweater";

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

myOutfit();

Diego Mayer
@Chrono79
Jun 20 2017 03:52
@naelmilien you'll learn to make it shorter with practice
@takeo33 the var name inside your function should be outerWear too, not local
Nathanael Milien
@naelmilien
Jun 20 2017 03:53
Thank you again @Chrono79 .... I was stuck all day and couldn't figure this out. I think now I need to go rest my eyes and brain before I look at any other exercises lol
CamperBot
@camperbot
Jun 20 2017 03:53
naelmilien sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:warning: naelmilien already gave chrono79 points
Diego Mayer
@Chrono79
Jun 20 2017 03:54
:+1:
takeo33
@takeo33
Jun 20 2017 03:54
@Chrono79 thank you!! :)
CamperBot
@camperbot
Jun 20 2017 03:54
takeo33 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4345 | @chrono79 |http://www.freecodecamp.com/chrono79
Allen Kim
@akimbjj77
Jun 20 2017 03:56
later @naelmilien
Diego Mayer
@Chrono79
Jun 20 2017 03:57
@akimbjj77
for(...) {
  if (someCondition) {
    return someValue;  
  }
}
return someOtherValue;
it'll only return someValue if someCondition is true, otherwise it'll end the loop and it'll return someOtherValue
Allen Kim
@akimbjj77
Jun 20 2017 03:58
ok i think i was close with the overall idea
just couldnt figure out how to use the indexOf
Diego Mayer
@Chrono79
Jun 20 2017 03:59
check MDN docs when in doubt
they have example code in most cases
Allen Kim
@akimbjj77
Jun 20 2017 03:59
but i think i will not use it as arr[0].indexOf(arr[1][i])
didn't think to use it like that to compare put them as a parent child
cool man thanks
takeo33
@takeo33
Jun 20 2017 04:02

// Example
var changed = 0;

function change(num) {
return (num + 5) / 3;
}

changed = change(10);

// Setup
var processed = 0;

function processArg(num) {
return (num + 3) / 5;
}

// Only change code below this line
processed = processed(7);

Diego Mayer
@Chrono79
Jun 20 2017 04:02
@takeo33 what's your function's name?
takeo33
@takeo33
Jun 20 2017 04:03
Assignment with a Returned Value
Diego Mayer
@Chrono79
Jun 20 2017 04:03
function processArg(num) {
processed = processed(7); <- fix it
Bethany Roberts
@Betanya
Jun 20 2017 04:04
//how does "j<arr[i[.length" make the variable j have to be less than the length of the first array to continue running?

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Diego Mayer
@Chrono79
Jun 20 2017 04:05
@Betanya exactly the same way i < arr.length works for the first loop
takeo33
@takeo33
Jun 20 2017 04:05
@Chrono79 how?
Diego Mayer
@Chrono79
Jun 20 2017 04:05
@takeo33 processed is not a function
see the example code again
takeo33
@takeo33
Jun 20 2017 04:07
it's the same, @Chrono79
Diego Mayer
@Chrono79
Jun 20 2017 04:08
@takeo33 changed = change(10); does it say changed at both sides? I don't think so
One is the var name, one is the function's name
Bethany Roberts
@Betanya
Jun 20 2017 04:08
@Chrono79 I would imagine arr[i] would print out a number, then how do you get a length for a number?
Diego Mayer
@Chrono79
Jun 20 2017 04:08
@Betanya arr[i] is an array there
arr[0] is [1, 2]
arr[1] is [3, 4]
arr[2] is [5, 6, 7]
takeo33
@takeo33
Jun 20 2017 04:09
hoooo!! @Chrono79 ok your right; thank you, i don't see anymore XD
CamperBot
@camperbot
Jun 20 2017 04:09
takeo33 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:warning: takeo33 already gave chrono79 points
Bethany Roberts
@Betanya
Jun 20 2017 04:13
@Chrono79 so it is equal to an array!
Diego Mayer
@Chrono79
Jun 20 2017 04:14
yes, they're called subarrays, but each one is an array by itself
arr[i][j] is a number there
Bethany Roberts
@Betanya
Jun 20 2017 04:18
@Chrono79 so arr[i][j] gives a single number? How?
vik555
@vik555
Jun 20 2017 04:21

function myReplace(str, before, after) {

var arr= str.split(' ');
var newaftU= after.charAt(0).toUpperCase()+after.slice(1);
var newaftL=after.charAt(0).toLowerCase()+after.slice(1);

if (before[0]===before[0].toLowerCase()) {

arr.splice(arr.indexOf(before),1, newaftL);

}

else if (before[0]===before[0].toUpperCase()) {

arr.splice(arr.indexOf(before),1,newaftU);

}

return arr.join(' ');
}

please suggest improvements for this code
Bethany Roberts
@Betanya
Jun 20 2017 04:22
@Chrono79 Ah ha! That's exactly what I needed! Then if each time 1 is added to the for loop, wouldn't it be:
i=0
j=0
then i=1, j=1 so on?
how could there ever be i=0 j=1?
Diego Mayer
@Chrono79
Jun 20 2017 04:23
@Betanya i is initialized only once
and j starts as o each time the outer loop runs
i:0 j:0,1
i:1 j:0,1
i:2 j:0,1,2
Bethany Roberts
@Betanya
Jun 20 2017 04:26
@Chrono79 ok! I already did lol it's just that the for loop has really "thrown me for a loop"
Diego Mayer
@Chrono79
Jun 20 2017 04:26
@vik555 you don't need 2 conditions, if it isn't the first one, it's the other case
you could use replace instead of arrays too
vik555
@vik555
Jun 20 2017 04:30

js: function myReplace(str, before, after) {

var arr= str.split(' ');
var newaftU= after.charAt(0).toUpperCase()+after.slice(1);
var newaftL=after.charAt(0).toLowerCase()+after.slice(1);

if (before[0]===before[0].toLowerCase()) {

arr.splice(arr.indexOf(before),1, newaftL);

}

else if (before[0]===before[0].toUpperCase()) {

arr.splice(arr.indexOf(before),1,newaftU);

}

return arr.join(' ');
}
thanks @Chrono79

CamperBot
@camperbot
Jun 20 2017 04:30
vik555 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4346 | @chrono79 |http://www.freecodecamp.com/chrono79
James Patrick Kerrane
@jamesjpk123
Jun 20 2017 04:30
In my code,
function abTest(a, b) {
// Only change code below this line
if (a === 0 || b === 0) {
return undefined;
}
I am trying to make it that if a = 0 or if b = 0, then it will return with undefined. For some reason, this code doesn't return anything! Can someone help me?
vik555
@vik555
Jun 20 2017 04:30
thanks @Chrono79
CamperBot
@camperbot
Jun 20 2017 04:30
vik555 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:warning: vik555 already gave chrono79 points
James Patrick Kerrane
@jamesjpk123
Jun 20 2017 04:31
:point_up: June 19, 2017 10:30 PM I am on the challenge Return Early Pattern for Functions
Bethany Roberts
@Betanya
Jun 20 2017 04:31
@Chrono79 Bc for (var j=0; j < arr[i].length; j++) will continue going until the j is bigger than the array length, but then what causes the i to start running again after that point?
Diego Mayer
@Chrono79
Jun 20 2017 04:32
@jamesjpk123 read the instructions again, that code is missing a } too
Shivam Mishra
@codifiedzio
Jun 20 2017 04:33
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
how to perform this ??
Diego Mayer
@Chrono79
Jun 20 2017 04:34
@Betanya
for (...) {
  for (...) {
  } //end of the inner loop, it continues with the rest
 //from here it goes to the next iteration of the outer loop
}
Mukul Agrawal
@mukul09
Jun 20 2017 04:35
@Betanya use .push() method to insert the number at the end of the array and .shift() method to remove the 1st element from the array
Ogundele Olumide
@Lumexralph
Jun 20 2017 04:35
@codifiedzio you need 2 array methods, how can you add a value to the end of an array?
Shivam Mishra
@codifiedzio
Jun 20 2017 04:36
@Lumexralph using .push() method..
Bethany Roberts
@Betanya
Jun 20 2017 04:36
@Chrono79 So its just the order it goes?
James Patrick Kerrane
@jamesjpk123
Jun 20 2017 04:36
@Chrono79 I made it so it was like
return abTest === undefined; but it still doesn't work
Ogundele Olumide
@Lumexralph
Jun 20 2017 04:37
@codifiedzio yes, push item into arr
Diego Mayer
@Chrono79
Jun 20 2017 04:37
@Betanya yes
Ogundele Olumide
@Lumexralph
Jun 20 2017 04:37
@codifiedzio how can you remove the first element in an array?
Bethany Roberts
@Betanya
Jun 20 2017 04:37
@Chrono79 Thank you for all your help, I've spent ~2 hours on this :P!!
CamperBot
@camperbot
Jun 20 2017 04:37
betanya sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4347 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Jun 20 2017 04:38
@jamesjpk123 if it is Return Early Pattern for Functions, it says:
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.
Shivam Mishra
@codifiedzio
Jun 20 2017 04:38
@Lumexralph using .pop()
Diego Mayer
@Chrono79
Jun 20 2017 04:38
not equal 0
James Patrick Kerrane
@jamesjpk123
Jun 20 2017 04:38
Ohh @Chrono79 thanks!
CamperBot
@camperbot
Jun 20 2017 04:38
jamesjpk123 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4348 | @chrono79 |http://www.freecodecamp.com/chrono79
Ogundele Olumide
@Lumexralph
Jun 20 2017 04:39
@codifiedzio nope, pop removes the last element
Shivam Mishra
@codifiedzio
Jun 20 2017 04:39
@Lumexralph then ??
Ogundele Olumide
@Lumexralph
Jun 20 2017 04:40
@codifiedzio shift
Shivam Mishra
@codifiedzio
Jun 20 2017 04:41
@Lumexralph can you tell me the syntax for this ??
Ogundele Olumide
@Lumexralph
Jun 20 2017 04:43
@codifiedzio array.shift();
mrgrizzlie33
@mrgrizzlie33
Jun 20 2017 04:47
any reason this shouldnt be working?

// Setup
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};

// Only change code below this line;

var playerNumber = testObj[16]; // Change this Line
var player = playerNumber;

Requirements: playerNumber should be a number
The variable player should be a string
The value of player should be "Montana"
You should use bracket notation to access testObj
You should be using the variable playerNumber in your bracket notation
BlackTiger
@BlackTigerRoar
Jun 20 2017 04:48
@mrgrizzlie33 you are getting value from testObj index 16
J. Cardenas
@ewrjontan
Jun 20 2017 04:48
I've got a question about the smallest common multiple problem
BlackTiger
@BlackTigerRoar
Jun 20 2017 04:48
@mrgrizzlie33 try this... testObj["16"]
J. Cardenas
@ewrjontan
Jun 20 2017 04:49
My code works, however such large numbers have to be generated
is there a way to complete the challenge without a bunch of for-loops and crashing my browser?
here is a jsfiddle of my code
mrgrizzlie33
@mrgrizzlie33
Jun 20 2017 04:51
@ShenyuSun Ok I will but why should I have to put 16 in quotes?
@ShenyuSun No luck
BlackTiger
@BlackTigerRoar
Jun 20 2017 04:52
@mrgrizzlie33 I read your question again, and then I answered it wrong. "playerNumber should be a number"
Paul Christian L. Catoera
@poncatoera
Jun 20 2017 04:52
```
BlackTiger
@BlackTigerRoar
Jun 20 2017 04:52
@mrgrizzlie33 You have testObj[16], which is not a number.
Paul Christian L. Catoera
@poncatoera
Jun 20 2017 04:52

function destroyer(arr) {
  // Remove all the values
  for(var i = 1; i < arguments.length - 1; i++) {
    for (var j = 0; j < arguments[0].length; j++) {
      if (arguments[i] == arguments[0][j]) {
        arguments[0].splice(j, 1);
      }
    }

  } return arguments[0];
}

destroyer([1, 3, 3, 1, 2, 3], 2, 3);
can anybody give their thoughts on my code?
mrgrizzlie33
@mrgrizzlie33
Jun 20 2017 04:52
@ShenyuSun Oh. But it still didn't work.
BlackTiger
@BlackTigerRoar
Jun 20 2017 04:54
@mrgrizzlie33 which challenage?
mrgrizzlie33
@mrgrizzlie33
Jun 20 2017 04:55
@ShenyuSun 202, titled "Accessing Objects Properties with Variables"
BlackTiger
@BlackTigerRoar
Jun 20 2017 04:56
@mrgrizzlie33 you should assign number to your playerNumber, and then use bracket notation to access testObj, so it looks like var player = testObj[something];
mrgrizzlie33
@mrgrizzlie33
Jun 20 2017 04:57
@ShenyuSun Got it solved, thanks.
BlackTiger
@BlackTigerRoar
Jun 20 2017 04:57
@mrgrizzlie33 That should help you pass that. if it still not working, then post what you have, and then we'll make it work.
CamperBot
@camperbot
Jun 20 2017 04:57
mrgrizzlie33 sends brownie points to @shenyusun :sparkles: :thumbsup: :sparkles:
:cookie: 223 | @shenyusun |http://www.freecodecamp.com/shenyusun
BlackTiger
@BlackTigerRoar
Jun 20 2017 04:58
@mrgrizzlie33 awesome. you are welcome.
Paul Christian L. Catoera
@poncatoera
Jun 20 2017 04:59

function destroyer(arr) {
  // Remove all the values
  var b = [];
  for(var i = 1; i < arguments.length; i++) {
    for (var j = 0; j < arguments[0].length; j++) {
      if (arguments[i] == arguments[0][j]) {
        arguments[0].splice(j, 1);
      }
    }

  } return arguments[0];
}

destroyer([3, 5, 1, 2, 2, 4, 5, 6], 2, 3, 5);
can anybody help me with seek and destroy task?
Markus Ivancsics
@ivancsicsmarkus
Jun 20 2017 05:01
@poncatoera
function destroyer(arr) {
  var args = Array.prototype.slice.call(arguments);
  args.splice(0, 1);
  return arr.filter(function(element) {
    return args.indexOf(element) === -1;
  });
}
Paul Christian L. Catoera
@poncatoera
Jun 20 2017 05:04
@ivancsicsmarkus why doesnt my code work?
Markus Ivancsics
@ivancsicsmarkus
Jun 20 2017 05:08
@poncatoera Because there can be duplicates of that item.
@poncatoera You only splice out 2 once, but it occurs two times. :/
Paul Christian L. Catoera
@poncatoera
Jun 20 2017 05:10
@ivancsicsmarkus doesnt it loop and splice again the 2nd 2?
Riyaz
@riyazcool
Jun 20 2017 05:10
1.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).
what should i do for above case
abraham anak agung
@padunk
Jun 20 2017 05:11
@poncatoera don't use splice, it will change your origginal array and messed up the loop
Markus Ivancsics
@ivancsicsmarkus
Jun 20 2017 05:12
@poncatoera Not really.
Paul Christian L. Catoera
@poncatoera
Jun 20 2017 05:14
@padunk @ivancsicsmarkus okay thanks
CamperBot
@camperbot
Jun 20 2017 05:14
poncatoera sends brownie points to @padunk and @ivancsicsmarkus :sparkles: :thumbsup: :sparkles:
:cookie: 349 | @padunk |http://www.freecodecamp.com/padunk
:cookie: 628 | @ivancsicsmarkus |http://www.freecodecamp.com/ivancsicsmarkus
Riyaz
@riyazcool
Jun 20 2017 05:21
alt
Markus Ivancsics
@ivancsicsmarkus
Jun 20 2017 05:21
@riyazcool hah?
Riyaz
@riyazcool
Jun 20 2017 05:23
@ivancsicsmarkus 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).
i am confused with this
Markus Ivancsics
@ivancsicsmarkus
Jun 20 2017 05:24
@riyazcool You should just return a sentense using the functions variables.
Aditya Agarwal
@adyagar
Jun 20 2017 05:24
Guys, for reversing a string, how's this wrong?
function reverseString(str) {
var y,a;
for(var i=0;i<str.length/2;i++)
{
t=str[i];
str[i]=str[str.length-i-1];
str[str.length-i-1]=t;
}
return str;
}
reverseString("hello");
a7n007
@a7n007
Jun 20 2017 05:25

function titleCase(str) {
var a=str.split('');
for(var i=0;i<a.length;i++)
{
for(var j=0;j<a[i].length;j++)
{
if(j==0)
a[i][j].toUpperCase();
else
a[i][j].toLowerCase();
}
}
str=a.join('');
return str;
}

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

Markus Ivancsics
@ivancsicsmarkus
Jun 20 2017 05:25
@riyazcool wordBlanks("dog", "big", "ran", "quickly"); should return all the words by some order...
BlackTiger
@BlackTigerRoar
Jun 20 2017 05:26
@adyagar Are you reverse 'hello' to 'olleh'? If so , I don't think you need str.length/2
a7n007
@a7n007
Jun 20 2017 05:27
yes he needs to do it
Aditya Agarwal
@adyagar
Jun 20 2017 05:28
@ShenyuSun Yes, I am to reverse hello to olleh. If not str.length/2, then what should be done?
BlackTiger
@BlackTigerRoar
Jun 20 2017 05:33
@adyagar You are reversing from the very end of index. Index starts from 0. The word 'hello' have length 5, but last index is 4
@adyagar so instead of i<str.length/2 , it should be var i = str.length - 1
@adyagar You are counting down from highest index to lowest one.
shankarkdhanaraj
@shankarkdhanaraj
Jun 20 2017 05:36
@adyagar try converting the string to array of characters and reversing that and converting back to string
BlackTiger
@BlackTigerRoar
Jun 20 2017 05:37
@adyagar If you look the helpful links, it recommended you to use the 3 function to do it. You can use split method, reverse method, and then join method to achieve this as well.
SIRIUScoder1
@SIRIUScoder1
Jun 20 2017 05:37
Can anybody help me with Escape
BlackTiger
@BlackTigerRoar
Jun 20 2017 05:37
@adyagar However, I had a job interview that the interviewer asked me to do reverse string without using any function.
Avery Biskup
@fraknard
Jun 20 2017 05:37
https://fraknard.github.io/portfolio/ is this over the top with transform just for a simple portfolio??
SIRIUScoder1
@SIRIUScoder1
Jun 20 2017 05:37
Can anybody help me with Escape sequences in Strings exercise
var myStr = "FirstLine\r\SecondLine\ThirdLine\n"; // Change this line
shankarkdhanaraj
@shankarkdhanaraj
Jun 20 2017 05:38
for the intermediate algorithmic scripting - Boo Hoo - finding if a passed value is boolean primitive or not, the helpful link points to boolean objects....i used typeof operator to detect if something is boolean or not....is there any other way?
BlackTiger
@BlackTigerRoar
Jun 20 2017 05:38
@SIRIUScoder1 What's your question
@SIRIUScoder1 First sentence is a new line
@SIRIUScoder1 Code Output
\' single quote
\" double quote
\ backslash
\n newline
\r carriage return
\t tab
\b backspace
\f form feed
SIRIUScoder1
@SIRIUScoder1
Jun 20 2017 05:39
Ok i try once
Aditya Agarwal
@adyagar
Jun 20 2017 05:41
@ShenyuSun If I do i<Str.length-1, I would end up reversing the string and then re reversing it back to the original, won't I?
BlackTiger
@BlackTigerRoar
Jun 20 2017 05:42
@fraknard it's i = str.length-1
i is your counter, you are counting from the highest index
from hello to olleh, you are outputing str[4], str[3], str[2], str[1], str[0]
i = str.length - 1, that gave you 4 to start from the highest index
SIRIUScoder1
@SIRIUScoder1
Jun 20 2017 05:44
var myStr = "FirstLine\n\SecondLine\ThirdLine\r"; // Change this line
Still showing error
BlackTiger
@BlackTigerRoar
Jun 20 2017 05:44
Second line is backslash
@SIRIUScoder1 you need to escape your backslash
kumquatfelafel
@kumquatfelafel
Jun 20 2017 05:45
@SIRIUScoder1 ^this. In order to get backslash you need "\\"
SIRIUScoder1
@SIRIUScoder1
Jun 20 2017 05:46
var myStr = "FirstLine\n\SecondLine\ThirdLine\r";
BlackTiger
@BlackTigerRoar
Jun 20 2017 05:46
@SIRIUScoder1 how do you escape backslash? Check the table in your question, or the table I pasted earlier.
SIRIUScoder1
@SIRIUScoder1
Jun 20 2017 05:46
I wrote this
BlackTiger
@BlackTigerRoar
Jun 20 2017 05:46
\ to escape backslash
SIRIUScoder1
@SIRIUScoder1
Jun 20 2017 05:46
Actually i am putting two backslashes only
BlackTiger
@BlackTigerRoar
Jun 20 2017 05:47
\ \
kumquatfelafel
@kumquatfelafel
Jun 20 2017 05:47
Also, your \r appears to be in wrong place
iirc
a7n007
@a7n007
Jun 20 2017 05:47

function titleCase(str) {
var a=str.split('');
for(var i=0;i<a.length;i++)
{
for(var j=0;j<a[i].length;j++)
{
if(j==0)
a[i][j].toUpperCase();
else
a[i][j].toLowerCase();
}
}
str=a.join('');
return str;
}

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

please help
anyone
please
BlackTiger
@BlackTigerRoar
Jun 20 2017 05:47
@SIRIUScoder1 between secondline and thirline, there's carriage return
SIRIUScoder1
@SIRIUScoder1
Jun 20 2017 05:47
Can anyone put the sample code for my problem?
a7n007
@a7n007
Jun 20 2017 05:48
stuck with same problem from yesterday
cjscode
@cjscode
Jun 20 2017 05:48
I'm having some trouble with the simple celsius to fahrenheit conversion

function convertToF(celsius) {
  var fahrenheit;
  // Only change code below this line
  fahrenheit = 9/5 + 32;

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

// Change the inputs below to test your code
convertToF(30);
SIRIUScoder1
@SIRIUScoder1
Jun 20 2017 05:48
@ShenyuSun
@ShenyuSun Thank u very much it worked
CamperBot
@camperbot
Jun 20 2017 05:49
:cookie: 228 | @shenyusun |http://www.freecodecamp.com/shenyusun
siriuscoder1 sends brownie points to @shenyusun :sparkles: :thumbsup: :sparkles:
BlackTiger
@BlackTigerRoar
Jun 20 2017 05:49
@SIRIUScoder1 sweet!
Kelvin Hernandez
@Yuriah
Jun 20 2017 05:49
@a7n007 are you trying to make every first letter uppercase?
Aditya Agarwal
@adyagar
Jun 20 2017 05:50
@cjscode It must be 9/5*celsius.
cjscode
@cjscode
Jun 20 2017 05:50
ah I didn't read the directions completely
thanks @adyagar
thanks @adyagar
CamperBot
@camperbot
Jun 20 2017 05:51
cjscode sends brownie points to @adyagar :sparkles: :thumbsup: :sparkles:
Aditya Agarwal
@adyagar
Jun 20 2017 05:51
9/5*C+32 essentially.
CamperBot
@camperbot
Jun 20 2017 05:51
:cookie: 240 | @adyagar |http://www.freecodecamp.com/adyagar
Aditya Agarwal
@adyagar
Jun 20 2017 05:51
Haha happens. Good luck! :smile:
CamperBot
@camperbot
Jun 20 2017 05:51
cjscode sends brownie points to @adyagar :sparkles: :thumbsup: :sparkles:
:warning: cjscode already gave adyagar points
Kelvin Hernandez
@Yuriah
Jun 20 2017 05:52
kinda weird using ur phone for this
alex shyaka
@shyakaster
Jun 20 2017 05:53
Hello guys. How can this be wrong var myStr="FirstLine\n\SecondLine\\rThirdline"; // Change this line
Sorry let me send it again var myStr="FirstLine\n\SecondLine\\rThirdline";
BlackTiger
@BlackTigerRoar
Jun 20 2017 05:53
@shyakaster you have wrong escape for backslash
abraham anak agung
@padunk
Jun 20 2017 05:53
@shyakaster backlash need \\
cjscode
@cjscode
Jun 20 2017 05:54
```
a7n007
@a7n007
Jun 20 2017 05:54

function titleCase(str) {
var a=str.split('');
for(var i=0;i<a.length;i++)
{
var x=a[i].split('');
for(var j=0;j<x.length;j++)
{
if(j===0)
x[j].toUpperCase();
else
x[j].toLowerCase();
}
a[i]=x.join('');
}
str=a.join('');
return str;
}

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

alex shyaka
@shyakaster
Jun 20 2017 05:54
var myStr="FirstLine\n\SecondLine\\rThirdline";
cjscode
@cjscode
Jun 20 2017 05:55

// Example
var firstName = "Alan";
var lastName = "Turing";

// Only change code below this line
myFirstName = "Cj";
myLastName = "Codes";
So, when declaring a variable in javascript, do you always have to put var in front of it? When is it appropriate to not put var
kumquatfelafel
@kumquatfelafel
Jun 20 2017 05:55
@shyakaster Unfortunately, things get a little ugly on here since \ treated as escape in "". Your "l" in ThirdLine should be upper
alex shyaka
@shyakaster
Jun 20 2017 05:55
Its there in the code I wonder why it is removed when I post it here
cjscode
@cjscode
Jun 20 2017 05:55
The solution is accepted without var, I just wonder if and when I should be using that
abraham anak agung
@padunk
Jun 20 2017 05:56
@cjscode you need to put var for variable. Or the computer will return your variable is undefined
alex shyaka
@shyakaster
Jun 20 2017 05:56
@kumquatfelafel thanks alot I was starting to doubt my abiities .hahaha. Thanks alot
CamperBot
@camperbot
Jun 20 2017 05:56
shyakaster sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 150 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
Kelvin Hernandez
@Yuriah
Jun 20 2017 05:57
var a = str.split (" "); //Put a space inside the quotes to split the "str" into words. Essentially, ull run a for-loop on a [0].toUpperCase ();
cjscode
@cjscode
Jun 20 2017 05:57
Thanks @padunk I just googled my question and found that without using 'var', you create a global variable
CamperBot
@camperbot
Jun 20 2017 05:57
cjscode sends brownie points to @padunk :sparkles: :thumbsup: :sparkles:
:cookie: 350 | @padunk |http://www.freecodecamp.com/padunk
alex shyaka
@shyakaster
Jun 20 2017 05:58
How do I send brownie points
kumquatfelafel
@kumquatfelafel
Jun 20 2017 05:59
@[insert name here] thanks
alex shyaka
@shyakaster
Jun 20 2017 05:59
@kumquatfelafel
Kelvin Hernandez
@Yuriah
Jun 20 2017 05:59
@a7n007
kumquatfelafel
@kumquatfelafel
Jun 20 2017 06:00
@shyakaster thanks. e.g.
CamperBot
@camperbot
Jun 20 2017 06:00
:cookie: 145 | @shyakaster |http://www.freecodecamp.com/shyakaster
kumquatfelafel sends brownie points to @shyakaster :sparkles: :thumbsup: :sparkles:
alex shyaka
@shyakaster
Jun 20 2017 06:00
OK I get it @kumquatfelafel , I just need to insert name. Sorry just getting used to this. I will catch up
Kelvin Hernandez
@Yuriah
Jun 20 2017 06:02
@a7n007
VinayVijayJoshi
@VinayVijayJoshi
Jun 20 2017 06:03
hi, I am in 'Wherefore art thou' challenge. I am unable to understand how to proceed.. Need help
Kelvin Hernandez
@Yuriah
Jun 20 2017 06:04
post a snippet of your problem
Maks Ushakov
@maks-ushakov
Jun 20 2017 06:09
@VinayVijayJoshi , do you figure out what you need to return?
VinayVijayJoshi
@VinayVijayJoshi
Jun 20 2017 06:11

@maks-ushakov yes, I know what I need to return..Below is what I am trying, but I am getting nothing in console..

function whatIsInAName(collection, source) {
  // What's in a name?
  var arr = [];
  // Only change code below this line
  var sourceKey = Object.keys(source);
  console.log = ("!!! " + sourceKey);

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


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

I am assuming that console should spit out value of Key 'last' i.e. "Capulet"

@maks-ushakov , I just corrected my console.log statement
@maks-ushakov my corrected code below

function whatIsInAName(collection, source) {
  // What's in a name?
  var arr = [];
  // Only change code below this line
  var sourceKey = Object.keys(source);
  console.log("!!! " + sourceKey);

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


whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
cjscode
@cjscode
Jun 20 2017 06:13
var myStr = "FirstLine \n \\ SecondLine \\ \r ThirdLine"; // Change this line
I can't quite figure out how to get the \ to display
How do I escape a backslash?
abraham anak agung
@padunk
Jun 20 2017 06:14
@cjscode no spaces, delete it
VinayVijayJoshi
@VinayVijayJoshi
Jun 20 2017 06:14
@maks-ushakov etting error 'console.log is not a funciton'
cjscode
@cjscode
Jun 20 2017 06:15
Ah they didn't really make that clear
oh shit
they did
abraham anak agung
@padunk
Jun 20 2017 06:15
@VinayVijayJoshi don't use + use ,
Emin Tavlayan
@emintavlayan
Jun 20 2017 06:15
hi there. i am stuck in the "profile lookup" challenge.
cjscode
@cjscode
Jun 20 2017 06:15
myStr should have encoded text with the proper escape sequences and /no spacing/
VinayVijayJoshi
@VinayVijayJoshi
Jun 20 2017 06:15
@padunk let me try
cjscode
@cjscode
Jun 20 2017 06:15
thanks @padunk
CamperBot
@camperbot
Jun 20 2017 06:15
cjscode sends brownie points to @padunk :sparkles: :thumbsup: :sparkles:
:warning: cjscode already gave padunk points
Maks Ushakov
@maks-ushakov
Jun 20 2017 06:15
@VinayVijayJoshi try to use real console or repl.it
Emin Tavlayan
@emintavlayan
Jun 20 2017 06:17

hi there. i am stuck in the "profile lookup" challenge. 'function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i < contacts.length ; i++){

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

  if (contacts[i].j == prop) {
    return contacts[i].j;

  } else {
    return "No such property";
  }


} else {
  return "No such contact";
}

}
// Only change code above this line
}

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

VinayVijayJoshi
@VinayVijayJoshi
Jun 20 2017 06:18
@maks-ushakov do not know how to use repl.it
BlackTiger
@BlackTigerRoar
Jun 20 2017 06:18
@emintavlayan I had the problem. Just resolved it. Happy to help.
VinayVijayJoshi
@VinayVijayJoshi
Jun 20 2017 06:18
@VinayVijayJoshi till now merrily used console.log to debug and it always worked..
Maks Ushakov
@maks-ushakov
Jun 20 2017 06:19
@VinayVijayJoshi
https://repl.it/languages/javascript
type your script then click to Run button
Emin Tavlayan
@emintavlayan
Jun 20 2017 06:19
@ShenyuSun thank you. cant access the objects properties
CamperBot
@camperbot
Jun 20 2017 06:19
emintavlayan sends brownie points to @shenyusun :sparkles: :thumbsup: :sparkles:
:cookie: 232 | @shenyusun |http://www.freecodecamp.com/shenyusun
jeffmcruz
@jeffmcruz
Jun 20 2017 06:19
so im working on var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>"; and need to remove the backslashes with single and double qoutesa and am completely stuck, any takers? will be paid with "e-highfive"
BlackTiger
@BlackTigerRoar
Jun 20 2017 06:20
@emintavlayan I am not sure why you have contacts[i].j
@emintavlayan any reason that you used .j ?
Emin Tavlayan
@emintavlayan
Jun 20 2017 06:20
sorry thats a wrong copy paste :).
VinayVijayJoshi
@VinayVijayJoshi
Jun 20 2017 06:20
@maks-ushakov below is my script. no output
https://repl.it/ItHx/0
Emin Tavlayan
@emintavlayan
Jun 20 2017 06:21

@ShenyuSun 'function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i < contacts.length ; i++){

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

  if (contacts[i].prop) {
    return contacts[i].prop;

  } else {
    return "No such property";
  }


} else {
  return "No such contact";
}

}
// Only change code above this line
}'

@ShenyuSun that is what i tried
Maks Ushakov
@maks-ushakov
Jun 20 2017 06:22
@VinayVijayJoshi
Native Browser JavaScript

!!!  [ 'last' ]
BlackTiger
@BlackTigerRoar
Jun 20 2017 06:22
@emintavlayan so you need the method to see if prop is existed or not
@emintavlayan remember the method 'hasOwnProperty' ?
Emin Tavlayan
@emintavlayan
Jun 20 2017 06:22
@ShenyuSun oh yessssss. i go check it out
@ShenyuSun thanks tiger
CamperBot
@camperbot
Jun 20 2017 06:23
emintavlayan sends brownie points to @shenyusun :sparkles: :thumbsup: :sparkles:
:warning: emintavlayan already gave shenyusun points
jeffmcruz
@jeffmcruz
Jun 20 2017 06:23
anyone? Bueller?
VinayVijayJoshi
@VinayVijayJoshi
Jun 20 2017 06:24
@maks-ushakov it is hung trying to run my previous code
BlackTiger
@BlackTigerRoar
Jun 20 2017 06:24
@emintavlayan roar roar~
abraham anak agung
@padunk
Jun 20 2017 06:25
@jeffmcruz just delete \
Greg Duncan
@GregatGit
Jun 20 2017 06:26
@jeffmcruz enclose myStr with ' not "
@jeffmcruz var myStr = '<a href=\"http://www.example.com\" target=\"_blank\">Link</a>';
jeffmcruz
@jeffmcruz
Jun 20 2017 06:27
@GregatGit perf thank you
CamperBot
@camperbot
Jun 20 2017 06:27
jeffmcruz sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 867 | @gregatgit |http://www.freecodecamp.com/gregatgit
Maks Ushakov
@maks-ushakov
Jun 20 2017 06:28

it is hung trying to run my previous code

Hmm your code works and show right key. Make another part of your code

VinayVijayJoshi
@VinayVijayJoshi
Jun 20 2017 06:28
@maks-ushakov ok, let me try