These are chat archives for FreeCodeCamp/HelpJavaScript

5th
Nov 2016
Walid Ashri
@walidashri
Nov 05 2016 00:09
@c0d0er u still have problem?
Conor Murphy
@cmurphy580
Nov 05 2016 00:20
Trying to convert unixtime to human time. Anyone see a way to help with this?
var unixTime = Math.floor(Date.now() / 1000);
       var myDate = newDate(unixTime*1000);
       var humanTime = moment(myDate).format("DD-MM-YYYY HH:mm:ss");
       console.log(humanTime);
Alexander Køpke
@alexanderkopke
Nov 05 2016 00:38
@cmurphy580 new Date not newDate
Logan Sinclair
@LoganS1
Nov 05 2016 00:44
Could someone help me with using escaped characters
Conor Murphy
@cmurphy580
Nov 05 2016 00:45
@alexanderkopke i've tried that still didn't work. switched it to this and still not working.
var humanTime = moment(Date.now()).format("DD-MM-YYYY HH:mm:ss");
       console.log(humanTime);
Logan Sinclair
@LoganS1
Nov 05 2016 00:45

Here is my code

var myStr = 'FirstLine \n \\SecondLine\\ \r ThirdLine'; // Change this line

And I am on the lesson:
Escape Sequences in Strings

Walid Ashri
@walidashri
Nov 05 2016 00:46
@LoganS1 no spaces
Logan Sinclair
@LoganS1
Nov 05 2016 00:46
Also @cmurphy580 you have too many () after Date.now... At least that is what I believe as I have not gotten that far yet
taipo1
@taipo1
Nov 05 2016 00:47
Can some1 help me figure out why my li wont turn green when clicked
Logan Sinclair
@LoganS1
Nov 05 2016 00:47
@walidashri I will try it without spaces let me see
@walidashri That was it! Thanks @walidashri !
CamperBot
@camperbot
Nov 05 2016 00:47
logans1 sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 574 | @walidashri |http://www.freecodecamp.com/walidashri
Walid Ashri
@walidashri
Nov 05 2016 00:48
@taipo1 you have no JQuery :)
taipo1
@taipo1
Nov 05 2016 00:48
doesnt work when i do have jquery either :smile:
Alexander Køpke
@alexanderkopke
Nov 05 2016 00:48
@cmurphy580 I just tried your code and it outputs this: "05-11-2016 01:46:55". I'm in Denmark
shannon guimaraes
@shannonguimaraes
Nov 05 2016 00:48
can anyone help me understand the in line challenge
taipo1
@taipo1
Nov 05 2016 00:49
but there aint any error in the jquery itself i think @walidashri
Walid Ashri
@walidashri
Nov 05 2016 00:50
@taipo1 u have to add it in the settings
Alexander Køpke
@alexanderkopke
Nov 05 2016 00:50
@cmurphy580 sorry if silly question. You are using the moment.js file? Because if you aren't then it would explain why it won't work.
help please
CamperBot
@camperbot
Nov 05 2016 00:50
no wiki entry for: please
Walid Ashri
@walidashri
Nov 05 2016 00:51
@shannonguimaraes u need to add item to arr then remove first element in arr and return this element
shannon guimaraes
@shannonguimaraes
Nov 05 2016 00:53
how can i do that? adding pop and push
Walid Ashri
@walidashri
Nov 05 2016 00:54
@shannonguimaraes push is ok pop removes from end we need the one removes from the start
amandahogan
@amandahogan
Nov 05 2016 00:54
@walid ashri I'm stuck as well can you check my code?
shannon guimaraes
@shannonguimaraes
Nov 05 2016 00:54
shift
amandahogan
@amandahogan
Nov 05 2016 00:54
function nextInLine(arr, item) {
// Your code here
testArr.push(item);
arr = testArr.shift(testArr[0]);
return arr; // Change this line
}
Walid Ashri
@walidashri
Nov 05 2016 00:55
@amandahogan we deal with function args arr and item not testArr
@shannonguimaraes :+1: @amandahogan gave u many hints
Manish Giri
@Manish-Giri
Nov 05 2016 00:56
@amandahogan .shift() doesn’t take any parameters
Walid Ashri
@walidashri
Nov 05 2016 00:56
@amandahogan shift() takes no args
Manish Giri
@Manish-Giri
Nov 05 2016 00:57
@amandahogan and you need to work with the array arr, not testArr
amandahogan
@amandahogan
Nov 05 2016 00:57
arr.push(item);
arr.shift();
return arr[0]; // Change this line
}
still doesn't seem to work, sorry guys been quite blocked on this
Manish Giri
@Manish-Giri
Nov 05 2016 00:58
@amandahogan you’re almost there, look at what you’re returning though
Alexander Køpke
@alexanderkopke
Nov 05 2016 00:58
@amandahogan shift doesn't change the array, if I recall correctly. You can store the return value of the shift method in a variable and return that variable
Manish Giri
@Manish-Giri
Nov 05 2016 00:58
@amandahogan you need to return the first item that was removed by using .shift()
Walid Ashri
@walidashri
Nov 05 2016 00:58
@amandahogan no we need to return the item that already been shifted not the arr 1st elem
SergeantCyrano
@SergeantCyrano
Nov 05 2016 00:59
Anyone got any insights into the pallindrome challenge?
amandahogan
@amandahogan
Nov 05 2016 01:00
Thanks everyone! got it!
Walid Ashri
@walidashri
Nov 05 2016 01:00
@amandahogan :+1:
SergeantCyrano
@SergeantCyrano
Nov 05 2016 01:00
I'm getting jammed by string immutability and invalid functions.
Alexander Køpke
@alexanderkopke
Nov 05 2016 01:00
excellent
Conor Murphy
@cmurphy580
Nov 05 2016 01:00
@alexanderkopke Yep. I"m not getting it work. Did you do anything differently then what i did
Joseph
@revisualize
Nov 05 2016 01:00
Hey hey.
I r on :bus:
LOL
Alexander Køpke
@alexanderkopke
Nov 05 2016 01:01
@cmurphy580 I tested it on jsbin, added the moment library and ran your code. But I don't know what you did tho
Conor Murphy
@cmurphy580
Nov 05 2016 01:02
@alexanderkopke I'm doing this in code.io i don't know if that makes any difference
Alexander Køpke
@alexanderkopke
Nov 05 2016 01:02
link?
Walid Ashri
@walidashri
Nov 05 2016 01:02
@SergeantCyrano try splitting the str
Alexander Køpke
@alexanderkopke
Nov 05 2016 01:03
@cmurphy580 you mean codepen? I will try it there now.. brb
SergeantCyrano
@SergeantCyrano
Nov 05 2016 01:05
@walidashri , I'm trying to split, replace, reverse, compare to original string value to determine boolean. None of my functions are working and I can't convert the string to an arry to manipulate it.
Walid Ashri
@walidashri
Nov 05 2016 01:06
@SergeantCyrano split gives u array from the string
SergeantCyrano
@SergeantCyrano
Nov 05 2016 01:06
Its saying str is undefined.
Deepak8717
@Deepak8717
Nov 05 2016 01:06

Hi
My challenge name is "Understand String Immutability"
In JavaScript, String values are immutable, which means that they cannot be altered once created.

For example, the following code:

var myStr = "Bob";
myStr[0] = "J";

cannot change the value of myStr to "Job", because the contents of myStr cannot be altered. Note that this does not mean that myStr cannot be changed, just that the individual characters of a string literal cannot be changed. The only way to change myStr would be to assign it with a new string, like this:

var myStr = "Bob";
myStr = "Job";

Now i am getting error in my code.

// Setup
var myStr = "Jello World";

// Only change code below this line
 myStr = "Hello world" ;
myStr[0] = ""; // Fix Me
CamperBot
@camperbot
Nov 05 2016 01:06

welcome to FreeCodeCamp @Deepak8717!

Walid Ashri
@walidashri
Nov 05 2016 01:06
@SergeantCyrano show ur code Please
Conor Murphy
@cmurphy580
Nov 05 2016 01:07
@alexanderkopke alright i got it to work using this,
 var unixTime = Math.floor(Date.now() / 1000);
      //Convert unixTime to humanTime
       var humanTime = new Date(unixTime * 1000);
Walid Ashri
@walidashri
Nov 05 2016 01:08
@Deepak8717 try capitalize world
Conor Murphy
@cmurphy580
Nov 05 2016 01:08
blob
SergeantCyrano
@SergeantCyrano
Nov 05 2016 01:08
I've reset it four times, just to clear my head.
Alexander Køpke
@alexanderkopke
Nov 05 2016 01:08
Conor Murphy
@cmurphy580
Nov 05 2016 01:08
@alexanderkopke it produces this , is there a way i can clean that up (see above)
Walid Ashri
@walidashri
Nov 05 2016 01:09
@SergeantCyrano u need to join before compare
Deepak8717
@Deepak8717
Nov 05 2016 01:11
@walidashri still getting the same error "TypeError: 0 is read-only"
SergeantCyrano
@SergeantCyrano
Nov 05 2016 01:11
function palindrome(str) {
// Good luck!
var result = str;{
result.split();
result.reverse();
result.join();
}
if (str === result);{
return true;}
else;
return false;
}
Conor Murphy
@cmurphy580
Nov 05 2016 01:11
@alexanderkopke Alright Thank you for the help!
CamperBot
@camperbot
Nov 05 2016 01:11
cmurphy580 sends brownie points to @alexanderkopke :sparkles: :thumbsup: :sparkles:
:cookie: 829 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
SergeantCyrano
@SergeantCyrano
Nov 05 2016 01:11
That's a sample. none of it works.
I took a few days off for work and t feels like I lost everything I know about javascript.
Deepak8717
@Deepak8717
Nov 05 2016 01:14

Can someone help me to replace "Jello world" with "Hello world" ?

var myStr = "Jello World";

// Only change code below this line
 myStr = "Hello World" ;
myStr[0] = ""; // Fix Me

i ma getting this error = "TypeError: 0 is read-only"

c0d0er
@c0d0er
Nov 05 2016 01:16
@walidashri yes, do you have any idea to fix?
washimara
@washimara
Nov 05 2016 01:16
@Deepak8717 var myStr is a string, and your line myStr[0] is for replacing Arrays
Walid Ashri
@walidashri
Nov 05 2016 01:16
@c0d0er I see no issue
c0d0er
@c0d0er
Nov 05 2016 01:17
@walidashri but if you click the big circle several times and click next button several times, then you cannot stop the running numbers
Deepak8717
@Deepak8717
Nov 05 2016 01:17
@washimara So how can i fix this please
Walid Ashri
@walidashri
Nov 05 2016 01:18
@SergeantCyrano u have unnecessary {} after str and u need to set the result to all this steps
washimara
@washimara
Nov 05 2016 01:19
@Deepak8717 var newstr = str.replace(/Hello World/i, 'Jello World'); something like this If I remember correctly
@Deepak8717 str.replace(/Jello World/i, 'Hello World'); this way, sorry
Alexander Køpke
@alexanderkopke
Nov 05 2016 01:20
@Deepak8717 you can simply reassign a variable with anything you want. myStr = "I'm the king of the world. Wohoo!!";
Walid Ashri
@walidashri
Nov 05 2016 01:21
@c0d0er I can't get this to happen check again
c0d0er
@c0d0er
Nov 05 2016 01:21
@walidashri thanks
CamperBot
@camperbot
Nov 05 2016 01:21
c0d0er sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 576 | @walidashri |http://www.freecodecamp.com/walidashri
Mark
@raghuvir
Nov 05 2016 01:21
str.split("") first @Deepak8717 , then you can access the first letter with your array call
washimara
@washimara
Nov 05 2016 01:22
guys do you know how to fix properly this code, it doesn't recognize this code properly for some reason : https://gyazo.com/34b7f112e2114c5ec47e89790bff42f0
c0d0er
@c0d0er
Nov 05 2016 01:25
why after i click big circle start work and next button several times, then click reset button, then it cannot stop the counting time or cannot stop when the big circle pauses and cannot go back to initial page? any idea to fix? http://codepen.io/c0d0er/pen/xRKpGO?editors=0010
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:27

guys still stuck this is the code I have:function nextInLine(arr, item) {

arr = nextInLine.push();
arr=nextInLine.shift(nextInLine[0]);}
return arr;

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

Terrance
@HeroslasherX
Nov 05 2016 01:27
Hi guys I need help!!!!
Joseph
@revisualize
Nov 05 2016 01:27
Hello.
@shannonguimaraes So, you're doing function calls.
@shannonguimaraes I have some info that may be able to help.
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:28
ok
@revisualize
Joseph
@revisualize
Nov 05 2016 01:28
@shannonguimaraes Can you click this link Gist by revisualize / FreeCodeCamp - Stand in Line.js There is a lot of text.
Terrance
@HeroslasherX
Nov 05 2016 01:28

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

// Your code above this line
return result;
}

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

Joseph
@revisualize
Nov 05 2016 01:29
@HeroslasherX I have one for you as well...
Conor Murphy
@cmurphy580
Nov 05 2016 01:30

Is there anyway to re-format this time,

using this code,

Joseph
@revisualize
Nov 05 2016 01:30
@shannonguimaraes That should set you on a different path. I'd be glad to assist further...
:D
Terrance
@HeroslasherX
Nov 05 2016 01:31
@revisualize okay I'll take a look thanks!!!
CamperBot
@camperbot
Nov 05 2016 01:31
:star2: 2232 | @revisualize |http://www.freecodecamp.com/revisualize
heroslasherx sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
Conor Murphy
@cmurphy580
Nov 05 2016 01:31
blob

Is there anyway to re-format this time,

using this code,

 //Call unixTime 
       var unixTime = Math.floor(Date.now() / 1000);
      //Convert unixTime to humanTime
       var humanTime = new Date(unixTime * 1000);
       //Attach to HTML element
      $("#time").html(humanTime);
Joseph
@revisualize
Nov 05 2016 01:32
@cmurphy580 Yes. Use moment.js
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:32
@revisualize , still lost
Joseph
@revisualize
Nov 05 2016 01:32
@shannonguimaraes Okay. Do you understand parameters?
Conor Murphy
@cmurphy580
Nov 05 2016 01:32
@revisualize so I could get rid of the "gmt" change the military to standard time
Walid Ashri
@walidashri
Nov 05 2016 01:32
@washimara try putting all ur vars inside the function
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:33
not really
Joseph
@revisualize
Nov 05 2016 01:33
@shannonguimaraes Did you read my comment about parameters?
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:33
on that link?
Joseph
@revisualize
Nov 05 2016 01:33
@shannonguimaraes Yes.
Ken Haduch
@khaduch
Nov 05 2016 01:34

@c0d0er - I think that I got this strange behavior to occur with a few clicks and then trying the reset button, which didn't stop anything. My guess is that you are not being careful enough with timer controls. I don't know why you have two timers, for one thing, but I guess that you should be able to make it work. I would try and make sure that I didn't have any possibility of multiple timers getting started under any circumstances, because if you do, then you will not be able to stop all of them.

The way that i would do this would be to make sure to initialize your value for timer1 and timer2 to null. Then, before you setInterval for a particular timer, make sure that you test for a null value. Furthermore, when you clearInterval, also clear the timer1, and/or timer2, as appropriate. In code:

var timer1 = null, timer2 = null;

