These are chat archives for FreeCodeCamp/Help

16th
Aug 2015
Cody Bouscaren
@codybousc
Aug 16 2015 00:00
hi all, i was wondering if i could get some help on bonfire #35. what i have so far is definitely not doing what i'd like it to!
function steamroller(arr) {
    var merged = [];
    for (var i = 0; i < arr.length; i++)
        if (Array.isArray(arr[i]) === false) {
            merged.push(arr[i]); 
        }
        else if (Array.isArray(arr[i]) === true) {
            console.log("WTF " + merged.concat.apply(merged, arr[i])); 
            merged.concat.apply(merged, arr[i]); 
        }

    return merged;
}

console.log(steamroller([1, [2], [3, [[4]]]]));
it outputs 1
but the console.log in the else if conditional actually prints out what i need
Jakob Dahl
@saadanerdetbare
Aug 16 2015 00:07
@codybousc the problem with concat.apply() is that it only takes you one level down. Try take a look here http://stackoverflow.com/questions/10865025/merge-flatten-an-array-of-arrays-in-javascript theres some good answers
Will Cenk
@WillCenk
Aug 16 2015 00:08
Can someone help me with the "Find the Longest Word in a String" bonfire? Here's what I have so far:
function findLongestWord(str) {
  str = str.split(" ")
  for (var i=0, i < str.length, i++) {
    if (str.length < str[i].length) {
      str = string[i];
    }
  }
  return str.length;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
CamperBot
@camperbot
Aug 16 2015 00:08
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Jakob Dahl
@saadanerdetbare
Aug 16 2015 00:13
@WillCenk you are on the way to trouble when you are changing the str variable and using str.length as a condition in the loop. I would introduce a result variable and declare it with a value of 0 in the top before the loop
Cody Bouscaren
@codybousc
Aug 16 2015 00:13
@saadanerdetbare that's where i found the concat.apply() ;)
Jakob Dahl
@saadanerdetbare
Aug 16 2015 00:14
@codybousc try to go down the page a bit, theres an answer that got 26 points
Nic Galluzzo
@ngalluzzo
Aug 16 2015 00:15

question about friendly date ranges…

assert.deepEqual(friendly(['2015-12-01', '2016-02-03']), ['December 1st','February 3rd'], 'one month apart can be inferred it is the next year');

that is not one month apart, so what’s the criteria there?

Martin Morissette
@studur
Aug 16 2015 00:15
Hi I would need a little bit of help with Bonfire Where art thou please ?
Will Cenk
@WillCenk
Aug 16 2015 00:16
@saadanerdetbare I've found some solutions to similar problems on Google, but I can't seem to apply them; am I any closer with this?
function findLongestWord(str) {
  string = str.split(" ")
  result = 0
  for (var i=0, i < string.length, i++) {
    if (result < string[i].length) {
      result = string[i];
    }
  }
  return result.length;
}
Jakob Dahl
@saadanerdetbare
Aug 16 2015 00:17
@WillCenk much closer, just return result, not result.length
and result = string[i].length;
Will Cenk
@WillCenk
Aug 16 2015 00:18
I figured I wasn't supposed to change the "return str.length" part.
function findLongestWord(str) {
  string = str.split(" ")
  result = 0
  for (var i=0, i < string.length, i++) {
    if (result < string[i].length) {
      result = string[i].length;
    }
  }
  return result;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
Cody Bouscaren
@codybousc
Aug 16 2015 00:19
@saadanerdetbare that one definitely works, though i have no clue why...
Young Lee
@young92117
Aug 16 2015 00:19
@WillCenk You are on right track.. I solved this problem last night used similar strategy
Will Cenk
@WillCenk
Aug 16 2015 00:19
I got it!
My remaining errors were silly things like using commas instead of semicolons in the "for" loop.
Jakob Dahl
@saadanerdetbare
Aug 16 2015 00:21
@codybousc sit down and take a look at the code, then change the variable names. It uses a lot of nice tricks and hits the array recursively
Will Cenk
@WillCenk
Aug 16 2015 00:21
For the past few weeks I've been working through the Rice University Coursera course on Python since the bonfires made me feel stupid.
DJ Nixon
@tGxcoder
Aug 16 2015 00:21

im supposed to make h2 red with !important. where do i place it? ```<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>

<style>
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}

</style>

<h2 class='blue-text urgently-red'>CatPhotoApp</h2>

<p class='red-text'>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

<p class='red-text'>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
```

Samuel Hunter
@MathManiac0
Aug 16 2015 00:21
Hello World
CamperBot
@camperbot
Aug 16 2015 00:21

welcome to FreeCodeCamp @MathManiac0!

Will Cenk
@WillCenk
Aug 16 2015 00:22
Thanks much @saadanerdetbare
CamperBot
@camperbot
Aug 16 2015 00:22
willcenk sends brownie points to @saadanerdetbare :sparkles: :thumbsup: :sparkles:
api offline
Jakob Dahl
@saadanerdetbare
Aug 16 2015 00:22
yw
DJ Nixon
@tGxcoder
Aug 16 2015 00:22

```<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>

<style>
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}

</style>

<h2 class='blue-text urgently-red'>CatPhotoApp</h2>

<p class='red-text'>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

<p class='red-text'>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
```

```<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>

<style>
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}

</style>

<h2 class='blue-text urgently-red'>CatPhotoApp</h2>

<p class='red-text'>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

<p class='red-text'>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
```

im supposed to make h2 red with !important . where do i place it?
Jakob Dahl
@saadanerdetbare
Aug 16 2015 00:24
@tGxcoder it goes last like this
.red-text {
color: red !important;
}
DJ Nixon
@tGxcoder
Aug 16 2015 00:26
@saadanerdetbare thanks.
CamperBot
@camperbot
Aug 16 2015 00:26
tgxcoder sends brownie points to @saadanerdetbare :sparkles: :thumbsup: :sparkles:
api offline
DJ Nixon
@tGxcoder
Aug 16 2015 00:27
how would i make h2 show up red while leaving blue text in the inline
Cody Bouscaren
@codybousc
Aug 16 2015 00:28
@saadanerdetbare will do! thank ya
CamperBot
@camperbot
Aug 16 2015 00:28
codybousc sends brownie points to @saadanerdetbare :sparkles: :thumbsup: :sparkles:
api offline
Jakob Dahl
@saadanerdetbare
Aug 16 2015 00:28
h2 {
color: red !important;
}
@codybousc yw
DJ Nixon
@tGxcoder
Aug 16 2015 00:31
@saadanerdetbare thanks again. that was the final piece
CamperBot
@camperbot
Aug 16 2015 00:31
tgxcoder sends brownie points to @saadanerdetbare :sparkles: :thumbsup: :sparkles:
api offline
Robin
@grobin1
Aug 16 2015 00:48
Hi guys! I need a little assistance in the HTML/CSS section if anyone is willing. I'm stuck on the part where I have to create a a gray background class and assign it to my div element. I added the following to my <style> section in an attempt to create the class: .gray-background { background color: gray} and that is where I'm stuck. I'm not sure what to do at this point to link it to the div element and make the gray background actually show up. I have tried a couple things and it's not working. At this point I'm not even sure I did the class part right. I don't even know if what I just said makes sense. I hope it does. :smile:
SojournerOctocat
@SojournerOctocat
Aug 16 2015 00:49
@grobin1 What's the link/URL?
Robin
@grobin1
Aug 16 2015 00:51
I didnt realize we could even link things.
blob
SojournerOctocat
@SojournerOctocat
Aug 16 2015 00:51
@grobin1 What's the website address for the waypoint you're working on?
help format
CamperBot
@camperbot
Aug 16 2015 00:52

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks, then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

SojournerOctocat
@SojournerOctocat
Aug 16 2015 00:52
@grobin1 ^^^
Robin
@grobin1
Aug 16 2015 00:52
I am so confused. Should I not have done that?
SojournerOctocat
@SojournerOctocat
Aug 16 2015 00:53
It's alright, but for future reference, paste your code in the chat window (using the formatting tips above) instead of screenshots.
Robin
@grobin1
Aug 16 2015 00:53
If i post the link will it show you where I'm at? I'll try it but I have a feeling I'm lost.
Ok I will. Sorry! I'm new.
SojournerOctocat
@SojournerOctocat
Aug 16 2015 00:53
The link will tell me which waypoint you're working on.
@grobin1 you only need to write a - instead of an empty space between background color
Harshal
@McQuinTrix
Aug 16 2015 00:56
@grobin1 you here ?
background-color
write like this
SojournerOctocat
@SojournerOctocat
Aug 16 2015 00:57
@grobin1 In your style section, change {background color: gray;} to {background-color: gray;}
Mohamed A. Farouk
@captainmoha
Aug 16 2015 00:57
yes @McQuinTrix
Robin
@grobin1
Aug 16 2015 00:57
Hi. Yes. Just looking at the link that captainmoha just posted
Harshal
@McQuinTrix
Aug 16 2015 00:57
@captainmoha you know about localStorage .. man .. in angularjs ?:(
Robin
@grobin1
Aug 16 2015 00:57
that was it??? oh man...
Harshal
@McQuinTrix
Aug 16 2015 00:57
ahhah
somemistakes are very trivial)
Robin
@grobin1
Aug 16 2015 00:58
Haha that's crazy! Thanks so much!
Mohamed A. Farouk
@captainmoha
Aug 16 2015 00:58
@McQuinTrix I'm still a beginner in javascript :smile:
Harshal
@McQuinTrix
Aug 16 2015 00:58
thats how you lesrn actually (: @grobin1
@captainmoha aaaa ok ((
SojournerOctocat
@SojournerOctocat
Aug 16 2015 00:58
You're welcome
Robin
@grobin1
Aug 16 2015 01:01
Just one little - and onto the next task. Just like that. After like 30 minutes of struggle. Does one start to notice and remember these things after a certain point? I sure hope so.
Luis Felipe López G.
@luishendrix92
Aug 16 2015 01:02
@grobin1 The more one struggles, the more one remembers. But only if you understood what you did and why it worked.
Hans van Riet
@hansinla
Aug 16 2015 01:03
Anybody on TicTacToe? I’ve got a question concerning game logic.
Robin
@grobin1
Aug 16 2015 01:03
If that's the case then I'm in luck!
Mohamed A. Farouk
@captainmoha
Aug 16 2015 01:03
@grobin1 Yes it will all get easier with practice and you will start to have an instinct.
Robin
@grobin1
Aug 16 2015 01:05
Awesome!
Mahtab
@RoadToCode822
Aug 16 2015 01:11
Is it bad that one hasn’t been able to solve the first 8 bonfires in his first try?
Mohamed A. Farouk
@captainmoha
Aug 16 2015 01:12
alt
Guys, save a copy your code on your pc just in case.
until this ends.
Donavin Northrup
@dnorthrupva
Aug 16 2015 01:13
If you use .split() on a string, with no parameters, it forms the ‘string’ inside of the array into a sub-array for each character, right?
Mohamed A. Farouk
@captainmoha
Aug 16 2015 01:14
@RoadToCode822 No it's perfectly normal. Getting it right from the first time doesn't really matter. What matters is that you get it and that you don't give up :smile:
Mahtab
@RoadToCode822
Aug 16 2015 01:14
Thanks @captainmoha
CamperBot
@camperbot
Aug 16 2015 01:14
roadtocode822 sends brownie points to @captainmoha :sparkles: :thumbsup: :sparkles:
api offline
Young Lee
@young92117
Aug 16 2015 01:18
@captainmoha Thanks for head up!!
CamperBot
@camperbot
Aug 16 2015 01:18
api offline
young92117 sends brownie points to @captainmoha :sparkles: :thumbsup: :sparkles:
Will Cenk
@WillCenk
Aug 16 2015 01:23
since this chat seems to be more populated than BonfireHelp, I'll ask here again too: Any hints or tips for this one? Return Largest Numbers in Array.
function largestOfFour(arr) {
  largest = 0;
  newArray = [];
  for (var i=0; i < arr.length; i++) {
    if (arr[i] > largest) {
      largest = arr[i];
    }
    newArray.push(largest);
  }

  return newArray;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
SojournerOctocat
@SojournerOctocat
Aug 16 2015 01:27
@WillCenk I used Math.max to find the largest numbers in the arrays.
Mohamed A. Farouk
@captainmoha
Aug 16 2015 01:28
@WillCenk you just need to declare your variables
Will Cenk
@WillCenk
Aug 16 2015 01:28
Whoops, been doing a Python course for the past few weeks...
Mohamed A. Farouk
@captainmoha
Aug 16 2015 01:29
@WillCenk I know that feeling :smile:
@WillCenk I started out with Python too.
Rasheed Bustamam
@abustamam
Aug 16 2015 01:30
I'm trying to start on the basejumps but I'm running into a peculiar error... http://i.imgur.com/gOEZRhs.png
I can't find any documentation on the Project testing (most yeoman tutorials don't even have the testing question) but it fails whether or not i choose jasmine or chai
Jason Martinez
@snwyvern
Aug 16 2015 01:31

I'm sure this is easy-peasy: What's wrong with this picture?

var orangeCost = function(cost) {
var price = function(5 * cost) {
console.log(price);
};
};
orangeCost 5

Will Cenk
@WillCenk
Aug 16 2015 01:32
I figured I'd give the bonfires another shot since I'm getting a little better at programming from the Rice University Python course on Coursera, which holds your hand a bit less than Codecademy's Javascript lessons. Perhaps I should pick a first language and stick with it, but instead, I'm just doing whatever I can with free resources. I may sign up for FirehoseProject at some point, and end up abandoning both to learn Ruby.
Mohamed A. Farouk
@captainmoha
Aug 16 2015 01:37
@WillCenk I took part one of Rice Univeristy's Python too. It's so much fun but can be quite challenging sometimes.
SojournerOctocat
@SojournerOctocat
Aug 16 2015 01:37
@snwyvern You never define cost. That looks like a recursion statement with no end.
Mohamed A. Farouk
@captainmoha
Aug 16 2015 01:38
@WillCenk By the way in your code keep in mind that the input is an array of arrays.
Jason Martinez
@snwyvern
Aug 16 2015 01:38
@SojournerOctocat Thank you.
CamperBot
@camperbot
Aug 16 2015 01:38
snwyvern sends brownie points to @sojourneroctocat :sparkles: :thumbsup: :sparkles:
api offline
Will Cenk
@WillCenk
Aug 16 2015 01:39
@captainmoha Yes, every resource I've come across is just a bit too challenging to go through without help, the Python course included. But if I can find the solution through Google and then understand how the code works, I'm still learning something.
@captainmoha I know it's an array of arrays, but I can't figure out how to access individual components of the sub-arrays.
Donavin Northrup
@dnorthrupva
Aug 16 2015 01:40
Anyone able to elaborate what .split does, since I keep hearing different things?
Mohamed A. Farouk
@captainmoha
Aug 16 2015 01:41
@WillCenk Just like you did with the bigger one with loop. So you need another loop.
Donavin Northrup
@dnorthrupva
Aug 16 2015 01:42
Yea, I did. I read it, W3C, and StackOverflow. According to all three my code -should- work, but it isn’t in the system (It is in Console Log, though)
Mohamed A. Farouk
@captainmoha
Aug 16 2015 01:43
@dnorthrupva can you paste your code ?
Will Cenk
@WillCenk
Aug 16 2015 01:43
@captainmoha That makes sense. I wish I had some idea of what that looks like.
Donavin Northrup
@dnorthrupva
Aug 16 2015 01:43
It’s really simple.
function reverseString(str) {
  str.split("").reverse().join('');
}

reverseString('hello');
I added the function reverseString(str) to try to make the requirements happy. Normally i would do
‘whatever string’.split(“”).reverse().join(‘’);
Mohamed A. Farouk
@captainmoha
Aug 16 2015 01:44
@WillCenk A nested loop (a loop inside the your current loop with a new iterator let's call it j).
Donavin Northrup
@dnorthrupva
Aug 16 2015 01:44
I’ve passed all the bonfires before, but I’m trying to pass them using the recommended methods, since I struggle with JS.
Will Cenk
@WillCenk
Aug 16 2015 01:45
@captainmoha Another for loop? Okay, I'll look.
@dnorthrupva I think you're just missing the word "return"
Jason Martinez
@snwyvern
Aug 16 2015 01:45

Zomg. What about this?

var orangeCost = function(this *5){
console.log(this)
}
orangeCost 5

Donavin Northrup
@dnorthrupva
Aug 16 2015 01:46
@WillCenk Adding return made me return a string to meet the 1 requirement, but it says nothing is being reversed. I wonder what I’m doing wrong...
Calling a blank .split should split the string into seperate character arrays, if I don’t put a modifer (I didn’t.). Then .reverse should flip the array. Then join should join it back together, right?
Will Cenk
@WillCenk
Aug 16 2015 01:47
@dnorthrupva My code is identical to yours for that one, except the word "return" comes before str.split("........etc.
Donavin Northrup
@dnorthrupva
Aug 16 2015 01:48
Ahh, I put it below. Let me try before.
omg @WillCenk You’re right. Wow, I was feeling like an idiot all over return.
Mohamed A. Farouk
@captainmoha
Aug 16 2015 01:49
@snwyvern try pasting your code using the format
three of these then your code then another three of
`
SojournerOctocat
@SojournerOctocat
Aug 16 2015 01:50
help format
CamperBot
@camperbot
Aug 16 2015 01:50

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks, then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Jason Martinez
@snwyvern
Aug 16 2015 01:51
//var orangeCost = function(price *5) {
//    var price = function(orangeCost * cost) {
//        console.log(price);
//    };};
Meh.
I thought I could get away with
var orangeCost = orangeCost * 5 {
console.log(this);
};
Jason Martinez
@snwyvern
Aug 16 2015 02:02
Or... this, also not working.:
var orangeCost = function(){
    var cost = orangeCost *5;
    console.log(cost);
}
orangeCost 5
Latest.
SojournerOctocat
@SojournerOctocat
Aug 16 2015 02:06
@snwyvern What are you trying to do?
Mohamed A. Farouk
@captainmoha
Aug 16 2015 02:08
@snwyvern there are a few things to note. your orangeCost function needs to have an argument because you wanna give it something so that it would give you back the result. So you take that argument and multiply it by 5 and save that in a variable and then print it. Lastly your function call int he last line needs to be like this functionname(argument);
I started a shared session here.
I can try to help you.
This is site is good for visualizing and debugging code
Jason Martinez
@snwyvern
Aug 16 2015 02:10
The lesson is to use a function with the name "orangeCost" to multiply the argument by five, and return that on the console.
Felipe Rodrigues
@feliperdius
Aug 16 2015 02:10
@WillCenk you should use multidimensional arrays
SojournerOctocat
@SojournerOctocat
Aug 16 2015 02:14
bf binary
CamperBot
@camperbot
Aug 16 2015 02:14

:fire:Bonfire: Binary Agents :link:

function binaryAgent(str) {
  return str;
}

binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111');

Return an English translated sentence of the passed binary string.

more info:  bf details | bf links | hint

SojournerOctocat
@SojournerOctocat
Aug 16 2015 02:14
bf details
CamperBot
@camperbot
Aug 16 2015 02:14

:fire:Bonfire: Binary Agents :link:

function binaryAgent(str) {
  return str;
}

binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111');
Return an English translated sentence of the passed binary string.
The binary string will be space separated.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
SojournerOctocat
@SojournerOctocat
Aug 16 2015 02:16
bf hint
CamperBot
@camperbot
Aug 16 2015 02:16
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Jason Martinez
@snwyvern
Aug 16 2015 02:21
@captainmoha Thanks!
CamperBot
@camperbot
Aug 16 2015 02:21
snwyvern sends brownie points to @captainmoha :sparkles: :thumbsup: :sparkles:
api offline
Mohamed A. Farouk
@captainmoha
Aug 16 2015 02:22
@snwyvern Anytime :smile:
Ramses
@ram535
Aug 16 2015 02:27
how can do a navegation bar for a webpage but keep it the same for all pages so I don't have to do it manualy page by page
is there a way to do it javascript?
Giorgio
@gDelgado14
Aug 16 2015 02:28
@ram535 u mean having template navigation HTML that is then pasted on each file that requires that template?
@ram535 u will need a framework like AngularJs or Ember or Meteor
Ramses
@ram535
Aug 16 2015 02:29
yes
Giorgio
@gDelgado14
Aug 16 2015 02:29
@ram535 look into one of those three ... they vary significantly, but they are all Javascript frameworks
all developed in order to create web applications that scale
@ram535 estoy asumiendo q hablas españl
Ramses
@ram535
Aug 16 2015 02:30
si jaja
tan mal ingles tengo
Giorgio
@gDelgado14
Aug 16 2015 02:31
yo hablo los dos bien asi q podemos hablar en esp si quieres
Ramses
@ram535
Aug 16 2015 02:31
no hay un estandar para lograr eso?
Giorgio
@gDelgado14
Aug 16 2015 02:31
agregame aqui o en screenhero y podemos hablar desps pero ahorita me voy a dormir
para lograr lo del template?
Ramses
@ram535
Aug 16 2015 02:32
como te agrego?
Giorgio
@gDelgado14
Aug 16 2015 02:32
hay muchisimas maneras diferentes para lograr lo que quieres hacer ... tambien jQuery te lo puede hacer facilmente
Ramses
@ram535
Aug 16 2015 02:32
segun yo screenhero ya no existe?
SojournerOctocat
@SojournerOctocat
Aug 16 2015 02:33
How do I convert binary strings? Where can i find information on that?
Angel Sanchez
@ASanchez26
Aug 16 2015 02:33
parseInt() is a fun resource for that
SM
@nogo10
Aug 16 2015 02:51
How do I turn off those annoying 'new chat' popups on the Gitter left pane???
Felipe Rodrigues
@feliperdius
Aug 16 2015 02:56
someone speak portuguese?
Juan Martínez
@jbmartinez
Aug 16 2015 02:57
@feliperdius I speak a little portuguese
Felipe Rodrigues
@feliperdius
Aug 16 2015 02:57
@nogo10 click on "tools" upper-right and "notifications" -> "turn off"
@jbmartinez wow, r u from?
Juan Martínez
@jbmartinez
Aug 16 2015 02:59
@feliperdius I'm from Venezuela
Felipe Rodrigues
@feliperdius
Aug 16 2015 02:59
@jbmartinez ow, nice! ;)
Kolloom
@Kolloom
Aug 16 2015 03:07
bf sum all
CamperBot
@camperbot
Aug 16 2015 03:07

:fire:Bonfire: Sum All Numbers in a Range :link:

function sumAll(arr) {
  return(1);
}

sumAll([1, 4]);

We'll pass you an array of two numbers. Return the sum of those two numbers and all numbers between them.

more info:  bf details | bf links | hint

Kolloom
@Kolloom
Aug 16 2015 03:07
bf sum all odd
CamperBot
@camperbot
Aug 16 2015 03:07

:fire:Bonfire: Sum All Odd Fibonacci Numbers :link:

function sumFibs(num) {
  return num;
}

sumFibs(4);

Return the sum of all odd Fibonacci numbers up to and including the passed number if it is a Fibonacci number.

more info:  bf details | bf links | hint

Nguyen Dang Quang
@quangnd
Aug 16 2015 03:19
anyone's learning Manage Package with NPM ?
Okay, so how do you link a bonfire in here like above? i can't figure that out.
Rafael J. Rodriguez
@Rafase282
Aug 16 2015 03:22
bf where
CamperBot
@camperbot
Aug 16 2015 03:22

:fire:Bonfire: Where art thou :link:

function where(collection, source) {
  var arr = [];
  // What's in a name?
  return arr;
}

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

Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument).

more info:  bf details | bf links | hint

Rafael J. Rodriguez
@Rafase282
Aug 16 2015 03:22
like that?
bf details
CamperBot
@camperbot
Aug 16 2015 03:22

:fire:Bonfire: Where art thou :link:

function where(collection, source) {
  var arr = [];
  // What's in a name?
  return arr;
}

where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });
Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument).
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
jameswlytle
@jameswlytle
Aug 16 2015 03:22
yes.
Rafael J. Rodriguez
@Rafase282
Aug 16 2015 03:23
bf then a name
CamperBot
@camperbot
Aug 16 2015 03:23
Sorry, can't find a bonfire called then a name. [ Check the map? ]
jameswlytle
@jameswlytle
Aug 16 2015 03:23
ah! that makes sense! thanks!
Rafael J. Rodriguez
@Rafase282
Aug 16 2015 03:24
no problem
jameswlytle
@jameswlytle
Aug 16 2015 03:24
i am stuck on the Where Art Thou bonfire. I think I am kind of close, but having issues casting an object to an array. anyone have any suggestions?
i can paste code.
Rafael J. Rodriguez
@Rafase282
Aug 16 2015 03:24
Array[index] = obj
SojournerOctocat
@SojournerOctocat
Aug 16 2015 03:24
@jameswlytle paste code
Rafael J. Rodriguez
@Rafase282
Aug 16 2015 03:25
I need help with Validate US Telephone Numbers
not sure how to even start
that regex seems to be complicated
jameswlytle
@jameswlytle
Aug 16 2015 03:27
without [index] returns "[object Object]" and with [index] returns ["[object Object]"] neither of which seem to be acceptable. pasting code now.
function where(collection, source) {
  var arr = [];
  var propName = Object.getOwnPropertyNames(source);
  // What's in a name?

  for (var i = 0; i < collection.length; i++) {
    if (collection[i][propName] === source[propName]) {
      arr = collection[i].toString();
    }
  }
  return arr;
}
Kolloom
@Kolloom
Aug 16 2015 03:27
@Rafase282 here's an interactive regex tutorial http://regexone.com/ might take one or two hour to complete
Rafael J. Rodriguez
@Rafase282
Aug 16 2015 03:30
I'm familiar with that tutorial
Kolloom
@Kolloom
Aug 16 2015 03:30
@jameswlytle try just use arr = collection[i]instead
Rafael J. Rodriguez
@Rafase282
Aug 16 2015 03:30
but the numbers can be anywhere from 10 to 13 or 14 i think
so I have to check if the input is in the rage between 10 and 14
Kolloom
@Kolloom
Aug 16 2015 03:31
1 3 3 4 or 3 3 4
Rafael J. Rodriguez
@Rafase282
Aug 16 2015 03:31
then check for the formats
jameswlytle
@jameswlytle
Aug 16 2015 03:31
@Kolloom when i do that, the results seem to be almost correct, except that each string is surrounded by "", which appears to be again unacceptable to the solution.
Rafael J. Rodriguez
@Rafase282
Aug 16 2015 03:31
let me check that tutorial to see how i canget that part
Jelani Thompson
@JelaniThompson
Aug 16 2015 03:32
Hey there guys
So I was having a bit of an issue with some code I was writing
Was hoping you could help
jameswlytle
@jameswlytle
Aug 16 2015 03:32
@Kolloom {"first":"Tybalt","last":"Capulet"}
Jelani Thompson
@JelaniThompson
Aug 16 2015 03:32
So say I had this
var dictionary = {
  "gimme": "༼ つ ◕_◕ ༽つ",
  "umadbro": "¯\_(ツ)_/¯",
  "lenny": "( ͡° ͜ʖ ͡°)"
}
How would I be able to access the emoticon part of the object and print it directly to the screen?
Kolloom
@Kolloom
Aug 16 2015 03:33
@jameswlytle you only return 1 object
jameswlytle
@jameswlytle
Aug 16 2015 03:34
@Kolloom okay, so maybe i am mis-understanding what they are asking for. some of these problem statements are rather vague it seems to me.
Kolloom
@Kolloom
Aug 16 2015 03:35
Make a function that looks through a list (first argument) and returns an array of !!!all objects!!! that have equivalent property values (second argument).
@JelaniThompson use a for loop
var dictionary = {
  "gimme": "༼ つ ◕_◕ ༽つ",
  "umadbro": "¯\_(ツ)_/¯",
  "lenny": "( ͡° ͜ʖ ͡°)"
}

for (var index in dictionary) {
    console.log(dictionary[index]);
}
jameswlytle
@jameswlytle
Aug 16 2015 03:39
@Kolloom so to return the value, I need to set arr = collection[i][propName] correct? for the list of Shakespeare characters, there is only one that is equal, so I only have one to return.
@Kolloom I think I just realized, i am needing to return the first and last name, and I am only returning the first! duh!
@Kolloom qualification I need to return first name as element 0 of the array and last name as element 1, correct?
Kolloom
@Kolloom
Aug 16 2015 03:43
you are asked to return all the object whose prop matches the given argument
jameswlytle
@jameswlytle
Aug 16 2015 03:44
@Kolloom which means I am only returning first AND last name as one element, and i need to return first name as one element, and last name as a second, correct? rather than combine them.
Kolloom
@Kolloom
Aug 16 2015 03:45
where([{ first: 'Romeo', last: 'Montague' }, //first argument, objects inside an array
       { first: 'Mercutio', last: null }, 
       { first: 'Tybalt', last: 'Capulet' }], 
      { last: 'Capulet' }); //second argument, an object
you need to return the objects in the array whose last value is 'Capulet'
in this case you need to get the object { first: 'Tybalt', last: 'Capulet' }
see how the input is formatted where( [{object}, {object}, {object}], {object} )
jameswlytle
@jameswlytle
Aug 16 2015 03:53
@Kolloom i get how the input is formatted. the problem i have is it is expecting an array of objects for that scenario, and there is only one object to return, so the array is of size 1 object, which it is not accepting.
I can get it to return { 'first': 'Tybalt', 'last': 'Capulet' }. is that not correct for the output?
jameswlytle
@jameswlytle
Aug 16 2015 03:59
@Kolloom got it! needed to add a variable index on my arr. arr[index++] = collection[i];
Brett Guillory
@kurzninja
Aug 16 2015 04:08
music
CamperBot
@camperbot
Aug 16 2015 04:08
fateshaper
@fateshaper
Aug 16 2015 04:41
hi guys...I don't really understand one part of the functional programming waypoint, would appreciate if somebody could help me out here
  return newReleases.map(function(video) { return {id: video.id, title: video.title}; });
///take id & title from each object in newReleases, and push into a new array
//map function is as follows 
Array.prototype.map = function(lolcat) {
    var results = [];
    this.forEach(function(itemInArray) {
        results.push(lolcat(itemInArray));
    });

    return results;
};
i don't really understand how the code is accessing iteminArray via video
xxYETTERxx
@xxYETTERxx
Aug 16 2015 04:46
I'm having issues with Sorter Union, seems like its outputing the right answers when I add the test parameters but its failing the tests. Anyone willing to look at my code?
Luis Felipe López G.
@luishendrix92
Aug 16 2015 05:06
@fateshaper try reading this:
wiki js map
CamperBot
@camperbot
Aug 16 2015 05:06

:point_right: js map [wiki]

Array.prototype.map

The method map of the Array prototype allows you to grab a hold of each element inside an array and apply a function to them. After map finishes iterating through the array, it will return a new array with the results of applying the function to the aforementioned elements.

The syntax is as follows:

myAwesomeArray.map(myAwesomeFunction)

Since map doesn't mutate the original array, it should be used as a value, stored inside a variable, passed in as a returned value inside a function (the most common case) and many other things.
Let's learn a little bit what this powerful function can do! Say we have an array of names and we want to create a new array with these names but UPPERCASED.

var names = ["Leia", "Anakin", "Luke", "Obi Wan Kenobi"];
var uppercaseNames = names.map(function(name) {
  return name.toUpperCase();
};

Now if we console.log(uppercaseNames) we will get this:

Array(4) -> ["LEIA", "ANAKIN", "LUKE", "OBI WAN KENOBI"]

But how does it work? Let's dive in more into it.
:pencil: read more about js map on the FCC Wiki

Luis Felipe López G.
@luishendrix92
Aug 16 2015 05:06
but apply it for forEach, which doesn't return anything new, just grabs a hold of each element in the array
and allows you to work with it
the parameter in the function is just that element
fateshaper
@fateshaper
Aug 16 2015 05:08
@luishendrix92 alright , i'll try looking through it now. looked at callback functions at javascriptissexy and getting a bit of a clearer picture. thank you!
CamperBot
@camperbot
Aug 16 2015 05:08
fateshaper sends brownie points to @luishendrix92 :sparkles: :thumbsup: :sparkles:
api offline
Mahtab
@RoadToCode822
Aug 16 2015 05:24
Why doesn’t this work?
function end(str, target) {
  var targetLength = target.length;
  var firstString = str.substr(-targetLength);
  if(firstString === target){
    return "Matches";
  }
  else {
    return "Doesn't match";
  }
}

end('Bastian', 'n');
Bill
@kirah1314
Aug 16 2015 05:26
@RoadToCode822 it helps to let people know what bonfire or waypoint this is
CamperBot
@camperbot
Aug 16 2015 05:26
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Mahtab
@RoadToCode822
Aug 16 2015 05:26
Bonfire: Confirm the Ending
CamperBot
@camperbot
Aug 16 2015 05:26

:fire:Bonfire: Confirm the Ending :link:

function end(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  return str;
}

end('Bastian', 'n');

Check if a string (first argument) ends with the given target string (second argument).

more info:  bf details | bf links | hint

Bill
@kirah1314
Aug 16 2015 05:28
@RoadToCode822 actually your code works fine but the bonfire asks you to return true and return false
@RoadToCode822 just change "Matches" to true and the other string to false
Rich Churcher
@richchurcher
Aug 16 2015 05:32
For that matter, you don't have to be explicit, just return the result of the expression...
return firstString === target;
which is clearer IMHO
Frederick Sy
@fredlimsy
Aug 16 2015 05:36
Can anyone help with my code for "Make a Person"

var Person = function(firstAndLast) {
this.getFirstName = function() {
splitName = firstAndLast.split(' ');
firstName = splitName0;
return firstName;
};
this.getLastName = function() {
splitName = firstAndLast.split(' ');
lastName = splitName1;
return lastName;
};
this.getFullName = function() {
return firstAndLast;
};
this.setFirstName = function(first) {
return this.firstName;
};
this.setLastName = function(last) {
return this.lastName;
};
this.setFullName = function(firstAndLast) {
return arguments0;
};
};

var bob = new Person('Bob Ross');
bob.getFullName();

Can't seems to make the set functions to work
Mahtab
@RoadToCode822
Aug 16 2015 05:38
I got it. Thanks @richchurcher for a simpler sol’n and @kirah1314 for pointing out the true/false thing
CamperBot
@camperbot
Aug 16 2015 05:38
roadtocode822 sends brownie points to @richchurcher and @kirah1314 :sparkles: :thumbsup: :sparkles:
api offline
api offline
Bill
@kirah1314
Aug 16 2015 05:38
@fredlimsy can you repost with code formats? it'll be easier to read it. ``` before and after codes
Ozy Design & Software
@OzySky
Aug 16 2015 05:38
@fredlimsy your not setting the actual value, only returning it
Rich Churcher
@richchurcher
Aug 16 2015 05:38
I'm not sure if it's just the way you've pasted it in, but there are no square brackets around the array index
yeah, what @ozydesign said ;)
Frederick Sy
@fredlimsy
Aug 16 2015 05:38
how do I post with code formats?
Bill
@kirah1314
Aug 16 2015 05:38
help format
CamperBot
@camperbot
Aug 16 2015 05:38

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks, then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Bill
@kirah1314
Aug 16 2015 05:39
@RoadToCode822 :thumbsup:
Rich Churcher
@richchurcher
Aug 16 2015 05:39
yw @RoadToCode822
Frederick Sy
@fredlimsy
Aug 16 2015 05:39
var Person = function(firstAndLast) {
  this.getFirstName = function() {
                        splitName = firstAndLast.split(' ');
                        firstName = splitName[0];
                        return firstName;
                      };
  this.getLastName = function() {
                        splitName = firstAndLast.split(' ');
                        lastName = splitName[1];
                        return lastName;
                     };
  this.getFullName = function() {
                       return firstAndLast;
                     };
  this.setFirstName = function(first) {
                        return this.firstName;
                      };
  this.setLastName = function(last) {
                        return this.lastName;
                     };
  this.setFullName = function(firstAndLast) {
                       return arguments[0];
                     };
};



var bob = new Person('Bob Ross');
bob.getFullName();
I do have brackets around the array indexes
Ozy Design & Software
@OzySky
Aug 16 2015 05:43
@fredlimsy yeah, sorry
Frederick Sy
@fredlimsy
Aug 16 2015 05:43
for some reason, the set methods are not working
Bill
@kirah1314
Aug 16 2015 05:43
@fredlimsy i don't see firstName and lastName declared
Frederick Sy
@fredlimsy
Aug 16 2015 05:43
no idea how to write the correct code
@kirah1314 I tried declaring the variables but still does not work
Bill
@kirah1314
Aug 16 2015 05:52
@fredlimsy there are other factors too but declaring firstName, lastName and splitName are essential
Frederick Sy
@fredlimsy
Aug 16 2015 05:56
var Person = function(firstAndLast) {
  var splitName = firstAndLast.split(' ');
  var firstName = splitName[0];
  var lastName = splitName[1];
  this.getFirstName = function() {
                        return firstName;
                      };
  this.getLastName = function() {
                        splitName = firstAndLast.split(' ');

                        return lastName;
                     };
  this.getFullName = function() {
                       return firstAndLast;
                     };
  this.setFirstName = function(first) {
                        return first;
                      };
  this.setLastName = function(last) {
                        return last;
                     };
  this.setFullName = function(firstAndLast) {
                       return arguments[0];
                     };
};



var bob = new Person('Bob Ross');
bob.getFullName();
@kirah1314 Please check my new code. I still cannot assign a firstName based on the parameter of the function
Bill
@kirah1314
Aug 16 2015 05:58
try firstName = first; instead of return first;
Frederick Sy
@fredlimsy
Aug 16 2015 06:03
@kirah1314 that worked except on the full name
Mahtab
@RoadToCode822
Aug 16 2015 06:09
This message was deleted
This message was deleted
CamperBot
@camperbot
Aug 16 2015 06:09
Sorry, can't find a bonfire called chunky monkeydifficulty . [ Check the map? ]
Mahtab
@RoadToCode822
Aug 16 2015 06:09
This message was deleted
CamperBot
@camperbot
Aug 16 2015 06:09

:fire:Bonfire: Chunky Monkey :link:

function chunk(arr, size) {
  // Break it up.
  return arr;
}

chunk(['a', 'b', 'c', 'd'], 2);

Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.

more info:  bf details | bf links | hint

Mahtab
@RoadToCode822
Aug 16 2015 06:09
For this, what if an array has odd # of elements?
Bill
@kirah1314
Aug 16 2015 06:16
@fredlimsy you almost got it! What I did was use setFullName to separate firstAndLast
hint
CamperBot
@camperbot
Aug 16 2015 06:17
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Bill
@kirah1314
Aug 16 2015 06:17
@RoadToCode822 ^ check out the custom room. It should explain in good details
Bill
@kirah1314
Aug 16 2015 06:26
@fredlimsy, I sent you a message
DJ Nixon
@tGxcoder
Aug 16 2015 06:57
<img src='https://bit.ly/fcc-kittens'/>
how do i add the class smaller-image ?
Woolwit
@Woolwit
Aug 16 2015 06:58
Bonfire: Spinal Tap Case
CamperBot
@camperbot
Aug 16 2015 06:58

:fire:Bonfire: Spinal Tap Case :link:

function spinalCase(str) {
  // "It's such a fine line between stupid, and clever."
  // --David St. Hubbins
  return str;
}

spinalCase('This Is Spinal Tap');

Convert a string to spinal case. Spinal case is all-lowercase-words-joined-by-dashes.

more info:  bf details | bf links | hint

Woolwit
@Woolwit
Aug 16 2015 07:00
Bonfire: Spinal Tap Case hint
CamperBot
@camperbot
Aug 16 2015 07:00
Sorry, can't find a bonfire called spinal tap case hint. [ Check the map? ]
Woolwit
@Woolwit
Aug 16 2015 07:00
bf hint
CamperBot
@camperbot
Aug 16 2015 07:00
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
DJ Nixon
@tGxcoder
Aug 16 2015 07:01
@camperbot how do i add the class smaller-image to <img src='https://bit.ly/fcc-kittens'/>
Woolwit
@Woolwit
Aug 16 2015 07:07
This seems like a really cool approach to solving Spinal Tap Case, but how should I approach passing all tests? Should I have if, else ifs with different regex to match each case, or can a single regex serve to match all cases? I'm a bit lost here... Thanks for any suggestions.
function spinalCase(str) {
  function upperToHyphenLower(match) {
    return '-' + match.toLowerCase();
  }
  return str.replace(/[A-Z]/g, upperToHyphenLower);
}
spinalCase("thisIsSpinalTap");
Rex Schrader
@SaintPeter
Aug 16 2015 07:12
@Woolwit You should be able to come up with a single regular expression that captures all of the cases. It'll be a bit more complex than what you've got there.
@tGxcoder To add a class to an HTML element, you add the attribute class="yourClassNameHere"
Woolwit
@Woolwit
Aug 16 2015 07:14
Thanks @SaintPeter I've been wracking my brain (racking?) trying to see what all 3 cases have in common. Will press on now that I know there is one.
CamperBot
@camperbot
Aug 16 2015 07:14
woolwit sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
api offline
Rex Schrader
@SaintPeter
Aug 16 2015 07:17
@Woolwit Just looked at my solution - it looks like I chained two replaces together, with a different regexp for each. The first one takes care of spaces and underscores, turning them into hypens, the second looks for things that are not hyhens followed by a capital letter, which it then adds a hyphen in between.
George Tsoukatos
@Gts0uk
Aug 16 2015 07:18
when the site will be updated ?
Woolwit
@Woolwit
Aug 16 2015 07:18
Cool! I will conquer this best tomorrow! Thanks @SaintPeter
CamperBot
@camperbot
Aug 16 2015 07:18
api offline
woolwit sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
Ozy Design & Software
@OzySky
Aug 16 2015 08:31
is there an efficient way do to no repeats please, because storing all the possible permutations - then filtering with regex sounds horribly inefficient to me (as well as it can't calculate a string with more then 10 letters +-)
tjstinso
@tjstinso
Aug 16 2015 08:50
It is pretty inefficient, but it works!
and you dont need regex, you can just store as a set, but regardless… terribly inneficient as finding permutation on longer strings is a disaster
Ozy Design & Software
@OzySky
Aug 16 2015 08:56
@tjstinso so what's the point really?
tjstinso
@tjstinso
Aug 16 2015 08:57
using a set? less code
Jeremy Gorniak
@Gornstats
Aug 16 2015 08:58
@ozydesign im almost certain there's a mathematic way to solve it, but the easiest way does seem to be just iterating through each possible permutation. not very elegant!
IllusionElements
@IllusionElements
Aug 16 2015 09:10
how do you return the part of an array that returns as false? e.g [1,2,3] check if arr[i] <2 then return all values that don't match that condition
tjstinso
@tjstinso
Aug 16 2015 09:13
var a = [1,2,3].filter(function(x) { if (x < 2) return true; return false; }
a is a new array based on the original. All values who pass the test, ie return true are included in the new array
IllusionElements
@IllusionElements
Aug 16 2015 09:14
but I don't want it to return true or false @tjstinso I want it to return 1
an array with all the values that don't match the condition
tjstinso
@tjstinso
Aug 16 2015 09:18
try it
Sudeepto
@Sudeepto
Aug 16 2015 09:41

Good afternoon campers.

var a = [1,2,3].filter(function(x) { if (x < 2) return x; }

filter, when called on an array , will return a new array with only those elements that passes the test . No need for returning true or false.
@tjstinso

Abhisek Pattnaik
@abhisekp
Aug 16 2015 10:12

@IllusionElements @Sudeepto @tsjr63 you can use this

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  // I've a hammer fist.
  return arr.filter(Boolean);
}

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

https://gist.github.com/abhisekp/ec330ea725247bbf9e8e#file-15-bonfire-falsey-bouncer-1-js

Mohamed A. Farouk
@captainmoha
Aug 16 2015 10:21
@abhisekp I don't think it's a good idea to post the solution like that.
@abhisekp Not good for learning.
Abhisek Pattnaik
@abhisekp
Aug 16 2015 10:21
@captainmoha I know. But thought this might help after two solns. already posted by others. :)
Just trying to show the alternative routes to solving a prob.
Mohamed A. Farouk
@captainmoha
Aug 16 2015 10:22
@abhisekp Just sayin :smile:
Nicholas
@nick88p
Aug 16 2015 10:37
Has anyone solved the Bonfire on Symmetric Differences?
galacticfan
@galacticfan
Aug 16 2015 10:38
@Sudeepto So in your example, would it pass each element in the array into the function as 'x'?
Ozy Design & Software
@OzySky
Aug 16 2015 10:45
@nick88p you need help?
Abhisek Pattnaik
@abhisekp
Aug 16 2015 10:56
bf sym
CamperBot
@camperbot
Aug 16 2015 10:56

:fire:Bonfire: Symmetric Difference :link:

function sym(args) {
  return arguments;
}

sym([1, 2, 3], [5, 2, 1, 4]);

Create a function that takes two or more arrays and returns an array of the symmetric difference of the provided arrays.

more info:  bf details | bf links | hint

Abhisek Pattnaik
@abhisekp
Aug 16 2015 10:56
bf details
CamperBot
@camperbot
Aug 16 2015 10:56

:fire:Bonfire: Symmetric Difference :link:

function sym(args) {
  return arguments;
}

sym([1, 2, 3], [5, 2, 1, 4]);
Create a function that takes two or more arrays and returns an array of the symmetric difference of the provided arrays.
The mathematical term symmetric difference refers to the elements in two sets that are in either the first or second set, but not in both.
Remember to use <a href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank'>RSAP</a> if you get stuck. Try to pair program. Write your own code.
links:
Ammar Ali Shah
@AmmarAliShah
Aug 16 2015 11:10
need a little help guys
galacticfan
@galacticfan
Aug 16 2015 11:13
@AmmarAliShah what with man?
Ammar Ali Shah
@AmmarAliShah
Aug 16 2015 11:14
A little question
Let's say I have an array: var arr = ["ammar", "ali", "shah"];
can I access a specific letter of every element in the array?
galacticfan
@galacticfan
Aug 16 2015 11:15
You can
Ammar Ali Shah
@AmmarAliShah
Aug 16 2015 11:15
Like if I want to target the letter at index 2 of arr[1]
@galacticfan How?
galacticfan
@galacticfan
Aug 16 2015 11:16
using arr[1][1]
would target index 2 at arr[1]
Ammar Ali Shah
@AmmarAliShah
Aug 16 2015 11:16
@galacticfan I'll give that a try
thanks
galacticfan
@galacticfan
Aug 16 2015 11:21
:)
Mahtab
@RoadToCode822
Aug 16 2015 13:22
FCC down?
Matthew Barber
@Honno
Aug 16 2015 13:24
So in http://api.openweathermap.org/data/2.5/weather?lat=51.503363&lon=-0.127625 there's a json file, how do I extract that object with jquery?
var details;
$.getJSON(url, function(data) {
  details = data;
});
?
John Nieves
@karn09
Aug 16 2015 13:35
bf sum
CamperBot
@camperbot
Aug 16 2015 13:35

:fire:Bonfire: Sum All Numbers in a Range :link:

function sumAll(arr) {
  return(1);
}

sumAll([1, 4]);

We'll pass you an array of two numbers. Return the sum of those two numbers and all numbers between them.

more info:  bf details | bf links | hint

John Nieves
@karn09
Aug 16 2015 13:36
hint
CamperBot
@camperbot
Aug 16 2015 13:36
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
John Nieves
@karn09
Aug 16 2015 13:36
bf sum hint
CamperBot
@camperbot
Aug 16 2015 13:36
Sorry, can't find a bonfire called sum hint. [ Check the map? ]
Matthew Barber
@Honno
Aug 16 2015 13:37
Hey @karn09, everythings down haha
John Nieves
@karn09
Aug 16 2015 13:37
yea sure seems like it
Matthew Barber
@Honno
Aug 16 2015 13:37
but I can help ya still
John Nieves
@karn09
Aug 16 2015 13:37
i just saw the twitter, looks like they are doing some upgrades
yea that would be awesome!
so I'm a bit stuck on this sum one
I figured out how to do reduce
Matthew Barber
@Honno
Aug 16 2015 13:38
@karn09 So, you want to find 1+2+3+4, how could you generate, say, an array of numbers between the two parameters?
John Nieves
@karn09
Aug 16 2015 13:38
,,,
Matthew Barber
@Honno
Aug 16 2015 13:38
@karn09 Also using arguments[0] returns the first argument, and so forth
John Nieves
@karn09
Aug 16 2015 13:38
is there a way to have it generate an array of 1,2,3,4 within the same reduce?
or do i have to have an outside loop as well?
Matthew Barber
@Honno
Aug 16 2015 13:39
@karn09 Try to figure this out with just simple for loops, once you get to the functional programming reduce will be much easier to use
@karn09 Function programming sectional in the FCC map I mean
Ozy Design & Software
@OzySky
Aug 16 2015 13:40
@Honno did you manage no repeats?
Matthew Barber
@Honno
Aug 16 2015 13:40
@ozydesign haha no, I skipped it, on the weather api
Omar
@oab00
Aug 16 2015 13:41
@Honno that works :o
the getjson call
Matthew Barber
@Honno
Aug 16 2015 13:42
@oab00 returns undefined for me >.>
Omar
@oab00
Aug 16 2015 13:42
well getjson is an async function
Matthew Barber
@Honno
Aug 16 2015 13:42
I'll try a new enviroment
Omar
@oab00
Aug 16 2015 13:42
no no call a function from inside getjson
John Nieves
@karn09
Aug 16 2015 13:42
so I ended up doing something like this
,,,
function sumAll(arr) {
var new_arr = []
for (var i = arr0; i <= arr1; i++) {
new_arr.push(i)
}
return new_arr.reduce(function(a,b) {
return a + b
})
}
,,,
Matthew Barber
@Honno
Aug 16 2015 13:43
@karn09 Use the ` below the esc button
John Nieves
@karn09
Aug 16 2015 13:43
function sumAll(arr) {
    var new_arr = []
    for (var i = arr[0]; i <= arr[1]; i++) {
        new_arr.push(i)
    }
    return new_arr.reduce(function(a,b) {
        return a + b
    })
}
Matthew Barber
@Honno
Aug 16 2015 13:43
@oab00 Thats what I did right?
Omar
@oab00
Aug 16 2015 13:43
@Honno
$.getJSON(url, function(data) {
  details = data;
  dataArrived();
});

function dataArrived() {
    console.log(details);
   // rest of code
}
John Nieves
@karn09
Aug 16 2015 13:44
so where i declare arr0 and arr1, i had originally did a find min max on the array, so the those values aren't static
but is there a way to bake the for loop, into the reduce to generate the array without having two loops?
Matthew Barber
@Honno
Aug 16 2015 13:44
That should work @karn09, I think
John Nieves
@karn09
Aug 16 2015 13:45
it works, just trying to figure out of there is a more elegant way
Matthew Barber
@Honno
Aug 16 2015 13:46
@karn09 That's as elegant as you're gunna get heh
@karn09 One thing, I recommend you not using underscores for variable names, only for stuff like generating links
John Nieves
@karn09
Aug 16 2015 13:47
@honno good call
Soumya Rauth
@soumyaRauth
Aug 16 2015 13:47
Having problem accessing FCC with my email address. Any idea when it's going to be fixed???
Matthew Barber
@Honno
Aug 16 2015 13:48
@soumyaRauth Sites in maintenance, probably why
John Nieves
@karn09
Aug 16 2015 13:48
thank you!
Soumya Rauth
@soumyaRauth
Aug 16 2015 13:49
@Honno ya most probably... But i here dying to code on FCC.
George Tsoukatos
@Gts0uk
Aug 16 2015 14:16
check out this site : 100mentors.com
Matthew Barber
@Honno
Aug 16 2015 14:33

@oab00 Why does details.name happen first, then the json request?

    var dataArrive = function(data) {
      console.log("hi");
      console.log(data);
      details = data;
    }
    $.getJSON(url, "", function(data) {
      dataArrive(data);
    });
    var location = details.name;

It goes details.name doesn't work because details is undefined, THEN it shows hi and the correct data?

Oh I think I know what you mean withit being asynchronous now
Pepijn Willekens
@peperbol
Aug 16 2015 14:43
help
Omar
@oab00
Aug 16 2015 14:43
@Honno getJSON is an asynchronous function that gets called then skipped to next instructions then it calls the anonymous function inside it when the data comes back from the server
CamperBot
@camperbot
Aug 16 2015 14:43

Hi I'm CamperBot! I can help you in this chatroom :smile:

Basic commands:

  • find TOPIC find all entries about topic. ex: find js
  • wiki TOPIC show contents of topic page
  • thanks @username send brownie points to another user
  • about @username shows info on that user
  • bonfire BFNAME info on a bonfire

:speech_balloon: meet camperbot in this room!

:pencil: read more about camperbot on the FCC Wiki

Matthew Barber
@Honno
Aug 16 2015 14:43
@oab00 yeah thanks, reading up on 'promises'
CamperBot
@camperbot
Aug 16 2015 14:43
honno sends brownie points to @oab00 :sparkles: :thumbsup: :sparkles:
:star: 181 | @oab00 | http://www.freecodecamp.com/oab00
Pepijn Willekens
@peperbol
Aug 16 2015 15:23
I've been working on the course of the current(/old) Functional Programming and i'm currently doing the asynchonous observables, I just made an excercise (39) and my solutions differs from the solution they provide, can someone review my solution, to tell if its an equal or worse solution? and why, or where it differs?
Nicholas
@nick88p
Aug 16 2015 15:26
Is anyone else having trouble logging into freecodecamp?
Rex Schrader
@SaintPeter
Aug 16 2015 15:27
@nick88p - Yup - the e-mail login is down due to the migration to the new site.
Pepijn Willekens
@peperbol
Aug 16 2015 15:28
you can use the other ways for the services you've connected
Nicholas
@nick88p
Aug 16 2015 15:28
Thanks.
Rex Schrader
@SaintPeter
Aug 16 2015 15:29
@peperbol I think that so long as it passes the test you're good. They've actually removed that waypoint, I think, or reduced the number of items to do in it.
Pepijn Willekens
@peperbol
Aug 16 2015 15:37
@SaintPeter i heard they did ;) it's still an interesting course ;) thanks for the reply
CamperBot
@camperbot
Aug 16 2015 15:37
peperbol sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 184 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Aug 16 2015 15:39
@peperbol No doubt, I learned a lot from it. That said, it's pretty rough around the edges and doesn't always work.
Pepijn Willekens
@peperbol
Aug 16 2015 15:42
@SaintPeter yes, the validation isn't too smart, and the editor is far from the best out there but the content is pretty good
ShafM
@ShafM
Aug 16 2015 15:49
Has anyone having problem login into free code camp
Rex Schrader
@SaintPeter
Aug 16 2015 15:57
@ShafM The e-mail login is not working properly right now. You should be able to login via other methods (IE: twitter/github) if you used them
John Nieves
@karn09
Aug 16 2015 16:02
is it just me or is the freecodecamp map completely different now?
Marc Davenport
@oneate7
Aug 16 2015 16:04
@karn09 I'm guessing they're implementing the new course flow. It's been in beta for a couple of weeks.
I can't get to the site at all at the moment.
John Nieves
@karn09
Aug 16 2015 16:05
i was able to log in using my github instead of email
Pepijn Willekens
@peperbol
Aug 16 2015 16:05
you need to remove the www in front: http://freecodecamp.com/
John Nieves
@karn09
Aug 16 2015 16:06
must be some funky things going on in the background. my progress is all borked
Rex Schrader
@SaintPeter
Aug 16 2015 16:07
@karn09 They're working on it, but there is also a lot of new site specific content.
devwillpatterson
@devwillpatterson
Aug 16 2015 16:08
is there someone who i could pm a quick question to?
Marc Davenport
@oneate7
Aug 16 2015 16:08
@peperbol Thanks!
Rex Schrader
@SaintPeter
Aug 16 2015 16:08
@devwillpatterson Hit me!
John Nieves
@karn09
Aug 16 2015 16:08
@SaintPeter the new work flow does seem to make a bit more sense
Richard
@Coderer1
Aug 16 2015 16:10
hey guys! I have been working through the rock, paper, scissors exercise on codeacademy and have managed everything except the very last 'extra credit' question and very pleased with myself :smile: I was wondering if any of you have completed that challenge, (it's part 9/9 question 3). Am sure I could do it by just repeating all the code again in some way, but of course, that goes against the golden rule of "don't repeat yourself", so am sure there must be an obvious and simple way to prompt for a new values for userChoice and to generate a new computerChoice. Would any of you generously help out a newbie? I would like to know how it's done in a way that I know the computerChoice is really 'new'. I did look for an answer in their Q and A section, but only found something that refers to a "var loop", but at this point codeacademy hasn't introduced me to the "loop" thinger so am certain there must be a much simpler way to do this. Any pointers would be appreciated!
ShafM
@ShafM
Aug 16 2015 16:13
Thanks SaintPeter
SeaBao
@SeaBao
Aug 16 2015 16:20
why there are some lessons i haven't learned but it says i have learned them. is that bug?
so strange
Marc Davenport
@oneate7
Aug 16 2015 16:21
@SeaBao - They're still working things out. I have the same thing going on... hopefully it will get fixed.
SeaBao
@SeaBao
Aug 16 2015 16:22
@oneate7 OK! Thanks for your reply!
CamperBot
@camperbot
Aug 16 2015 16:22
seabao sends brownie points to @oneate7 :sparkles: :thumbsup: :sparkles:
:star: 143 | @oneate7 | http://www.freecodecamp.com/oneate7
Gaurav Chauhan
@gschauhan
Aug 16 2015 16:47
What happened here?Everything sims different...
Marc Davenport
@oneate7
Aug 16 2015 16:49
@gschauhan - They're switching over to the new content/course flow.
Gaurav Chauhan
@gschauhan
Aug 16 2015 16:50
@oneate7 thnx. My map shows some new things, and some of them are check marked.
CamperBot
@camperbot
Aug 16 2015 16:50
gschauhan sends brownie points to @oneate7 :sparkles: :thumbsup: :sparkles:
:star: 144 | @oneate7 | http://www.freecodecamp.com/oneate7
Marc Davenport
@oneate7
Aug 16 2015 16:51
Same here. Hopefully they'll get it worked out so that we don't have credit for things we haven't done.
Gaurav Chauhan
@gschauhan
Aug 16 2015 16:51
i believe i will wait till things get fixed...Good luck team @QuincyLarson
Marc Davenport
@oneate7
Aug 16 2015 16:56
Some of the things that were incorrectly checked an hour ago no longer are. They're definitely working on it.
Jonathan Reasor
@abraxasrex
Aug 16 2015 16:57
question on the bonfire "pairwise" instructions: "Return the sum of all indices of elements of 'arr' that can be paired with one other element to form a sum that equals the value in the second argument 'arg'. "If multiple sums are possible, return the smallest sum. Once an element has been used, it cannot be reused to pair with another." How can I return the smallest sum when all of the sums should from the first argument should equal the second argument, and should therefore have the same value?
Jonathan Reasor
@abraxasrex
Aug 16 2015 17:06
question on the bonfire "pairwise" instructions: "Return the sum of all indices of elements of 'arr' that can be paired with one other element to form a sum that equals the value in the second argument 'arg'. "If multiple sums are possible, return the smallest sum. Once an element has been used, it cannot be reused to pair with another." How can I return the smallest sum when all of the sums should from the first argument should equal the second argument, and should therefore have the same value?
flota113
@flota113
Aug 16 2015 17:16
@abraxasrex notice the word - indices
I don't know if english is your native language so it means index of elements in array
Sam
@samscripts
Aug 16 2015 17:18
hello all, nice to meet you all. Anybody having problem logging to their freecodecamp account ? Thnaks
flota113
@flota113
Aug 16 2015 17:21
study the example they gave
'4' - indice = 1
'2' - indice = 2
'3' - indice = 3
'5' - indice = 5
4+3 = 7
2+5 = 7
Sum of indices equals 11
But they imply that you could pair numbers in more ways which could result in higher indices which would result in higher sum - I don't know if there's such a test, but probably Yes
@samscripts Yes, it's a known issue, and FCC staff isworking on it
Sam
@samscripts
Aug 16 2015 17:23
@flota113 thanks a lot
CamperBot
@camperbot
Aug 16 2015 17:23
samscripts sends brownie points to @flota113 :sparkles: :thumbsup: :sparkles:
:star: 163 | @flota113 | http://www.freecodecamp.com/flota113
flota113
@flota113
Aug 16 2015 17:23
no problem ;)
Sam
@samscripts
Aug 16 2015 17:24
@camperbot sorry how to send brownie ?
Rex Schrader
@SaintPeter
Aug 16 2015 17:25
Just say "thanks" or "Thank you" and @mention someone
CamperBot
@camperbot
Aug 16 2015 17:25
saintpeter sends brownie points to @mention :sparkles: :thumbsup: :sparkles:
Sam
@samscripts
Aug 16 2015 17:26
@SaintPeter thanks
CamperBot
@camperbot
Aug 16 2015 17:26
samscripts sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 187 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Aug 16 2015 17:26
Oh, hey:
wiki brownie
CamperBot
@camperbot
Aug 16 2015 17:26

:point_right: brownie points [wiki]

The number beside your picture on Free Code Camp tells you how many Brownie Points you have.

A user profile picture next to a with Brownie Points score

There are three ways you can get Brownie Points:

  1. Complete challenges - you get one point per challenge you complete
  2. Post relevant links on Camper News - you get 1 point for posting a link, and another point for each upvote your link gets
  3. Help other campers in chat - each time you help another camper and they thank you (by typing "thanks @yourname"), you will get a point

Brownie Points help you look like the kind of person who codes a lot, shares relevant links, and helps people.

They also add to your Streak.
:pencil: read more about brownie points on the FCC Wiki

Sam
@samscripts
Aug 16 2015 17:27
thanks @camperbot
CamperBot
@camperbot
Aug 16 2015 17:27
samscripts sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
Sam
@samscripts
Aug 16 2015 17:28
thanks @SaintPeter
CamperBot
@camperbot
Aug 16 2015 17:28
samscripts sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
Sam
@samscripts
Aug 16 2015 17:29
thanks @flota113
CamperBot
@camperbot
Aug 16 2015 17:29
samscripts sends brownie points to @flota113 :sparkles: :thumbsup: :sparkles:
Jonathan Reasor
@abraxasrex
Aug 16 2015 17:29
@flota113 thanks.
CamperBot
@camperbot
Aug 16 2015 17:29
abraxasrex sends brownie points to @flota113 :sparkles: :thumbsup: :sparkles:
:star: 164 | @flota113 | http://www.freecodecamp.com/flota113
Luis Felipe López G.
@luishendrix92
Aug 16 2015 17:33
about @luishendrix92
CamperBot
@camperbot
Aug 16 2015 17:33
:star: 120 | @luishendrix92 | http://www.freecodecamp.com/luishendrix92
Robert
@rc242
Aug 16 2015 17:38
Looks like the Challenge Map is still a bit buggy.
George Tsoukatos
@Gts0uk
Aug 16 2015 17:45
Your #target1 element should have the classes animated‚ shake and btn-primary.
I do it like that : $("#target1").addClass("nimated snake btn-primary");
and doesn't work
Any help ?
ShafM
@ShafM
Aug 16 2015 17:51
Hey I need some help my
Am not sure we're to add the anchor text
flota113
@flota113
Aug 16 2015 17:54
@abraxasrex no problem, glad I could help
:)
@ShafM anywhere You think it fits ;)
ShafM
@ShafM
Aug 16 2015 17:58
Cool
flota113
@flota113
Aug 16 2015 17:59
@Gts0uk You wrote here with spelling errors, -
  • 'nimated' should be 'animated'
    • 'snake' should be 'shake'
      I'm not sure if in waypoint You did the same
George Tsoukatos
@Gts0uk
Aug 16 2015 18:01
already fixed it
thanks
Josh Ghent
@joshghent
Aug 16 2015 18:12
According to the new update I’ve done most of the ziplines… :D
Davis
@ajdavis56
Aug 16 2015 18:20
So in the Bonfire DNA pairing problem.
we are supposed to return two arrays of the given pair and then the matching pair element?
Jesse B
@JesseNoBata
Aug 16 2015 18:27
Having a lot of difficulty with the Twitch zipline; I am at the point where I understand making a JSONP request to the Twitch API; but I'm not sure how exactly to implement that. There's cross-domain issues and JSONP parsing but actually seeing a working javascript example I haven't been able to find. Any pointers would be great.
flota113
@flota113
Aug 16 2015 18:29
You need callback
add this "?callback=?" at the end of url
@JesseNoBata https://api.jquery.com/jQuery.getJSON/ "If the URL includes the string "callback=?" (or similar, as defined by the server-side API), the request is treated as JSONP instead. See the discussion of the jsonp data type in $.ajax() for more details."
Mahtab
@RoadToCode822
Aug 16 2015 19:13
Servers are still down? :O
Joris Labie
@labiej
Aug 16 2015 19:15
slow*
Abhisek Pattnaik
@abhisekp
Aug 16 2015 19:30
They're running a 56bps line!! :P
Joris Labie
@labiej
Aug 16 2015 19:37
Nah the requests are sent by carrier pigeons ^_^
Bianca Mihai
@biancamihai
Aug 16 2015 20:24
help stuck
CamperBot
@camperbot
Aug 16 2015 20:24

:point_right: how to get help when you get stuck [wiki]

When you get stuck, remember: Read-Search-Ask.

1) Read the documentation or error
2) Search Google
3) Ask your friends for help

This is the most time-efficient way to handle being stuck, and it's the most respectful of other people's time, too.

Most of the time, you'll solve your problem after just one or two steps of this algorithm.

We have a special chat room just for getting help: <a href='https://gitter.im/freecodecamp/help/' target='_blank'>https://gitter.im/freecodecamp/help/</a>

Learning to code is hard. But it's a lot easier if you ask for help when you need it!
:pencil: read more about how to get help when you get stuck on the FCC Wiki

Bianca Mihai
@biancamihai
Aug 16 2015 20:25
help how to start
CamperBot
@camperbot
Aug 16 2015 20:25

:point_right: how to start when you are stuck (i) [wiki]

How to start when you are stuck (II))

How to start when you are stuck (III))

You are a camper just like me, you get to an exercise and you get stuck … just like anyone else. You have no idea how to start, you stare at your editor and you think you must have a problem, surely you are not developer material … well you’re wrong! Perhaps you are just like me? I’m a visual person, I like a drawing better than a text. Everytime the same problem put down in a schema makes more sense to me than if you gave me a text. So … what do I do when I have problems solving/understanding an exercise? I start to draw. After I have my drawing in place if I need more to translate it to code I can also write it in pseudocode. After that transposing it to code should not be very hard.

So what are this flowcharts (the drawings) and pseudocode?

During my first semester in college, we had a course about introduction to algorithms. This is where we first learned about this stuff. We learned that a good algorithm and good logical programing is developed using flowcharts and pseudocode.

A flowchart represents your program flow from top to bottom. Each command is represented on this. Depending on the nature of the command there are different shapes you can use. A few of them that I mostly use (you can google more on this, google is your friend when you know what to google for) are:

More information about this you can find here https://en.wikipedia.org/wiki/Flowchart.

Pseudocode is an informal language that helps developers write algorithms. It is a text-based design tool and it uses a human readable language. It’s a structured english text that describes an algorithm.

Every bonfire in Free Code Camp curriculum can be solved using pseudocode and after that translated using javascript in a functional javascript code.

:pencil: read more about how to start when you are stuck i on the FCC Wiki

Richard
@Coderer1
Aug 16 2015 21:09
@biancamihai Hi, what is your problem? Are you trying to log in to freecodecamp?
Bianca Mihai
@biancamihai
Aug 16 2015 21:10
hi @Coderer1 nop, no problem, freecodecamp is slow now and has some problems in profile but I guess is work in progress, thank you!
Richard
@Coderer1
Aug 16 2015 21:13
@biancamihai Good. They seem to be very busy today updating the site. Best wishes.
Pepijn Willekens
@peperbol
Aug 16 2015 21:19
How can i add font-awesome to my codepen?
Tommy Noe
@tjnoe
Aug 16 2015 21:26
@peperbol In your pen's CSS settings, you can add one of the Font-Awesome CDN links as an external style sheet (see http://fortawesome.github.io/Font-Awesome/get-started/).
Pepijn Willekens
@peperbol
Aug 16 2015 21:29
@tjnoe thanks!
CamperBot
@camperbot
Aug 16 2015 21:29
peperbol sends brownie points to @tjnoe :sparkles: :thumbsup: :sparkles:
Brian van Vlymen
@arduino731
Aug 16 2015 21:43
Hello !
How do the Javascript recognize the letter if the letter is true 'a' change to color:green in Angular's way?
$scope.turnGreen = function(){
        if('a'){
            $scope.colors.current = {color: "green"};
        }
Cristi Rusu
@CristiInfo
Aug 16 2015 21:43
@ironheartbj18 hi
is written in condition , (...)
Brian van Vlymen
@arduino731
Aug 16 2015 21:46
yes in letter change to color
Cristi Rusu
@CristiInfo
Aug 16 2015 21:48
as long as 'a' exists, do color = green
Brian van Vlymen
@arduino731
Aug 16 2015 21:50
it does not work because the letter "a" and "B001" is changed to green both.
in index.html
  <div ng-style="colors.current">
    <p>a</p>
    <p>
    B0001,
   </p>
</div>
else{
            $scope.colors.current ={color: 'red'};
        }
hmm? any idea its not work that way
Cristi Rusu
@CristiInfo
Aug 16 2015 21:52
yes, if yu want to work, you have to assign style only to the first <p>
<div>
<p ng-style="colors.current">a</p>
<p>B0001,
</p>
</div>
else{....}
Brian van Vlymen
@arduino731
Aug 16 2015 21:55

not in <div ng-style="colors.current">

its very limited if to do this way

<div>
<p ng-style="colors.current">a</p>
<p>B0001,</p>
</div>

if change to like this

<p ng-style="colors.current">a,  b</p>

its still same problem the letter of 'b' would change to green anyway not change to red color

<p ng-style="colors.current">b</p>
same problem change to green
color.js
     $scope.turnGreen = function(){
        if('a'){
            $scope.colors.current = {color: "green"};
        }
        else{
            $scope.colors.current ={color: 'red'};
        }
    };
I have no idea why javascript not work this way
inkcode
@inkcode
Aug 16 2015 22:43
Hey
can anyone
help me with a small jquery issue?
CamperBot
@camperbot
Aug 16 2015 22:44
no wiki entry for: me with a small jquery issue
:pencil: click here to create one now!after creating your page type update to reload it here
inkcode
@inkcode
Aug 16 2015 22:44
i mean its a javascript loop problem
im ew here and idk how to ask for help :|
*new
no luck?
:|
Coira Ellison
@Coira
Aug 16 2015 22:46
hi @aviral235 what do you need help with?
inkcode
@inkcode
Aug 16 2015 22:46
yay god bless you
i cant for the life of me figure out
how for loops work and why the code ive used int working
basically
there are like 11 siblings
and i need to loop through them

jQuery(document).ready(function ($) {
var allReds = $('#c11').parent().children(); // get the children
i=11;
do { // use another counter i
console.log(i);
setTimeout(function() { // since the animation happens once, you don't need to save it in a variable
$( allReds[i] ).mouseenter(); // get next child allReds[i]
}, i*500); // ..and animate one after another every .5 second

setTimeout(function() {
    $( allReds[i] ).mouseout();
}, i*500 + 5000);    // second animation on same element, .5 second after it started

i--;
}
while(i>0);
});

or like

jQuery(document).ready(function ($) {
var allReds = $('#c11').parent().children(); // get the children

for (var i = 0; i < 11; i++) { // use another counter i
setTimeout(function() { // since the animation happens once, you don't need to save it in a variable
$( allReds[i] ).mouseenter(); // get next child allReds[i]
}, i*500); // ..and animate one after another every .5 second

setTimeout(function() {
    $( allReds[i] ).mouseout();
}, i*500 + 5000);    // second animation on same element, .5 second after it started

}
});

now here
the i goes from 1 to 2 to 3 to 4....
Coira Ellison
@Coira
Aug 16 2015 22:49
post your code using three backticks ` and it'll format it
inkcode
@inkcode
Aug 16 2015 22:49
This message was deleted
This message was deleted
This message was deleted
UGH
This message was deleted
Coira Ellison
@Coira
Aug 16 2015 22:50
three backticks, then shift+enter for a new line i think
inkcode
@inkcode
Aug 16 2015 22:51
jQuery(document).ready(function ($) {
var allReds = $('#c11').parent().children();    // get the children


for (var i = 0; i < 11; i++) {    // use another counter i
    setTimeout(function() {    // since the animation happens once, you don't need to save it in a variable
        $( allReds[i] ).mouseenter();    // get next child allReds[i]
    }, i*500);    // ..and animate one after another every .5 second

    setTimeout(function() {
        $( allReds[i] ).mouseout();
    }, i*500 + 5000);    // second animation on same element, .5 second after it started
}
});
SUCCESS
lol
so basically
instead of the mouseenter
and mouseout
happening on EVERY sibling
it just happens on the nth one
like in this case 11th
so if i keep the number as i<6
the numbers will go from 0 to 5 if i console.log(i);
but the code doesnt execute each time
the parent of #c11 has like 11 children, from c1....c11
Coira Ellison
@Coira
Aug 16 2015 22:53
is this a waypoint?
inkcode
@inkcode
Aug 16 2015 22:53
nope
just need to trigger an animation
based on pseudo hovers
point is
it just triggers ONCE
and the child is selected depending upon the number i use for i<11 or i<7 or whatever
could i wrap this
in anohter for look
loop*
so that we use i<n instead of a number
in the nested child loop
Coira Ellison
@Coira
Aug 16 2015 22:55
oh... this is one of those weird javascript things, because you're assigning functions inside of a loop
inkcode
@inkcode
Aug 16 2015 22:55
so that each time the inner loop executes
Coira Ellison
@Coira
Aug 16 2015 22:55
have you done closures?
inkcode
@inkcode
Aug 16 2015 22:55
im level noob
like my solution is to make the whole for loop
run eleven times
with i<1, 1<2, i<3,....i<11
get it?
Coira Ellison
@Coira
Aug 16 2015 22:56
but it's only running once for you, and that's on the last child?
inkcode
@inkcode
Aug 16 2015 22:56
yep
except that the counter increments obviously like the variable i goes all the way from 0 to whatever
how do i make the functions work each time
instead of jjust once at the end
Coira Ellison
@Coira
Aug 16 2015 22:58
in most other languages, it would work, but javascript has weird execution context rules, so while you've assigned the function each time, it doesn't actually "exist" until it's been called, right at the end
inkcode
@inkcode
Aug 16 2015 22:58
damn
lol
so well
if it's called at the 'end'
then in this case i've defined the 'end' as 11 right
Coira Ellison
@Coira
Aug 16 2015 22:59
yeah
inkcode
@inkcode
Aug 16 2015 22:59
how about making the end '1' first
then '2'
then '3'
by putting this in another loop
can that be done?
Coira Ellison
@Coira
Aug 16 2015 22:59
the problem is you're doing it in a loop
inkcode
@inkcode
Aug 16 2015 22:59
so what do i do
Coira Ellison
@Coira
Aug 16 2015 22:59
let me look up if there's a solution
Marie Pelletier
@Marie000
Aug 16 2015 22:59

I am on my second trial trying to solve the Sum All Primes bonfire. Here's what I have so far:

function sumPrimes(num) {

// create an array with all dividers for number  
function findDividers(number){
  // create empty array
  arr = [];
  //find all divider for number
  for (x=2;x<number;x++){
    if (number%x===0)
      // push all dividers into the empty array
      arr.push(x);
  }
}
 // create an almost empty array (testing for 2 is difficult, so I'll start at three)
 prime = [2];

 // for all numbers from 3 to num
 for (i=3;i<=num;i++){
   // perform test finding dividers for each number
    findDividers(i);
    // if arr is empty (no dividers), it is a prime number
    if (arr === []) { 
      // therefore push it in the array
      prime.push(i);
    }
 }
  // this should return an array with all prime numbers up to num
  return prime;
}

sumPrimes(10);

I think my problem comes when I call my findDividers function in my for loop. In fact, I don't think my program 'sees' the array result from the function outside of it. Is there a way to fix that?

Coira Ellison
@Coira
Aug 16 2015 23:00
@aviral235 when you get to closures it'll make more sense, i'm still new to js's way of doing stuff
Marie Pelletier
@Marie000
Aug 16 2015 23:00
wow... my comments really screw up the visibility of the code. Here it is again without comments:
function sumPrimes(num) {
  //var arr = [];

function findDividers(number){
  arr = [];
  for (x=2;x<num;x++){
    if (number%x===0)
      arr.push(x);
  }
}

 prime = [2];

 for (i=3;i<=num;i++){
    findDividers(i);
    if (arr === [i]) { 
      prime.push(i);
    }
 }
  return prime;
}

sumPrimes(10);
oops... in the findDividers function, it should be x<number, not x<num.
Coira Ellison
@Coira
Aug 16 2015 23:03
@aviral235 try this?
jQuery(document).ready(function ($) {
var allReds = $('#c11').parent().children();    // get the children


for (var i = 0; i < 11; i++) {    // use another counter i
    setTimeout(function(index) {    // since the animation happens once, you don't need to save it in a variable
        $( allReds[index] ).mouseenter();    // get next child allReds[i]
    }(i), i*500);    // ..and animate one after another every .5 second

    setTimeout(function(index) {
        $( allReds[index] ).mouseout();
    }(i), i*500 + 5000);    // second animation on same element, .5 second after it started
}
});
@Marie000 did you work out your problem?
inkcode
@inkcode
Aug 16 2015 23:05
@Coira thanks
CamperBot
@camperbot
Aug 16 2015 23:05
aviral235 sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
inkcode
@inkcode
Aug 16 2015 23:05
but im guessing
CamperBot
@camperbot
Aug 16 2015 23:05
:star: 156 | @coira | http://www.freecodecamp.com/coira
inkcode
@inkcode
Aug 16 2015 23:05
i should just give up :'3
lol
Coira Ellison
@Coira
Aug 16 2015 23:05
did it not work?
inkcode
@inkcode
Aug 16 2015 23:05
nope
i guess theres no solution
i'll start afresh using jquery each or sth
Marie Pelletier
@Marie000
Aug 16 2015 23:05
@coira no... I am still stumped.
inkcode
@inkcode
Aug 16 2015 23:06
thng is i have 11 siblings...each needs to do a mousein, wait for 6 seconds, do a mouse out, then the next one's mouse in, wait for 6 seconds, then mouseout...and so on
till all siblings are done
things sounded so easy but NOPE.
jQuery(document).ready(function ($) {
var allReds = $('#c11').parent().children();    // get the children


for (var i = 0; i < 11; i++) {    // use another counter i
    setTimeout(function(index) {    // since the animation happens once, you don't need to save it in a variable
        $( allReds[index] ).mouseenter();    // get next child allReds[i]
    }, i*500, i );    // ..and animate one after another every .5 second

    setTimeout(function(index) {
        $( allReds[index] ).mouseout();
    }, i*500 + 5000, i);    // second animation on same element, .5 second after it started
}
});
i didn't call the function the right way
inkcode
@inkcode
Aug 16 2015 23:16
okay @Coira kudos thanks
CamperBot
@camperbot
Aug 16 2015 23:16
aviral235 sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
inkcode
@inkcode
Aug 16 2015 23:16
i wish i could give you more than brownie points lol
somebody gimme a donate button
XD
Coira Ellison
@Coira
Aug 16 2015 23:17
i take it that means it worked? :)
inkcode
@inkcode
Aug 16 2015 23:17
it did
but the timing is all messed up
as in i want the mousein to happen
and then 5-6 seconds break
and then mouseout
and then next mouse in
5 sec hold
then mouseout
....
Coira Ellison
@Coira
Aug 16 2015 23:18
@Marie000 you declared arr without var, so that makes it global, but if you uncomment the var arr at the top that's better
hm instead of mousein etc, can you animate it directly
i.e. put something like .animate() instead of mousein() ?
inkcode
@inkcode
Aug 16 2015 23:20
it's like a tooltip pops over
on hover
so yeah
Coira Ellison
@Coira
Aug 16 2015 23:20
hm
@Marie000 i'm just going through your code seeing what's happening
why are you using setinterval? @aviral235
inkcode
@inkcode
Aug 16 2015 23:23
im not im just using setTimeout
Coira Ellison
@Coira
Aug 16 2015 23:24
oh sorry, that's what i meant
inkcode
@inkcode
Aug 16 2015 23:24
idk what else to use :P
i mean delay was an epic fail
man i suck at this i should really reconsider my life options
Coira Ellison
@Coira
Aug 16 2015 23:25
huh no, this is how everybody learns to code
i don't know much about web coding
inkcode
@inkcode
Aug 16 2015 23:25
hmm
youre awesome anyway ^_^
Coira Ellison
@Coira
Aug 16 2015 23:26
i mean, you want to simulate a mouse going over a element every 5 seconds, so it animates?
inkcode
@inkcode
Aug 16 2015 23:26
basically the imaginary mouse
goes to sibling1(sib1)
stays there for 5 secs
then moves out
and then goes to sib2
Coira Ellison
@Coira
Aug 16 2015 23:26
but why not cut out the middle man and go straight for the animate?
inkcode
@inkcode
Aug 16 2015 23:26
and stays for anohter 5
im already using a tooltip plugin for the tooltips XD
ill just delete the whole thing
and take an easier approach
using :hover and stuff
will put really less work on my hands
Coira Ellison
@Coira
Aug 16 2015 23:27
perhaps ask in the main chat room room?
ok, this stuff i'm clueless about, but it's all good fun :)
inkcode
@inkcode
Aug 16 2015 23:28
hehe yes i'll figure my way out
thanks a lot though
Coira Ellison
@Coira
Aug 16 2015 23:28
np, good luck!
@Marie000 still around?
Marie Pelletier
@Marie000
Aug 16 2015 23:32
yes, just having problems with the site being slow.
Coira Ellison
@Coira
Aug 16 2015 23:33
yeah, same here
also there's usually more people around to help, guess with the site being under maintenance people are away
inkcode
@inkcode
Aug 16 2015 23:34
well at least we have a community where people are helpful. it's kinda awesome
Marie Pelletier
@Marie000
Aug 16 2015 23:35
that's okay... evenings are usually more busy, but I also do a lot of my work around 6am on weekends, so there's no one around to help then.
Coira Ellison
@Coira
Aug 16 2015 23:36
oh yeah, it's great, sometimes the coding community can get kinda, well snobbish
Marie Pelletier
@Marie000
Aug 16 2015 23:37
I think I'm having trouble with the "run code" function on the site, so it makes it hard to test my code. Unless my code really does nothing. I'll try it on another site.
inkcode
@inkcode
Aug 16 2015 23:38
codepen all the way
Cordoba84
@fcordoba84
Aug 16 2015 23:38
hi i need to do this (Nest your text input element within a form element.)
i have done this

<input type="text" placeholder="cat photo URL">

<form action="/url-where-you-want-to-submit-form-data" ></form>.
<form action="/submit-cat-photo"></form>

can any one help what those nest your text element mean?
no ona
?
Coira Ellison
@Coira
Aug 16 2015 23:42
@Marie000 i've found a couple things wrong with your code
Marie Pelletier
@Marie000
Aug 16 2015 23:43
@coira what are they?
Coira Ellison
@Coira
Aug 16 2015 23:44
one sec
in findDividers, should x<number be x<=number?
because later on you test `arr===[i]
Manuel Alzadiq Romero
@erratadei
Aug 16 2015 23:46
@fcordoba84 nest might mean to put something inside another element
Marie Pelletier
@Marie000
Aug 16 2015 23:48
oh, yes, maybe I should test for arr === [] instead? that or use x<= number
Coira Ellison
@Coira
Aug 16 2015 23:48
either of those will work
i can't work out why prime only ever is 2 tho
Felipe Rodrigues
@feliperdius
Aug 16 2015 23:49
@fcordoba84 all <input> have to be inside form: <form> <input></form>
Marie Pelletier
@Marie000
Aug 16 2015 23:50
yeah, that's my problem too.
Coira Ellison
@Coira
Aug 16 2015 23:51
ok... try console.log([2] === [2]);
it's false, can't compare arrays like that
Marie Pelletier
@Marie000
Aug 16 2015 23:52
ok, I'll try. Just as soon as I can get the page to open again.
Coira Ellison
@Coira
Aug 16 2015 23:53
you can try it in the console if you want to test it out
Marie Pelletier
@Marie000
Aug 16 2015 23:54
that might be the problem... (still trying to load) in which case I could test if arr.length = 0 instead.
Coira Ellison
@Coira
Aug 16 2015 23:54
i guess something like arr.length === 0 would work better
:)
Marie Pelletier
@Marie000
Aug 16 2015 23:54
:worried:
oops. I meant :-)
Coira Ellison
@Coira
Aug 16 2015 23:54
i wonder why you can't compare arrays
Justin Dieter
@JDieter12
Aug 16 2015 23:56

body {
background-color: #5d3337;
font-family: Helvetica, sans-serif;
font-size: 16px;
font-weight: 400;
height: auto;
height: 100%;
line-height: 1.6em;
min-height: 100%;
}
h4 {
color: #97ca66;
font-size: 2.1em;
font-weight: 200;
margin: 0 0 24px 2;
}

label {
color: #97ca66;
}

.subbtn{
background-color: #97ca66;
border-radius: 25px;
border: 1px solid #5d3337;
padding: 10px;
margin-left: 75px;
margin-top: 15px;
}

section#login {
border: 1px solid #5d3337;
border-radius: 3px;
margin: 40px auto;
padding: 24px;
width: 500px;
}
header, footer {
background-color: #dcd6cb;
height: 45px;
color: #5d3337;
}

img.login {
display: block;
margin-left: auto;
margin-right: auto;
}

That didn’t work…lol
Marie Pelletier
@Marie000
Aug 16 2015 23:56
the code is not returning anything. There might be something wrong with the site.
Coira Ellison
@Coira
Aug 16 2015 23:57
don't forget you have to sum everything in prime first then return it
Marie Pelletier
@Marie000
Aug 16 2015 23:58
I think it worked! I ran it on the codeacademy website and it gave me: [2,3,5,7]
now I just need to add things up and come back when FreeCodeCamp is running correctly.
Coira Ellison
@Coira
Aug 16 2015 23:59
oh phew, just fcc being a pain then
Marie Pelletier
@Marie000
Aug 16 2015 23:59
yes. it really made no sense that it would return nothing at all.