These are chat archives for FreeCodeCamp/HelpJavaScript

9th
Nov 2016
ghanzo
@ghanzo
Nov 09 2016 00:03

can anyone explain what is happening in this code?
```var myArr = [ 2, 3, 4, 5, 6];

// Only change code below this line
var total = 0;
for (var g = 0; g < myArr.length; g++){

total += myArr[g];

}
```

var myArr = [ 2, 3, 4, 5, 6];

// Only change code below this line
var total = 0;
for (var g = 0; g < myArr.length; g++){

  total += myArr[g];

}
there we go
so what is going on here
Jason Luboff
@JLuboff
Nov 09 2016 00:04
@ghanzo Yoou're adding each element of the array to total
ghanzo
@ghanzo
Nov 09 2016 00:04
ok so what does .length do?
Jason Luboff
@JLuboff
Nov 09 2016 00:04
total += ,yArr[g] is equivelent to total = total + myArr[g]
length is used to determine the number of elements in an array, in this case, it is 5
ghanzo
@ghanzo
Nov 09 2016 00:05
so g < 5?
Jason Luboff
@JLuboff
Nov 09 2016 00:06
@ghanzo Yes. With g starting at 0, and going up by one after each iteration of the loop
ghanzo
@ghanzo
Nov 09 2016 00:06
and how does it add each part of the array together
Jason Luboff
@JLuboff
Nov 09 2016 00:06
The loop stops at 4
ghanzo
@ghanzo
Nov 09 2016 00:06
ok
doesn't the loop start at 0?
like the first array is 0?
wouldn't it come out as false for the first time through?
Jason Luboff
@JLuboff
Nov 09 2016 00:07
Yes it starts at 0, and goes until 4
No, remember that to access the first element of an array, you start at index 0
ghanzo
@ghanzo
Nov 09 2016 00:08
g = 0; g<0 is false
var myArr = [ 2, 3, 4, 5, 6];
var total = 0;
for (var g = 0; g < myArr.length; g++){
total += myArr[g];   
}
Jason Luboff
@JLuboff
Nov 09 2016 00:09
myArr[0] = 2
ghanzo
@ghanzo
Nov 09 2016 00:09
oh i see
but its .length
so wouldn't it be 0?
ohh so its 2
if that was -1 the first one would come out at false?
Jason Luboff
@JLuboff
Nov 09 2016 00:10
Yes, there is no element in -1
ghanzo
@ghanzo
Nov 09 2016 00:10
no i mean if the value was -1
I'm confused here
Greg Duncan
@GregatGit
Nov 09 2016 00:10
@AidenMead while tricky at first, once you get your head around it - it's quite simple
ghanzo
@ghanzo
Nov 09 2016 00:10
i still don't see why g < myrrh.length , if the first one is 0
Jason Luboff
@JLuboff
Nov 09 2016 00:11
All g< myArr.length is saying, is keep looping until g is no longer less then myArr.length (which in this case, is 5)
Aiden
@AidenMead
Nov 09 2016 00:11
@GregatGit yeah, it's the wrapping my head around it that seems to be the issue, but I'm sure I'll get it eventually. Is the example selection that I posted correct?
Greg Duncan
@GregatGit
Nov 09 2016 00:12
@AidenMead you need to know when to use []
ghanzo
@ghanzo
Nov 09 2016 00:13
so at first its 5, then 4, 3, 2, 1 etc?
Greg Duncan
@GregatGit
Nov 09 2016 00:13
you have missed a step
Jason Luboff
@JLuboff
Nov 09 2016 00:14
@ghanzo No, you defined the variable g as 0, so it goes from 0 to 4
Aiden
@AidenMead
Nov 09 2016 00:15
@GregatGit do you know of a good resource to explain the best instances to use each?
Stephanie
@spennypacker
Nov 09 2016 00:15

having a lot of trouble with the algorithms to convert celsius to Fahrenheit , when i run the tests it says I have the first conversion right...I can't figure out how to write the others

this is what I have so far

fahrenheit= (celsius+ 32) 9/5;
fahrenheit= (celsius-30+32)
9/5;

what am I doing wrong?

Jason Luboff
@JLuboff
Nov 09 2016 00:16
for ( var g = 0; g < myArr.length; g++)
Lets look at each portion of this. First, we initialize our variable, g, to equal 0
Next we say, keep looping until g is no longer less then the length of myArr
Then as each loop goes, we use g++ to add one to our variable g. Thus we go from 0 up to 4 until its no longer less then myArr length
@ghanzo
Joseph
@revisualize
Nov 09 2016 00:16
la la la
@spennypacker PEMDAS
Celsius times 9/5 plus 32
ghanzo
@ghanzo
Nov 09 2016 00:17
@JLuboff ok now i understand whats going on with the loop
g is going up
not myArr
Greg Duncan
@GregatGit
Nov 09 2016 00:18
@AidenMead here is a good start http://www.w3schools.com/js/js_objects.asp - i would recomend building your own objects and practice get values from them here https://repl.it/languages/javascript
ghanzo
@ghanzo
Nov 09 2016 00:18
so 5 is the number that stays the same
Jax
@jax11000
Nov 09 2016 00:18
confused about returning boolean values from functions. why is this not correct?

function isLess(a, b) {
// Fix this code
return a === b;

}

// Change these values to test
isLess(10, 15);

Greg Duncan
@GregatGit
Nov 09 2016 00:18
@AidenMead as confusing as it is, you will get the hang of it
Jason Luboff
@JLuboff
Nov 09 2016 00:18
@ghanzo Correct
Aiden
@AidenMead
Nov 09 2016 00:18
AH! @GregatGit ! Thank you! I was poking around on w3 trying ti find that and couldn't find it again!
CamperBot
@camperbot
Nov 09 2016 00:18
aidenmead sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 782 | @gregatgit |http://www.freecodecamp.com/gregatgit
ghanzo
@ghanzo
Nov 09 2016 00:18
ok then heres my next question... why does the total account for all of the numbers in the array
Stephanie
@spennypacker
Nov 09 2016 00:18
@revisualize that was it...such a simple fix
ghanzo
@ghanzo
Nov 09 2016 00:19
how does it add them
silver537
@silver537
Nov 09 2016 00:19
@AidenMead to get country:
query.results.channel.location.country
Joseph
@revisualize
Nov 09 2016 00:19
@jax11000 Less than.
Jason Luboff
@JLuboff
Nov 09 2016 00:19
@ghanzo You're telling it in the loop to add each element to total
total += myArr[g] is the same as total = total + myArr[g]
Jax
@jax11000
Nov 09 2016 00:20
@revisualize you mind elaborating on that a little? i want to actually understand the answer not just pass the challenge
ghanzo
@ghanzo
Nov 09 2016 00:20
the += means what exactly?
Jax
@jax11000
Nov 09 2016 00:20
@revisualize nevermind i got it. thank you. lol
CamperBot
@camperbot
Nov 09 2016 00:21
jax11000 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2273 | @revisualize |http://www.freecodecamp.com/revisualize
Jason Luboff
@JLuboff
Nov 09 2016 00:21
@ghanzo See my post above
@ghanzo += is just shorthand for what I showed above
ghanzo
@ghanzo
Nov 09 2016 00:21
@JLuboff ok so its like g = 0 + 2 +3+4+5+6 stop
Jason Luboff
@JLuboff
Nov 09 2016 00:22
@ghanzo More like total = 0 + 2+3+4+5+6
ghanzo
@ghanzo
Nov 09 2016 00:22
oh right
and it loops down to there huh?
i see
its a for statement
for (x) do y
and since its a loop its runs it through the for statement until it closes
Jason Luboff
@JLuboff
Nov 09 2016 00:23
Yup
ghanzo
@ghanzo
Nov 09 2016 00:23
ahh
@JLuboff thanks for the help
CamperBot
@camperbot
Nov 09 2016 00:24
ghanzo sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:cookie: 437 | @jluboff |http://www.freecodecamp.com/jluboff
Jason Luboff
@JLuboff
Nov 09 2016 00:24
:+1:
rdiggle55423
@rdiggle55423
Nov 09 2016 00:49
I'm stuck at the Storing Values with the Assignment Operator challenge and I don't understand what I'm doing wrong.
Anyone that can assist me?
Walid Ashri
@walidashri
Nov 09 2016 00:51
@rdiggle55423 ur code please?
rdiggle55423
@rdiggle55423
Nov 09 2016 00:52

// Setup

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

I get all the check boxes except the 'do not change code above the line'. It seems changing the code at all triggers an incorrect.
Walid Ashri
@walidashri
Nov 09 2016 00:52
@rdiggle55423 u removed the setup line?
rdiggle55423
@rdiggle55423
Nov 09 2016 00:53
No, it
right above "only change code.." line
Walid Ashri
@walidashri
Nov 09 2016 00:54

@rdiggle55423


// Setup
var a;
var b = 2;

// Only change code below this line

this

rdiggle55423
@rdiggle55423
Nov 09 2016 00:54
Yeah I had it as that at first but like I said every change of the code, regardless of how slight, triggers an incorrect for that box.
Walid Ashri
@walidashri
Nov 09 2016 00:54
keep those lines and do ur code
rdiggle55423
@rdiggle55423
Nov 09 2016 00:55
If I change any code it triggers an incorrect for that box.
Conor Murphy
@cmurphy580
Nov 09 2016 00:55
@AidenMead create a function like "$.getJSON(variablethatshouldbelinktoapi, function(data){" define a variable with that function by setting it equal to whatever you want to call, ie "data.query.results.channel.lastBuildDate"
can anyone let me know if this works for them. should give them a temperature that corresponds to the background and logo. The time should also correspond with the logo -- night/day. got feedback the geolocation didn't work. Just want to make sure before i change the whole thing.
https://codepen.io/cmurphy580/pen/rWBJEr?editors=1010
Walid Ashri
@walidashri
Nov 09 2016 00:57
@rdiggle55423 yes because you use var again the declaration with var happens only once for the same variable
Anthony Torres
@ATorresDev
Nov 09 2016 00:57
yes it works for me
Walid Ashri
@walidashri
Nov 09 2016 00:58
@cmurphy580 nice work the icon should be white in day time right?
@cmurphy580 nvm you set it for sun motion :+1:
Conor Murphy
@cmurphy580
Nov 09 2016 01:02
@walidashri haha no the icon should a charcol color. the icon should turn into a moon at night. The background should change with the temperature (red, orange, yellow, teal, blue). Did any of that happen?
Walid Ashri
@walidashri
Nov 09 2016 01:03
@cmurphy580 it's 69 and got orange
Conor Murphy
@cmurphy580
Nov 09 2016 01:03
@ATorresDev @walidashri nice! thanks for the feedback
CamperBot
@camperbot
Nov 09 2016 01:03
cmurphy580 sends brownie points to @atorresdev and @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 598 | @walidashri |http://www.freecodecamp.com/walidashri
:cookie: 174 | @atorresdev |http://www.freecodecamp.com/atorresdev
rdiggle55423
@rdiggle55423
Nov 09 2016 01:04
so I should only have one var?
Walid Ashri
@walidashri
Nov 09 2016 01:05
@rdiggle55423 one for a and one for b
rdiggle55423
@rdiggle55423
Nov 09 2016 01:06
So, then I really have no idea what I'm doing wrong. It says to assign the value of 7 to variable a, I do that, and then I assign a to b, no matter what changes I make it says X for "Do not change the code above the line'.
*below the line
Walid Ashri
@walidashri
Nov 09 2016 01:07
@rdiggle55423 u have to keep this part un changed

// Setup
var a;
var b = 2;

// Only change code below this line
rdiggle55423
@rdiggle55423
Nov 09 2016 01:08
Oh, I see. Got it now. Thanks
Chris
@Cbhansen
Nov 09 2016 01:12
wat does Nth meanm
Walid Ashri
@walidashri
Nov 09 2016 01:13
@Cbhansen what does 5th mean?
Choz
@chozzz
Nov 09 2016 01:13
@Cbhansen N represents an index..
Chris
@Cbhansen
Nov 09 2016 01:14
ah ok
so nth is just replaced with whatever character im trying to get?
Cage Echarte
@CageEcharte
Nov 09 2016 01:17
i need helppp
Chris
@Cbhansen
Nov 09 2016 01:17
with?
lazycat
@lazycat92
Nov 09 2016 01:18
what?
Cage Echarte
@CageEcharte
Nov 09 2016 01:19
Accessing Nested Objects
Conor Murphy
@cmurphy580
Nov 09 2016 01:19
@walidashri can i get you take another look at this to see if it works
just checking on the logo again
it was night here and i was getting a sun. switched the order of something and want to see if the logo was matching up to the time
Choz
@chozzz
Nov 09 2016 01:21
@CageEcharte
var obj1 = {
    obj2: {
        obj3: {
            text: 'I am in obj3'
        }
    }
}

var str = obj1.obj2.obj3;
Walid Ashri
@walidashri
Nov 09 2016 01:21
@cmurphy580 now it's moon :)
Cage Echarte
@CageEcharte
Nov 09 2016 01:22
here is my code....var gloveBoxContents = myStorage.car.inside.glovebox;
Conor Murphy
@cmurphy580
Nov 09 2016 01:22
@walidashri dang! is it daylight where you are?
Walid Ashri
@walidashri
Nov 09 2016 01:24
@cmurphy580 5.24 AM
Jax
@jax11000
Nov 09 2016 01:26
this might not classify as help, but is it normal to have no idea what youre doing with javascript? i can complete the challenges after a bit, but i still feel like im just not grasping the concept.
Walid Ashri
@walidashri
Nov 09 2016 01:27
@CageEcharte glove box is two words you ned to use brackets
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 01:27
var booty ="BIGGER THE BETTER"

if (booty.substring(0,0 === "B"))
{

 console.log("I finished my first course!");
 }


 else(booty.substring(0,0 /== "B"))
 {
     console.log("fail")
     }
can I do a substring like that? also is my else correct?
Walid Ashri
@walidashri
Nov 09 2016 01:28
@WhiteLeaf1103 :O
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 01:29
@walidashri >.>
Walid Ashri
@walidashri
Nov 09 2016 01:29
@WhiteLeaf1103 .substring(0,0) === "B"
else takes no condition so it's else if
Cage Echarte
@CageEcharte
Nov 09 2016 01:29
@walidashri thanks
CamperBot
@camperbot
Nov 09 2016 01:29
cageecharte sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 599 | @walidashri |http://www.freecodecamp.com/walidashri
Jenky W. Nolasco
@jenkynolasco11
Nov 09 2016 01:31
Hola mundo o/
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 01:32
@walidashri SO I delete the bit after else?
So how come my if isn't true then?
Walid Ashri
@walidashri
Nov 09 2016 01:33
@WhiteLeaf1103 if no other condition yes else come alone or with if
Conor Murphy
@cmurphy580
Nov 09 2016 01:34
@walidashri sun probably isn't up yet. i need to take a look at this. thanks again for the help
CamperBot
@camperbot
Nov 09 2016 01:34
cmurphy580 sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:warning: cmurphy580 already gave walidashri points
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 01:35
I deletede everything after else. Can i use a substring as an if statement. DId i do it correct? @walidashri
ashleypt
@ashleypt
Nov 09 2016 01:35
just wanted to say im really proud of the title case solution i came up with! getting the hang of functional programming really well! :)
Walid Ashri
@walidashri
Nov 09 2016 01:35
@WhiteLeaf1103
if(cond is true){
do this
} else // when it's false{
do that
}
ashleypt
@ashleypt
Nov 09 2016 01:35