// at the point where you might be ready to start a timer:
// only start one if timer1 is null.
if ( timer1 === null ) {
    timer1 = setInterval( ... );
}

// then when you are to stop the timer:

if ( timer1 !== null ) {
    clearInterval(timer1);
    timer1 = null;
}

That way, you wrap some additional control around your timer operation. You can do it with both timers. Now, I still don't know if there is a possibility that you would have both timer1 and timer2 running at the same time? I haven't really delved into the logic of your timer operations. But you could also put an additional test when you are going to work with timer2 to make sure that if timer1 is not null, then you could stop the timer and clear the variable? Same for timer2 - or you could also do some diagnostic checks to see if timer1 was running while you were trying to start a timer2 and notify yourself of that, so you would understand that that was happening.

Conor Murphy
@cmurphy580
Nov 05 2016 01:36
@revisualize i can never get moment to work.
washimara
@washimara
Nov 05 2016 01:37
@walidashri Thank you! It worked, very strange
CamperBot
@camperbot
Nov 05 2016 01:37
washimara sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 577 | @walidashri |http://www.freecodecamp.com/walidashri
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:38
@revisualize , i did but its still a little foggy
Joseph
@revisualize
Nov 05 2016 01:38
@shannonguimaraes Okay.
Nicola Scaramuzzo
@muzzotech
Nov 05 2016 01:38

OK, now I got this working for 4 - 5 scenarios but I can't get it to work with "glove"

function translatePigLatin(str) {

   var strArr = str.split("");
   var re = /^[aeiou]/i;
   var h = /^h/i;
   var l = /^l/i;
   if(str.search(re) === 0) {
      strArr.push("w", "a", "y");
    } else if (str.search(h) === 1 || str.search(l) === 1){
      var firstLetter = strArr.shift().toLowerCase();
      var secondLetter = strArr.shift().toLowerCase();
      strArr.push(firstLetter, secondLetter, "a", "y");
    } else {
      var fLetter = strArr.shift().toLowerCase();
      strArr.push(fLetter, "a", "y");
    }
    var newstr = strArr.join("");
    return newstr;
  }

translatePigLatin("glove");

It comes up with "lovegay" instead of "oveglay"

Joseph
@revisualize
Nov 05 2016 01:39
@shannonguimaraes Can we reset and start over?
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:39
sure
c0d0er
@c0d0er
Nov 05 2016 01:39
@khaduch i add console.log(3) in reset clicking event
then when i cannot reset everyting, the 3 doesnt show in the console
you can check yourself
it is very strange, but after i reset successfully, then when i click reset, the 3 100% is shown in the console, any idea?
Terrance
@HeroslasherX
Nov 05 2016 01:40
@revisualize FINALLY!!! I got it thanks for your help
CamperBot
@camperbot
Nov 05 2016 01:40
heroslasherx sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: heroslasherx already gave revisualize points
Joseph
@revisualize
Nov 05 2016 01:40

@shannonguimaraes So, here is your function...

function nextInLine(arr, item) {

    return item; // Change this line
}

What "variables" do you have access to?

Nicola Scaramuzzo
@muzzotech
Nov 05 2016 01:40
nevermind, my regex was wrong
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:40
arr and item
c0d0er
@c0d0er
Nov 05 2016 01:41
@khaduch thanks
CamperBot
@camperbot
Nov 05 2016 01:41
c0d0er sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1879 | @khaduch |http://www.freecodecamp.com/khaduch
Joseph
@revisualize
Nov 05 2016 01:41
@shannonguimaraes Great.
Now if we do this:
// Write a function nextInLine which has two paramaters 
// an array (arr) and a number (item).
function nextInLine(arr, item) {
    // Add the number to the end of the array,

    return item; // Change this line
}
@shannonguimaraes How do you add a number (item) to the end of an array (arr)?
Nicola Scaramuzzo
@muzzotech
Nov 05 2016 01:42
after fixing that, I got an ok
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:42
push
Joseph
@revisualize
Nov 05 2016 01:42
I have to specify you in bold so that other people don't try to answer the question.
@shannonguimaraes Great. Can you show me?
c0d0er
@c0d0er
Nov 05 2016 01:43
@khaduch i tried your method, still have the same issue
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:43
arr.push()
Joseph
@revisualize
Nov 05 2016 01:43
@shannonguimaraes What about the number (item)?
Ken Haduch
@khaduch
Nov 05 2016 01:43
@c0d0er - I think that you might have some other control problem. I'll have a further look at the code and experiment with it.
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:44
arr.push(item)
Ken Haduch
@khaduch
Nov 05 2016 01:44
@c0d0er - are you still working in the same pen, or did you save a new one?
c0d0er
@c0d0er
Nov 05 2016 01:44
@khaduch the strange thing is why i click same button, sometimes show 3 in the console, sometimes not?
Joseph
@revisualize
Nov 05 2016 01:44
@shannonguimaraes Perfect.
Joseph
@revisualize
Nov 05 2016 01:45

@shannonguimaraes

// Write a function nextInLine which has two paramaters 
// an array (arr) and a number (item).
function nextInLine(arr, item) {
    // Add the number to the end of the array,
    arr.push(item);
    // then remove the first element of array.
    // The nextInLine function should 
    // then return the element that was removed.
    return item; // Change this line
}

So, here we are... How do you remove the first element from an array (arr)?

Nicola Scaramuzzo
@muzzotech
Nov 05 2016 01:45
Does anyone understand the DNA Pairing exercise?
Ken Haduch
@khaduch
Nov 05 2016 01:45
@c0d0er - ok, I don't see where you implemented my suggestion. I'll try it in a fork...
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:45
ok
Ruben Ruiz
@carpefukendiem
Nov 05 2016 01:46
"Nesting For Loops " is giving me a hard time. I'm trying to mimic the sample code
Joseph
@revisualize
Nov 05 2016 01:46
@carpefukendiem Don't mimic it completely.
c0d0er
@c0d0er
Nov 05 2016 01:46
@khaduch i tried in my local files, didnt copy to the codepen
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:46
shift
Joseph
@revisualize
Nov 05 2016 01:46
@shannonguimaraes Care to show me?
Ken Haduch
@khaduch
Nov 05 2016 01:47
@c0d0er - ok
Ruben Ruiz
@carpefukendiem
Nov 05 2016 01:47

`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++){
console.log(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]]);`

shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:47
arr.shift()
Walid Ashri
@walidashri
Nov 05 2016 01:47
@washimara not strange it's just global vars interfere with fcc tests
Joseph
@revisualize
Nov 05 2016 01:47
@carpefukendiem How does console.log modify product?
@shannonguimaraes Okay.. .shift() actually does two things. What are those two things?
c0d0er
@c0d0er
Nov 05 2016 01:49
@khaduch no need to check, i found it, because should set click on the button not the reset icon
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:49
takes it to the end of the array...
Joseph
@revisualize
Nov 05 2016 01:49
@shannonguimaraes What?
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:49
the number
Joseph
@revisualize
Nov 05 2016 01:50
@shannonguimaraes No.
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:50
the item
Joseph
@revisualize
Nov 05 2016 01:50
@shannonguimaraes The answer is on that page.
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:50
it brings it to the beginning?
Nicola Scaramuzzo
@muzzotech
Nov 05 2016 01:50
@shannonguimaraes it takes the first item of an array and stores it within a variable
Joseph
@revisualize
Nov 05 2016 01:51
@muzzotech No it doesn't.
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:51
removes the first element from an array and returns that element.
Nicola Scaramuzzo
@muzzotech
Nov 05 2016 01:52
@shannonguimaraes yes
Joseph
@revisualize
Nov 05 2016 01:52
@shannonguimaraes Great!
@shannonguimaraes What do we want our function to return?
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:52
the first number?
Joseph
@revisualize
Nov 05 2016 01:53
Which is what to .shift()?
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:53
yes
Joseph
@revisualize
Nov 05 2016 01:54
@shannonguimaraes Can you solve the challenge now?
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:54
@revisualize , i hope so
Nicola Scaramuzzo
@muzzotech
Nov 05 2016 01:55
Does anyone know where to begin with the DNA Pairing problem? I am totally confused as to how it comes up with the answers it is supposed to.
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:55
i added aarr.p
Nicola Scaramuzzo
@muzzotech
Nov 05 2016 01:55
That didn't sound right
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:55
arr.shift()
Joseph
@revisualize
Nov 05 2016 01:55
@shannonguimaraes Yes.
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:56
but its still not working
Joseph
@revisualize
Nov 05 2016 01:56
Show me.
Cage Echarte
@CageEcharte
Nov 05 2016 01:56
Hey I'm stuck on the "Stand in Line" exercise
Nicola Scaramuzzo
@muzzotech
Nov 05 2016 01:56
I don't want the answer, I just want to know how the answers that are supposed to come up actually come up
MM Nauman
@mmnauman
Nov 05 2016 01:56

Hello any one please help me Here I'm not able to understand this instructions function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line

// Your code above this line
return result;
}

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

Nicola Scaramuzzo
@muzzotech
Nov 05 2016 01:57
@mmnauman so you see the words in the example
shannon guimaraes
@shannonguimaraes
Nov 05 2016 01:58
@revisualize , function nextInLine(arr, item) {
arr.push(item);
arr.shift();
return item;
Walid Ashri
@walidashri
Nov 05 2016 01:59
@muzzotech get every letter match with it's dna equivalent then add both to array
Joseph
@revisualize
Nov 05 2016 01:59
@shannonguimaraes You're not returning the element that was removed. You're returning item.
Nicola Scaramuzzo
@muzzotech
Nov 05 2016 01:59
okay, thanks
MM Nauman
@mmnauman
Nov 05 2016 01:59
Can you explain me this tutorial in simple English in more user friendly way ?
Joseph
@revisualize
Nov 05 2016 01:59
@mmnauman I did.
Link.
shannon guimaraes
@shannonguimaraes
Nov 05 2016 02:01
how do i do that?
Joseph
@revisualize
Nov 05 2016 02:01
You return the element that was removed. What does .shift return?
shannon guimaraes
@shannonguimaraes
Nov 05 2016 02:02
i thought shift did that
Jenky W. Nolasco
@jenkynolasco11
Nov 05 2016 02:02
Hola mundo! o/
Krishna
@krisskb
Nov 05 2016 02:02
Dear Fellowcampers, Could someone give me best resources to learn reactjs. Currently I am having difficulty in doing react Projects. Many thanks. Regards, Krishna
Joseph
@revisualize
Nov 05 2016 02:02
@shannonguimaraes return arr.shift()
washimara
@washimara
Nov 05 2016 02:02
guys any idea how to make such statement in JS, where IF condition searched for A to N letters, something like this https://gyazo.com/fa1fb5f97d42aa7534e7a85b60c0eed7
MM Nauman
@mmnauman
Nov 05 2016 02:02
@revisualize So We need to use Result variable to show everything or should create new variables?
Joseph
@revisualize
Nov 05 2016 02:03
@mmnauman Why would you create new variables?
Jenky W. Nolasco
@jenkynolasco11
Nov 05 2016 02:03
Walid Ashri
@walidashri
Nov 05 2016 02:03
@washimara u need to test the regex ;)
Krishna
@krisskb
Nov 05 2016 02:04
Thank you @jenkynolasco11
CamperBot
@camperbot
Nov 05 2016 02:04
krisskb sends brownie points to @jenkynolasco11 :sparkles: :thumbsup: :sparkles:
:cookie: 366 | @jenkynolasco11 |http://www.freecodecamp.com/jenkynolasco11
washimara
@washimara
Nov 05 2016 02:05
@walidashri hm, what do you mean by test regex ?
Palakurthi Durga Kiran Kumar
@durgakiran
Nov 05 2016 02:05
please review my js calculator https://repl.it/ENVR/66
Joseph
@revisualize
Nov 05 2016 02:06
@shannonguimaraes Does all of that make sense?
MM Nauman
@mmnauman
Nov 05 2016 02:06
@revisualize I Thought to create New Var and append it to result variable
Joseph
@revisualize
Nov 05 2016 02:06
@mmnauman You don't need to declare any new variables.
Jenky W. Nolasco
@jenkynolasco11
Nov 05 2016 02:07
@washimara probably something like /[a-m]/gi.test (string)
shannon guimaraes
@shannonguimaraes
Nov 05 2016 02:07
@revisualize function nextInLine(arr, item) {
arr.push(item);// Your code here
arr.shift();
return arr.shift();
Joseph
@revisualize
Nov 05 2016 02:07
@shannonguimaraes Read your code.
MM Nauman
@mmnauman
Nov 05 2016 02:07
@revisualize OK So I need to Just take result var and add the string right?
Joseph
@revisualize
Nov 05 2016 02:08
@mmnauman No. You need to use the parameters to build a string.
Dylan
@dhcodes
Nov 05 2016 02:08
@durgakiran looks good, works well! you can get more feedback in the CodeReview room
MM Nauman
@mmnauman
Nov 05 2016 02:09
@revisualize OK I got it now Thanks
CamperBot
@camperbot
Nov 05 2016 02:09
mmnauman sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2233 | @revisualize |http://www.freecodecamp.com/revisualize
Palakurthi Durga Kiran Kumar
@durgakiran
Nov 05 2016 02:09
@dhcodes thanks man.......
CamperBot
@camperbot
Nov 05 2016 02:09
durgakiran sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:star2: 1555 | @dhcodes |http://www.freecodecamp.com/dhcodes
Joseph
@revisualize
Nov 05 2016 02:09
@shannonguimaraes Here's what you're doing... You adding item to the end of the arr. You're removing the first element from the arr. You're not doing anything with .shift()s return. Then you're returning arr.shift() which is removing the first element (again) and returning the element removed. Essentially, you're removing two elements from the array.
This message was deleted
shannon guimaraes
@shannonguimaraes
Nov 05 2016 02:10
i thought thats what you said i should do
Walid Ashri
@walidashri
Nov 05 2016 02:11
@washimara regexObj.test(str)
Joseph
@revisualize
Nov 05 2016 02:11
@shannonguimaraes You just want to remove 1 element from the array.
@shannonguimaraes Did you actually follow along or are you still not understanding this challenge?
shannon guimaraes
@shannonguimaraes
Nov 05 2016 02:11
i did follow along,
washimara
@washimara
Nov 05 2016 02:11
@walidashri thanks ! I will play with it
CamperBot
@camperbot
Nov 05 2016 02:11
washimara sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:warning: washimara already gave walidashri points
Joseph
@revisualize
Nov 05 2016 02:12
@shannonguimaraes You're removing two elements from the array. Not 1.
Joseph
@revisualize
Nov 05 2016 02:18
@shannonguimaraes Is there something else that I need to clarify?
silver537
@silver537
Nov 05 2016 02:18
@revisualize yes i'd like to know why you are cool?
washimara
@washimara
Nov 05 2016 02:18
@jenkynolasco11 Thank you! Sorry missed your reply earlier
CamperBot
@camperbot
Nov 05 2016 02:18
washimara sends brownie points to @jenkynolasco11 :sparkles: :thumbsup: :sparkles:
:cookie: 367 | @jenkynolasco11 |http://www.freecodecamp.com/jenkynolasco11
Joseph
@revisualize
Nov 05 2016 02:18
@silver537 Whomever, told you that was a liar. A bloody fucking worthless liar.
silver537
@silver537
Nov 05 2016 02:19
lmao
you told me that
Joseph
@revisualize
Nov 05 2016 02:19
Okay.
Still holds true.
Yup.
silver537
@silver537
Nov 05 2016 02:19
xD
nice one
FOOL
Joseph
@revisualize
Nov 05 2016 02:20
hehe.
shannon guimaraes
@shannonguimaraes
Nov 05 2016 02:23
@revisualize , i don't get what i should return
can i just take the return off the code?
Joseph
@revisualize
Nov 05 2016 02:23
@shannonguimaraes You should return what you're returning. You just shouldn't be shifting twice.
shannon guimaraes
@shannonguimaraes
Nov 05 2016 02:25
tks it worked @revisualize
Joseph
@revisualize
Nov 05 2016 02:26
@shannonguimaraes But, really. Do you understand it?
shannon guimaraes
@shannonguimaraes
Nov 05 2016 02:26
yes i was just confused with returning
i thought arr.shift would return the item
tks so much
MM Nauman
@mmnauman
Nov 05 2016 02:27
Hello can any one say How many total tutorials are there? Now I'm in 161
Ian Lee
@asparism
Nov 05 2016 02:29

hello, what does

addTogether(2)(3)

mean, and how is it different from

addTogether(2, 3)

? where can i learn more?

silver537
@silver537
Nov 05 2016 02:29
@shannonguimaraes shift is it's own method(which is a function), so the item returned terminates that method, but you're still in the outer function. so technically you are returning a returned value.
@asparism that is called closure
Ian Lee
@asparism
Nov 05 2016 02:30
okay thanks @silver537
CamperBot
@camperbot
Nov 05 2016 02:30
asparism sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
:cookie: 675 | @silver537 |http://www.freecodecamp.com/silver537
silver537
@silver537
Nov 05 2016 02:31
@asparism you can learn that here
in a nutshell, it's a function that returns another function
Walid Ashri
@walidashri
Nov 05 2016 02:32
@asparism here also
silver537
@silver537
Nov 05 2016 02:32
javascript IS sexy. ;)
Walid Ashri
@walidashri
Nov 05 2016 02:32
@silver537 So :)
Joseph
@revisualize
Nov 05 2016 02:33
@asparism closure!
Ian Lee
@asparism
Nov 05 2016 02:34
haha
ghanzo
@ghanzo
Nov 05 2016 02:37
// Setup
function phoneticLookup(val) {
  var result = "";

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

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


// Change this value to test
phoneticLookup("charlie");
not sure what I'm doing wrong here
anyone have some suggestions
phoneticLookup("alpha") should equal "Adams"
phoneticLookup("bravo") should equal "Boston"
phoneticLookup("charlie") should equal "Chicago"
phoneticLookup("delta") should equal "Denver"
phoneticLookup("echo") should equal "Easy"
phoneticLookup("foxtrot") should equal "Frank"
phoneticLookup("") should equal undefined
You should not use case, switch, or if statements
Walid Ashri
@walidashri
Nov 05 2016 02:38
@ghanzo what is the value of result at the end of ur func?
ghanzo
@ghanzo
Nov 05 2016 02:38
nothing comes up
should be chicago
Walid Ashri
@walidashri
Nov 05 2016 02:39
sure it's still ""
ghanzo
@ghanzo
Nov 05 2016 02:39
?
Walid Ashri
@walidashri
Nov 05 2016 02:39
u need to set to the value of val in relation to the object in the function
ghanzo
@ghanzo
Nov 05 2016 02:40
i thought i did that
with alpha / adams
is it just val
no var?
Walid Ashri
@walidashri
Nov 05 2016 02:42
val is a function parameter so it's sort of a defined var
ghanzo
@ghanzo
Nov 05 2016 02:43
so whats that mean, i need to use a different variable?
Walid Ashri
@walidashri
Nov 05 2016 02:44
u need to set result to the value of the object property val
ghanzo
@ghanzo
Nov 05 2016 02:46
phoneticLookup("alpha") should equal "Adams"
phoneticLookup("bravo") should equal "Boston"
phoneticLookup("charlie") should equal "Chicago"
phoneticLookup("delta") should equal "Denver"
phoneticLookup("echo") should equal "Easy"
phoneticLookup("foxtrot") should equal "Frank"
phoneticLookup("") should equal undefined
You should not use case, switch, or if statements
oops

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

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

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


// Change this value to test
phoneticLookup("charlie");
closer?
Walid Ashri
@walidashri
Nov 05 2016 02:47
@ghanzo Far u went :(
ghanzo
@ghanzo
Nov 05 2016 02:48
hah
im confused
Walid Ashri
@walidashri
Nov 05 2016 02:49
the object name is lookup not result nor val
ghanzo
@ghanzo
Nov 05 2016 02:50
object name...
theres nothing called lookup
theres just something called phonetic lookup
Walid Ashri
@walidashri
Nov 05 2016 02:51
result = { this one
ghanzo
@ghanzo
Nov 05 2016 02:51
i don't know what you're talking about
silver537
@silver537
Nov 05 2016 02:54
@ghanzo look
on your result,
the last one, where you return it
return, result[val] and then you're done
you know why??? cause you're confusing yourself by doing it your own way. >:/
ghanzo
@ghanzo
Nov 05 2016 02:55
we don't need to play the blame game, i did it just as it says in the instructions
I got a solution
I still don't understand it
silver537
@silver537
Nov 05 2016 02:57
Convert the switch statement into a lookup table called lookup. Use it to lookup val and assign the associated string to the result variable.
your table is called result ....
ghanzo
@ghanzo
Nov 05 2016 02:58
so is lookup an arbitrary variable?
silver537
@silver537
Nov 05 2016 02:58
yea
Walid Ashri
@walidashri
Nov 05 2016 03:00
@silver537 thanks
CamperBot
@camperbot
Nov 05 2016 03:00
walidashri sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
:cookie: 678 | @silver537 |http://www.freecodecamp.com/silver537
ghanzo
@ghanzo
Nov 05 2016 03:03
so why is it return lookup[val] specifically [val]
// Setup
function phoneticLookup(val) {
  var result = "";

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

  return lookup[val];

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


// Change this value to test
phoneticLookup("charlie");
silver537
@silver537
Nov 05 2016 03:04
because val is the variable being initialized with the argument when you call the function
ghanzo
@ghanzo
Nov 05 2016 03:04
ok
silver537
@silver537
Nov 05 2016 03:04
phoneticLookup("charlie"); <-- you call the function wish "charlie" as the argument
ghanzo
@ghanzo
Nov 05 2016 03:04
right
silver537
@silver537
Nov 05 2016 03:05
function phoneticLookup(val) <--- you initialize this function with the variable val.
ghanzo
@ghanzo
Nov 05 2016 03:05
ok
so lookup is what exactly
silver537
@silver537
Nov 05 2016 03:05
so everytime you call this function, anything inside the parenthesis as an argument will be stored into the variable
ghanzo
@ghanzo
Nov 05 2016 03:05
a storage container
silver537
@silver537
Nov 05 2016 03:05
lookup is an object.
ghanzo
@ghanzo
Nov 05 2016 03:06
and it could be named anything
silver537
@silver537
Nov 05 2016 03:06
yes.
ghanzo
@ghanzo
Nov 05 2016 03:06
not just lookup
so you build a container or an "object"
Brad Johnson
@Twigarm
Nov 05 2016 03:07

Hey guys, i just reversed a string. this was my code:

var splitArr = [];
var reverseStr = '';
var joinArr = [];
function reverseString(str) {
var splitArr = str.split('');
var reverseStr = splitArr.reverse();
var joinArr = reverseStr.join('');
return joinArr;
}
reverseString("hello");

was there a better/easier way of doing this?

ghanzo
@ghanzo
Nov 05 2016 03:07
then you call the object, and its parameter
and it will give you the related parameter?
silver537
@silver537
Nov 05 2016 03:08
yes. the object is a container which contains many properties/keys(variables) that has values.
ghanzo
@ghanzo
Nov 05 2016 03:08
can each one have only one value?
silver537
@silver537
Nov 05 2016 03:08
so when you call the container name with the variable as the argument, you are grabbing that specific property.
ghanzo
@ghanzo
Nov 05 2016 03:08
yeah
silver537
@silver537
Nov 05 2016 03:09
dont get ahead of yourself.
ghanzo
@ghanzo
Nov 05 2016 03:09
and then it pops out what that variable is
Walid Ashri
@walidashri
Nov 05 2016 03:09
@Twigarm no but u can do something like
return str.split('').reverse().join('');
ghanzo
@ghanzo
Nov 05 2016 03:09
well.... confusing to say the least but i think i have some grasp on it
thanks @silver537
CamperBot
@camperbot
Nov 05 2016 03:09
ghanzo sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
:cookie: 679 | @silver537 |http://www.freecodecamp.com/silver537
silver537
@silver537
Nov 05 2016 03:10
you want to understand the names of the object 's parts
ghanzo
@ghanzo
Nov 05 2016 03:10
what about the return, result
the result is what the object's part's name is
var result = "";
why have that
silver537
@silver537
Nov 05 2016 03:11
var obj = {        // <-- this is the name of the object
  prop1: "value1", // <-- this is the name of the property with it's value
  prop2: "value2"  // <-- property 2 with value 2
}
Walid Ashri
@walidashri
Nov 05 2016 03:11
@Twigarm it's the same as you have done but in one line with no new vars
Brad Johnson
@Twigarm
Nov 05 2016 03:12
@walidashri oh awesome I'll try that out
@walidashri thank you
CamperBot
@camperbot
Nov 05 2016 03:12
twigarm sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 578 | @walidashri |http://www.freecodecamp.com/walidashri
Walid Ashri
@walidashri
Nov 05 2016 03:12
@Twigarm :+1:
Fernando Sugianto
@fyzz100
Nov 05 2016 03:13
how to create a loop for profile lookup
please help
Sarah
@aggibabi
Nov 05 2016 03:14

// Setup
var myStr = "Jello World";

// Only change code below this line

myStr[0] = "H"; // Fix Me
myStr = "Hello World";

silver537
@silver537
Nov 05 2016 03:14
var key = "prop1";  // <-- this assigns prop1 into key
obj[key]  //  <-- this calls obj with key as it's argument which outputs "value1"
obj.prop1 // <-- this does the same in dot notation
Sarah
@aggibabi
Nov 05 2016 03:14
Does anyone know what I"m doing wrong?
ghanzo
@ghanzo
Nov 05 2016 03:14
right
silver537
@silver537
Nov 05 2016 03:14
@ghanzo the challenge wanted you to assign the value of the object into result, and return that result variable
ghanzo
@ghanzo
Nov 05 2016 03:14
so the output is the result
Walid Ashri
@walidashri
Nov 05 2016 03:14
@aggibabi this line myStr[0] = "H"; // Fix Me
ghanzo
@ghanzo
Nov 05 2016 03:15
alright
thanks man
Sarah
@aggibabi
Nov 05 2016 03:15
@walidashri what is wrong with that line?
silver537
@silver537
Nov 05 2016 03:15
like this: result = lookup[val]
c0d0er
@c0d0er
Nov 05 2016 03:16
after using audio.play();, does anybody know instead of using audio.pause();, is there any other method to completely stop the audio playing instead of just pausing>
Sarah
@aggibabi
Nov 05 2016 03:17
@walidashri THank you! I got it
CamperBot
@camperbot
Nov 05 2016 03:17
aggibabi sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 579 | @walidashri |http://www.freecodecamp.com/walidashri
silver537
@silver537
Nov 05 2016 03:17
so technically this is it
result = lookup[val] = lookup["charlie"] = Chicago
return 'Chicago'
@ghanzo
Walid Ashri
@walidashri
Nov 05 2016 03:17
@aggibabi it's trying to set 1st char in string to differante value and it can't be
And u don't need it just remove it Oh you already did :)
silver537
@silver537
Nov 05 2016 03:18
@c0d0er you're already in simon game? nice!
c0d0er
@c0d0er
Nov 05 2016 03:18
@silver537 not yet, hard to move
Fernando Sugianto
@fyzz100
Nov 05 2016 03:19
anyone can help me?
how can i make a loop for profile lookup?
RicardoJDG
@RicardoJDG
Nov 05 2016 03:22

Hey guys, I'm kinda stuck in the "where do I belong bonfire"

function getIndexToIns(arr, num) {
  // Find my place in this sorted array.
  sorted = arr.sort();
  var ind = 0;

  for (var i = 0; i < arr.length; i++) {
    if (num > arr[i]) {
      console.log(i);
      ind = i + 1;
    }
  }

  return ind;
}

getIndexToIns([40, 60], 50);

For some reason, that works with everything except getIndexToIns([5, 3, 20, 3], 5), which should return a 2, but it returns a 3. Any ideas?

Walid Ashri
@walidashri
Nov 05 2016 03:23
@c0d0er after pause() set audio.currentTime =0;
silver537
@silver537
Nov 05 2016 03:23
@RicardoJDG i certainly help you since you kindly gave us the code to debug! :)
c0d0er
@c0d0er
Nov 05 2016 03:25
@walidashri thanks!
CamperBot
@camperbot
Nov 05 2016 03:25
c0d0er sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 580 | @walidashri |http://www.freecodecamp.com/walidashri
Walid Ashri
@walidashri
Nov 05 2016 03:26
@RicardoJDG [5, 3, 20, 3].sort() will return [20, 3, 3, 5]
RicardoJDG
@RicardoJDG
Nov 05 2016 03:31
Oooh, it sorts them by their unicode value, right.
So, it basically worked with the other ones by pure luck? haha
silver537
@silver537
Nov 05 2016 03:32
^yep
and not unicode
but their first number
RicardoJDG
@RicardoJDG
Nov 05 2016 03:33
Oh, I see
silver537
@silver537
Nov 05 2016 03:33
you see 5,3,20,3 but the computer sees 5,3,2,3
so therefore it does 2,3,3,5 => 20,3,3,5
RicardoJDG
@RicardoJDG
Nov 05 2016 03:34
Alright
Thanks @walidashri and @silver537
CamperBot
@camperbot
Nov 05 2016 03:34
ricardojdg sends brownie points to @walidashri and @silver537 :sparkles: :thumbsup: :sparkles:
:cookie: 681 | @silver537 |http://www.freecodecamp.com/silver537
:cookie: 581 | @walidashri |http://www.freecodecamp.com/walidashri
Alexander Køpke
@alexanderkopke
Nov 05 2016 03:35
@RicardoJDG sort can take a function so you'll get what you want. I think it is something like var sorted = arr. sort(function(a, b){ return a - b; }); Note: b - a reverses the order of the numbers. You'll proberly want to use the sorted array in the for loop. If you do arr[i] it will use the old array instead of the new one in sorted.
RicardoJDG
@RicardoJDG
Nov 05 2016 03:39
@alexanderkopke Yep! just did that and it worked. Thanks again guys.
CamperBot
@camperbot
Nov 05 2016 03:39
ricardojdg sends brownie points to @alexanderkopke :sparkles: :thumbsup: :sparkles:
:cookie: 830 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
Chapin Evans
@cmaverick92
Nov 05 2016 04:00
Hi! I'm having some trouble om Javascript's "storing values with the assignment operator" assigning variable a to variable
*to variable b
Juwdohr
@Juwdohr
Nov 05 2016 04:02
Anyone know how to get a button to act like pressing repeatedly, but your actually press and holding?
Walid Ashri
@walidashri
Nov 05 2016 04:04
@cmaverick92 a= b
Chapin Evans
@cmaverick92
Nov 05 2016 04:04
var a = 7;
var a = var b;
it's saying there is a syntax error
Instructions
Assign the value 7 to variable a.
Assign the contents of a to variable b. (I'm stuck on this part)
Walid Ashri
@walidashri
Nov 05 2016 04:05
@Juwdohr try
@cmaverick92 no no we use var for one variable only one time
Chapin Evans
@cmaverick92
Nov 05 2016 04:09
I'm not understanding :'(
VZee
@VZee
Nov 05 2016 04:09
@cmaverick92 Try breaking down the question. You're right on var a (var a = 7). Now you want to make another variable, b. And you want b to equal a.
Chapin Evans
@cmaverick92
Nov 05 2016 04:09
var a = 7;
var b = 7;
var a = myNum;
var b = myVar;
myNum = myVar;
that's not right either
VZee
@VZee
Nov 05 2016 04:11
Too much breaking down. :) So. Assign the value of 7 to var a: code is var a = 7;
Now assign the contents of a to variable b. We need a variable b. First, let's code: var b;
If that makes sense, how would you finish the problem (assign contents of a to b)?
Chapin Evans
@cmaverick92
Nov 05 2016 04:15
ummmmm okay i got this. I feel like I way overthinking this haha!
Juwdohr
@Juwdohr
Nov 05 2016 04:15
@walidashri that did not work still only did what it was supposed to do 1x. So what I want it to do is if I press and hold the button for like 5sec then it increments the object by 5. Yet for each time it increments it shows that it is incrementing.
Chapin Evans
@cmaverick92
Nov 05 2016 04:17
wow @VZee what is wrong with me hahaha I finally got it
2 lines -_-
how do I give you cookies? I can't remember it's been forever since i have been on here!
Melissa Smith
@yvette45
Nov 05 2016 04:19
Help Please!!! What's wrong with code?
var myStr;
myStr += "This is the first sentence.";
myStr = "This is the second sentence.";
CamperBot
@camperbot
Nov 05 2016 04:19
no wiki entry for: please whats wrong with codevar mystrmystr this is the first sentencemystr this is the second sentence
perseusMyk
@perseusMyk
Nov 05 2016 04:20
@yvette45 you for got to declair the type of your variable (string)
Chapin Evans
@cmaverick92
Nov 05 2016 04:20
@VZee :cookie:
perseusMyk
@perseusMyk
Nov 05 2016 04:20
haha
send a thanks to her I guess
Chapin Evans
@cmaverick92
Nov 05 2016 04:20
lmao
thanks @VZee
CamperBot
@camperbot
Nov 05 2016 04:20
cmaverick92 sends brownie points to @vzee :sparkles: :thumbsup: :sparkles:
:cookie: 296 | @vzee |http://www.freecodecamp.com/vzee
Melissa Smith
@yvette45
Nov 05 2016 04:22
Ok thanks, @VZee
CamperBot
@camperbot
Nov 05 2016 04:22
yvette45 sends brownie points to @vzee :sparkles: :thumbsup: :sparkles:
:cookie: 297 | @vzee |http://www.freecodecamp.com/vzee
silver537
@silver537
Nov 05 2016 04:22
@cmaverick92 that was funny
Matt Tankersley
@txtanks
Nov 05 2016 04:22
Looking for help with "Comparisons with the Logical And Operator" and concern there is bug....anyone available to assist?
sparklie3
@sparklie3
Nov 05 2016 04:22
@txtanks what's the question?
c0d0er
@c0d0er
Nov 05 2016 04:23
does anybody know why i use <script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.js'></script> to add jquery ui causes error? how could i correctly add jquery ui with script tag?
Matt Tankersley
@txtanks
Nov 05 2016 04:23
afraid there is a bug
VZee
@VZee
Nov 05 2016 04:23
hth :)
sparklie3
@sparklie3
Nov 05 2016 04:23
what's the bug?
Matt Tankersley
@txtanks
Nov 05 2016 04:24
testLogicalAnd(0) states it should return "No" when:

function testLogicalAnd(val) {
// Only change code below this line

if (val >=50 && val <= 25); {
return "Yes";
}

// Only change code above this line
return "No";
}

// Change this value to test
testLogicalAnd(0);

wait....checking...
sparklie3
@sparklie3
Nov 05 2016 04:25
okay...um..
how can val be greater or equal to 50 && less than equal to 25?
also, you don't need a ; after your if condition
Matt Tankersley
@txtanks
Nov 05 2016 04:26
it's NOT - but is reporting what I stated: testLogicalAnd(0) should return "No"
NOPE - that fixed the 0 issue, now for 25, 30 and 50...checking
sparklie3
@sparklie3
Nov 05 2016 04:27
but this code wouldn't even run
Matt Tankersley
@txtanks
Nov 05 2016 04:27
fixed that already
sparklie3
@sparklie3
Nov 05 2016 04:27
ah
but your first if condition doesn't make any sense
you asked the computer to return Yes, if the val is greater or equal to 50 and less than equal to 25
Matt Tankersley
@txtanks
Nov 05 2016 04:28
Combine the two if statements into one statement which will return "Yes" if val is less than or equal to 50 and greater than or equal to 25. Otherwise, will return "No".
sparklie3
@sparklie3
Nov 05 2016 04:28
what you wrote in word don't match your code
Matt Tankersley
@txtanks
Nov 05 2016 04:28
had signs reversed I think
that was it...got it - thanks for the extra eyes & ears
sparklie3
@sparklie3
Nov 05 2016 04:29
np
Matt Tankersley
@txtanks
Nov 05 2016 04:29

this was correct version:

function testLogicalAnd(val) {
// Only change code below this line

if (val <=50 && val >= 25) {
return "Yes";
}

// Only change code above this line
return "No";
}

// Change this value to test
testLogicalAnd(0);

sparklie3
@sparklie3
Nov 05 2016 04:29
yup
Matt Tankersley
@txtanks
Nov 05 2016 04:29
Muchos Gracias!
sparklie3
@sparklie3
Nov 05 2016 04:30
sure thing
Deepak Yadav
@ydeepk
Nov 05 2016 04:34

Everything be true (Intermediate Algo challange)

I need your help guys!

Not getting expected output for following code:

function truthCheck(collection, pre) {
  // Is everyone being true
  for(var x = 0; x < collection.length; x++) {
    var ifNaN = isNaN(collection[x][pre]);
    if(collection[x].hasOwnProperty(pre) && (!ifNaN || collection[x][pre] !== undefined || collection[x][pre] !== 0 || collection[x][pre] !== false || collection[x][pre] !== "" || collection[x][pre] !== null)) {
      return true;
    }
  }

  return false;
}

truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex");

// should return true

truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex");
// should return false
Joseph
@revisualize
Nov 05 2016 04:38
@cmaverick92 :wave:
@cmaverick92 Hello from Seattle.
Anyhow..
@ydeepk I solved that one the same way that I solved Falsy Bouncer
@ydeepk I used the Boolean() object and I also used .every()
@ydeepk But, really... all of this:
&& (!ifNaN || collection[x][pre] !== undefined || collection[x][pre] !== 0 || collection[x][pre] !== false || collection[x][pre] !== "" || collection[x][pre] !== null)
Should just be passed to Boolean()
Deepak Yadav
@ydeepk
Nov 05 2016 04:42
@revisualize okay let me try!
Nicola Scaramuzzo
@muzzotech
Nov 05 2016 04:44
I'm on Convert HTML Entities and have run into a snag. Below is the POS code that I came up with which obviously won't work so a little direction would help.

function convertHTML(str) {
  // &colon;&rpar;

  var i, key, value,
  newStr = str.split(""),
  ESC_MAP = {
    '&': '&amp;',
    '<': '&lt;',
    '>': '&gt;',
    '"': '&quot;',
    "'": '&apos;'
  };

  for(i = 0; i < newStr.length; i++) {
    if(newStr[i] === ESC_MAP[key]) {
      newStr.replace(key, value);
    }
  }

  var newerStr = newStr.join("");

  return newerStr;


}

convertHTML("Dolce & Gabbana");
Joseph
@revisualize
Nov 05 2016 04:47
@muzzotech I knid of did it the same way you are.
@muzzotech Have you looked at Object.keys
Homero
@homerrowsky
Nov 05 2016 04:54
hi comrades. Where can I find the explanation for this:
var x  = 90.74;
x -= 20;
x -= 20;
// gives 50.739999999999995
I'm stuck with checkCashRegister
Ramsey Darling
@Ramsanine
Nov 05 2016 04:55
I am on basics of JS "Record Collection" and I have looked this up on google and been going back on the skills I have learned and I am still having trouble. I will post my code in a second. If anyone can help that would be really cool.
Nicola Scaramuzzo
@muzzotech
Nov 05 2016 04:55
@revisualize I tried the following to no avail:
function convertHTML(str) {
  // &colon;&rpar;

  var i, key, value,
  newStr = str.split(""),
  re = /\W/,
  ESC_MAP = {
    '&': '&amp;',
    '<': '&lt;',
    '>': '&gt;',
    '"': '&quot;',
    "'": '&apos;'
  };

  for (i = 0; i <newStr.length; i++){
    if(newStr[i] === re)
      newStr.replace(Object.keys(ESC_MAP));
  }

  var newerStr = newStr.join("");

  return newerStr;


}

convertHTML("Dolce & Gabbana");
Joseph
@revisualize
Nov 05 2016 04:55
@homerrowsky JS math sucks sometimes.
Ramsey Darling
@Ramsanine
Nov 05 2016 04:55
@homerrowsky You just subtracted 20 from x twice.
Joseph
@revisualize
Nov 05 2016 04:56
@muzzotech I'm a bit tired.
Nicola Scaramuzzo
@muzzotech
Nov 05 2016 04:56
No worries
Homero
@homerrowsky
Nov 05 2016 04:56
@revisualize yep that's what I've been realizing for the last 5 hoours....
Nicola Scaramuzzo
@muzzotech
Nov 05 2016 04:56
@revisualize thank you for all of your help today
CamperBot
@camperbot
Nov 05 2016 04:56
muzzotech sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2238 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Nov 05 2016 04:57
@homerrowsky No really it does some crazy stuff like that. It happens all the time. You just have to account for it.
Like... 0.2 + 0.1
=> 0.30000000000000004
Where the hell did it get the extra digits?
Homero
@homerrowsky
Nov 05 2016 04:58
@revisualize oh yes I checked yur example
I've tried the trick of Math.floor(number*100)/100 but no result
Joseph
@revisualize
Nov 05 2016 04:59
I think I'm going to head to bed.
I'm realizing that I'm really freaking tired.
:v:
@muzzotech Here are my recommendations... I'd recommend using your object like you are. It's really cool. The for loop is kind of lame. Learn that you can pass functions through replace. And use Object.keys as a string in your regex for the replace. That should solve it.
Homero
@homerrowsky
Nov 05 2016 05:03
@revisualize thanks! Good night!
CamperBot
@camperbot
Nov 05 2016 05:03
homerrowsky sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2239 | @revisualize |http://www.freecodecamp.com/revisualize
Juwdohr
@Juwdohr
Nov 05 2016 05:03

anyone able to get this:

$('#breakDown').click(function() {
        if (breakTime > 1)
            $('#breakTime').val(--breakTime);
        breakTimer.setTime(breakTime * 60);
    });

to work with this: http://stackoverflow.com/questions/28127507/incrementing-value-continuously-on-mouse-hold

Not sure if I tried implementing it correctly.

Johnny
@JohnnyBizzel
Nov 05 2016 05:22
@Juwdohr What are you trying to do?
Yasser Hussain
@yasserhussain1110
Nov 05 2016 05:28
When I build javascript with webpack I don't see the built files. But the js gets deployed properly and I see the output. Why can't I see the built files and build directory ??
Johnny
@JohnnyBizzel
Nov 05 2016 05:28
@yasserhussain1110 Deployed? Where?
SergeantCyrano
@SergeantCyrano
Nov 05 2016 05:31
What's going on, guys?
Yasser Hussain
@yasserhussain1110
Nov 05 2016 05:32
@JohnnyBizzel In my local machine.
Funny part is when I run webpack-dev-server it serves up the js and site works as expected. Its just that I don't see any built js files.
Johnny
@JohnnyBizzel
Nov 05 2016 05:34
@yasserhussain1110 I've not used webpack myself but my friend showed me the output so they are there in another folder. Can't remember exactly where.
Search your computer for bundle.js
Yasser Hussain
@yasserhussain1110
Nov 05 2016 05:40
@JohnnyBizzel I tried that. Its not there.
Johnny
@JohnnyBizzel
Nov 05 2016 05:41
@yasserhussain1110 Am I right in thinking that bundle.js is where the output is saved to?
Yasser Hussain
@yasserhussain1110
Nov 05 2016 05:42
No its testing.js. I renamed the output file.
Its not there in my file system.
But I can open it in my browser.
Johnny
@JohnnyBizzel
Nov 05 2016 05:43
@yasserhussain1110 My friend was looking at this: http://survivejs.com/webpack/introduction/
Yasser Hussain
@yasserhussain1110
Nov 05 2016 05:44
Thank you. But that's not really much of a help.
c0d0er
@c0d0er
Nov 05 2016 05:44
@walidashri thanks
CamperBot
@camperbot
Nov 05 2016 05:44
c0d0er sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:warning: c0d0er already gave walidashri points
Walid Ashri
@walidashri
Nov 05 2016 05:45
@c0d0er :+1:
Johnny
@JohnnyBizzel
Nov 05 2016 05:45
@yasserhussain1110 I can ask him but he might not be online for a while. What's the path to the file through the browser?
Yasser Hussain
@yasserhussain1110
Nov 05 2016 05:46
Johnny
@JohnnyBizzel
Nov 05 2016 05:48
@walidashri How are you today?
Walid Ashri
@walidashri
Nov 05 2016 05:50
@JohnnyBizzel Tired as every day :pain: thanks
CamperBot
@camperbot
Nov 05 2016 05:50
walidashri sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:cookie: 749 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Johnny
@JohnnyBizzel
Nov 05 2016 05:55

@yasserhussain1110 Are you using webpack-dev-server ?

The dev server uses webpack’s watch mode. It also prevents webpack from emitting the resulting files to disk. Instead it keeps and serves the resulting files from memory.

walidashri @walidashri off to bed Happy coding every one!
Johnny
@JohnnyBizzel
Nov 05 2016 05:55
@walidashri sleep well. "No pain no gain"
Yasser Hussain
@yasserhussain1110
Nov 05 2016 05:58
@JohnnyBizzel Yes I am. That is the problem I think.
Thanks for the tip.
Johnny
@JohnnyBizzel
Nov 05 2016 05:59
@yasserhussain1110 Anytime ;) But why is it a problem? Why do you need to view the output?
Yasser Hussain
@yasserhussain1110
Nov 05 2016 06:01
@JohnnyBizzel I just wanted to see the built js. To understand which part of my code got converted to what.
Johnny
@JohnnyBizzel
Nov 05 2016 06:01
@yasserhussain1110 Maybe you can only view it through the browser?
musicsmithnz
@musicsmithnz
Nov 05 2016 06:06
help symmetric difference
CamperBot
@camperbot
Nov 05 2016 06:06
no wiki entry for: symmetric difference
musicsmithnz
@musicsmithnz
Nov 05 2016 06:06
help symmetric-difference
CamperBot
@camperbot
Nov 05 2016 06:06
no wiki entry for: symmetric
musicsmithnz
@musicsmithnz
Nov 05 2016 06:08
help symmetric-difference
CamperBot
@camperbot
Nov 05 2016 06:08
no wiki entry for: symmetric-difference
Yasser Hussain
@yasserhussain1110
Nov 05 2016 06:12
@JohnnyBizzel naah! I can just stop webpack-dev-server and build using webpack. That way I get to see all the built files.
My problem's solved. Thanks.
Johnny
@JohnnyBizzel
Nov 05 2016 06:12
@yasserhussain1110 Almost got a brownie! :P
Yasser Hussain
@yasserhussain1110
Nov 05 2016 06:13
@JohnnyBizzel Want a brownie?? :smile:
Johnny
@JohnnyBizzel
Nov 05 2016 06:13
@yasserhussain1110 Thanks <- with a mention gives a brownie
CamperBot
@camperbot
Nov 05 2016 06:13
johnnybizzel sends brownie points to @yasserhussain1110 :sparkles: :thumbsup: :sparkles:
:cookie: 362 | @yasserhussain1110 |http://www.freecodecamp.com/yasserhussain1110
Johnny
@JohnnyBizzel
Nov 05 2016 06:13
It encourages us to help!
Boris Yordanov
@borisyordanov
Nov 05 2016 06:14
Does anyone have any experience with the Meteor Framework?
Johnny
@JohnnyBizzel
Nov 05 2016 06:14
Though I would prefer :cake:
Yasser Hussain
@yasserhussain1110
Nov 05 2016 06:15
You are getting encouragement from brownie? lol. :laughing:
Thank anyway man @JohnnyBizzel
CamperBot
@camperbot
Nov 05 2016 06:15
yasserhussain1110 sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:cookie: 750 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Johnny
@JohnnyBizzel
Nov 05 2016 06:15
@yasserhussain1110 Yum!! ;)
@borisyordanov Not another Framework! :eyes:
Ramsey Darling
@Ramsanine
Nov 05 2016 06:16
@revisualize thank you, I will take a look at that link
CamperBot
@camperbot
Nov 05 2016 06:16
ramsanine sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2240 | @revisualize |http://www.freecodecamp.com/revisualize
Boris Yordanov
@borisyordanov
Nov 05 2016 06:16
@JohnnyBizzel yeah - it's this one https://www.meteor.com . I have a job interview i need to prepare for by learning it
Johnny
@JohnnyBizzel
Nov 05 2016 06:16
@borisyordanov What does this one do?
Boris Yordanov
@borisyordanov
Nov 05 2016 06:17
@JohnnyBizzel rapid prototyping or something like that. Saves time... i don't know
@JohnnyBizzel i just installed it but can't even get it to work
Johnny
@JohnnyBizzel
Nov 05 2016 06:17
@borisyordanov For making mobile APPS, I see.
Boris Yordanov
@borisyordanov
Nov 05 2016 06:18
@JohnnyBizzel correct
Johnny
@JohnnyBizzel
Nov 05 2016 06:18
@borisyordanov Uses Angular2 I see.
Johnny
@JohnnyBizzel
Nov 05 2016 06:24
@borisyordanov ... or React, or it's own Blaze.
Are you familiar with any of these?
eusid
@eusid
Nov 05 2016 06:28

maybe someone can help me figure out why my weatherIcon function is not working ?

http://codepen.io/eusid/pen/KNKmXM

this thing is becoming a spaghetti mess
pretty sure i did the quotes correctly i think my jquery add statement is not working
SergeantCyrano
@SergeantCyrano
Nov 05 2016 06:30
I'm hating these palindromes.
eusid
@eusid
Nov 05 2016 06:30
whats problem ?
Johnny
@JohnnyBizzel
Nov 05 2016 06:30
@eusid You only have 2 images at the moment? Should be "drizzle" not "dizzle"
eusid
@eusid
Nov 05 2016 06:30
@JohnnyBizzel yes it was clear then it turned to cloudy and i had to duplicate it so i could test
is the default statement required ? just hit me that maybe thats why its not working
lols
found an error but not the one we need to find
Johnny
@JohnnyBizzel
Nov 05 2016 06:37
@eusid USe .html instead of .add
  $('.icon').html('<img src="https://s3.us-east-2.amazonaws.com/eusid-static/sun.png">');
eusid
@eusid
Nov 05 2016 06:38
@JohnnyBizzel thx so much man, i actually looked up the documentation for add and it said i could put html strings in it :(
CamperBot
@camperbot
Nov 05 2016 06:38
eusid sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:cookie: 751 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Sorin Ruse
@sorinr
Nov 05 2016 06:38
@eusid if you are using openweather api u can load this font icon lib that have support for the api weather codes: https://cdnjs.com/libraries/weather-icons and here the icons for the api: https://erikflowers.github.io/weather-icons/api-list.html
Johnny
@JohnnyBizzel
Nov 05 2016 06:38
@eusid Maybe so but .html will replace whatever is inside the tags. :+1:
vanshaj kerni
@vanshaj-kerni
Nov 05 2016 06:40

Emphasize the text in your target4 button by adding HTML tags.
Make sure the text is otherwise unchanged. <script>
$(document).ready(function() {
$("#target1").css("color", "red");

$("#target4").html("<em> #target4 </em>");

});
</script>

how to do it please i tried many times?
eusid
@eusid
Nov 05 2016 06:41
@sorinr thx i will check it out
CamperBot
@camperbot
Nov 05 2016 06:41
eusid sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 817 | @sorinr |http://www.freecodecamp.com/sorinr
Sorin Ruse
@sorinr
Nov 05 2016 06:41
@eusid welcome
eusid
@eusid
Nov 05 2016 06:44
@sorinr at this point i think that would mean changing my code though lol ready to be done with this damn weather thing
starting to feel like i know what im doing a little
SergeantCyrano
@SergeantCyrano
Nov 05 2016 06:45
Guys, what am I doing wrong here?
function palindrome(str) {
// Good luck!
var forwards= str.replace(/\W*/,g "").replace(/_/,g "").toLowerCase();
var backwards= str.split("").reverse().join("");
if (forwards[0] === backwards[0]){
for (var i=0, i<forwards.length; i++) {
if (forwards[i] === backwards[i]) {
return true;
} else {
return false;
}
} if (forwards[i] != backwards[i]) {
return false;
}
}
}
palindrome("eye");
Johnny
@JohnnyBizzel
Nov 05 2016 06:47
function palindrome(str) {
// Good luck!
var forwards= str.replace(/\W*/,g "").replace(/_/,g "").toLowerCase();
var backwards= str.split("").reverse().join("");
if (forwards[0] === backwards[0]){
    for (var i=0, i<forwards.length; i++) {
        if (forwards[i] === backwards[i]) {
            return true;
        } else {
            return false;
        }
   }
   if (forwards[i] != backwards[i]) {
       return false;
   }
  }
}
palindrome("eye");
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 06:49
@SergeantCyrano Why is there a comma before the g in your regex?
adilkara
@adilkara
Nov 05 2016 06:49

help! var myArray = [["John", 23], ["dog", 3]];
myArray.shift();

// Only change code below this line.
myArray.unshift(["paul" , 35] ) ;

CamperBot
@camperbot
Nov 05 2016 06:49
no wiki entry for: var myarray john 23 dog 3myarrayshift only change code below this linemyarrayunshiftpaul 35
adilkara
@adilkara
Nov 05 2016 06:49
and it asks myArray should now have [["Paul", 35], ["dog", 3]].
the output i get is same as above
but it doesn't approve
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 06:50
Did you shift the first one off?
adilkara
@adilkara
Nov 05 2016 06:50
i did
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 06:51
Oh wait, sorry...missed that
Maybe it's case sensitive
Try Paul instead of paul
adilkara
@adilkara
Nov 05 2016 06:52
yeah it worked @NicksIdeaEngine thank you.
CamperBot
@camperbot
Nov 05 2016 06:52
adilkara sends brownie points to @nicksideaengine :sparkles: :thumbsup: :sparkles:
:cookie: 266 | @nicksideaengine |http://www.freecodecamp.com/nicksideaengine
Johnny
@JohnnyBizzel
Nov 05 2016 06:52
@SergeantCyrano This for loop looks wrong:
for (var i=0, i<forwards.length; i++) { it should use semi colons
Sorin Ruse
@sorinr
Nov 05 2016 06:54
@eusid just add the cdn lib to ur pen and replace img with an <i> tag and you are done
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 06:55
@SergeantCyrano There's another problem or two you're going to run into, but I would first double check your syntax to make sure what you're trying to write doesn't throw a Syntax Error.
Emmanuel Kaku
@jindeli05
Nov 05 2016 07:01
Need help with a search code for search button click
Jaswanth Chadalavada
@intrnt-sud-b-free
Nov 05 2016 07:08
@gbsimon87 I mean a button which will let people comeback after they open the Wiki Search Page :) ,
SergeantCyrano
@SergeantCyrano
Nov 05 2016 07:13
Figured it out. Only took me three days
Thanks @NicksIdeaEngine
CamperBot
@camperbot
Nov 05 2016 07:14
sergeantcyrano sends brownie points to @nicksideaengine :sparkles: :thumbsup: :sparkles:
:cookie: 269 | @nicksideaengine |http://www.freecodecamp.com/nicksideaengine
SergeantCyrano
@SergeantCyrano
Nov 05 2016 07:14
Thanks @JohnnyBizzel
CamperBot
@camperbot
Nov 05 2016 07:14
sergeantcyrano sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:cookie: 752 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 07:16
@SergeantCyrano That one took me a while, too. I wound up finding someone in here that wrote a solution inside of 2 lines for it if you want to see an easier way
SergeantCyrano
@SergeantCyrano
Nov 05 2016 07:16
Please.
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 07:17
function palindrome(str) {
  str = str.toLowerCase().replace(/[\W_]/g, "");
  return str === str.split("").reverse().join("");
}
SergeantCyrano
@SergeantCyrano
Nov 05 2016 07:17
I ended up individually replacing all non-string characters.
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 07:17
I did the same thing when I first wrote it. My original solution was 20+ lines of code.
SergeantCyrano
@SergeantCyrano
Nov 05 2016 07:18
One of the more frustrating bits is that this isn't really elegant code.
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 07:18
I broke it up into an array, tested each element against the respective one in another array, then returned true or false.
I'm not sure where the line between elegant and not elegant is, but the only reason I felt weird about that solution above is because I didn't understand it.

It basically reads:

Assign a lowercased string with non alpha characters to variable str.
Return whether str is equal to itself when reversed.

with non alpha characters removed *
SergeantCyrano
@SergeantCyrano
Nov 05 2016 07:22
At that point th return will be boolean by default?
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 07:22
Yes :D
SergeantCyrano
@SergeantCyrano
Nov 05 2016 07:23
That's what I need to be able to do. The good news is, after that one, the next one was relatively easy.
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 07:23
Yeah, the ones that follow in that series get much faster/easier after the palindrome one. I'd say you're over one of the harder hurdles for that part.
SergeantCyrano
@SergeantCyrano
Nov 05 2016 07:25
I'm on title casing characters now. I've split the string, written my for loop, now I'm just trying ot remember how to draft the function to make the first letter uppercase. I don't remember the method. I'm thinking something along the lines of .upperCase[i][0]; str.join(""); should do it.
akilesh
@akileshv
Nov 05 2016 07:26
use charAt() make first letter to upper case
SergeantCyrano
@SergeantCyrano
Nov 05 2016 07:28
LOL, oh look, I broke it again! LOL
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 07:28
lol I had a messy solution for that one because I didn't know about charAt() yet, which is not taught in FCC until after that challenge
So I split up the string by words into an array, then split up the words into an array of letters.
Then it's just a matter of a nested for loop to capitalize the first letter and lowercase the rest.
But if you don't mind getting ahead on your learning, charAt will make it simpler.
SergeantCyrano
@SergeantCyrano
Nov 05 2016 07:31
I'm reading about it now, but I don't yetsee how I would use it.
javascript is the only of four languages that I've been trying to learn that's giving me fits, but none of the others are object oriented.
Thanks @akhileshv
CamperBot
@camperbot
Nov 05 2016 07:32
:cookie: 270 | @akhileshv |http://www.freecodecamp.com/akhileshv
sergeantcyrano sends brownie points to @akhileshv :sparkles: :thumbsup: :sparkles:
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 07:34
So, the syntax for charAt is
yourStringVariable.charAt(indexOfLetterYouWant)
You'd still split up the sentence into an array, but now you can use a for loop set to go for the length of each word to capitalize the first letter while lowercasing the rest. Then join it back together and you're good.
SergeantCyrano
@SergeantCyrano
Nov 05 2016 07:37
I know how to do very little of that.

This is my working code before I have everything figured out:

function titleCase(str) {
var upperCase= str.split("");
for (i=0; i<upperCase.length; i++){
str=upperCase.charAt(0).toUpperCase;
str=upperCase.join();
}
return str;
}

And I havent added any code to lowercase it yet.
toUpperCase doesn't appear to be working.
It seems like my big problem is trying to write functions as expressions,
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 07:42
The uppercase and lowercase can happen at the same time. Here's each step broken down. Tell me which part sounds weird.
Split incoming string into array.
Start for loop and set it to run the total length of the array.
Start another for loop and set it to run the total length of the array element (which means, the length of each word)
Using charAt, if you're at the first letter in the word, uppercase.  Else, lowercase.
Join the array back together with spaces between the words.
Return the string.
SergeantCyrano
@SergeantCyrano
Nov 05 2016 07:44
Oh, that's interesting.
Now I'm just having indexing issues, it appears...
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 07:48
Indexing is base 0, so the first element in an array is index 0
Same goes for strings.
In this case, I'd write both of my for loops with the starting variable equal to 0, then have the loop run while starting variable is less than the length of the array (or string), and add one after each loop.
SergeantCyrano
@SergeantCyrano
Nov 05 2016 07:51
The indexing issue is calling on a specific index within a string element.
It should be nameOfStringElementHere[0].toUpperCase;
But what is nameOfStringElementHere?
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 07:52
Your string, whatever the variable name is
in your case, just str
Or the array after breaking it up
But if you broke it up into an array, str[0].toUpperCase will capitalize the first word
Ashish verma
@ashish1500616
Nov 05 2016 08:01
var myMusic =
[
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [ "CS", "8T", "LP" ],
"gold": true
}
// Add record here
{
"artist": "Daft Punk",
"title": "Homework",
"release_year": 1997,
"formats": [ "CD","Cassette","LP"];
"gold": true
}
];
getting syntax error unexpected token
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 08:11
Is that all of the code?
I didn't find anything off about that code, but perhaps the problem is elsewhere
MM Nauman
@mmnauman
Nov 05 2016 08:12
Hello Need Help in tutorial 167
Abhisek Pattnaik
@abhisekp
Nov 05 2016 08:13
@mmnauman Could you please give a link to the challenge?
@mmnauman btw, Challenges are not numbered ;)
Abhisek Pattnaik
@abhisekp
Nov 05 2016 08:15
@mmnauman awesome! What do you need help with?
Is there anything which you do not understand?
MM Nauman
@mmnauman
Nov 05 2016 08:15
Instructions
Instructions are little Confusing As functionWithArgs should be a function
functionWithArgs(1,2) should output 3
functionWithArgs(7,9) should output 16
Call functionWithArgs after you define it.
eusid
@eusid
Nov 05 2016 08:16
there has to be a better way to do the celsius fahrenheit logic ? seems like way too much code for something so simple? http://codepen.io/eusid/pen/KNKmXM
Abhisek Pattnaik
@abhisekp
Nov 05 2016 08:16
@mmnauman Q: What is a function?
Nick Garcia
@NicksIdeaEngine
Nov 05 2016 08:19
@SergeantCyrano I'm heading to bed. FCC wrote an article on this if you wanted to see it (but it does give you the answers) Three Ways to Title Case a Sentence in JavaScript
MM Nauman
@mmnauman
Nov 05 2016 08:19
@abhisekp The Reusable Code and we can make our script short by adding the function which we can invoke any time when we need
Guys any idea how to prevent unvalid operations?
Like when the string starts with an operation ( / * +)
Or having more than 1 operation
Abhisek Pattnaik
@abhisekp
Nov 05 2016 08:21
@mmnauman perfect. :white_check_mark:
Function is something you give input to and get some output after processing the input.
[INPUT -> PROCESS -> OUTPUT] <-- this whole thing makes a function.
function sum(a, b) { // input
  var c = a + b; // processing
  return c; // output
}
Gaston Kirsman
@gastikirs
Nov 05 2016 08:21
Its working but if you write valid operations
eusid
@eusid
Nov 05 2016 08:22
@gastikirs not that far yet but good job !
Gaston Kirsman
@gastikirs
Nov 05 2016 08:23
@eusid :) but its not working well
eusid
@eusid
Nov 05 2016 08:23
@gastikirs how can i replicate error?
Sorin Ruse
@sorinr
Nov 05 2016 08:24
@abhisekp not necessarily. you can call a function without any arguments but always you expect some kind of a response
Gaston Kirsman
@gastikirs
Nov 05 2016 08:25
@eusid You can start an operation with +++ or //
Abhisek Pattnaik
@abhisekp
Nov 05 2016 08:25
@sorinr :point_up: November 5, 2016 1:45 PM
Gaston Kirsman
@gastikirs
Nov 05 2016 08:25
You can write "2+2++++4///4"
Shouldnt be like that
eusid
@eusid
Nov 05 2016 08:25
@gastikirs i'd write a function called validOperation or something to test the input before evaluating
Gaston Kirsman
@gastikirs
Nov 05 2016 08:26
@eusid I just dont want to be able to write more than 1 operation
eusid
@eusid
Nov 05 2016 08:26
yea im trying to think of how i would write that function but with negative values etc would be confusing
Sorin Ruse
@sorinr
Nov 05 2016 08:27
@abhisekp in that case. yes. you need to pass args to the function. if u don't pass them there will be an err coz the func expects them
MM Nauman
@mmnauman
Nov 05 2016 08:31