function titleCase(str) {
  return str.split(' ').map(function(word) {
    return word.split('').map(function(character, index) {
      return index === 0 ? character.toUpperCase() : character.toLowerCase();
    }).join('');
  }).join(' ');
}

titleCase("I'm a little tea pot");
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 01:36
@ashleypt omg. functionception.
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 01:37
@walidashri can I use a substring as a condition and did I do it correct? cause it won't come true
@ashleypt honestly ashley I have no idea what that is... but looks really clean
Jenky W. Nolasco
@jenkynolasco11
Nov 09 2016 01:37
It doesnt lol
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 01:39
@WhiteLeaf1103 you can use substring === as a condition but don't include the condition to substring parameters.
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 01:40
that makes very little sense to me. @kennethlumalicay can explain? or give example
ashleypt
@ashleypt
Nov 09 2016 01:40
@WhiteLeaf1103 it goes through and splits a sentence into words and maps each word to the results of mapping the split word into title case (if first index capitalize, else lowercase)
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 01:40
@WhiteLeaf1103 parameters are values you pass on to a function. in this case substring is a function. so you put something.substring(param1, param2) then you put the condition === "B"
ashleypt
@ashleypt
Nov 09 2016 01:41
then joins it
gabriel poissant
@gabpoiss
Nov 09 2016 01:41

```js

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

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

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

``` Someone could help? Im really not sure how to use the statement in each case. In a switch statement.

Kenneth Malicay
@kennethlumalicay
Nov 09 2016 01:41
@WhiteLeaf1103 param1 is the start index and param2 is the end index. in this case you did 0,0. just don't include the condition to the substring parameters.
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 01:42
Im still lost. Can you organize my code how you mean. i'm a visual learner.
I apologize
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 01:42
@WhiteLeaf1103 post it again
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 01:42
var booty ="BIGGER THE BETTER"

if (booty.substring(0,1 === "BI"))
{

 console.log("I finished my first course!");
 }


 else
 {
     console.log("fail")
     }
Jenky W. Nolasco
@jenkynolasco11
Nov 09 2016 01:43
@ashleypt instead of splitting the whole word and only returning the first letter if index =0, and looping through all the remain letters, why dont you just return word.splice (0,1).toUppercase () + word.splice (1)?
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 01:43
see inside your if you have booty.substring(0,1 === "BI").
Tom
@CodePrime
Nov 09 2016 01:43
Sorry to interrupt, but I'm currently stuck on the find the largest number in an array challenge. All my output is correct but the debugger won't let me pass for some reason.
Jenky W. Nolasco
@jenkynolasco11
Nov 09 2016 01:43
The last map wouldnt be necessary
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 01:43
I already passed the challenge but I wanted to try another way to complete it and I got stumped
@kennethlumalicay yes
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 01:43
@WhiteLeaf1103 the right way is if(booty.substring(0,0) === "B")
Tom
@CodePrime
Nov 09 2016 01:43
My code:
var largest=0;
var largestArr=[];
function largestOfFour(arr) {
  // You can do this!

  for (var i=0;i<4;i++)
    {
      largest=arr[i][0];
      for (var a=0;a<4;a++)
        {     
          if (arr[i][a]>largest)
            {
              largest=arr[i][a];
            }
        }
      largestArr.push(largest);
    }
  return largestArr;
}

largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]);
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 01:44
@kennethlumalicay GOT IT NOW thanks!
CamperBot
@camperbot
Nov 09 2016 01:44
whiteleaf1103 sends brownie points to @kennethlumalicay :sparkles: :thumbsup: :sparkles:
:cookie: 331 | @kennethlumalicay |http://www.freecodecamp.com/kennethlumalicay
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 01:44
@WhiteLeaf1103 your welcome. keep learning. :D
@CodePrime did the instruction tell you to pass an array or a number?
@CodePrime cause you're passing an array, that may be it.
Tom
@CodePrime
Nov 09 2016 01:46
nope, it asks me to pass an array
the preset code returns the array passed into the function as the argument (arr), I just changed that and made it return my own.
Stephen James
@sjames1958gm
Nov 09 2016 01:47
@CodePrime You need all variables inside the function - also you need to reset largest every loop
Tom
@CodePrime
Nov 09 2016 01:47
I'm thinking that's why it wont let me pass
it does
largest clears at every iteration at the first for loop
Stephen James
@sjames1958gm
Nov 09 2016 01:47
@CodePrime I see it now - dark code
Tom
@CodePrime
Nov 09 2016 01:47
in my console it looks fine, I don't know why it's dark here lol
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 01:48
@CodePrime could you post the should be results.
Stephen James
@sjames1958gm
Nov 09 2016 01:48

@CodePrime

var largest=0;
var largestArr=[];

move these inside the function

Tom
@CodePrime
Nov 09 2016 01:48
@sjames1958gm That wouldnt help. Those only need to be initialized once
hang on I"ll copy the expected results
Stephen James
@sjames1958gm
Nov 09 2016 01:49
@CodePrime They have to be because the tests will run the code over and over without those being reset
Tom
@CodePrime
Nov 09 2016 01:49
so for the dataset above, I should be getting: [9, 35, 97, 1000000]
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 01:49
then stephen might be right
cause fcc keeps testing again and again for different data.
Tom
@CodePrime
Nov 09 2016 01:50
lemme try it
omg
it worked
but...how? Largest is set to the first value of every array at the beginning of the first for loop
thanks @kenneth @sjames1958gm
CamperBot
@camperbot
Nov 09 2016 01:51
codeprime sends brownie points to @kenneth and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 26 | @kenneth |http://www.freecodecamp.com/kenneth
:star2: 4256 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Nov 09 2016 01:52
@CodePrime FCC never clear the largestArray so it grows each call
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 01:53
@CodePrime fcc probably just adds the function calls instead of resetting the program for each data.
not sure.
but it's probably a good practice to keep your variables local unless needed.
Tom
@CodePrime
Nov 09 2016 01:53
in a real-world ide, would i run into the same problem?
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 01:54
probably yes.
Tom
@CodePrime
Nov 09 2016 01:55
kk, thanks guys, this tip is a keeper
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 02:05
how do you do something in javascript so it goes in order.
I have 2 prompts inbetween console.log but the prompts come up. then when they are done it displays everything ater
confirm("ready to play?");
var age= prompt("What's your age?");