if we want to add different arguments in one function for example:

function example(a, b) {

console.log(a * b);

}

example(5 , 5);

Now If we want to call the function with arguments of addition and subtraction then we need to write different function Because when I tried to write console.log(a + b) It over writes the existing function?

Sorin Ruse
@sorinr
Nov 05 2016 08:33
@mmnauman you should call example(5,5)
MM Nauman
@mmnauman
Nov 05 2016 08:35
@sorinr Oh Yes Corrected
Sorin Ruse
@sorinr
Nov 05 2016 08:35
@mmnauman or define the function as example(a,operator, b)
MM Nauman
@mmnauman
Nov 05 2016 08:35
@sorinr can you explain me with an example
Sorin Ruse
@sorinr
Nov 05 2016 08:36
@mmnauman just a sec
@mmnauman here an example: example
MM Nauman
@mmnauman
Nov 05 2016 08:41
@sorinr Wow thanks for the example Now Understood but Can you say me About eval and operator ? operator is a variable or just a parameter?
CamperBot
@camperbot
Nov 05 2016 08:41
mmnauman sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 818 | @sorinr |http://www.freecodecamp.com/sorinr
Sorin Ruse
@sorinr
Nov 05 2016 08:44
@mmnauman operator is just a parameter ur passing to the function. eval is a js function that try to "evaluate" that string. ofc if you pass shit to that function you will expect shit back :)
Abhisek Pattnaik
@abhisekp
Nov 05 2016 08:45
I wouldn't use such language though
Sorin Ruse
@sorinr
Nov 05 2016 08:47
@abhisekp it was just to emphasize that you have to give a function the right parameters it expects. sorry for that
MM Nauman
@mmnauman
Nov 05 2016 08:50
@sorinr This is Wrong You can Cannot use this type of words while explaining. If you don't know anything in future then if someone use this type of words while explaining you then you will know how i'm feeling now.
eusid
@eusid
Nov 05 2016 08:53
the operator is a variable where u assign the operator to the functions parameters ? :)
Abhisek Pattnaik
@abhisekp
Nov 05 2016 08:54
@sorinr :warning: Also I request you to please read and abide by FreeCodeCamp Code of Conduct if you've not already.
Ilian Iliev
@zaken
Nov 05 2016 08:55
good morning guys, can anyone through https://www.freecodecamp.com/challenges/make-object-properties-private help me understand what is the task, please?
Sorin Ruse
@sorinr
Nov 05 2016 08:56
i apologize to all for my example
MM Nauman
@mmnauman
Nov 05 2016 08:59
@sorinr Its ok . See we got this Outstanding platform to discuss and help each other So Leaving our ego at home we have to help and discuss politely hope you understand.
Sorin Ruse
@sorinr
Nov 05 2016 08:59
@mmnauman what i meant is that you have to pass to the function the right parameters in order to work. it was no offence to you and if you took it like that i am really sorry. it was not my intention to do that
MM Nauman
@mmnauman
Nov 05 2016 09:01
@sorinr It's okay.
Ilian Iliev
@zaken
Nov 05 2016 09:05
thanks @dzift got it myself :D
CamperBot
@camperbot
Nov 05 2016 09:05
sorry dzift, you can't send brownie points to yourself! :sparkles: :sparkles:
khadijah1
@khadijah1
Nov 05 2016 09:41
how do you solve the using bjects for lookups challenge
Chuks Opia
@9jaswag
Nov 05 2016 09:44
hello guys, how do I go about solving the Title Case a Sentence challenge?
when I split all the text into an array, what do I do next?
Kartikeya Gupta
@kartikeya100
Nov 05 2016 09:48
what react apps can i do.....i find game of life and dungeon game very hard i if you could suggest me any less complex react app....thanks
@9jaswag you should splice the 1st word convert it to upper case and then join it with rest of the words
Semak
@drdextar
Nov 05 2016 09:53
Hello everyone
Chuks Opia
@9jaswag
Nov 05 2016 09:53
@kartikeya100 true...I never even gave that a thought...let me try it
Semak
@drdextar
Nov 05 2016 09:54
i am struck on the counting cards challenge.
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 10:05
print ur code here
Semak
@drdextar
Nov 05 2016 10:06

var count = 0;

function cc(card) {
// Only change code below this line

if (card >= 7 || card <= 9){
return count +' '+"Hold";
}

else if (card == 10 || card == "j"||card == "Q"||card =="K" ||card == "A" ){
count -= 1;
return count +' '+"Hold";
}

else if(card >= 2 || card <= 6 ){
count += 1 ;
return count +' '+"Bet";
}

// Only change code above this line
}

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

D O R C ¥
@Dorcy-ndg3
Nov 05 2016 10:07
@drdextar u will want to put retun at the end cause the values of those cards keep changing
Semak
@drdextar
Nov 05 2016 10:08
@Dorcy-ndg3 you mean in the main function. function cc(card)
Kodemar Gaurav Thantry
@gauravthantry
Nov 05 2016 10:09

function confirmEnding(str, target) {
var arr=[];
var arr1=[];
if(target.length===1){
arr = str.split("");
if(arr[arr.length-1]===target)
return true;
else if(arr[arr.length-1]!==target)
return false;
}
else if(target.length>1){
arr = str.split(" ");

if(arr[arr.length-1]===target)
return true;
else if(arr[arr.length-1]!==target)
return false;
}
arr1=target.split("");
var k=0;
for(var i=arr1.length-1;i>=0;i--)
{
for(var j=arr.length-1;j>=0;j--)
if(arr1[i]===arr[j]){
k++;
}
}

if(k===arr1.length){
  return true;}
  else if(k!==arr1.length)
    return false;

}