if (age <13)
{
    console.log("You can play but I take no responsibility");
}
else{
    console.log("HAVE FUN PLAYBOOOIIIII!");}

    console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'");

    console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'");

    var userAnswer=prompt("do you want to race Bieber on stage?")

    if (userAnswer === "yes"){
        console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");}

    else {
       console.log(" Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
    }

    var feedback=prompt("Rate game from 1-10")

    if(feedback >8){
        console.log("Thank you! We should race at the next concert!");}


    else{
        console.log("I'll keep practicing coding and racing.");}
oh actually... wait what I mean is after I answer the prompts it doesn't display anything. It just goes right to next prompt. untill the end of the code. then it displays
Tom
@CodePrime
Nov 09 2016 02:08
@WhiteLeaf1103 I don't have an answer, but I found your statements hilarious
A++ very entertain
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 02:10
Your welcome @CodePrime
;)
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 02:11
@WhiteLeaf1103 it worked as you intended on mine
Somia ♡
@somiajagadish
Nov 09 2016 02:12
help?

To test your learning, you will create a solution "from scratch". Place your code between the indicated lines and it will be tested against multiple test cases.

The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.

You are given a variable celsius representing a temperature in Celsius. Use the variable fahrenheit already defined and apply the algorithm to assign it the corresponding temperature in Fahrenheit.

Note
Don't worry too much about the function and return statements as they will be covered in future challenges. For now, only use operators that you have already learned.

what do they want me to do?
Tom
@CodePrime
Nov 09 2016 02:12
@kenneth it didn't work on js fiddle
all the prompts show up all at once
Conor Murphy
@cmurphy580
Nov 09 2016 02:13

@kennethlumalicay @WhiteLeaf1103 @CodePrime @sjames1958gm @ashleypt @gabpoiss

Alright i think i'm finally done with this,
https://codepen.io/cmurphy580/pen/rWBJEr?editors=0010
you should get a background that corresponds with the temperature, and an icon that corresponds with the time of day and the weather description. let me know if works and give me some feedback.

Kenneth Malicay
@kennethlumalicay
Nov 09 2016 02:13
@CodePrime maybe you didn't have devtool open?
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 02:13
@kennethlumalicay what program are you using?
Somia ♡
@somiajagadish
Nov 09 2016 02:13
anyone?
Tom
@CodePrime
Nov 09 2016 02:13
@kennethlumalicay yep just noticed... I'm a doge
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 02:13
@cmurphy580 worked on me
Stephen James
@sjames1958gm
Nov 09 2016 02:13
@cmurphy580 :+1:
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 02:14
@cmurphy580 all i get is local weather... nothing else
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 02:14
@WhiteLeaf1103 i used jsfiddle
Conor Murphy
@cmurphy580
Nov 09 2016 02:14
@WhiteLeaf1103 give it a second
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 02:14
@WhiteLeaf1103 are you using google chrome?
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 02:14
yes
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 02:14
@WhiteLeaf1103 just press f12 then run your code
also make sure you're on console tab.
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 02:15
run my code in what?
wait if I save this as an HTML then open it? it will run?
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 02:15
@WhiteLeaf1103 where did you make it?
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 02:15
made it on codeacdemy
Daniel
@profoundhub
Nov 09 2016 02:15
@Makzin how is it going?
Stephen James
@sjames1958gm
Nov 09 2016 02:16
@somiajagadish You are given the parameter/variable celsius which will hold the value to be converted
YOu need to use the formula F = C * 9/5 +32 and celsius to set the fahrenheit variable in the function
Matthew Pengelly
@mcpengelly
Nov 09 2016 02:16
?
Damnuel Coleman West
@Dalton-West
Nov 09 2016 02:16

Okay so I'm stuck on the Manipulating Complex Data task
Here's My code
`

var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
}

  {
    "artist" : "name,
    "title" : "work title",
    "release_year" : 2006,
    "formats": [
      "CD",
      "LP",
      "Digital"
    ]
  }

// Add record here
];
`

Kenneth Malicay
@kennethlumalicay
Nov 09 2016 02:16
@WhiteLeaf1103 does it not have any button to run the code?
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 02:17
yea I can run it.
but it just does thr prompts. THEN SHOWS all the console.logs after.
at the very end. after the last prompt.
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 02:17
@WhiteLeaf1103 try press f12
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 02:17
Idk i guess I was expecting like a 10sec lapse
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 02:17
@WhiteLeaf1103 then go to console
then run your code while the console is open.
Damnuel Coleman West
@Dalton-West
Nov 09 2016 02:18
I get SyntaxError: Unexpected token {
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 02:19
@kennethlumalicay way outta my scope it doesnt change anything. But idk...
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 02:19
@Dalton-West try to put your code inside ``` tags so we could understand it better.
Stephen James
@sjames1958gm
Nov 09 2016 02:19
@Dalton-West Just like any array - there is a ',' between elements
Walid Ashri
@walidashri
Nov 09 2016 02:19
@Dalton-West u r missing ,
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 02:19
@WhiteLeaf1103 try to copy paste it in jsfiddle then https://jsfiddle.net/ maybe make your codes there.
ashleypt
@ashleypt
Nov 09 2016 02:19
is there a better way to do this functionally? it works but Im practicing functional programming:

function repeatStringNumTimes(str, num) {
  var repeated = [];
  for (var i = 0; i < num; i++) {
    repeated = repeated.concat(str.split());
  }
  return num > 0 ? repeated.join('') : "";
}

repeatStringNumTimes("abc", 3);
Walid Ashri
@walidashri
Nov 09 2016 02:20
@sjames1958gm I tried to make short as possible still u won :(
Stephen James
@sjames1958gm
Nov 09 2016 02:20
@walidashri lol
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 02:20
@kennethlumalicay Thanks
CamperBot
@camperbot
Nov 09 2016 02:20
whiteleaf1103 sends brownie points to @kennethlumalicay :sparkles: :thumbsup: :sparkles:
:warning: whiteleaf1103 already gave kennethlumalicay points
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 02:20
np
Stephen James
@sjames1958gm
Nov 09 2016 02:22
@ashleypt Why wouldn't using string concat be just as functional without splits and joins.
Damnuel Coleman West
@Dalton-West
Nov 09 2016 02:23

@sjames1958gm @kennethlumalicay Like This?

  {
    "artist": "name",
    "title": "work title",
    "release_year": 2006,
    "formats": [
      "CD",
      "LP",
      "Digital"
    ]
  }

This is in the variable myMusic

ashleypt
@ashleypt
Nov 09 2016 02:24
@sjames1958gm oh i didnt know string could do concat haha
Stephen James
@sjames1958gm
Nov 09 2016 02:24
@Dalton-West A comma goes right before your added entry looks like this [{}, {}]
Damnuel Coleman West
@Dalton-West
Nov 09 2016 02:25
@sjames1958gm Okay Thanks. Gotta watch my commas >|
CamperBot
@camperbot
Nov 09 2016 02:25
dalton-west sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4257 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Nov 09 2016 02:25
@Dalton-West :+1:
Damnuel Coleman West
@Dalton-West
Nov 09 2016 02:26
@sjames1958gm Out of curiosity the comma acts like a separator for the code right?
Telling it to brows this then that?
Stephen James
@sjames1958gm
Nov 09 2016 02:27
@Dalton-West A seperater for the elements in the array
Damnuel Coleman West
@Dalton-West
Nov 09 2016 02:27
Oh
gabriel poissant
@gabpoiss
Nov 09 2016 02:29

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

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

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

How do i do a statement? when i use a switch statement?
Walid Ashri
@walidashri
Nov 09 2016 02:31
@gabpoiss set result to value instead of console logging
Joseph
@revisualize
Nov 09 2016 02:32
@gabpoiss You don't console.log your response. You need to reassign the answer variable that your code is returning.
Insight24
@Insight24
Nov 09 2016 02:44
Hey I am a new member
Joseph
@revisualize
Nov 09 2016 02:44
hi
ashleypt
@ashleypt
Nov 09 2016 02:44
why isn't this working?

function truncateString(str, num) {
  return str.substr(0, (num <= 3 || str.length >= num) ? num : num - 3) + (str.length > num ? "..." : "");
}

truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2);
Insight24
@Insight24
Nov 09 2016 02:45
I am the beginner can someone guide me with a basic
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 02:47
lesson 1 then 2 @Insight24 and so forth
Ken Haduch
@khaduch
Nov 09 2016 02:49
@ashleypt - how close is it to passing?
Rob
@s31181
Nov 09 2016 02:51
hello i'm working on the local weather app and i'm trying to access the openweather API but for some reason its not returning anything
i was wondering if anyone could check my codepen
ashleypt
@ashleypt
Nov 09 2016 02:56
@khaduch 3 out of 6 pass
@khaduch my shortened way of doing it might be confusing me. or i might be using substr wrong, but I also had it up to 4 of 6 at one point in that pattern lol
Ken Haduch
@khaduch
Nov 09 2016 03:01
@ashleypt - try changing your condition for the substring length to this: (num <= 3 || num >= str.length ) - it f ixes the case you have in your example, but I haven't tried it for all? or (num <= 3 || str.length < num) ? num : num - 3)
Walid Ashri
@walidashri
Nov 09 2016 03:01
@s31181 https://crossorigin.me/ add this just before ur api link
Rob
@s31181
Nov 09 2016 03:01
alright thank you very much!
thank you @walidashri
CamperBot
@camperbot
Nov 09 2016 03:01
s31181 sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 603 | @walidashri |http://www.freecodecamp.com/walidashri
Ken Haduch
@khaduch
Nov 09 2016 03:02
@ashleypt - it should work with that modification, I just tried it.
Ken Haduch
@khaduch
Nov 09 2016 03:20
@joehesse - your a = 7; fulfills part one of the problem solution. The next part Assign the contents of a to variable b. means to use the variable a to set the value of b, not to use the same numeric constant to set the value.
JBindi
@JBindi
Nov 09 2016 03:23
If my container will only be holding a single image, should I just style the <img> directly or would that be bad?
Actually, sorry, didn't mean to post that in the js chat!
Joe Mercurio
@RandBetween
Nov 09 2016 03:29
Is an XMLHttprequest the appropriate way to request JSON data from an API?
Sam Dunn
@gh0steater
Nov 09 2016 03:37
hello all! I'm just starting to really get into this javascript, I'm currently talking about characters that can be escaped inside a string
I used \r \n and \ all check out but its still saying myStr should have encoded text with the proper escape sequences and no spacing
thing if, I thought I did that?
this is *

here is my code:

var myStr = "FirstLine\n\SecondLine\\rThirdline";

oh never mind I think I see it now that I typed it out again
nope that didnt work I added another \ in front of second line still didnt work
what am I doing wrong??
Ken Haduch
@khaduch
Nov 09 2016 03:40
@gh0steater - can you post your code with markdown quotations around it - the ` backslash character before and after the single line of code?
because the browser will change the text unless you do that... - also, make sure you keep the same capitalization in the non-escaped words, I just noticed that.
Sam Dunn
@gh0steater
Nov 09 2016 03:42
ah! good eye. I was getting so caught up I didnt notice that
thanks for the help @khaduch much appreciated
CamperBot
@camperbot
Nov 09 2016 03:42
gh0steater sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1897 | @khaduch |http://www.freecodecamp.com/khaduch
Jax
@jax11000
Nov 09 2016 03:44
can someone please explain this record collection challenge to me? ive looked up everything about it. including the actual solution, and for the life of me i just cant seem to wrap my head around whats going on with this if statements.
Joseph
@revisualize
Nov 09 2016 03:52
@jax11000 Sure. What do you need?
@gh0steater Your code:
var myStr = "FirstLine\n\\SecondLine\\\rThirdline";
You didn't spell ThirdLine correctly.
NoobsNoob
@NoobsNoob
Nov 09 2016 03:53
function destroyer(arr) {
  // Remove all the values
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3); //Returns [1,2,3,1,2,4] as one array rather than separated such as input
I don't understand why the returned value is a single array when it is input as a array containing an array and two individual numbers elements
can someone help me to understand this?
Joseph
@revisualize
Nov 09 2016 03:54
@NoobsNoob Do you understand parameters?
@NoobsNoob Do you understand arguments?
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 03:57
@NoobsNoob is this something that tells you to use arguments?
@NoobsNoob look at the instruction side, there's a link referring to arguments. You need to learn how to get arguments even though it's not initialized as a parameter.
Joseph
@revisualize
Nov 09 2016 04:06
la la la la
NoobsNoob
@NoobsNoob
Nov 09 2016 04:08
@revisualize @kennethlumalicay I had a play with this using array from arguments but couldn't get the desired result as arr[0] wasn't recognised
redoing now to get error/code
William
@waruiz
Nov 09 2016 04:10
Is it possible to run an event listener from the browser console when a website's selected element value changes? What I'm trying to do is get my Mac to read aloud Google's delegate counts for the US prez candidates as the delegate value is updates, but I don't think the event listener from the console is working because the computer isn't talking anymore when the delegate count changes. Should I be using Node for this or something?? :smile:
// The Variables
var delegatesList = document.querySelectorAll('span._Azm');
var candidatesList = document.querySelectorAll('div._kAm');
var message;

// The Talky Part
function myFunction() {
    for (var i=0; i<delegatesList.length; i++) {
        message += candidatesList[i].innerHTML + ' has ' + delegatesList[i].innerHTML + ' delegates. ';
    }
    var talk = new SpeechSynthesisUtterance(message);
    window.speechSynthesis.speak(talk);    
};

// The Event Handler
delegatesList.addEventListener("change", myFunction, false);
Joseph
@revisualize
Nov 09 2016 04:12
@NoobsNoob That didn't answer the question that I asked. But, okay.
NoobsNoob
@NoobsNoob
Nov 09 2016 04:13
@revisualize I believe I understand what arguments/paramters are. e.g. your function inputs.
Joseph
@revisualize
Nov 09 2016 04:14
I'm just going to post this.

Parameters are values that get passed into your function from the function call.
https://cs.wellesley.edu/~cs110/lectures/L16/images/function-anatomy.png
Notice how the variables level and score in the function definition addScore are called parameters.
However, when we invoke the function like in:
addScore(3, 10) or addScore(6, 20)
the values are called arguments. Here is an important lesson:
You define a function with parameters, you call a function with arguments.

Another example of this:

function hello(fName, uName) {
     return "Hello " + fName + " " + uName + ", How is your day?";
}
hello("Joseph", "@revisualize"); // "Hello Joseph @revisualize, How is your day?"
hello("Bella", "@bellaknoti"); // "Hello Bella @bellaknoti, How is your day?"
hello("Andy", "@dirn"); // "Hello Andy @dirn, How is your day?"

You can use the fName and uName parameters just like a variable inside of your function.

Other important things to remember:
* A function can have zero parameters. You still have to use the parentheses to define it.
* A function might have no return statements. In this case we say that the function returns undefined.

Another way to look at this is from the arguments perspective. You can have MORE arguments than parameters.
function someArguments (name) {
     console.log(name);
     console.log(arguments);
     return "Hello " + name;
}
someArguments("Joseph", "is", "an", "awesome", "guy", "so", "he", "thinks");
Output:
Joseph
{ '0': 'Joseph',
  '1': 'is',
  '2': 'an',
  '3': 'awesome',
  '4': 'guy',
  '5': 'so',
  '6': 'he',
  '7': 'thinks' }
=> 'Hello Joseph'
WhiteLeaf1103
@WhiteLeaf1103
Nov 09 2016 04:18
why use a contenation to add a spce like "hey"+" "+ name when you can just add the space after the hey?
Joseph
@revisualize
Nov 09 2016 04:20
@WhiteLeaf1103 I don't know why someone would do that.
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 04:22
@revisualize is it late at night where you are?
Joseph
@revisualize
Nov 09 2016 04:22
@Jeff-Shapiro Seattle.
8:22PM PST.
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 04:23
can tell its coming up to your bed time HA
@revisualize makes me think of this song https://www.youtube.com/watch?v=qCv4MwkjE30
NoobsNoob
@NoobsNoob
Nov 09 2016 04:28
@kennethlumalicay I've been reviewing the arguments MDN page and am having trouble working out how to separate out the first argument array so that I can then combine the rest of the arguments into an array for quick and easy comparision
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 04:28
where's your code @NoobsNoob
Joseph
@revisualize
Nov 09 2016 04:29
@NoobsNoob
var args = Array.prototype.slice.call(arguments);
... OR ...
var args = Array.prototype.slice.call(arguments, 1);
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 04:29
@NoobsNoob arr is already your first argument.
Joseph
@revisualize
Nov 09 2016 04:30
Direct copy and paste from the MDN.
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 04:30
@NoobsNoob arr as well as arguments[0] is the same since it's initialized in the parameter. I think.
you just have to get the arguments[1] and arguments[2] and use it as instructed.
NoobsNoob
@NoobsNoob
Nov 09 2016 04:32
BRBR work calls
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 04:39
// function is destroyer which initialize the first parameter as arr.
function destroyer(arr) {
  // Remove all the values
  return arr;
}
/*
  [1,2,3,1,2,3] this value is passed to arr and arguments[0] - 1st param
  8 this is passed to arguments[1] - 2nd param
  22 this is passed to arguments[2] - 3rd param
*/
destroyer([1, 2, 3, 1, 2, 3], 8, 22);
Here, maybe this will help.
Monesul Haque
@mones-cse
Nov 09 2016 04:51
can any one help me with react ?
Krishna Bhandari
@krishna8723
Nov 09 2016 05:14
please help. The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32

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

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

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

Finally done myself.

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

fahrenheit = (celsius*(9/5))+32;
// Only change code above this line
return fahrenheit;
}

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

Jax
@jax11000
Nov 09 2016 05:27
whats the problem with my code for counting the odd numbers from 1-10? for (var i=0;i<10;i+=3);
myArray.push(i);
lol nevermind im an idiot
yifeilyf
@yifeilyf
Nov 09 2016 05:27
blob
anyone can have a look this one?
the initial function just has one argument,
but example need more?
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 05:28
// function is destroyer which initialize the first parameter as arr.
function destroyer(arr) {
  // Remove all the values
  return arr;
}
/*
  [1,2,3,1,2,3] this value is passed to arr and arguments[0] - 1st param
  8 this is passed to arguments[1] - 2nd param
  22 this is passed to arguments[2] - 3rd param
*/
destroyer([1, 2, 3, 1, 2, 3], 8, 22);
@yifeilyf read the link at the instructions about arguments.
yifeilyf
@yifeilyf
Nov 09 2016 05:30
@kennethlumalicay ok, thank you
CamperBot
@camperbot
Nov 09 2016 05:30
yifeilyf sends brownie points to @kennethlumalicay :sparkles: :thumbsup: :sparkles:
:cookie: 332 | @kennethlumalicay |http://www.freecodecamp.com/kennethlumalicay
Kenneth Malicay
@kennethlumalicay
Nov 09 2016 05:30
no prob
Goodnight peeps. It's quiet here. Seems like the election results have been decided.
Chris Cullen
@123xylem
Nov 09 2016 05:57

Hello!
I am making a frogger game with a repo given me by Udacity.
Can someone help me on where or how I use the repo they gave me though as the instructins dont seem to cover that https://docs.google.com/document/d/1v01aScPjSWCCWQLIpFqvg3-vXLH2e8_SZQKC8jNO0Dc/pub

So question: How/where do i use the given Repos info to make my game???

Ghulam Shabir
@ghulamshabir
Nov 09 2016 06:10
@123xylem open the provided link arts assets and game engineand download the project by clicking on clone or download button
Chris Cullen
@123xylem
Nov 09 2016 06:14
@ghulamshabir yes i have the files but dont know what to do with them.. How to upload to codepen or where else to do it
Chuks Opia
@9jaswag
Nov 09 2016 06:19
hey guys...how do I implement the ability to tweet in the random quote generator?
@ghulamshabir how do I implement the ability to tweet in the random quote generator?
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 06:23
@9jaswag with the twitter api
Chuks Opia
@9jaswag
Nov 09 2016 06:24
@Jeff-Shapiro I know...haven't used the twitter api before...tried reading it up but not much help
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 06:25
@9jaswag codeacademy have a quick course on it
Chuks Opia
@9jaswag
Nov 09 2016 06:25
link pls
@ghulamshabir do I use jQuery.post() ?
Ghulam Shabir
@ghulamshabir
Nov 09 2016 06:31
@9jaswag you can use js function window.open
@9jaswag but you have to be careful for iframe thingy in codepen and also use encodeURIComponent for encoding url paramemters
Fani041
@Fani041
Nov 09 2016 07:19
hi all, can somebody help me with thi challenge https://www.freecodecamp.com/challenges/record-collection
Markus Kiili
@Masd925
Nov 09 2016 07:20
@Fani041 Sure.
Fani041
@Fani041
Nov 09 2016 07:21
here is my code function updateRecords(id, prop, value) {
switch(prop){
case "tracks":
if(collection[id].hasOwnProperty(prop) && value !== ""){
collection[id][prop].push(value);
}
else if(value !== ""){
collection[id][prop] = [];
collection[id][prop].push(value);
}
break;
default:
if(value !== ""){
collection[id][prop] = value;
}
else{
//do nothing
}
}
idk whats wrong with my code :(
Markus Kiili
@Masd925
Nov 09 2016 07:22
@Fani041 Don't use switch because you need to test both value and prop. Make if's and then access collection on if blocks. Tracks property needs some extra attention.
Switch makes it harder to understand.
Fani041
@Fani041
Nov 09 2016 07:23
noted. ill review my code then, thx a lot
Markus Kiili
@Masd925
Nov 09 2016 07:24
@Fani041 You can avoid some repeating conditions by starting with if (value==="")
Fani041
@Fani041
Nov 09 2016 07:24
but if you can,pls show me the code which that works, it will helps me learn this faster :D
Markus Kiili
@Masd925
Nov 09 2016 07:25
@Fani041 Yes. I will hold my silence.
Fani041
@Fani041
Nov 09 2016 07:26
:(
小抹茶
@ITzl
Nov 09 2016 07:27
你们做那个了吗,就是如果判断语句if,else-if,这些,如果有一个判断条件是val<1,还有一个是val<2怎么办啊
是怎么处理没有歧义啊
Markus Kiili
@Masd925
Nov 09 2016 07:28
@Fani041 It is better if you try to solve it yourself. Ask for help here if you get stuck.
Fani041
@Fani041
Nov 09 2016 07:29
Okay, thank alot dude
__SharifTarver__
@Sharifdesigns22
Nov 09 2016 07:37
Can someone help with the converting celsius to fahrenheit challenge?
Ogundele Olumide
@Lumexralph
Nov 09 2016 07:38
@Sharifdesigns22 what exactly do you need help with?
Ghulam Shabir
@ghulamshabir
Nov 09 2016 07:39
@Sharifdesigns22 you need to use this formula for celsius to fahrenheit conversion t(f) = c * 9/5 + 32
Aamnah Akram
@aamnah
Nov 09 2016 07:39
hey all. i'm at 'Using Objects for Lookup' and it won't pass. What am i missing? Here's the code
```

// 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"
  };
  var value = val;
  result = lookup.value;

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

// Change this value to test
phoneticLookup("charlie");
__SharifTarver__
@Sharifdesigns22
Nov 09 2016 07:40

@ghulamshabir
function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
// Only change code above this line
return fahrenheit;
}

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

Markus Kiili
@Masd925
Nov 09 2016 07:40
@aamnah Use bracket notation when the property key is in a variable. .value looks for property key "value".
Ghulam Shabir
@ghulamshabir
Nov 09 2016 07:40
@Sharifdesigns22 here c is celsius value to convert into fahrenheit, you already have parameter celsius use that for cin the formula and assign the result to fahrenheit
__SharifTarver__
@Sharifdesigns22
Nov 09 2016 07:40
trying to make -30 celsius = -22
Aamnah Akram
@aamnah
Nov 09 2016 07:42
@Masd925 duh. thanks man!
CamperBot
@camperbot
Nov 09 2016 07:42
aamnah sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2859 | @masd925 |http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
Nov 09 2016 07:42
@aamnah Also that value variable is just redundant.
__SharifTarver__
@Sharifdesigns22
Nov 09 2016 07:44
Can you show me?? @ghulamshabir I'm very new to javascript, it's a little confusing
Aamnah Akram
@aamnah
Nov 09 2016 07:44
@Masd925 i know, just wanted to make sure i wasn't missing anything :D
Ghulam Shabir
@ghulamshabir
Nov 09 2016 07:45
@Sharifdesigns22 do you see convertTof(0) at last line, could you tell me where does that zero (or any value you put into parenthesis) go ?
for example convertToF(25) ?
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 07:53
@ghulamshabir how does .fromChar() work
.fromCharCode() sorry
Ghulam Shabir
@ghulamshabir
Nov 09 2016 07:54
@aamnah hello Ammnah, how are you?
@Dorcy-ndg3 it takes charCode and returns a string out of it
Markus Kiili
@Masd925
Nov 09 2016 07:56
String.fromCharCode(66,67,68); // 'BCD'
String.fromCharCode.apply(null,[66,67,68]); // 'BCD'
__SharifTarver__
@Sharifdesigns22
Nov 09 2016 07:56
@ghulamshabir it returns a value but i dont know where
Ghulam Shabir
@ghulamshabir
Nov 09 2016 07:56
I am from Sindh, welcome here @aamnah
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 07:57
so @Masd925 what change does apply bring ??
Markus Kiili
@Masd925
Nov 09 2016 07:57
@Dorcy-ndg3 You can transform an array of charcodes at once.
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 07:58
it looks like it did the same job as the one without apply tho
Aamnah Akram
@aamnah
Nov 09 2016 07:58
@ghulamshabir hey, i'm fine. yourself?
Ghulam Shabir
@ghulamshabir
Nov 09 2016 07:58
@aamnah I am good, thanks
CamperBot
@camperbot
Nov 09 2016 07:58
ghulamshabir sends brownie points to @aamnah :sparkles: :thumbsup: :sparkles:
:cookie: 239 | @aamnah |http://www.freecodecamp.com/aamnah
Markus Kiili
@Masd925
Nov 09 2016 07:59
@Dorcy-ndg3 Many times you split a string into an array of characters and then transform it into an array of charcodes and maybe map those charcodes. You can then make the result string with that apply line.
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 08:00
am trying to understand what u mean here
let me read more anyway
@Masd925 u cant use the method on strings??
__SharifTarver__
@Sharifdesigns22
Nov 09 2016 08:03
@ghulamshabir ??
Markus Kiili
@Masd925
Nov 09 2016 08:05
@Dorcy-ndg3 fromCharCode works on numbers, not on any particular string. Therefore it is not a string method (inherited to all strings from String.prototype). For that reason it is stored on the String constructor (the method has to be stored somewhere).
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 08:05
@Sharifdesigns22 did u use a return statement
Ghulam Shabir
@ghulamshabir
Nov 09 2016 08:06
@Sharifdesigns22 the value goes to celsius parameter, you see that in () of function definition ?
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 08:06
@Masd925 so i dont need to split the array first
Ghulam Shabir
@ghulamshabir
Nov 09 2016 08:06
@Sharifdesigns22 you need to convert the value of that parameter into fahrenheit and assign the result to fahrenheit
Markus Kiili
@Masd925
Nov 09 2016 08:07
@Dorcy-ndg3 Split is a string method.
You need to split the string to get an array of characters, yes.
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 08:08
i meant i dont need to split the string to an array?
no the challenge am working on says to return a decoded string
i am doing ceasers cipher
Markus Kiili
@Masd925
Nov 09 2016 08:09
@Dorcy-ndg3 Split the string, change characters on elements into charcodes and then map those charcodes as asked. You can then make the result string with the apply trick there.
__SharifTarver__
@Sharifdesigns22
Nov 09 2016 08:11
@ghulamshabir when I assign the result do I enter var fahrenheit?
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 08:13
@Masd925 so i turn them into charcodes or from charcodes
Markus Kiili
@Masd925
Nov 09 2016 08:13
@Dorcy-ndg3 First you turn characters into charcodes and then the other way. You start and end with a string.
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 08:14
ok
Ghulam Shabir
@ghulamshabir
Nov 09 2016 08:14
@Sharifdesigns22 yes, got to go, hope someone will help you here
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 08:14
lemme give it a shot
__SharifTarver__
@Sharifdesigns22
Nov 09 2016 08:15
@ghulamshabir just remembered i have to enter the formula first. thanks
CamperBot
@camperbot
Nov 09 2016 08:15
sharifdesigns22 sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
:cookie: 925 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
upendra
@ardnepu
Nov 09 2016 08:16
hello
can we make a fully functional website without knowlege of php?
with html5 css3 and javscript only
heroiczero
@heroiczero
Nov 09 2016 08:18
@ardnepu yes u can
upendra
@ardnepu
Nov 09 2016 08:19
do u have examples of some website
Chandrahas P
@Chan11
Nov 09 2016 08:20
@ardnepu freecodecamp is built using javascript
upendra
@ardnepu
Nov 09 2016 08:20
without the use of frameworks?
Markus Kiili
@Masd925
Nov 09 2016 08:21
@ardnepu FCC uses backend too.
Chandrahas P
@Chan11
Nov 09 2016 08:21
@ardnepu
Angular.js. AngularJS, the baby of Google...
React.js. What powers Facebook and Instagram's user Interface? ...
Ember.js. EmberJS is another powerful MVC JavaScript framework. ...
Aurelia.js. ...
Meteor.js. ...
Backbone.js. ...
Polymer.js. ...
Knockout.js.
upendra
@ardnepu
Nov 09 2016 08:23
i want to learn web development but there are many frameworks and stuffs so i get confused what to learn
heroiczero
@heroiczero
Nov 09 2016 08:24
@ardnepu i would start with html css and javascript
upendra
@ardnepu
Nov 09 2016 08:24
yeah i know html5 css3 and basic js
now what shall i learn
Codemzy
@codemzy
Nov 09 2016 08:24
@ardnepu follow the FCC map its perfect for learning full stack web dev and will introduce you to some frameworks along the way... you can pick others up as you go
upendra
@ardnepu
Nov 09 2016 08:25
ok i will try
Ogundele Olumide
@Lumexralph
Nov 09 2016 08:26
@ardnepu you can pick up react
Markus Kiili
@Masd925
Nov 09 2016 08:26
@ardnepu You need to learn new things all the way, so what framework you pick now is not a big deal. Choose one that is somewhat popular.
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:26
Google doesn't use Angular...
Ogundele Olumide
@Lumexralph
Nov 09 2016 08:27
@ardnepu react is kind of popular for now and will have more resources though other frameworks are awesome too
Markus Kiili
@Masd925
Nov 09 2016 08:27
@veksen baby of Google means maintained by Google.
upendra
@ardnepu
Nov 09 2016 08:27
agian i am confused should i go for node.js or react
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:28
Node.js is backend
React is frontend
Back runs on the server
While front, in the browser
Ogundele Olumide
@Lumexralph
Nov 09 2016 08:29
@ardnepu depends on what you want to work on
upendra
@ardnepu
Nov 09 2016 08:29
will react have completely different syntax from js?
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:29
no, React is Javascript
Dan Couper
@DanCouper
Nov 09 2016 08:30
Node is just an environment to run JavaScript that isn’t the browser.
You still use it generally when developing with React because you can’t compile the React code fast enough just using the browser, you need to do stuff beforehand, take your React modules and turn them into one big blob of JS
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:32
"compile the React code fast enough in the browser"
please don't spread lies
Dan Couper
@DanCouper
Nov 09 2016 08:33
You can't
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:33
..........
Dan Couper
@DanCouper
Nov 09 2016 08:33
it is super slow
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:33
I'm just going to facepalm out of here
good luck
Dan Couper
@DanCouper
Nov 09 2016 08:33
Seriously?
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:33
yep.
you're saying nonsense.
have you ever used React?
Chandrahas P
@Chan11
Nov 09 2016 08:33
@ardnepu u can even build cross platform desktop apps with javascript using electron
Dan Couper
@DanCouper
Nov 09 2016 08:34
Given I’m a senior frontend developer & I build apps in React, yeah, there is no way on earth I’m compiling modules in the browser
Unless I want insanely slow sites
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:34
React is super quick, for very specific cases you would rely to SSR, otherwise everything is rendered client side.
unless you meant that JSX cannot be run in the browser....
Dan Couper
@DanCouper
Nov 09 2016 08:35
Given you think it’s ok to compile in browser, how the actual fuck do you run it through linters, Babel, compile modules… etc etc
You can run JSX in the browser, it’s just super slow
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:36
nothing to do with Node.js
Dan Couper
@DanCouper
Nov 09 2016 08:36
because you need to include libraries to compile it in the browser
You need Node to precompile
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:36
the talk was about React vs Nodejs
Dan Couper
@DanCouper
Nov 09 2016 08:36
right
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:36
not Node for dependencies to compile.
Dan Couper
@DanCouper
Nov 09 2016 08:37
but what I’ve just said is you need to use it to precompile, so you use Node with React 99.999999999999999% of the time
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:37
well duh
still not using a Nodejs backend, or any backend at all
Dan Couper
@DanCouper
Nov 09 2016 08:38
so your not using a node backend, except you are using node
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:38
yes
ok we're good, sorry for being rude
Dan Couper
@DanCouper
Nov 09 2016 08:38
:thumbsup: sorry, bit ratty this morning, is a depressing day
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:39
it's depressing for everyone :(
upendra
@ardnepu
Nov 09 2016 08:39
haha
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:39
except you know.
upendra
@ardnepu
Nov 09 2016 08:39
anyone know about ionic framework?
cordova
Dan Couper
@DanCouper
Nov 09 2016 08:41
putting aside the way it works, in practise React is more of a pattern to write JS - Vue, Angular 2 etc are all now very similar, is a good thing to learn, it’s a good pattern
Codemzy
@codemzy
Nov 09 2016 08:43
@ardnepu I looked into it, but I think I am gonna go down the React Native route for mobile apps
Dan Couper
@DanCouper
Nov 09 2016 08:43
Cordova is a horrible thing imo, but still generally necessary to get apps into the app store; it wraps your JS code up in a container, and gives you access to native stuff on phones. It will hopefully become obselete over the next few years (YMMV)
React native is really nice
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:43
I would consider React Native over Cordova
Codemzy
@codemzy
Nov 09 2016 08:44
@DanCouper thats good to hear, I've not started learning React Native yet, but seemed like the best choice for JS in mobile apps
Dan Couper
@DanCouper
Nov 09 2016 08:44
:thumbsup: it’s a much better approach
upendra
@ardnepu
Nov 09 2016 08:45
we can make mobile apps with react too?
Dan Couper
@DanCouper
Nov 09 2016 08:46
React Native
it’s the same pattern as vanilla React, a little bit different in practice
but if you learn one, you’ll understand the other
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:47
yeah, just except of using components you create yourself, you use "available" Native components
upendra
@ardnepu
Nov 09 2016 08:48
thanx
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:48
say a list of items would go in a <ListView />
why discourage him?
the JS architecture of today is complex, yes, but it's complex for a good reason
Dan Couper
@DanCouper
Nov 09 2016 08:49
the study plan to cure JS fatigue is basically just “Learn React” though :)
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:50
okay second one is okay
but first link haha..
Dan Couper
@DanCouper
Nov 09 2016 08:50
yeah, I saw it a few weeks ago, it’s quite funny. A bit discouraging. Hopefully it’ll start to settle this year though
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:51
but yeah building serious, twelve-factor style apps today is complex, altogether
Dan Couper
@DanCouper
Nov 09 2016 08:51
Looks like React way of working is winning atm, need to simplify the build process for new starters though
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:51
it's why Vue is so popular
Dan Couper
@DanCouper
Nov 09 2016 08:52
:thumbsup: the react start app is good as well, install it and off you go
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:52
when you start, you include it like you would include jQuery, then you can write Vue.js components
Dan Couper
@DanCouper
Nov 09 2016 08:53
yeah, been looking at it recently for small stuff to get started really quickly
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:54
I'm enjoying the react-boilerplate very much, a bit more complex, but Router, Translations, Redux, HMR, Linting, Tests etc
even comes with stuff like ngrok etc
e2e also...
all of those can be a pain to setup properly
Omer Tarik Koc
@omertarik96
Nov 09 2016 08:56
Hello, I need a little help.. I'm stuck with assigning contents of a variable to another. Do you guys know how can I do this?
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:57
like so?
var a = 'something';
var b = a;
Sorin Ruse
@sorinr
Nov 09 2016 08:57
@veksen vue is not yet as popular as react but i like vue for its simplicity in use
Omer Tarik Koc
@omertarik96
Nov 09 2016 08:58
I tried var a = 'something';
var b = a;
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:58
@sorinr oh no I know, but it gained in popularity very quickly
Blauelf
@Blauelf
Nov 09 2016 08:58
@omertarik96 "Assign value of X to Y" and "Assign Y the value of X" both translate to Y = X; (though your variables are different)
Jean-Philippe Sirois
@veksen
Nov 09 2016 08:58
@omertarik96 if you console.log(b), you should get 'something'
Blauelf
@Blauelf
Nov 09 2016 08:58
@omertarik96 Your 'something' might instead have to be 7 per task description?
Sorin Ruse
@sorinr
Nov 09 2016 08:59
@veksen just because its very easy to use it on an existing html structure
Jean-Philippe Sirois
@veksen
Nov 09 2016 09:00
@sorinr yes definitely :) it's good because it pulls many devs away from bad jQuery patterns and into more serious development
Omer Tarik Koc
@omertarik96
Nov 09 2016 09:00
@veksen If I write that code and change "something" to 7 (because of 7), I'm not getting 7 on console. (Sorry for that, I just started to learn JavaScript)
@Blauelf I tried already but I'm getting "2" instead of "7"
Jean-Philippe Sirois
@veksen
Nov 09 2016 09:01
@omertarik96 show the full code?
Omer Tarik Koc
@omertarik96
Nov 09 2016 09:01

<code>
// Setup
var a;
var b = 2;

// Only change code below this line

var a = 7;
var a = b;

<code>
// Setup
var a;
var b = 2;

// Only change code below this line

var a = 7;
var a = b;
</code>

Jean-Philippe Sirois
@veksen
Nov 09 2016 09:02
you are assigning a to 7, and then, you are assigning it to b, and b is equal to 2
so in the end, a = 2
Emmanuel
@chriemma
Nov 09 2016 09:03
somebody help what went wrong here += a + 12;
+= 9 + b;
+= c + 7;
Jean-Philippe Sirois
@veksen
Nov 09 2016 09:03
@chriemma that's invalid syntax, what are you trying to do?
@chriemma b += 9 is the equivalent of b = b + 9
Sorin Ruse
@sorinr
Nov 09 2016 09:04
@veksen coz it forces you to write js good modular code if i can say that
Emmanuel
@chriemma
Nov 09 2016 09:05
@veksen am trying to use the += operator for each variable
Omer Tarik Koc
@omertarik96
Nov 09 2016 09:05
@veksen Thanks for your help! I just changed the order and it worked!
CamperBot
@camperbot
Nov 09 2016 09:05
omertarik96 sends brownie points to @veksen :sparkles: :thumbsup: :sparkles:
:cookie: 108 | @veksen |http://www.freecodecamp.com/veksen
Jean-Philippe Sirois
@veksen
Nov 09 2016 09:06
@chriemma you cannot start with +=
@omertarik96 =) good
Emmanuel
@chriemma
Nov 09 2016 09:06
Example please @veksen
Jean-Philippe Sirois
@veksen
Nov 09 2016 09:07
@chriemma I did =) b += 9 is the equivalent of b = b + 9
it reads b equals itself plus 9
Blauelf
@Blauelf
Nov 09 2016 09:16
@omertarik96 The first code you posted already was var b = a;, so you had the solution :P
rahisarm
@rahisarm
Nov 09 2016 09:17
cannot complete Record Collection
exercise
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 09:19
@rahisarm Don't give up! Strive for success!!!
NainaPS
@Navyya
Nov 09 2016 09:29
hey i got stuck at
Sum All Numbers in a Range
can anyone help where did i make mistake?
amir38
@amir38
Nov 09 2016 09:30
Storing Values with the Assignment Operator
rahisarm
@rahisarm
Nov 09 2016 09:30
@Jeff-Shapiro Thanks mahn
CamperBot
@camperbot
Nov 09 2016 09:30
rahisarm sends brownie points to @jeff-shapiro :sparkles: :thumbsup: :sparkles:
:cookie: 326 | @jeff-shapiro |http://www.freecodecamp.com/jeff-shapiro
Jean Baptiste Kwizera
@jbkwizera
Nov 09 2016 09:30
Hello Everyone! I have been using Windows, but I started to think that it's not a good environment for programming. So of course, I am thinking of Linux now.
Can you tell me what I should expect to experience with Linux, and how I can install Linux on a PC windows uninstalling Windows?
rahisarm
@rahisarm
Nov 09 2016 09:31
but cannot getting a break through
Ghulam Shabir
@ghulamshabir
Nov 09 2016 09:32
@Navyya unless you share your code here
Emmanuel
@chriemma
Nov 09 2016 09:32
I need help on this challenge convertToF(30);
convertToF(0);
convertToF(-30);
convertToF(-10);
convertToF(0);
convertToF(20);
convertToF(30);
amir38
@amir38
Nov 09 2016 09:32
Can give examples of Storing Values with the Assignment Operator
Johnny
@JohnnyBizzel
Nov 09 2016 09:32
@jbkwizera The easiest way is to add a 2nd Hard drive and install Linux on that. You can then dual boot your PC
NainaPS
@Navyya
Nov 09 2016 09:32
wait
amir38
@amir38
Nov 09 2016 09:32
please
Ghulam Shabir
@ghulamshabir
Nov 09 2016 09:33
@amir38 = works from rifht to left var b = 4
NainaPS
@Navyya
Nov 09 2016 09:33

function sumAll(arr) {
var max=Math.max(arr);
var min=Math.min(arr);
return arr.reduce(function(max,min){ return (max+min);
},
0);
// return 1;
}

sumAll([1, 4]);

amir38
@amir38
Nov 09 2016 09:33

console.log("a = " + a + ", b = " + b );
// Setup
var a;
var b = 2;

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

Johnny
@JohnnyBizzel
Nov 09 2016 09:33
@jbkwizera IF you are happy to get rid of Windows, try Linux by burning it to a DVD (if you want) and then your can boot and test it before installing.
amir38
@amir38
Nov 09 2016 09:34
failed b should have a value of 7
Johnny
@JohnnyBizzel
Nov 09 2016 09:34
@amir38 Set a = 7 before b=a?
Jean Baptiste Kwizera
@jbkwizera
Nov 09 2016 09:34
yes thanks @JohnnyBizzel I want to finish this week started with Linux
CamperBot
@camperbot
Nov 09 2016 09:34
jbkwizera sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:cookie: 779 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
NainaPS
@Navyya
Nov 09 2016 09:35
I came aftr along time how to format text
heroiczero
@heroiczero
Nov 09 2016 09:35
@Navyya are u not trying to sum all in the array
Ghulam Shabir
@ghulamshabir
Nov 09 2016 09:35
@Navyya arr has only two values initial value and final value of range, you need to fill the array wit all values inbetween the range
NainaPS
@Navyya
Nov 09 2016 09:35
@heroiczero cn u tell how to switch to coding mode?
Johnny
@JohnnyBizzel
Nov 09 2016 09:35
@jbkwizera I am using ubuntu and Mint. There are many tools available to you which are simple to install.
NainaPS
@Navyya
Nov 09 2016 09:36
@ghulamshabir ok so what next must i do?
heroiczero
@heroiczero
Nov 09 2016 09:36
@Navyya ```js function{}
Jean Baptiste Kwizera
@jbkwizera
Nov 09 2016 09:36
Like not the whole Linux @JohnnyBizzel
?
I want to use Linux Mint
mr.san
@emresandikci
Nov 09 2016 09:37
Hi guys
NainaPS
@Navyya
Nov 09 2016 09:37
'''
CamperBot
@camperbot
Nov 09 2016 09:37
:bulb: to format code use backticks! ``` more info
amir38
@amir38
Nov 09 2016 09:37
Can help me about Storing Values with the Assignment Operator, and give an example of her?
mr.san
@emresandikci
Nov 09 2016 09:37
I have a problem about some question on freeCodeCamp ? I cant pass it whats the problem I cant fix it
Johnny
@JohnnyBizzel
Nov 09 2016 09:37
@jbkwizera I like Mint. I am using it now but I normally develop on Ubuntu.
amir38
@amir38
Nov 09 2016 09:38
help
help
Johnny
@JohnnyBizzel
Nov 09 2016 09:38
@amir38 Assignment operator is =
Have you seen code like this
i = 0
mr.san
@emresandikci
Nov 09 2016 09:39
Someone can help me about FreeCodeCamp question ?
NainaPS
@Navyya
Nov 09 2016 09:39

'''js
function sumAll(arr) {
var max=Math.max(arr);
var min=Math.min(arr);
return arr.reduce(function(max,min){ return (max+min);
},
0);
// return 1;
}

sumAll([1, 4]);
'''

CamperBot
@camperbot
Nov 09 2016 09:39
:bulb: to format code use backticks! ``` more info
Johnny
@JohnnyBizzel
Nov 09 2016 09:39
@mrsand We will try...
heroiczero
@heroiczero
Nov 09 2016 09:39
@Navyya i think its shift enter
Jean Baptiste Kwizera
@jbkwizera
Nov 09 2016 09:39
I realized there is no real programmer who develops on Windows. I felt ashamed. Now is the time to change.
@JohnnyBizzel Do you thing the user interface is great (as in self-explanatory) on Ubuntu or Mint?
NainaPS
@Navyya
Nov 09 2016 09:39
whats hapening i returned aftr so long n m not able to format text
haan i did
mr.san
@emresandikci
Nov 09 2016 09:40
Increment a Number with JavaScript this section
myVar = myVar should be changed

var myVar = 87;

// Only change code below this line
myVar = myVar + 1;
myVar++ ;
myVar = 88;

whats wrong is here
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 09:40
maybe ur pressing the wrong backsticks on ur keyboard @Navyya
@mrsand use +=
Johnny
@JohnnyBizzel
Nov 09 2016 09:41
@jbkwizera I don't know about that. If you built stuff for .NET Windows and VisualStudio is what you should use. I did for years!
Ghulam Shabir
@ghulamshabir
Nov 09 2016 09:41
@Navyya see sumAll([1, 4]) ? array has values 1 and 4, you need to fill other values using a loop so that arrwill have values [1, 2, 3, 4]
Johnny
@JohnnyBizzel
Nov 09 2016 09:41
@mrsand You are changing myVar 3 times?
Ghulam Shabir
@ghulamshabir
Nov 09 2016 09:42
@Navyya when you get the arrfilled with all values then use reduce on the array to get total
NainaPS
@Navyya
Nov 09 2016 09:42
ok @ghulamshabir I will give a try
mr.san
@emresandikci
Nov 09 2016 09:42
@Dorcy-ndg3 I cant pass just that myVar = myVar should be changed
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 09:42
@mrsand ur changing it many times
Johnny
@JohnnyBizzel
Nov 09 2016 09:42
@ghulamshabir Good morning sir. How are you getting on with React?
Ghulam Shabir
@ghulamshabir
Nov 09 2016 09:42
@mrsand ++ operator increments the variable in place, no need of assignment again
heroiczero
@heroiczero
Nov 09 2016 09:43
@Navyya if you want to do .reduce(); remember its function (previousnumber, currentnumber){} so previous+current will return the result
Ghulam Shabir
@ghulamshabir
Nov 09 2016 09:43
@JohnnyBizzel Hey buddy :smile:
@JohnnyBizzel I think I am slow learner
Blauelf
@Blauelf
Nov 09 2016 09:43
@mrsand Just the line myVar++; is sufficient, the first is equivalent (so you increment twice), the last is not needed.
rahisarm
@rahisarm
Nov 09 2016 09:44
@Jeff-Shapiro Finally gt it
Ghulam Shabir
@ghulamshabir
Nov 09 2016 09:44
@JohnnyBizzel I seeing the same stuff in React syntax for the whole week but I am not digesting it fully
Johnny
@JohnnyBizzel
Nov 09 2016 09:44
@ghulamshabir I have been learning it myself. Not easy.
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 09:45
@rahisarm I'm sorry but I am not sure what your talking about. But well done :)
mr.san
@emresandikci
Nov 09 2016 09:45
@Blauelf myVar = myVar should be changed this section cant pass I already use just that myVar = ++myVar; this is work for 3 questions but not myVar=myvAr should be change
Johnny
@JohnnyBizzel
Nov 09 2016 09:45
@ghulamshabir I've done some of the Lynda.com course and also some of Stephen Mayeux's videos.
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 09:46
@mrsand u just need this line of code
myVar ++ ;
mr.san
@emresandikci
Nov 09 2016 09:46
@Dorcy-ndg3 I know but its not work for javascript
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 09:47
what do u mean
heroiczero
@heroiczero
Nov 09 2016 09:47
@mrsand u just need myVar++; not myVar+=1;
@mrsand what you are doing is adding it twice
mr.san
@emresandikci
Nov 09 2016 09:47
@Dorcy-ndg3 I think I have to remove browser history and cache
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 09:47
++ is supposed to increment by 1 @mrsand
@mrsand or just refresh
mr.san
@emresandikci
Nov 09 2016 09:48
@heroiczero @Dorcy-ndg3 I will remove browser cache thanks and I will try again
CamperBot
@camperbot
Nov 09 2016 09:48
mrsand sends brownie points to @heroiczero and @dorcy-ndg3 :sparkles: :thumbsup: :sparkles:
:cookie: 364 | @heroiczero |http://www.freecodecamp.com/heroiczero
:cookie: 322 | @dorcy-ndg3 |http://www.freecodecamp.com/dorcy-ndg3
Ghulam Shabir
@ghulamshabir
Nov 09 2016 09:48
@JohnnyBizzel oh I see, lynda.com is paid so for me its no no, I have seen ReactJS http://courses.reactjsprogram.com/ but he is too fast, I want to understand theory behind React, now I am studying React succintly
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 09:49
ur welcome
and code on!
Guys am really sad Donald trump won the election
Johnny
@JohnnyBizzel
Nov 09 2016 09:49
@ghulamshabir My friend was going through the CodeAcademy course which is free. I have a free 1 month trial with Lynda through linked in
@Dorcy-ndg3 You shouldn't really put political comments here.
Ghulam Shabir
@ghulamshabir
Nov 09 2016 09:51
@JohnnyBizzel oh ya I forgot that one month trial, surely will give it a try but I want to study the basics from elsewhere and use that leverage for a month on linkedn to study something advance
Johnny
@JohnnyBizzel
Nov 09 2016 09:51
@ghulamshabir If you have questions I am happy to help. I haven't started coding but my friend did the Markdown preview.
mr.san
@emresandikci
Nov 09 2016 09:53
its work for me now thanks guys it was about cache
Yuliya
@YuliaMas
Nov 09 2016 09:53
Hello! "FirstLine newline backslash SecondLine backslash carriage-return ThirdLine" . What I need to do in this task? myStr should have encoded text with the proper escape sequences and no spacing.
Ghulam Shabir
@ghulamshabir
Nov 09 2016 09:53
@JohnnyBizzel thanks for your offer, I am going to start a project on react soon probably twitch.tv or may be rework weather app on react
CamperBot
@camperbot
Nov 09 2016 09:53
ghulamshabir sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:cookie: 780 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Johnny
@JohnnyBizzel
Nov 09 2016 09:53
@mrsand Genius!
@ghulamshabir Good plan! :+1:
@ghulamshabir I made this to test making something on codepen:
http://codepen.io/JohnnyBizzel/pen/zoOZdK
@YuliaMas put + " " + some + " " + spaces + " " + in
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 09:59
so in fromCharCode() can i put a name of a string in the parenthasis??
Johnny
@JohnnyBizzel
Nov 09 2016 10:00
@YuliaMas Dobre utra. You will need escape characters like backslash = \\
Markus Kiili
@Masd925
Nov 09 2016 10:00
@Dorcy-ndg3 No. String.fromCharCode() works on numbers and returns a string.
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 10:00
then i dont know what to do for this
tangwen
@xinbeimousha
Nov 09 2016 10:01
heelo
Johnny
@JohnnyBizzel
Nov 09 2016 10:01
@Dorcy-ndg3 depends which this you mean! It usually refers to the dom element it is inside :P
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 10:01
function rot13(str) { // LBH QVQ VG!
 var converted ="";
  str = str.split(" ");
  converted = str.fromCharCode();
  return str;
}
i want to accout for str
Markus Kiili
@Masd925
Nov 09 2016 10:01
@JohnnyBizzel What is a functeon ?
Johnny
@JohnnyBizzel
Nov 09 2016 10:02
@Masd925 A typo of function
tangwen
@xinbeimousha
Nov 09 2016 10:02
can somebody else help me with the Falsy Bouncer project
Markus Kiili
@Masd925
Nov 09 2016 10:02
@JohnnyBizzel ok :)
Johnny
@JohnnyBizzel
Nov 09 2016 10:02
@xinbeimousha yes sir, how can we help
@Masd925 Spelling was never my forte! Thank god for auto correct!
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 10:03
@Masd925 how can i account for str
Markus Kiili
@Masd925
Nov 09 2016 10:03
@Dorcy-ndg3 Do you have an array of charcodes there?
Or are you looping the original string?
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 10:04
doesnt splitting it mean i have that array
Markus Kiili
@Masd925
Nov 09 2016 10:04
Yes.
Sorry, I didn't notice the code you posted.
tangwen
@xinbeimousha
Nov 09 2016 10:04
i need to delete the False value in Array with the filter API
Johnny
@JohnnyBizzel
Nov 09 2016 10:04
lol
heroiczero
@heroiczero
Nov 09 2016 10:05
@Dorcy-ndg3 yes it is an array
Johnny
@JohnnyBizzel
Nov 09 2016 10:05
@xinbeimousha Use a filter function. Are you happy with how this works? It takes some getting used to.
Markus Kiili
@Masd925
Nov 09 2016 10:05
@Dorcy-ndg3 You are splitting to an array of words. You should split to array of characters.
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 10:06
how
Ghulam Shabir
@ghulamshabir
Nov 09 2016 10:06
@JohnnyBizzel its good :+1: , took a while to get it, but I think actual thing to learn is how to make use of the props, component hierarchy
Markus Kiili
@Masd925
Nov 09 2016 10:06
@Dorcy-ndg3 Use .split("")
@Dorcy-ndg3 Then you need to loop or iterate that array of characters.
Aamnah Akram
@aamnah
Nov 09 2016 10:06
i'm at 'Record Collection' in JavaScript Basics, can't get the condition (After updateRecords(5439, "tracks", "Take a Chance on Me"), tracks should have "Take a Chance on Me" as the last element) to pass.. ideas? here's the code

// Setup
var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {

  var hasTracks = collection[id].hasOwnProperty("tracks");

  if (prop !== "tracks" && value !== "") {
    // set `value`
    collection[id][prop] = value;
  } else if (prop === "tracks" && !hasTracks) {
    // create an empty array before adding value
    collection[id].tracks = {};
    collection[id].tracks += value;
  } else if (prop === "tracks" && value !== "") {
    // push the value to the end of existing tracks array
    collection[id].tracks.push(value);
  } else if (value === "") {
    // delete the given prop
    delete collection[id][prop];
  }

  return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
Marcin Sanecki
@msanecki
Nov 09 2016 10:07
Hi all!
Yuliya
@YuliaMas
Nov 09 2016 10:07
@JohnnyBizzel Dobroe utro!
Johnny
@JohnnyBizzel
Nov 09 2016 10:07
@ghulamshabir And the state is important too.
Ghulam Shabir
@ghulamshabir
Nov 09 2016 10:07
@JohnnyBizzel yes
Johnny
@JohnnyBizzel
Nov 09 2016 10:07
@YuliaMas Kak u vas dela?
tangwen
@xinbeimousha
Nov 09 2016 10:07
hey guys ,how could i send a picture like above that
Johnny
@JohnnyBizzel
Nov 09 2016 10:08
'''
CamperBot
@camperbot
Nov 09 2016 10:08
:bulb: to format code use backticks! ``` more info
Marcin Sanecki
@msanecki
Nov 09 2016 10:08
Could anyone look at my Caesars Cipher js function and give any tip?
Stephen James
@sjames1958gm
Nov 09 2016 10:08
@aamnah collection[id].tracks = {}; isn't tracks and array ? collection[id].tracks += value; is this how you add to an array?
Johnny
@JohnnyBizzel
Nov 09 2016 10:08
^^ read
Yuliya
@YuliaMas
Nov 09 2016 10:08
@JohnnyBizzel Chtoto ne o4en
Ghulam Shabir
@ghulamshabir
Nov 09 2016 10:08
@aamnah you need to create an empty array for tracks if it does not exist
heroiczero
@heroiczero
Nov 09 2016 10:08
@aamnah collection[id].tracks = {}; arent u trying to create a array of tracks?
Johnny
@JohnnyBizzel
Nov 09 2016 10:08
@YuliaMas :+1:
hanhoah
@hanhoah
Nov 09 2016 10:08
hi all, i get stuck in the Falsy Bouncer Task
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 10:08
ok @Masd925 lemme do that
Ghulam Shabir
@ghulamshabir
Nov 09 2016 10:09
@aamnah empty array [] instead of {}
hanhoah
@hanhoah
Nov 09 2016 10:09
can anybody help?
tangwen
@xinbeimousha
Nov 09 2016 10:09
@hanhoah me too,,,
Johnny
@JohnnyBizzel
Nov 09 2016 10:09
@hanhoah What do you need help with?
Markus Kiili
@Masd925
Nov 09 2016 10:09
@hanhoah You can just post your question here and the relevant code.
hanhoah
@hanhoah
Nov 09 2016 10:09
yeah thank you guys
Kush Sharma
@N0M9D
Nov 09 2016 10:09
how do i refresh the quote on button click in random quote machine ? Right now the button click loads the same quote everytime. https://codepen.io/N0M9D/full/mAawAb/
tangwen
@xinbeimousha
Nov 09 2016 10:09

function bouncer(arr) {
// Don't show a false ID to this bouncer.
var newArr= arr.filter(function(){
for(var i=0;i<arr.length;i++){
if(arr[i]!==false||null||0||""||undefined||NaN);{
return true;
}
}
});
return newArr;
}

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

hanhoah
@hanhoah
Nov 09 2016 10:09
i have a problem with testing NAN
tangwen
@xinbeimousha
Nov 09 2016 10:10
is there someting wrong with my code
Johnny
@JohnnyBizzel
Nov 09 2016 10:10
@xinbeimousha Don't loop inside filter
Ghulam Shabir
@ghulamshabir
Nov 09 2016 10:10
@xinbeimousha your tests have wrong syntax
Stephen James
@sjames1958gm
Nov 09 2016 10:10
@xinbeimousha if(arr[i]!==false||null||0||""||undefined||NaN);{ this is not the correct syntax
Markus Kiili
@Masd925
Nov 09 2016 10:10
@hanhoah A test for value NaN is val===val and for not being NaN val!==val
hanhoah
@hanhoah
Nov 09 2016 10:11
i tried to test all false items in a for loop
Markus Kiili
@Masd925
Nov 09 2016 10:11
@hanhoah isNaN() is not a test for value NaN.
hanhoah
@hanhoah
Nov 09 2016 10:11
after i put them in an array
Yuliya
@YuliaMas
Nov 09 2016 10:11
Escape Sequences in Strings - I don't know this task. @JohnnyBizzel
hanhoah
@hanhoah
Nov 09 2016 10:11

function isAllowed(item){
falseArray=[false, NaN, null, 0, "", undefined];
for (var i=0; i<falseArray.length;i++){
//document.write(item + " = " +falseArray[i]+"?<br>");
if ((item===falseArray[i])||isNaN(item)){

        return false;
    }
 }
return true;

}

first i removed the ||isNaN(item) part
but also doesn't work
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 10:12
@Masd925 this real looks bad
 for (var i=0; i<str.length; i++){
  return  str[i].fromCharCode(str);
 }
heroiczero
@heroiczero
Nov 09 2016 10:13
@Dorcy-ndg3 doesnt that only return once
Markus Kiili
@Masd925
Nov 09 2016 10:13
@Dorcy-ndg3 Inside that loop str[i] is one character. You need to get the charcode of that character.
hanhoah
@hanhoah
Nov 09 2016 10:13
@Masd925 how can i test for calue NaN?
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 10:13
there is another return statement below it
heroiczero
@heroiczero
Nov 09 2016 10:13
@Dorcy-ndg3 return takes you out of the function
Markus Kiili
@Masd925
Nov 09 2016 10:13
@hanhoah val!==val
Because NaN!==NaN is true.
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 10:14
@heroiczero u mean the loop
Ghulam Shabir
@ghulamshabir
Nov 09 2016 10:14
@aamnah use array methods to add a value to an array
heroiczero
@heroiczero
Nov 09 2016 10:14
@Dorcy-ndg3 so you are only getting charcode for str[0] because of the return
Kush Sharma
@N0M9D
Nov 09 2016 10:15
Can anyone suggest some ideas please on this: how do i refresh the quote on button click in random quote machine ? Right now the button click loads the same quote everytime
hanhoah
@hanhoah
Nov 09 2016 10:15
thank you markus, i will give it a try (btw. bist du deutscher?) @Masd925
CamperBot
@camperbot
Nov 09 2016 10:15
hanhoah sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2860 | @masd925 |http://www.freecodecamp.com/masd925
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 10:15
@heroiczero its not like i want to keep iterating
Markus Kiili
@Masd925
Nov 09 2016 10:16
@hanhoah (Eine kleine Finlander)
heroiczero
@heroiczero
Nov 09 2016 10:17
@heroiczero sorry I would just use a variable to store it so you can get the whole string charcode
Markus Kiili
@Masd925
Nov 09 2016 10:17
@hanhoah I don't speak any Germany.
hanhoah
@hanhoah
Nov 09 2016 10:17
ein Finnlander knowing german and javascript. thats good!! thumbs up
heroiczero
@heroiczero
Nov 09 2016 10:17
@Dorcy-ndg3 then return that variable
Ogundele Olumide
@Lumexralph
Nov 09 2016 10:18
@N0M9D let's see your code
Johnny
@JohnnyBizzel
Nov 09 2016 10:18
@N0M9D I don't think the API is random. Even their own sample shows teh same thing all the time
https://quotesondesign.com/wp-json/posts?filter[orderby]=rand
Jefferson
@jeffersonnnn
Nov 09 2016 10:19
any help with the Reverse Arrays with reverse challenge? I don't know what i am doing wrong.

var array = [1,2,3,4,5,6,7];
var newArray = [];

// Only change code below this line.


var array = [1,2,3,4,5,6,7];
array.reverse();

array = newArray;
Kush Sharma
@N0M9D
Nov 09 2016 10:19
@Lumexralph here is the link: https://codepen.io/N0M9D/full/mAawAb/
@JohnnyBizzel no if you reload the page then the quote changes also
heroiczero
@heroiczero
Nov 09 2016 10:20
@jeffersonnnn newArray should equal array.reverse();
Johnny
@JohnnyBizzel
Nov 09 2016 10:20
@N0M9D Not for me :(
Kush Sharma
@N0M9D
Nov 09 2016 10:20
Ogundele Olumide
@Lumexralph
Nov 09 2016 10:20
@jeffersonnnn if you reverse an array, it'll return the reversed array..you're not using any variable to hold the reversed array
heroiczero
@heroiczero
Nov 09 2016 10:21
@jeffersonnnn newArray=array.reverse();
Johnny
@JohnnyBizzel
Nov 09 2016 10:21
@N0M9D I get that. It jsut doesnt work on copdepane
Kush Sharma
@N0M9D
Nov 09 2016 10:22
@JohnnyBizzel but on the challenge page the URL which is given for the sample Pen, in that it works
Ogundele Olumide
@Lumexralph
Nov 09 2016 10:23
@N0M9D i believe your json is an array for you to be able to use for each?
lydie88
@lydie88
Nov 09 2016 10:23
@miaosan /Using Objects for Lookups
怎么做
@miaosan /Using Objects for Lookups
Kush Sharma
@N0M9D
Nov 09 2016 10:25
@Lumexralph yes, json is an array
Ogundele Olumide
@Lumexralph
Nov 09 2016 10:26
@N0M9D If json is an array, you can generate random number and use that to index the json(which I hope is an array) from your code
Johnny
@JohnnyBizzel
Nov 09 2016 10:26
@YuliaMas This is the answer: https://jsfiddle.net/JohnnyBizzel/1jrseyq5/
@N0M9D Not for me it didn't. It gave the same quote every time. Try with a different API
Kush Sharma
@N0M9D
Nov 09 2016 10:29
@JohnnyBizzel strange
@Lumexralph i thought about that but the IDs seem to be random
jigarhparmar
@jigarhparmar
Nov 09 2016 10:30
return (str.substr(-target.length) === target);

function confirmEnding(str, target) {
// "Never give up and good luck will find you."

var char1=str.charAt(str.length-1);

if(char1===target){
return true;
}else{
return false;
}
// -- Falcor
}

anyone can help me
solve this problem
Johnny
@JohnnyBizzel
Nov 09 2016 10:31
@jigarhparmar There is no function call
Kush Sharma
@N0M9D
Nov 09 2016 10:32
can any body provide an API for the quotes challenge that worked for you?
jigarhparmar
@jigarhparmar
Nov 09 2016 10:32

function confirmEnding(str, target) {
// "Never give up and good luck will find you."

var char1=str.charAt(str.length-1);

if(char1===target){
return true;
}else{
return false;
}
// -- Falcor
}

confirmEnding("Bastian", "n");

this is whole code
Ogundele Olumide
@Lumexralph
Nov 09 2016 10:32
@N0M9D what am thinking is just storing the random number in the function and using it every time it's called
Jefferson
@jeffersonnnn
Nov 09 2016 10:32
@heroiczero @Lumexralph Thanks guysss
CamperBot
@camperbot
Nov 09 2016 10:32
jeffersonnnn sends brownie points to @heroiczero and @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 423 | @lumexralph |http://www.freecodecamp.com/lumexralph
:cookie: 365 | @heroiczero |http://www.freecodecamp.com/heroiczero
jigarhparmar
@jigarhparmar
Nov 09 2016 10:33
confirmEnding("He has to give me a new name", "name") should return true.
confirmEnding("Open sesame", "same") should return true.
heroiczero
@heroiczero
Nov 09 2016 10:33
@jigarhparmar that will only get you the last letter what about same
jigarhparmar
@jigarhparmar
Nov 09 2016 10:33
this two condition not satisfied
Kush Sharma
@N0M9D
Nov 09 2016 10:33
@Lumexralph will try that
Johnny
@JohnnyBizzel
Nov 09 2016 10:33
@jigarhparmar The code you posted returns true
jigarhparmar
@jigarhparmar
Nov 09 2016 10:34
right bro
Ogundele Olumide
@Lumexralph
Nov 09 2016 10:34
@jigarhparmar why don't you use indexOf method
jigarhparmar
@jigarhparmar
Nov 09 2016 10:34
char1 stored only last character
Ogundele Olumide
@Lumexralph
Nov 09 2016 10:35
to know if the target is in the string and use that index to output the element in that string
jigarhparmar
@jigarhparmar
Nov 09 2016 10:35
how can i get word matching
heroiczero
@heroiczero
Nov 09 2016 10:35
@jigarhparmar you have to get target.length and use substr of the str to find if that substr= to the target
Ogundele Olumide
@Lumexralph
Nov 09 2016 10:36
or check if the index is equal to the length of that string - 1, which is the last element in the array of strings
just a thought
heroiczero
@heroiczero
Nov 09 2016 10:36
@jigarhparmar 'substr(startIndex,endIndex)=target`
jigarhparmar
@jigarhparmar
Nov 09 2016 10:36
i will try
heroiczero
@heroiczero
Nov 09 2016 10:37
@jigarhparmar you have to figure out where in the str you want to start and where you want it to end i suggest using .length
jigarhparmar
@jigarhparmar
Nov 09 2016 10:37
can u give me solution
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 10:38
@jigarhparmar I have a solution
heroiczero
@heroiczero
Nov 09 2016 10:38
  return target===str.substr(str.length-target.length,target.length);
  return target===str.substring(str.length-target.length,str.length);
@jigarhparmar either one works
jigarhparmar
@jigarhparmar
Nov 09 2016 10:40
thanks
wolfsbane90
@wolfsbane90
Nov 09 2016 10:41

function palindrome(str)
{
var myStr= (str.replace(/[^a-zA-Z]/gi, "").toLowerCase());
for(var i=0, j=myStr.length-1; i<((myStr.length-1)/2); i++)
{
if(myStr[i] === myStr[j])
{
j--;
}
else
return false;
}

return true;
}

gives an error on palindrome("1 eye for of 1 eye.")
Jon Bodnar
@jonmbodnar
Nov 09 2016 10:42
I'm working on the 'counting cards' challenge. I have a solution that works locally but doesn't pass the online challenge environment's test setup. Can someone tell me if I'm missing something and what the problem is? Here's the solution I came up with:
function cc(card) {

  switch (card) {
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      count++;
      break;
    case 7:
    case 8:
    case 9:
      break;
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      count--;
      break;
  }

  if (count > 0) {
    return 'Bet ' + count;
  }

  return 'Hold ' + count;
}
Stephen James
@sjames1958gm
Nov 09 2016 10:42
@wolfsbane90 You are supposed to retain numbers as well as letters
@jbodgithub count + " Hold" is the format of the response
wolfsbane90
@wolfsbane90
Nov 09 2016 10:43
@sjames1958gm there's a problem with regex?
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 10:43
@jbodgithub Have you declared count somewhere?
Jon Bodnar
@jonmbodnar
Nov 09 2016 10:43
Ha! That was easy.
Stephen James
@sjames1958gm
Nov 09 2016 10:43
@wolfsbane90 Yes, it is only keeping a letters
@jbodgithub :+1:
Jon Bodnar
@jonmbodnar
Nov 09 2016 10:44
Yeah, count is the global declared int he test setup.
Ogundele Olumide
@Lumexralph
Nov 09 2016 10:44
@jbodgithub the order of your answer
@jbodgithub FCC wanted count + string not string + count
wolfsbane90
@wolfsbane90
Nov 09 2016 10:45
@sjames1958gm cool
thanks
Stephen James
@sjames1958gm
Nov 09 2016 10:45
@wolfsbane90 :+1:
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 10:45
@jbodgithub if you do the if variant of that challenge its much tidier
Jon Bodnar
@jonmbodnar
Nov 09 2016 10:47
Lots of comments. The problem was I just reversed the order of the output -- "string count" should have been "count string".
Ewa
@ewamal
Nov 09 2016 10:47
hi guys, someone could maybe give me a hint how to return all the values at once in challange 114?
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 10:48

@jbodgithub

if (card >= 2 && card <= 6 ) {
count++;
}
else if (card >= 7 && card <= 9 ) {
count +=0;
} else
count--;

does the same thing

Tormody
@Tormody
Nov 09 2016 10:54
Hey guys, anyone of u who could give me a helping hand? I started the javascript and im really stuck on 162. Im supposed to convert celsius to fahrenheit and i have tried everything except the right one. So am i starting the change with the function convertToF (celsius) {
?
Ewa
@ewamal
Nov 09 2016 10:56
@Tormody i'm stuck there as well
Ogundele Olumide
@Lumexralph
Nov 09 2016 10:57
@Tormody what're you trying to do?
Tormody
@Tormody
Nov 09 2016 10:57
@Lumexralph so this is the description: "You are given a variable celsius representing a temperature in Celsius. Use the variable fahrenheit already defined and apply the algorithm to assign it the corresponding temperature in Fahrenheit."

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

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

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

Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 10:58
@Tormody Would you like to chat in private and I will guide you through the challenge step by step?
Tormody
@Tormody
Nov 09 2016 10:58
Sure that would be great!
Ewa
@ewamal
Nov 09 2016 10:58
i can do it to return one number but don't know how to return all numbers
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 10:59
@Tormody I sent you a message
Ogundele Olumide
@Lumexralph
Nov 09 2016 11:00
@Tormody you're to write a function that takes in celsius, you have to perform the formula of converting celsius to Fahrenheit
@Jeff-Shapiro remember the solution will help others as well just like @ewamal
@ewamal let's see your code
@ewamal your function will take a parameter celsius right?
Ghulam Shabir
@ghulamshabir
Nov 09 2016 11:01
@ewamal you need to use the formula for celsius to fahrenheit conversion, its t(f) = c * 9/5 + 32, you already have celsius as function parameter use that in place of c in the formula
Ogundele Olumide
@Lumexralph
Nov 09 2016 11:01
@ewamal remember the formula for converting celsius to fahrenheit?
Ewa
@ewamal
Nov 09 2016 11:01

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

// Only change code above this line
return fahrenheit;
}
// Change the inputs below to test your code
convertToF(30);

heroiczero
@heroiczero
Nov 09 2016 11:02
@ewamal dont u need to use celsius variable in code
Mukul
@mukulramchandani
Nov 09 2016 11:02
heyy guys, i'm just stuck here in mutations algorithm.. Would really appreciate if someone can help me
Ogundele Olumide
@Lumexralph
Nov 09 2016 11:02
@ewamal as @ghulamshabir said that should solve it, remember that every parameter like celsius is like a container to take in every value you put to the function when it's called
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 11:02
hey why doesnt this pass ??
function rot13(str) {
 // an array where we are going to push new results
  var converted =[];
 // turn the string into an array
  converted = str.split('');
  // create a loop 
  for (var i=0; i<str.length; i++){
    //get the charcode of each letter 
    var code = str.charCodeAt(i);
    //increase by 13 for all letters upto the point of M
    if(code>=65 && code<=77){
      code += 13;
    }
    else if(code>=78 && code<=90){
      code -=13;
    }
    //turn code back to letters and push it to converted
     converted.push(String.fromCharCode(code));
  }
  //turn the array buck to a string and return it
  return converted.join('');

}
Mukul
@mukulramchandani
Nov 09 2016 11:03
function mutation(arr) {
     var i,j;
  var n = arr[0].split('');
  var m = arr[1].split('');
  var count =0;
  for(i = 0;i<m.length-1;i++){
    for(j = 0;j<n.length-1;j++){
      if(m[i]===n[j]){
        count++;
      }

    }
  }


  if(count === m.length){
    return true;
  }
    else
      return false;

}

mutation(["hello", "hey"]);
here's my code
Yuliya
@YuliaMas
Nov 09 2016 11:05
@JohnnyBizzel Thank you very much.
CamperBot
@camperbot
Nov 09 2016 11:05
yuliamas sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:cookie: 781 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Ogundele Olumide
@Lumexralph
Nov 09 2016 11:05

@mukulcode

for(i = 0;i<m.length-1;i++){
    for(j = 0;j<n.length-1;j++){
      if(m[i]===n[j]){
        count++;

why are you comparing to less than m.length - 1, means you're ignoring the last element

Ewa
@ewamal
Nov 09 2016 11:05
Thank you guys :)
Ghulam Shabir
@ghulamshabir
Nov 09 2016 11:05
@Dorcy-ndg3 you should push the code in converted in each if
@ewamal mention @name for thanksgivings
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 11:06
@mukulcode what is ur loop iterating through
Jasmine Garcia
@garciajasminejoy
Nov 09 2016 11:06
challenge 218 is confusing XD
Ghulam Shabir
@ghulamshabir
Nov 09 2016 11:07
@Dorcy-ndg3 also add an else to your last if, in that push code without adding/subtracting
Mukul
@mukulramchandani
Nov 09 2016 11:07
@Dorcy-ndg3 it is supposed to check whether elements in 'm' are equal to 'n' or not
Ogundele Olumide
@Lumexralph
Nov 09 2016 11:07
@mukulcode you have two arrays m and n and in your loop it's i < m.length - 1 and j < n.length - 1, it will ignore the last element of each array, you could just say i <= m.length - 1 or i < m.length
Mukul
@mukulramchandani
Nov 09 2016 11:08
@Lumexralph sure i'll try out this one.
Ghulam Shabir
@ghulamshabir
Nov 09 2016 11:08
@mukulcode use indexOf on n to get rid of second loop
Ogundele Olumide
@Lumexralph
Nov 09 2016 11:08
@ewamal like this thanks with the name
CamperBot
@camperbot
Nov 09 2016 11:08
lumexralph sends brownie points to @ewamal :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for ewamal
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 11:09
@ghulamshabir it still fails
Mukul
@mukulramchandani
Nov 09 2016 11:09
@ghulamshabir i'm not at all getting how indexOf () fn works
Tormody
@Tormody
Nov 09 2016 11:09
@ghulamshabir Thx!
CamperBot
@camperbot
Nov 09 2016 11:09
tormody sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
:cookie: 926 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
Ghulam Shabir
@ghulamshabir
Nov 09 2016 11:09
@Tormody :smile:
Tormody
@Tormody
Nov 09 2016 11:10
Finally got it! Was driving me crazy:p thx
Ghulam Shabir
@ghulamshabir
Nov 09 2016 11:11
@mukulcode .indexOf takes a value and searches for it in the array, if it finds the value in the array it returns index of it otherwise it returns -1
Mukul
@mukulramchandani
Nov 09 2016 11:12
@ghulamshabir but here to check the equality i don't need index na... i need value..
Ghulam Shabir
@ghulamshabir
Nov 09 2016 11:13
@mukulcode so loop through the m array and in if condition give each element of it to indexOf calling it on n to test if it exists in the n if it returns -1 return false otherwise return true outside loop
@mukulcode you need to make use of indexOf in if to test if the value of m exists in n array
Mukul
@mukulramchandani
Nov 09 2016 11:16
@ghulamshabir in IF condition i need to insert indexOf function to cheque the equality right?
Ghulam Shabir
@ghulamshabir
Nov 09 2016 11:17
@mukulcode if(n.indexOf(m[i]) == -1)
Mukul
@mukulramchandani
Nov 09 2016 11:19
@ghulamshabir ohh yes i'll try this .. Why didn't i got this first :smile:
kevindalgleish
@kevindalgleish
Nov 09 2016 11:20
Hey guys, I'm stuck at Global Scopte and Functions. I have to set oopsGlobal to 5 without using var, and I can not come up with anything else that actually works, everything I try fails.
heroiczero
@heroiczero
Nov 09 2016 11:21
@kevindalgleish oopsGlobal=5;
Ghulam Shabir
@ghulamshabir
Nov 09 2016 11:21
@kevindalgleish what do you have
Mukul
@mukulramchandani
Nov 09 2016 11:21
@kevindalgleish show your code
kevindalgleish
@kevindalgleish
Nov 09 2016 11:21
var myGlobal = 10;
// Declare your variable here


function fun1(oopsGlobal) {
  // Assign 5 to oopsGlobal Here
  console.log(oopsGlobal);
}
fun1(5);

// Only change code above this line
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}
heroiczero
@heroiczero
Nov 09 2016 11:21
@kevindalgleish if its in a function u dont use the var or it will be a Local variable
kevindalgleish
@kevindalgleish
Nov 09 2016 11:22
I'm guessing it's actually really easy
Johnny
@JohnnyBizzel
Nov 09 2016 11:22
@YuliaMas Bolshoy spasiba :D
kevindalgleish
@kevindalgleish
Nov 09 2016 11:22
but I cant come up with anything
Ghulam Shabir
@ghulamshabir
Nov 09 2016 11:22
@kevindalgleish oopsGlobal should be inside function not in parethesis
kevindalgleish
@kevindalgleish
Nov 09 2016 11:23
Ok
heroiczero
@heroiczero
Nov 09 2016 11:24
@kevindalgleish don't console.log(oopsGlobal); but use oopsGlobal=5;
@kevindalgleish it states oopsGlobal as a global variable
kevindalgleish
@kevindalgleish
Nov 09 2016 11:25
I hate these JS challenges, I always overthink them.
Mapamatician
@Mapamatician
Nov 09 2016 11:25
hi friends, I am trying to get all values that happens per month across a number of months. I can get the values I need, but now I am stuck trying to relate them
kevindalgleish
@kevindalgleish
Nov 09 2016 11:25
Thank you so much @heroiczero
CamperBot
@camperbot
Nov 09 2016 11:25
kevindalgleish sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:cookie: 366 | @heroiczero |http://www.freecodecamp.com/heroiczero
Mapamatician
@Mapamatician
Nov 09 2016 11:25
Array [ "Jul", "Aug", "Sept", "Oct" ]map:342:2
Array [ "2016-07: 5 ", "2016-10: 2" ]
How could I relate these?
Harun Richards
@hricha05
Nov 09 2016 11:26
hey guys im stuck on the fahrenheit challenge can anyone offer any help
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 11:26
about @Masd925
CamperBot
@camperbot
Nov 09 2016 11:26
:star2: 2860 | @masd925 |http://www.freecodecamp.com/masd925
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 11:27
@hricha05 have u writen any code yet??
Harun Richards
@hricha05
Nov 09 2016 11:28
@Dorcy-ndg3 im not really sure what to write tbh
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 11:29
create a variable that takes celsius and it multiplies it by ----------------------
i dont really remember the instructions
the main thing u must multiply and divide by those numbers given
Harun Richards
@hricha05
Nov 09 2016 11:31
@Dorcy-ndg3 so i need to create a variable for celsius not fahrenheit
Ogundele Olumide
@Lumexralph
Nov 09 2016 11:31
@hricha05 use the formula Multiply by 9, then divide by 5, then add 32
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 11:32
whatever variable u create
as long as u multiply and divide correctly
Ogundele Olumide
@Lumexralph
Nov 09 2016 11:32
@hricha05 to the parameter and assign the result to fahrenheit, then you return fahrenheit
Harun Richards
@hricha05
Nov 09 2016 11:32
@Dorcy-ndg3 @Lumexralph i have this so far var celsius = 30 * 9/5 + 32;
Ogundele Olumide
@Lumexralph
Nov 09 2016 11:32
@hricha05 it should be fahrenheit = c * 9/5 + 32
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 11:33
but now 30 is a random number so it will return an answer of celsius as 30 only
Ogundele Olumide
@Lumexralph
Nov 09 2016 11:33
hope you understand? celsius is the parameter from the function
Harun Richards
@hricha05
Nov 09 2016 11:33
@Lumexralph @Dorcy-ndg3 ok yeah i understand that now thanks guys
CamperBot
@camperbot
Nov 09 2016 11:33
hricha05 sends brownie points to @lumexralph and @dorcy-ndg3 :sparkles: :thumbsup: :sparkles:
:cookie: 323 | @dorcy-ndg3 |http://www.freecodecamp.com/dorcy-ndg3
:cookie: 424 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Nov 09 2016 11:34
@hricha05 :+1:
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 11:34
use the value in ur parameter to multiply and divide
Ghulam Shabir
@ghulamshabir
Nov 09 2016 11:35
@hricha05 c is for celsius value which you have in celsius parameter, so you will have to use celsiusin place c
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 11:41
hey i want to know in this code what makes str a string coz wen i commented out the line of code with .split the code passed the test and when i tried to remove .join at the end it printed an array to the console yet i commented out split
function rot13(str) {
 // an array where we are going to push new results
  var converted =[];
 // turn the string into an array
  converted = str.split('');
  // create a loop 
  for (var i=0; i<str.length; i++){
    //get the charcode of each letter 
    var code = str.charCodeAt(i);
    //increase by 13 for all letters upto the point of M
    if(code>=65 && code<=77){
      code += 13;
    }
    else if(code>=78 && code<=90){
      code -=13;
    }
    //turn code back to letters and push it to converted
     converted.push(String.fromCharCode(code));
  }
  //turn the array buck to a string and return it
  return converted.join('');

}
Mapamatician
@Mapamatician
Nov 09 2016 11:46
how can I get value of <span class="myClass" value="10">Hello</span> with jQuery?
.innerText = Hello
.className = myClass
value ??
Markus Kiili
@Masd925
Nov 09 2016 11:47
@Dorcy-ndg3 You don't need the split because you loop str characters there using the index i.
Mapamatician
@Mapamatician
Nov 09 2016 11:47
.value, .value(), .val, .val() not working
Markus Kiili
@Masd925
Nov 09 2016 11:47
Split is useful if you plan to use array methods like .map().
@Mapamatician .text()
Yuliya
@YuliaMas
Nov 09 2016 11:49
@JohnnyBizzel :smile:
Mapamatician
@Mapamatician
Nov 09 2016 11:49
nope
Markus Kiili
@Masd925
Nov 09 2016 11:50
@Mapamatician .attr("value")
Mapamatician
@Mapamatician
Nov 09 2016 11:51
nope ;[
Markus Kiili
@Masd925
Nov 09 2016 11:52
@Mapamatician What were you trying to get there?
Mapamatician
@Mapamatician
Nov 09 2016 11:52
just an integer
i can move it to between the brackets and call .innerText or innerHTML i guess
actually I can't , i have key and value in the innerText. I want to access value independently
Markus Kiili
@Masd925
Nov 09 2016 11:53
@Mapamatician .attr()should get the value of an attribute.
Mapamatician
@Mapamatician
Nov 09 2016 11:54
i have a div id="monthlyvalues", then I loop through my values and create a span for each row. I want to access the span elements so I can create a chart of monthly values
    var divs = $('#monthvalueid').children();

    for (i=0; i < divs.length; i++) {
        // monthlyDataValues.push(divs[i].innerText);
        // monthlyDataValues.push([divs[i].className]);
        console.log(divs[i].attr('value'));
    }
    // console.log(monthlyDataValues);
i can console.log(divs[i].innterText); and .className, so .attr('value') should work the same but its throwing an error
i am getting TypeError: divs[i].attr is not a function
Markus Kiili
@Masd925
Nov 09 2016 12:00
@Mapamatician I believe that an element of the children collection is not a jquery object. it is just a dom element.
Use .getAttribute()
Or wrap it first to a jquery object.
Mapamatician
@Mapamatician
Nov 09 2016 12:01
thanks @Masd925 console.log(spans[i].getAttribute('value')); worked
CamperBot
@camperbot
Nov 09 2016 12:01
mapamatician sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2861 | @masd925 |http://www.freecodecamp.com/masd925
Mapamatician
@Mapamatician
Nov 09 2016 12:03
1 more question ... as I loop through the array, how can I create array = [ "key": value, ...] ?
var monthlyDataValues = [];

function extractDataMonths() {

    // each span is inside a div = monthvalueid
    var spans = $('#monthvalueid').children();

    for (i=0; i < spans.length; i++) {
        monthlyDataValues.push(spans[i].className);
        console.log(spans[i].getAttribute('value'));
    }
    console.log(monthlyDataValues);
I want monthlyDataValues = ["date": value, "date": value...]
date = className
value = value
Mukul
@mukulramchandani
Nov 09 2016 12:04
@ghulamshabir thanks a lot .. it got executed.
CamperBot
@camperbot
Nov 09 2016 12:04
mukulcode sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
:cookie: 927 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
Mapamatician
@Mapamatician
Nov 09 2016 12:05
something like
for...() {
    monthlyDataValues[spans[i].className] = spans[i].getAttribute('value);
}
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 12:05
so i want tho thank the following who helped me with the ceaser cipher challenge
@Masd925 @ghulamshabir @heroiczero
CamperBot
@camperbot
Nov 09 2016 12:05
dorcy-ndg3 sends brownie points to @masd925 and @ghulamshabir and @heroiczero :sparkles: :thumbsup: :sparkles:
:cookie: 928 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
:cookie: 367 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 2862 | @masd925 |http://www.freecodecamp.com/masd925
D O R C ¥
@Dorcy-ndg3
Nov 09 2016 12:06
@Masd925 wic index would i have to provide inorder to use split without an issue
Markus Kiili
@Masd925
Nov 09 2016 12:08
@Dorcy-ndg3 If you split into an array of characters, you could use .map() method to map the characters.
Mapamatician
@Mapamatician
Nov 09 2016 12:09
can someone help me dynamically create key: value pair plz
for (i=0; i < spans.length; i++) {
monthlyDataValues[spans[i].className] = spans[i].getAttribute('value');
}
i was using monthlyvalues = [], changed to {} :smile:
Tolga Dur
@tolgadur
Nov 09 2016 12:12
what's wrong with my code? var Bike = function() {
var gear = 0;
// Only change code below this line.
this.setGear = function(xy){
gear += xy;
};
this.getGear = function(){
return gear;
};
};
Mapamatician
@Mapamatician
Nov 09 2016 12:15
can you put it between x3 ` top and bottom plz
code
Piotr
@PiotrSzablewski
Nov 09 2016 12:16
@tolgadur i should look somathin like that var Bike = function() {
var gear = 6;
this.setGear = (change)=> gear = change;
this.getGear = ()=> gear;
};
Tolga Dur
@tolgadur
Nov 09 2016 12:18
@PiotrSzablewski thanks!
CamperBot
@camperbot
Nov 09 2016 12:18
tolgadur sends brownie points to @piotrszablewski :sparkles: :thumbsup: :sparkles:
:cookie: 237 | @piotrszablewski |http://www.freecodecamp.com/piotrszablewski
Stephen James
@sjames1958gm
Nov 09 2016 12:19
@tolgadur The key is you are supposed to set gear value not add to it.
Dmytro
@lomm28
Nov 09 2016 12:20
Hi There! I cannot understand what I need to do in this challenge: https://www.freecodecamp.com/challenges/smallest-common-multiple I may sound stupid but I just cannot figure it out. I read the article about Smallest Common Multiples but the task is not clear. Any hints?)
Diego Mayer
@Chrono79
Nov 09 2016 12:21
@lomm28 you have to find the smallest common multiple of a range of numbers, lets say, if they gave you [1,5], 1, 2, 3, 4, 5, the smallest common multiple is 60
Dmytro
@lomm28
Nov 09 2016 12:23
@Chrono79 does it mean that 60 is the smallest common multiple for all 5 numbers: 1,2,3,4 and 5?
Diego Mayer
@Chrono79
Nov 09 2016 12:23
that's right
Dario Costanzo
@dariocostanzo
Nov 09 2016 12:23
hi
Ogundele Olumide
@Lumexralph
Nov 09 2016 12:24
@dariocostanzo hey!
Dario Costanzo
@dariocostanzo
Nov 09 2016 12:24
is there anyone who could kindly help me with Record Collection?
Ogundele Olumide
@Lumexralph
Nov 09 2016 12:24
@dariocostanzo what do you need help with?
Dario Costanzo
@dariocostanzo
Nov 09 2016 12:25
what's wrong here?

function updateRecords(id, prop, value) {
if (prop!=="tracks" && collection.hasOwnProperty(value)!==true){
collection[id][prop]=value;
} else if (prop==="tracks" && collection.hasOwnProperty(tracks)===false) {
collection[id][prop]=[];
} else if (prop==="tracks" && collection.hasOwnProperty(value)!==true){
collection[id][prop].push(value);
} else if (value===""){
delete collection[id][prop];
}

return collection;

}

Dmytro
@lomm28
Nov 09 2016 12:25
@Chrono79 thanks a lot, my friend) will see what I can do with it
CamperBot
@camperbot
Nov 09 2016 12:25
lomm28 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2469 | @chrono79 |http://www.freecodecamp.com/chrono79
Dario Costanzo
@dariocostanzo
Nov 09 2016 12:25
I can't figured it out
Diego Mayer
@Chrono79
Nov 09 2016 12:26
@dariocostanzo collection.hasOwnProperty(value) this is wrong
collection.hasOwnProperty(tracks) this is also wrong
and you have to test that value isn't "" in every if (except the last), or reorder your ifs
Note that when you create tracks as an empty array, you still need to add the value
Dario Costanzo
@dariocostanzo
Nov 09 2016 12:27
value !== ""
Blauelf
@Blauelf
Nov 09 2016 12:29

@dariocostanzo First, value does not hold a property name (prop does, and also "tracks" is one!). Then, ===false and !==true applied to a boolean are the same. Also, not collection has properties like "tracks", but collection[id].

And listen to @Chrono79 ;)

Stephen James
@sjames1958gm
Nov 09 2016 12:30
@dariocostanzo If you put the check for value === "" first then you will not have to check value !== "" after that (in the else ifs)
Jenky W. Nolasco
@jenkynolasco11
Nov 09 2016 12:30
Hola mundo o/
Dario Costanzo
@dariocostanzo
Nov 09 2016 12:31
thanks guys, I am trying to fix it and I wll get u back
Patkaa
@Patkaa
Nov 09 2016 12:33
card game

var count = 0;

function cc(card) {
  // Only change code below this line
  switch (card) {
    case "2":
    case "3": 
    case "4":
    case "5": 
    case "6": 
      count=count+1; 
      break; 
    case "7": 
    case "8":
    case "9":
      count=count+0; 
      break; 
    case "10":
    case "J":
    case "Q":
    case "K":
    case "A": 
      count--; 
    break; 
      default : 
        console.log(undefined); 


              }

  return card;
  // 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');
why doesn't it work? :/
i gotta define variables?
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 12:34
your not returning anything?
Patkaa
@Patkaa
Nov 09 2016 12:34
return count ?
Jeff Shapiro
@Jeff-Shapiro
Nov 09 2016 12:35
@Patkaa mind the language please.
Read the requirements of the challenge
Patkaa
@Patkaa
Nov 09 2016 12:35
@Jeff-Shapiro Sorry:( I'll try once more ;)
Blauelf
@Blauelf
Nov 09 2016 12:36
@Patkaa Return count and either Bet or Hold, depending on the value of count, and don't forget that the final string should have a space between the number and Bet/Hold.
Ogundele Olumide
@Lumexralph
Nov 09 2016 12:36
@Patkaa you're to return count + string
Patkaa
@Patkaa
Nov 09 2016 12:38
  // Only change code below this line
  switch (card) {
    case "2":
    case "3": 
    case "4":
    case "5": 
    case "6": 
      count=count+1; 
      break; 
    case "7": 
    case "8":
    case "9":
      count=count+0; 
      break; 
    case "10":
    case "J":
    case "Q":
    case "K":
    case "A": 
      count--; 
    break; 
      default : 
        console.log(undefined); 

    }
    if (count>0){
      return count + " Bet"; 
    }
  else {
    return count + " Hold";
  }
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
wait
  if (count>0){
      return +  count + " Bet"; 
    }
  else {
    return +  count + " Hold";
  }
bahaa aldin
@bahaa-al-deen
Nov 09 2016 12:38
stuck at
Patkaa
@Patkaa
Nov 09 2016 12:39
doesn't work tho
Ogundele Olumide
@Lumexralph
Nov 09 2016 12:39
@Patkaa return is a keyword
@Patkaa it returns the value you want you don't use it like a string or you use it to give out a result
@Patkaa return count + string;
Patkaa
@Patkaa
Nov 09 2016 12:41
  if (count>0){
      return count + " Bet"; 
    }
  else {
    return count + " Hold";