confirmEnding("Bastian", "n");

guys my last for loop portion after the initialization of K is wrong
please help me out there
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 10:10
@drdextar yes just set ur count in the if sections the call return with its respective counts and a word bet or hold
Kodemar Gaurav Thantry
@gauravthantry
Nov 05 2016 10:11
how do i check if a part of the ending word matches with the compared array
?
Semak
@drdextar
Nov 05 2016 10:19
@Dorcy-ndg3 can i send you pm.
Chuks Opia
@9jaswag
Nov 05 2016 10:27
@kartikeya100 thanks! I solved it but I wanna know if there are better ways of solving the problem...maybe compare codes with yours
CamperBot
@camperbot
Nov 05 2016 10:27
9jaswag sends brownie points to @kartikeya100 :sparkles: :thumbsup: :sparkles:
:cookie: 361 | @kartikeya100 |http://www.freecodecamp.com/kartikeya100
Semak
@drdextar
Nov 05 2016 10:28
@Dorcy-ndg3 i am still not able to complete it.
eusid
@eusid
Nov 05 2016 10:29
@gauravthantry you need to look at the substring method
Skibper
@Skibper
Nov 05 2016 10:29
hey guy, im in Roman Numeral Converter challenge, can anyone make my code better? because i think it's quite terrible...
function convertToRoman(num) {
var arr = [];
var m = num/1000;
var d = (num%1000)/500;
var c = (num%500)/100;
var l = (num%100)/50;
var x = (num%50)/10;
var v = (num%10)/5;
var i = num%5;
for (var a=0;a<7;a++) arr[a]=''; for (var j=1;j<=m;j++) arr[0]+='M'; if (d>=1)
arr[1]+='D';
if ((num/100)%10>=9){
arr[2]+='CM';
arr[1]='';
}
else if ((num/100)%10>=4 && (num/100)%10<5) arr[2]+='CD'; else{ for (var k=1;k<=c;k++) arr[2]+='C'; } if (l>=1)
arr[3]+='L';
if ((num/10)%10>=9){
arr[4]+='XC';
arr[3]='';
}
else if ((num/10)%10>=4 && (num/10)%10<5) arr[4]+='XL'; else{ for (var z=1;z<=x;z++) arr[4]+='X'; } if (v>=1)
arr[5]+='V';
if (num%10>=9){
arr[6]+='IX';
arr[5]='';
}
else if (num%10>=4 && num%10<5)
arr[6]+='IV';
else{
for (var y=1;y<=i;y++)
arr[6]+='I';
}
return arr.join("");
}
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 10:33
@drdextar paste ur current code but do this first
type () before u paste ur code the hit (shift+enter to go to a new line) paste ur code and skip a line again (shift+enter) and type the ()again
i meant type ```
Axelle
@AxelleDRouge
Nov 05 2016 10:35
Hello, I have problems with the following Challenge https://www.freecodecamp.com/challenges/record-collection
Can someone help me understand it, I can show the collection but after that, I'm lost
Semak
@drdextar
Nov 05 2016 10:37

type (
var count = 0;

function cc(card) {
// Only change code below this line

if (card >= 7 || card <= 9){

return count +' '+"Hold";
}

else if (card == 10 || card == "j"||card == "Q"||card =="K" ||card == "A" ){
var negtivecount = count - 1;
return negtivecount +' '+"Hold";
}

else if(card >= 2 || card <= 6 ){
var postivecount = count + 1;
return postivecount +' '+"Bet";
}

// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(2); cc(10);

)

Patkaa
@Patkaa
Nov 05 2016 10:37
not really understanding " Returning Boolean Values from Function "
Skibper
@Skibper
Nov 05 2016 10:38
```
function convertToRoman(num) {
  var arr = [];
  var m = num/1000;
  var d = (num%1000)/500;
  var c = (num%500)/100;
  var l = (num%100)/50;
  var x = (num%50)/10;
  var v = (num%10)/5;
  var i = num%5;
  for (var a=0;a<7;a++)
    arr[a]='';
  for (var j=1;j<=m;j++)
    arr[0]+='M';
  if (d>=1)
    arr[1]+='D';
  if ((num/100)%10>=9){
    arr[2]+='CM';
    arr[1]='';
  }
  else if ((num/100)%10>=4 && (num/100)%10<5)
    arr[2]+='CD';
  else{
    for (var k=1;k<=c;k++)
      arr[2]+='C';
  }
  if (l>=1)
    arr[3]+='L';
  if ((num/10)%10>=9){
    arr[4]+='XC';
    arr[3]='';
  }
  else if ((num/10)%10>=4 && (num/10)%10<5)
    arr[4]+='XL';
  else{
    for (var z=1;z<=x;z++)
      arr[4]+='X';
  }
  if (v>=1)
    arr[5]+='V';
  if (num%10>=9){
    arr[6]+='IX';
    arr[5]='';
  }
  else if (num%10>=4 && num%10<5)
    arr[6]+='IV';
  else{
    for (var y=1;y<=i;y++)
      arr[6]+='I';
  }
  return arr.join("");
Semak
@drdextar
Nov 05 2016 10:39
@Skibper how you paste your code i am not able to paste it correctly. :worried:
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 10:40
@drdextar i told u to only return at the en
wiki how to format code
CamperBot
@camperbot
Nov 05 2016 10:40
no wiki entry for: how to format code
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 10:40
how to format code
@drdextar use backsticks before pasting code
skip a line
paste ur code
the put backsticks again
they should be three of them
Skibper
@Skibper
Nov 05 2016 10:41
@drdextar i just type and press (shift + enter) and the last i paste my code between two signals
```
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 10:42
backsticks are normally before the number one on ur keyboard
then hit shift enter, paste ur code, shift enter again then backsticks
Patkaa
@Patkaa
Nov 05 2016 10:42

function isLess(a, b) {
  // Fix this code
  {
   return a < b; 
  }
   return a === b;
   }
why does this one work, but if I change the position between the returns, it doesn't?
then it only gives me " false "
should the "true" value always be first?
Temi
@temiadesina
Nov 05 2016 10:43
Hi Guys please I need help understanding how I can approach this problem, what would your pseudocode be like ?
https://www.freecodecamp.com/challenges/profile-lookup#?solution=%0A%2F%2FSetup%0Avar%20contacts%20%3D%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Akira%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Laine%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220543236543%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Pizza%22%2C%20%22Coding%22%2C%20%22Brownie%20Points%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Harry%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Potter%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220994372684%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Hogwarts%22%2C%20%22Magic%22%2C%20%22Hagrid%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Sherlock%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Holmes%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220487345643%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Intriguing%20Cases%22%2C%20%22Violin%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Kristian%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Vos%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%22unknown%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Javascript%22%2C%20%22Gaming%22%2C%20%22Foxes%22%5D%0A%20%20%20%20%7D%0A%5D%3B%0A%0A%0Afunction%20lookUpProfile(firstName%2C%20prop)%7B%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0A%0A%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20contacts.length)%0A%2F%2F%20Only%20change%20code%20above%20this%20line%0A%7D%0A%0A%2F%2F%20Change%20these%20values%20to%20test%20your%20function%0AlookUpProfile(%22Akira%22%2C%20%22likes%22)%3B%0A
Semak
@drdextar
Nov 05 2016 10:44
@Dorcy-ndg3 @Skibper thank you
CamperBot
@camperbot
Nov 05 2016 10:44
drdextar sends brownie points to @dorcy-ndg3 and @skibper :sparkles: :thumbsup: :sparkles:
:cookie: 258 | @skibper |http://www.freecodecamp.com/skibper
:cookie: 290 | @dorcy-ndg3 |http://www.freecodecamp.com/dorcy-ndg3
Markus Kiili
@Masd925
Nov 05 2016 10:44
@Patkaa The first return is always executed. Never the second.
Shawn Kemp
@official-shawnkemp
Nov 05 2016 10:44
hi is there an open source community? i want to build/enhance my skills as a front end by doing so, thats why i want to join even tho its for free. ✌🏻️#juniordevforlife
Patkaa
@Patkaa
Nov 05 2016 10:45
@Masd925 Ahh true. What's the point of having two then?
if it's not in switch
Conor Murphy
@cmurphy580
Nov 05 2016 10:45
Hey i'm trying to set up my local weather page and have the background color change with the temperature. This is the code i have set up, but for some reason its not working. any ideas that might help with this problem?
if (fahrenheit>=80) {
          $("#body").css("background-color", "#C41919");
        } else if (fahrenheit>=60) {
          $("#body").css("background-color", "#FF7931");
        } else if (fahrenheit>=40) {
          $("#body").css("background-color", "#FFD631");
        } else if (fahrenheit>=20) {
          $("#body").css("background-color", "#1DECBA");
        } else if (fahrenheit>0) {
          $("#body").css("background-color", "#006DD3");
        }
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 10:45
@temiadesina should look like this some how u can use ur method and if u dont understand this one ask ,,,
```
function updateRecords(id, prop, value) {

  if (value === "") {
    delete collection[id][prop];

  } else if(prop !== "tracks"){
      collection[id][prop] = value;
    }

    else if (collection[id].hasOwnProperty(prop)) {
      collection[id][prop].push(value);
    }

      else {
      collection[id][prop] = [value];
    }
  }

  return collection;
}
Markus Kiili
@Masd925
Nov 05 2016 10:45
@Patkaa I see no point here for two returns.
Shawn Kemp
@official-shawnkemp
Nov 05 2016 10:46
@Patkaa maybe u could use nesting?
Chuks Opia
@9jaswag
Nov 05 2016 10:47
for some funny reasons, I now have to reload my browser before I can get new messages posted into this room...
Patkaa
@Patkaa
Nov 05 2016 10:47
^ it worked perfectly fine without the second return here, hehe
^thanks guys!
Temi
@temiadesina
Nov 05 2016 10:48
@Dorcy-ndg3 Hey I have done this challenge you might be responding to an old question I asked I am trying to understand how to approach this problem:
https://www.freecodecamp.com/challenges/profile-lookup#?solution=%0A%2F%2FSetup%0Avar%20contacts%20%3D%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Akira%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Laine%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220543236543%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Pizza%22%2C%20%22Coding%22%2C%20%22Brownie%20Points%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Harry%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Potter%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220994372684%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Hogwarts%22%2C%20%22Magic%22%2C%20%22Hagrid%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Sherlock%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Holmes%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220487345643%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Intriguing%20Cases%22%2C%20%22Violin%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Kristian%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Vos%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%22unknown%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Javascript%22%2C%20%22Gaming%22%2C%20%22Foxes%22%5D%0A%20%20%20%20%7D%0A%5D%3B%0A%0A%0Afunction%20lookUpProfile(firstName%2C%20prop)%7B%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0A%0A%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20contacts.length)%0A%2F%2F%20Only%20change%20code%20above%20this%20line%0A%7D%0A%0A%2F%2F%20Change%20these%20values%20to%20test%20your%20function%0AlookUpProfile(%22Akira%22%2C%20%22likes%22)%3B%0A
Ajinkya
@Ajinkya5509
Nov 05 2016 10:49
h i'm stuck at Boo who challange .. plz help me i can't undersatnd what suoopse to do it
Chuks Opia
@9jaswag
Nov 05 2016 10:49
@temiadesina you don't need to grab the whole link...just the bit before #?
Axelle
@AxelleDRouge
Nov 05 2016 10:56
@Dorcy-ndg3 well you didn't answer directly to me but thanks for your help anyway ;)
CamperBot
@camperbot
Nov 05 2016 10:56
axelledrouge sends brownie points to @dorcy-ndg3 :sparkles: :thumbsup: :sparkles:
:cookie: 291 | @dorcy-ndg3 |http://www.freecodecamp.com/dorcy-ndg3
Temi
@temiadesina
Nov 05 2016 10:56
@9jaswag thanks would do that
CamperBot
@camperbot
Nov 05 2016 10:56
temiadesina sends brownie points to @9jaswag :sparkles: :thumbsup: :sparkles:
:cookie: 248 | @9jaswag |http://www.freecodecamp.com/9jaswag
Temi
@temiadesina
Nov 05 2016 10:58
Okay maybe I should break it down into pieces of the solution I am trying to understand: How can I check for the length or size of an object so I can iterate through it ?
Markus Kiili
@Masd925
Nov 05 2016 10:59
@temiadesina On profile lookup, just make a simple for loop through array contacts.
You have learned that on earlier challenges.
Chuks Opia
@9jaswag
Nov 05 2016 11:00
@temiadesina your function the following with the two arguments its passed: loop thru the contacts array to see if firstName is an actually exists and that (prop) is a property of that contact.
if that condition is passed, then you return contact[i][firstName] @temiadesina
Temi
@temiadesina
Nov 05 2016 11:02
@Masd925 @9jaswag yeah I am trying to do that, what I am trying to know is how to set the condition for the loop, i.e. i < contacts. ? , how do you get the size of an object
Chuks Opia
@9jaswag
Nov 05 2016 11:02
@temiadesina i < contact.length
contact is an array not an objectt @temiadesina
Markus Kiili
@Masd925
Nov 05 2016 11:03
@temiadesina i<contacts.length
Temi
@temiadesina
Nov 05 2016 11:04
@9jaswag ahh tried that but I wasn't sure checked online and saw people using Object.size(objectArrayname)
@9jaswag I would use that now
Chuks Opia
@9jaswag
Nov 05 2016 11:04
send me a pm @temiadesina
ok..do use it then
khadijah1
@khadijah1
Nov 05 2016 11:10
can someone help me with the using objects for lookups challenge?

ar lookup = {
'alpha': function () {
return (result="Adams");
},

'bravo': function () {
 return (result="Boston");

},

'charlie': function () {
  return (result = "Chicago");
},
'delta': function () {
  return (result="Denver");
},
'echo': function(){
 return (result="Easy");

},

'foxtrot': function(){
  result="Frank";
},
'""':function(){
  result="undefined";
}

};

lookupval;

heroiczero
@heroiczero
Nov 05 2016 11:12
@khadijah1 you gotta use objects like {"alpha": "Adams",}
khadijah1
@khadijah1
Nov 05 2016 11:13
@heroiczero so instead of using a function i replace it with{"alpha": "Adams",}?
heroiczero
@heroiczero
Nov 05 2016 11:15
@khadijah1 yes store the objects in a variable return the result with the variable[objects}
[object]
khadijah1
@khadijah1
Nov 05 2016 11:16
@heroiczero could you give an example ?
heroiczero
@heroiczero
Nov 05 2016 11:18
@khadijah1 variable lookup={"like": "hello"};
return lookup[variable];
khadijah1
@khadijah1
Nov 05 2016 11:18
@heroiczero thx
CamperBot
@camperbot
Nov 05 2016 11:18
khadijah1 sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:cookie: 346 | @heroiczero |http://www.freecodecamp.com/heroiczero
Temi
@temiadesina
Nov 05 2016 11:21
@Masd925 @9jaswag okay I tried this but it returns only one answer why do you think so ?
//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


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

for(var i=0; i < contacts.length; i++) {

  if (contacts[i].firstName === firstName && (contacts.hasOwnProperty)===true) {
    return contacts[i][prop];
  }

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

  else if ((contacts.hasOwnProperty)===false) {
    return "No such property";
  }
}
// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "address");
heroiczero
@heroiczero
Nov 05 2016 11:22
@temiadesina you need two loops
Chuks Opia
@9jaswag
Nov 05 2016 11:22
@temiadesina the last else if should be just an else
and the reason you're getting one answer is cos of your multiple return statements...return statements end the function
Diego Mayer
@Chrono79
Nov 05 2016 11:23
@heroiczero no he doesn't
Chuks Opia
@9jaswag
Nov 05 2016 11:24
@heroiczero he doesn't need two loops
@temiadesina assign "No such contact" to a var
Diego Mayer
@Chrono79
Nov 05 2016 11:25
@temiadesina contacts.hasOwnPropertythis is one of the thing you should fix, contacts is an array, you can't use hasOwnProperty with it
Devil Xie
@thanktiger
Nov 05 2016 11:26
hello everybody
Markus Kiili
@Masd925
Nov 05 2016 11:27
@temiadesina The simplest if structure is two nested if's inside contact loop. First for firstName check and second for property existence.
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 11:28
guys whats wrong with this code ???

function mutation(arr) {
  var changeCase1 = arr[0].lowerCase;
  var changeCase2 = arr[1].lowerCase;

 for(var i=0; i<changeCase2.length; i++){
  var answer = changeCase1.indexOf(changeCase2[i] , 0);

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

 }  
 return true;
}

mutation(["hello", "hey"]);
Diego Mayer
@Chrono79
Nov 05 2016 11:29
@Dorcy-ndg3 it's toLowerCase()
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 11:30
i saw that but some cases arent running
Chuks Opia
@9jaswag
Nov 05 2016 11:30
thumbs up
Diego Mayer
@Chrono79
Nov 05 2016 11:30
What you do inside the loop is also wrong, if you return in both if and else, your loop won't run more than once @Dorcy-ndg3
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 11:31
why is it wrong??
Diego Mayer
@Chrono79
Nov 05 2016 11:32
@Dorcy-ndg3 you only check first letter like that, return exits the loop (and the function)
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 11:32
so what do i do if i want to chech letter by letter
its only one condition not passing
Diego Mayer
@Chrono79
Nov 05 2016 11:33
@Dorcy-ndg3 that's just a concidence
You could return early in one condition
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 11:33
thats why am asking what i should do
so ur saying returns ends my loop
Patkaa
@Patkaa
Nov 05 2016 11:34
^can you have two returns, one giving out if it's " true " and the other one if it's "false" ?
Diego Mayer
@Chrono79
Nov 05 2016 11:34
and I'm giving you hints on what to do, it's your job to figure out which condition that is
do you have always to check all the letters?
Patkaa
@Patkaa
Nov 05 2016 11:34
or should u just use a var answer example?
Chuks Opia
@9jaswag
Nov 05 2016 11:35
@temiadesina are you sorted?
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 11:36
@Chrono79 its supposed to check all letters and returns true if all letters in arr[1] are found in arr[0]
no matter the case
Diego Mayer
@Chrono79
Nov 05 2016 11:37
@Dorcy-ndg3 and if any of them isn't there, why would you keep checking?
Chuks Opia
@9jaswag
Nov 05 2016 11:37
@Chrono79 what do you think is wrong with my code?
function largestOfFour(arr) {
  // You can do this!
  newArr = [];
  for (var i = 0; i < arr.length; i++) {
      for (var j = 0; j < arr[i].length; j++) {
        max = 0;
          max = arr[i][j] > max ?arr[i][j] :max;
      }
    newArr.push(max);

  }
  return newArr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 11:37
its suppposed to return false then
Diego Mayer
@Chrono79
Nov 05 2016 11:38
@Dorcy-ndg3 then you could return false inside your loop
and true elsewhere
Chuks Opia
@9jaswag
Nov 05 2016 11:38
@Chrono79 it returns [3,26,39,1]
Monesul Haque
@mones-cse
Nov 05 2016 11:39
@9jaswag in each loop max become 0 is it that what you want to be ?
Diego Mayer
@Chrono79
Nov 05 2016 11:40
@9jaswag you reset max where you shouldn't
Maximilian Berkmann
@Berkmann18
Nov 05 2016 11:40
@9jaswag Is your function supposed to return the largest number of each individual arrays or the largest array ?
Chuks Opia
@9jaswag
Nov 05 2016 11:40
@mones-cse so I'm better off declaring it outside?
@Berkmann18 largest
Maximilian Berkmann
@Berkmann18
Nov 05 2016 11:41
@9jaswag ?
Chuks Opia
@9jaswag
Nov 05 2016 11:41
@mones-cse thanks...that solved it...can't believe I keep making such mistakes
CamperBot
@camperbot
Nov 05 2016 11:41
9jaswag sends brownie points to @mones-cse :sparkles: :thumbsup: :sparkles:
:cookie: 430 | @mones-cse |http://www.freecodecamp.com/mones-cse
Monesul Haque
@mones-cse
Nov 05 2016 11:42
@9jaswag dont worry every one make mistake :P
Chuks Opia
@9jaswag
Nov 05 2016 11:43
@mones-cse @Chrono79 is it me or can this also be solved using the reduce() function...cos it doesn't seem to work when I try using it
Diego Mayer
@Chrono79
Nov 05 2016 11:44
@9jaswag yes, you can use reduce and map (or map alone)
Chuks Opia
@9jaswag
Nov 05 2016 11:44
instead of running the second loop, I feel .reduce can be used in the first loop to return the highest number in each sub array
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 11:45
@Chrono79 am still stuck
Diego Mayer
@Chrono79
Nov 05 2016 11:45
@Dorcy-ndg3 show your code
Chuks Opia
@9jaswag
Nov 05 2016 11:45
@Chrono79 can you help with the code using reduce and map?
I wanna compare it
Diego Mayer
@Chrono79
Nov 05 2016 11:45
@9jaswag first map, then reduce (that's all I'm allowed to disclose ;))
they're not chained btw
Chuks Opia
@9jaswag
Nov 05 2016 11:45
ok
I'll give it a try
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 11:49
ok it now passes cause i passed the last return outside the loop
thanks @Chrono79
CamperBot
@camperbot
Nov 05 2016 11:49
dorcy-ndg3 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2429 | @chrono79 |http://www.freecodecamp.com/chrono79
D O R C ¥
@Dorcy-ndg3
Nov 05 2016 11:50
buh i have a question is it that two return statements will end the loop or any return statement
Ofor Chinedu
@oforchinedu
Nov 05 2016 11:51
I dont understand the instruction

You will need to use escape sequences to insert special characters correctly. You will also need to follow the spacing as it looks above, with no spaces between escape sequences or words.

Here is the text with the escape sequences written out.

FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine

Any one ?
Diego Mayer
@Chrono79
Nov 05 2016 11:55
@Dorcy-ndg3 if there is no possibility that the loop keeps running, it'll end at the first execution, that's why you can't put return in both if/else branches
This message was deleted
@oforchinedu FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine
Use the table to replace the bold text
Ofor Chinedu
@oforchinedu
Nov 05 2016 11:57
thanks @Chrono79
CamperBot
@camperbot
Nov 05 2016 11:57
oforchinedu sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2430 | @chrono79 |http://www.freecodecamp.com/chrono79
Ofor Chinedu
@oforchinedu
Nov 05 2016 11:57
ALso how do I send brownies lol @Chrono79
Theodore P.
@Ierofantis
Nov 05 2016 11:57
does anyone knows how to choose an element(document.getElementById) in React?
Chuks Opia
@9jaswag
Nov 05 2016 11:58
@oforchinedu by thanking a person
Diego Mayer
@Chrono79
Nov 05 2016 11:58
saying thanks and mentioning something like @Ierofantis
CamperBot
@camperbot
Nov 05 2016 11:58
chrono79 sends brownie points to @ierofantis :sparkles: :thumbsup: :sparkles:
:cookie: 401 | @ierofantis |http://www.freecodecamp.com/ierofantis
Theodore P.
@Ierofantis
Nov 05 2016 11:58
@Chrono79 hahahaha
@Chrono79 thanks for mentioning :P
CamperBot
@camperbot
Nov 05 2016 11:58
ierofantis sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2431 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Nov 05 2016 11:58
:+1:
Chuks Opia
@9jaswag
Nov 05 2016 11:58
@Chrono79 what's the diff btw substring() and substr()
Ofor Chinedu
@oforchinedu
Nov 05 2016 11:59
lol thanks @Chrono79
CamperBot
@camperbot
Nov 05 2016 11:59
oforchinedu sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:warning: oforchinedu already gave chrono79 points
Monesul Haque
@mones-cse
Nov 05 2016 11:59
lolz
Chuks Opia
@9jaswag
Nov 05 2016 11:59
lol\
Diego Mayer
@Chrono79
Nov 05 2016 11:59
@9jaswag read mdn docs, but I think one of them (don't remember which one right now) uses a length and the other only indices
Chuks Opia
@9jaswag
Nov 05 2016 12:00
ok
Josaped Moreno
@androuino
Nov 05 2016 12:00
hello, would like to ask if you have a better simpler solution for Seek and Destroy challenge than mine.

function destroyer(arr) {
  // Remove all the values
  // extract the first arr argument
  var len = arguments[0];
  // create a temp arr that will hold the values of 2nd and 3rd arguments
  var myArr = [];
  // iterate over the arguments starting from index 1
  for (var i = 1, argLen = arguments.length; i < argLen; i++) {
    // put the values in the temp arr
    myArr.push(arguments[i]);
  }

  // filter the 2 arrays
  // don't know why my code works but it's cool to see it's working
  var destroy = len.filter(function(arg) {
    // var to hold boolean value
    var bool;
    for (var j = 0; j < myArr.length; j++) {
      if (myArr[j] === arg)
        return false;
      else
        bool = true;
    }
    return bool;
  });

  // finally return the destroy variable
  return destroy;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Thanks...
Theodore P.
@Ierofantis
Nov 05 2016 12:00
@9jaswag I don't remember but I ve found a good article in stack overflow I think It will help you https://stackoverflow.com/questions/3745515/what-is-the-difference-between-substr-and-substring
Chuks Opia
@9jaswag
Nov 05 2016 12:01
@lerofantis thanks. i'll check it out
CamperBot
@camperbot
Nov 05 2016 12:01
9jaswag sends brownie points to @lerofantis :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for lerofantis
Theodore P.
@Ierofantis
Nov 05 2016 12:02
@9jaswag :+1:
Stephen James
@sjames1958gm
Nov 05 2016 12:02
@androuino in your filter function boolean is not needed just return true after your loop. You could even use indexOf instead of the for loop
Josaped Moreno
@androuino
Nov 05 2016 12:03
doesn't work man @sjames1958gm
Diego Mayer
@Chrono79
Nov 05 2016 12:07
@androuino why using len instead of arr? Not that it'll solve your problems but unneeded code is a source of headaches later on
Stephen James
@sjames1958gm
Nov 05 2016 12:07
@androuino hmm since you either return false or set bool to true seems you could just return true where you return bool
Josaped Moreno
@androuino
Nov 05 2016 12:10
@sjames1958gm if you check my code here http://www.pythontutor.com/javascript.html#mode=edit you will see how my code behave.
@Chrono79 means arr = arguments[0]?
Ofor Chinedu
@oforchinedu
Nov 05 2016 12:12
@Chrono79 I tried this and it did not work "FirstLine\n \SecondLine\ \rThirdLine "
Diego Mayer
@Chrono79
Nov 05 2016 12:12
@androuino yes, arr === arguments[0]
@oforchinedu leave no spaces and escape your backslashes
Josaped Moreno
@androuino
Nov 05 2016 12:13
@Chrono79 it works man. Thanks.
CamperBot
@camperbot
Nov 05 2016 12:13
androuino sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2432 | @chrono79 |http://www.freecodecamp.com/chrono79
Ofor Chinedu
@oforchinedu
Nov 05 2016 12:13
Not leaving space reduces the number of passed tests
@Chrono79
Diego Mayer
@Chrono79
Nov 05 2016 12:14

@oforchinedu do both things at the same time, it's not a matter or blindly trying to get all green marks ;)

myStr should have encoded text with the proper escape sequences and no spacing.
myStr should have one newline character \n
myStr should have one carriage return character \r
myStr should have two correctly escaped backslash characters \\

Those are the things you should achieve, see the first one, it says no spacing

marzelin
@marzelin
Nov 05 2016 12:16
@androuino
function destroyer(arr) {
  return arr.filter(i => ![...arguments].includes(i));
}
Josaped Moreno
@androuino
Nov 05 2016 12:16
@marzelin don't know how to use .includes yet.
Ofor Chinedu
@oforchinedu
Nov 05 2016 12:17
@Chrono79 this worked "FirstLine\n\SecondLine\\rThirdLine"
marzelin
@marzelin
Nov 05 2016 12:18
@androuino
function destroyer(arr) {
  return arr.filter(i => [...arguments].indexOf(i) < 0);
}
Stephen James
@sjames1958gm
Nov 05 2016 12:19
@androuino This is what I meant - and it works
  // filter the 2 arrays
  // don't know why my code works but it's cool to see it's working
  return arr.filter(function(arg) {
    for (var j = 0; j < myArr.length; j++) {
      if (myArr[j] === arg)
        return false;
    }
    return true;
  });
Josaped Moreno
@androuino
Nov 05 2016 12:21
@marzelin arrow function syntax is only available in ES6 says from the terminal
@sjames1958gm thanks man, I've changed my code with your solution.
CamperBot
@camperbot
Nov 05 2016 12:23
androuino sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4197 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Theodore P.
@Ierofantis
Nov 05 2016 12:23
Can anyone tells me why my ComponentDidMount component is not working?
https://codepen.io/Ierofantis/pen/XjvxzY?editors=1010
Stephen James
@sjames1958gm
Nov 05 2016 12:23
@androuino :+1:
Theodore P.
@Ierofantis
Nov 05 2016 12:25
I want to change the line setstate color black to something like cell[arr[c]].style.backgroundColor = "red"; when var cell = document.getElementById("wrapper").getElementsByTagName("td");
but I dont know how to do this with refs
marzelin
@marzelin
Nov 05 2016 12:26
@Ierofantis open browser console and you'll see where the problem is
Jay Mehta
@mjay2001007
Nov 05 2016 12:30
best editor to start coding in
adilkara
@adilkara
Nov 05 2016 12:31

function myLocalScope() {
var myVar='use strict';

console.log(myVar);
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope
console.log(myVar);

// Now remove the console log line to pass the test

Theodore P.
@Ierofantis
Nov 05 2016 12:31
@marzelin it says that arrint is undefined but i cannot understand why
heroiczero
@heroiczero
Nov 05 2016 12:31
@mjay2001007 some use codepen other use jsfiddle
adilkara
@adilkara
Nov 05 2016 12:31
can anyone please spot mistake?
Jay Mehta
@mjay2001007
Nov 05 2016 12:32
@heroiczero thanks
CamperBot
@camperbot
Nov 05 2016 12:32
mjay2001007 sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:cookie: 349 | @heroiczero |http://www.freecodecamp.com/heroiczero
adilkara
@adilkara
Nov 05 2016 12:32
i did remove console.log line but yet test didn't passs
heroiczero
@heroiczero
Nov 05 2016 12:32
@adilkara local variable
adilkara
@adilkara
Nov 05 2016 12:32
@heroiczero what do you mean?
heroiczero
@heroiczero
Nov 05 2016 12:32
@adilkara but still should return the console.log i think
Theodore P.
@Ierofantis
Nov 05 2016 12:32
this line is wrong this.state.arrint.push(this.state.counter);
but can anyone expain why?
adilkara
@adilkara
Nov 05 2016 12:33
@heroiczero No global myVar variable this is what they are asking
marzelin
@marzelin
Nov 05 2016 12:34
@Ierofantis because of this
heroiczero
@heroiczero
Nov 05 2016 12:34
@adilkara if u want a global variable gotta define it outside the function or define it as myVar
@adilkara remove the var in var myVar should do it too. I think
Theodore P.
@Ierofantis
Nov 05 2016 12:36
@marzelin without this it says state is not defined
adilkara
@adilkara
Nov 05 2016 12:37
@heroiczero read the comment it says Now remove the console log line
no it din't work
adilkara
@adilkara
Nov 05 2016 12:37
i tried removing ,
heroiczero
@heroiczero
Nov 05 2016 12:41
@adilkara hmm if you want a global variable
function myFunction() {
carName = "Volvo";
}
or define it outside the function but i do not know what they are asking you to do.
Stephen James
@sjames1958gm
Nov 05 2016 12:41
@adilkara The point of the challenge is that the variable myVar is not accessible outside the function (with var)
try removing the console.log(myVar) and refresh
adilkara
@adilkara
Nov 05 2016 12:44
@sjames1958gm thank you it helped!
CamperBot
@camperbot
Nov 05 2016 12:44
adilkara sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4198 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
adilkara
@adilkara
Nov 05 2016 12:44
@heroiczero thank you
CamperBot
@camperbot
Nov 05 2016 12:44
adilkara sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:cookie: 350 | @heroiczero |http://www.freecodecamp.com/heroiczero
motoradk
@motoradk
Nov 05 2016 12:46
Hi everyone! I've got some problem with Seek and Destroy task
Can anybody tell me what I can call every arguments in destroyer function?
In task I have code like this:

function destroyer(arr) {
// Remove all the values
return arr;
}

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

as You can see in declaration of function I have only argument for array but not for numbers to delete from this array
Stephen James
@sjames1958gm
Nov 05 2016 12:47
@motoradk there is an object called arguments that holds all of them - see the link in the instructions
motoradk
@motoradk
Nov 05 2016 12:49
Oh actually! Thank You @sjames1958gm !
CamperBot
@camperbot
Nov 05 2016 12:49
motoradk sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4199 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
the son of god
@the-god-of-son
Nov 05 2016 12:51
about Roman Numeral Converter ,no idea,boy
CamperBot
@camperbot
Nov 05 2016 12:51
you need to ask about @someone!
Abhisek Pattnaik
@abhisekp
Nov 05 2016 12:53
@motoradk after solving it using arguments object, i've another trick for ya o/ ;)
Stephen James
@sjames1958gm
Nov 05 2016 12:56
@the-god-of-son Write in plain language the instructions you might give to someone how to convert arabic to roman, then adapt to code.
Don't jump straight to code with these more complex algorithms
Abhisek Pattnaik
@abhisekp
Nov 05 2016 12:56

this line is wrong this.state.arrint.push(this.state.counter);

@Ierofantis where and how are you using it?

the son of god
@the-god-of-son
Nov 05 2016 12:57
@sjames1958gm ok,let me try
@sjames1958gm thank
CamperBot
@camperbot
Nov 05 2016 12:58
the-god-of-son sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4200 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Nov 05 2016 12:58
@the-god-of-son :+1:
Theodore P.
@Ierofantis
Nov 05 2016 12:59
@abhisekp I was using it in componentDidMount after getInitialState but I change It and now the console says that setState is not a function. i assume that I have to use bind.this. anyways here is my code
var App = React.createClass({
  getInitialState: function() {
    return {

      color: "#E9573F"
    };
  },
  componentDidMount: function() {
    var arr = [0, 1, 2, 4, 5, 6, 10, 11, 12, 19, 21, 22, 23, 25, 26];
    arr.sort(function() {
      return .15 - Math.random();
    })
    var comp = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]
    var arrint = [];
    var counter = 0;
    setInterval(function() {
      var c = counter++;
      arrint.push(c)
      for (var i = 0; i < arr.length; i++) {
        if (comp[c] === arr[i]) {
          this.setState({
            color: "black"
          })
        }
      }
    }, 1000);
  },

  render: function() {
    var indents = [];
    for (var i = 0; i < 5; i++) {
      indents.push(<table style={{backgroundColor: this.state.color}} className='table' ref="td"><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>);
    }
    return (
      <div>
          {indents}
    </div>
    );
  }
});

ReactDOM.render(
  <App  />,
  document.getElementById('container')
);
now it is working i had to do sth=this and after sth.state
Abhisek Pattnaik
@abhisekp
Nov 05 2016 13:04
@Ierofantis What does the table injection in the code do?
Joran de Haan
@LeCoquille
Nov 05 2016 13:05
hey guys! hope everyone is doing well
Abhisek Pattnaik
@abhisekp
Nov 05 2016 13:05
I mean what is the purpose and usage of the table? @LeCoquille
@LeCoquille Everything is as sweet as it used to be :yum:
Matthew arvidson
@mattdavida
Nov 05 2016 13:05
Hey all... any idea what is wrong with this code? I am getting a pass for myBike.setGear() should return 4, but not 3 or 1.

var Car = function() {
// this is a private variable
var speed = 10;

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

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

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

var Bike = function() {

// Only change code below this line.
var gear = 0;

this.getGear = function() {
return gear;
};

this.setGear = function(num) {
gear += num;
};
};

var myCar = new Car();

var myBike = new Bike();

Abhisek Pattnaik
@abhisekp
Nov 05 2016 13:05
:expressionless:
that's illegal
Theodore P.
@Ierofantis
Nov 05 2016 13:05
@abhisekp it just insterts a table with rows
Joran de Haan
@LeCoquille
Nov 05 2016 13:05
@abhisekp good :)
Ghulam Shabir
@ghulamshabir
Nov 05 2016 13:06
@mattdavida set gear in setGear not add
Diego Mayer
@Chrono79
Nov 05 2016 13:06
@mattdavida it's setGear, not increaseGear ;)
Theodore P.
@Ierofantis
Nov 05 2016 13:06
@abhisekp the reason is because i want to iterate on every row
Joran de Haan
@LeCoquille
Nov 05 2016 13:06
I've got kind of a theoretical question about javascript. There's something I still don't really understand, however I think it's probably a stupid question.
Abhisek Pattnaik
@abhisekp
Nov 05 2016 13:06
@Ierofantis use table for inserting tabular data