These are chat archives for FreeCodeCamp/Help

6th
Aug 2015
Chris
@Shifthawke
Aug 06 2015 00:02
I've rewritten this code several times now. I think I'm going to skip it. Maybe because I'm using Edge it won't accept it. It's so biased lol
Ross Kaffenberger
@rossta
Aug 06 2015 00:02
sorry @Shifthawke, it worked for me. your answer looks correct unless it’s total PEBKAC
Chris
@Shifthawke
Aug 06 2015 00:06
lol it probably is me. I stared at it wrong lol.
Brock Hayes
@brockson007
Aug 06 2015 00:06
This message was deleted
// Write your jQuery code on line 3!
$(document).ready(function()
$('ol:last-child');
    $target.fadeOut('fast');
});
Liz Rezes
@queenlizo
Aug 06 2015 00:07
This message was deleted
Brock Hayes
@brockson007
Aug 06 2015 00:07
need help. Did this exercise yesterday, yet I completely forgot how to do it! Lol. Here's the link: https://www.codecademy.com/courses/web-beginner-en-GfjC6/0/3
Liz Rezes
@queenlizo
Aug 06 2015 00:11
I'm having problems getting started with Bonfire: Diff Two Arrays. I need to use String.slice(), Array.filter(), Array.indexOf() and String.concat() to compare two arrays and return a new array with any items not found in both of the original arrays. Anyone have any advice to get me in the right direction? Thanks!
function diff(arr1, arr2) {
    var newArr = [];
  // Same, same; but different.
    for(var i=0;i<arr1.length;i++){
        if (arr2.indexOf(arr1[i]) == -1) {
            newArr = newArr.push(i);
        }
    }
  return newArr;
}

diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
@brockson007 If you did it yesterday, your work should be saved in the codeacademy page- mine was.
Brock Hayes
@brockson007
Aug 06 2015 00:13
@queenlizo My cache on my computer was cleaned yesterday, so now it's gone
Liz Rezes
@queenlizo
Aug 06 2015 00:13
@brockson007 Ooh. Bummer. It's been a while since I've done this exercise. let me take a look
Brock Hayes
@brockson007
Aug 06 2015 00:13
ok
gazzer82
@gazzer82
Aug 06 2015 00:14
Ok so on the third attempt i have just completed Waypoint: Practice Functional Programming, that was so hard, but i think i am finally getting it.
SojournerOctocat
@SojournerOctocat
Aug 06 2015 00:16
@queenlizo I processed the arrays separately, using filter and an if statement. Then combined the two using concat.
Liz Rezes
@queenlizo
Aug 06 2015 00:17
@SojournerOctocat Ah. Cool. Thanks!
Brock Hayes
@brockson007
Aug 06 2015 00:18
Anyone got an idea what's wrong?
// Write your jQuery code on line 3!
$(document).ready(function()
$('ol:last-child');
    $target.fadeOut('fast');
});
Liz Rezes
@queenlizo
Aug 06 2015 00:18
@brockson007 I'm sorry. I've done this one, but I'm just as lost as you.
Brock Hayes
@brockson007
Aug 06 2015 00:18
@queenlizo Thanks for trying
Liz Rezes
@queenlizo
Aug 06 2015 00:19
@brockson007 No problem. I need to go over that! I just did it a few weeks ago!
Brock Hayes
@brockson007
Aug 06 2015 00:19
I did it yesterday and I already forgot! :smile:
Moisés Man
@moigithub
Aug 06 2015 00:20
u did urself ? or copy paste some code ? :P
Brock Hayes
@brockson007
Aug 06 2015 00:21
var = 'no comment'
@moigithub Yes, I worked on code
Moisés Man
@moigithub
Aug 06 2015 00:22
$('ol:last-child'); this is a "selector"
probably u wanna "store/assign" that o a variable.. so u can "use" it later...
like in
$target.fadeOut('fast');
Randy Goldsmith
@Dueldrawer8
Aug 06 2015 00:23
//Remember to set your condition outside the loop!
var count = 0

var loop = function(){
    while(count < 3){
        console.log("I'm looping!");
    }
};

loop();
Moisés Man
@moigithub
Aug 06 2015 00:23
so...
$target = selector..
Randy Goldsmith
@Dueldrawer8
Aug 06 2015 00:23
how do I get I'm looping to loop 3 times
Moisés Man
@moigithub
Aug 06 2015 00:24
@Dueldrawer8 while count < 3...
so count start on 0
then do 1 loop...
and check if count<3
then loop again.. and keep checking if count < 3
Brock Hayes
@brockson007
Aug 06 2015 00:24
var $target =$('ol:last-child');
@moigithub does this look right?
Moisés Man
@moigithub
Aug 06 2015 00:25
@Dueldrawer8 so... when count changes ???
@brockson007 yep
Brock Hayes
@brockson007
Aug 06 2015 00:25
@moigithub it's still not working
Randy Goldsmith
@Dueldrawer8
Aug 06 2015 00:25
i found the answer in other chat i need to add count++ which increments the count by 1 @moigithub
Brock Hayes
@brockson007
Aug 06 2015 00:26
This message was deleted
SojournerOctocat
@SojournerOctocat
Aug 06 2015 00:26
@brockson007
// Write your jQuery code on line 3!
$(document).ready(function() {

    $target = $('ul li:nth-child(4)');
    $target.fadeOut('fast');
});
Brock Hayes
@brockson007
Aug 06 2015 00:27
@SojournerOctocat
// Write your jQuery code on line 3!
$(document).ready(function()
$target= $('ol:last-child');
    $target.fadeOut('fast');
});
@SojournerOctocat no luck
Moisés Man
@moigithub
Aug 06 2015 00:28
depends what ur html structure is...
Moisés Man
@moigithub
Aug 06 2015 00:28
do u have UL or OL ?? (list )
Brock Hayes
@brockson007
Aug 06 2015 00:28
ol
SojournerOctocat
@SojournerOctocat
Aug 06 2015 00:28
@brockson007 It works for me. Maybe try refreshing your page?
Moisés Man
@moigithub
Aug 06 2015 00:29
'ol li:last-child' probably...
SojournerOctocat
@SojournerOctocat
Aug 06 2015 00:29
@moigithub @brockson007 You have a ul with a nested ol.
Which is why what I pasted works.
Brock Hayes
@brockson007
Aug 06 2015 00:31
I think @SojournerOctocat @moigithub that it's my browser cause I tried what @SojournerOctocat did and it still didn't work.
@SojournerOctocat @moigithub It was my browser. I tried it in another browser and it worked.
I guess sometimes it's not always the users fault
SojournerOctocat
@SojournerOctocat
Aug 06 2015 00:34
:smile:
dc
@dcsan
Aug 06 2015 00:34
ID-10T error?
Brock Hayes
@brockson007
Aug 06 2015 00:36
@dcsan actually the opposite
dc
@dcsan
Aug 06 2015 00:37
!PEBKAC
Mike Moss
@MMux
Aug 06 2015 00:44
I'm working through the zipline for local weather, and want to put a bootstrap tooltip for the temperature display (F to C). I cannot figure out what I'm missing, and I've been combing bootstrap 3 docs:
http://codepen.io/MMux/pen/QbYMoP
  • any help is appreciated...
Joris Labie
@labiej
Aug 06 2015 00:45
Can't help, but looks stunning
Mike Moss
@MMux
Aug 06 2015 00:46
@labiej thanks!
ctcrnitv
@ctcrnitv
Aug 06 2015 00:47
Does anyone know why this is returning a primitive Number instead of an Array?
I thought that was the point of the reduce function :trollface:
CamperBot
@camperbot
Aug 06 2015 00:48
If you're having troll problems notify admins here
ctcrnitv
@ctcrnitv
Aug 06 2015 00:48
damnit camperbot
Bill
@kirah1314
Aug 06 2015 00:49
:trollface:
CamperBot
@camperbot
Aug 06 2015 00:49
If you're having troll problems notify admins here
:trollface: whats up guize?
Joris Labie
@labiej
Aug 06 2015 00:50
npm-waypoint is fully broken?
Bill
@kirah1314
Aug 06 2015 00:50
@camperbot just testing what that does :)
CamperBot
@camperbot
Aug 06 2015 00:51
@kirah1314 np. just a bit of advance preparation in case reddit folks come in
Bill
@kirah1314
Aug 06 2015 00:51
lol
Lightwaves
@Lightwaves
Aug 06 2015 01:01
haha
I'd be more worried about 4chan-ers
I'm the epitome of troll.
CamperBot
@camperbot
Aug 06 2015 01:02
If you're having troll problems notify admins here
Joris Labie
@labiej
Aug 06 2015 01:03
"If you're having troll problems I feel bad for you son..." would be better :-)
CamperBot
@camperbot
Aug 06 2015 01:03
If you're having troll problems notify admins here
Tyler St. Onge
@tylerstonge
Aug 06 2015 01:09
Does anyone know of pair programming software for linux? Screen Hero seems to be Mac/Win only.
Sean
@seanr707
Aug 06 2015 01:10
@tylerstonge TeamViewer
Same thing as screen hero, there are also sharable IDE's on the web, such as C9
Tyler St. Onge
@tylerstonge
Aug 06 2015 01:11
@seanr707 Sweet, I'll look into that. Thanks!.
I just saw that Teamviewer had a gitter channel, right as you sent that haha
Sean
@seanr707
Aug 06 2015 01:13
@tylerstonge well, that was the first I knew of its own gitter, we both learned something!
@labiej +1
javielero
@javielero
Aug 06 2015 01:22
can anyone help me out with bonfire: factorialize a number?
M Used
@mildused
Aug 06 2015 01:24
@javielero sure
bonfire factorialize
CamperBot
@camperbot
Aug 06 2015 01:24

:fire:Bonfire: Factorialize a Number :link:

function factorialize(num) {
  return num;
}

factorialize(5);

Return the factorial of the provided integer.
If the integer is represented with the letter n, a factorial is the product of all positive integers less than or equal to n.
Factorials are often represented with the shorthand notation n!
For example: 5! = 1 2 3 4 5 = 120f
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

javielero
@javielero
Aug 06 2015 01:24
function factorialize(num) {

  for (i > 1; i <= num; i++){
    num *= i;
  }
  return num;
}

factorialize(5);
how do i use the num inside the loop?
M Used
@mildused
Aug 06 2015 01:25
there are two ways to do it that are common, recursion and another way similar to yours
This message was deleted
javielero
@javielero
Aug 06 2015 01:26
the error thats thrown says that my i variable isnt initialized
M Used
@mildused
Aug 06 2015 01:26
do you understand what a factorial is?
javielero
@javielero
Aug 06 2015 01:26
yes ive read up on it
M Used
@mildused
Aug 06 2015 01:26
okay so pretty much you start at a number and multiply down until you get to one
javielero
@javielero
Aug 06 2015 01:27
yes. thats what my loop does
its not multiplying due to an error in the code
M Used
@mildused
Aug 06 2015 01:27
for (var i = num; i >= 1; i--)
From this snippet, we initialize i from num, subtract one from i until i is not greater than or equal to one
You had an incorrect syntax
does this make sense?
javielero
@javielero
Aug 06 2015 01:28
oh yea i forgot var =
oh
you made it the new variable === num
M Used
@mildused
Aug 06 2015 01:29
Sure
javielero
@javielero
Aug 06 2015 01:29
hold on
M Used
@mildused
Aug 06 2015 01:31
@javielero Any doubts I can clear up?
javielero
@javielero
Aug 06 2015 01:31
ok, so youve made it start at the num, then it minus 1 number and runs as long as its bigger than 1
M Used
@mildused
Aug 06 2015 01:32
yeah
javielero
@javielero
Aug 06 2015 01:32
or equal
M Used
@mildused
Aug 06 2015 01:32
it doesn't really matter because one multiplied won't do anything, but it makes sense from the mathematical definition
but yes
shall we continue?
javielero
@javielero
Aug 06 2015 01:33
yes
M Used
@mildused
Aug 06 2015 01:34
so for every i, we want to multiply them all together
so let's have a separate variable called answer
var answer = 1;
for (var i = num; i >= 1; i--)
we want it outside so that it can be accessed anywhere in the function
Confirm?
javielero
@javielero
Aug 06 2015 01:35
yu[
yup
M Used
@mildused
Aug 06 2015 01:35
so let's go through with the for loop
So for each i, we multiply answer by i. Can you convert that into javascript?
javielero
@javielero
Aug 06 2015 01:36
answer *= i
M Used
@mildused
Aug 06 2015 01:37
right, so type it out until now
javielero
@javielero
Aug 06 2015 01:37
answer = i * answer; no?
M Used
@mildused
Aug 06 2015 01:37
it's the same :)
javielero
@javielero
Aug 06 2015 01:38
ok cool, i was pretty sure
but to this point im not returning num
M Used
@mildused
Aug 06 2015 01:38
nope
keep going
type it out so we can continue
javielero
@javielero
Aug 06 2015 01:39
yea i have it
M Used
@mildused
Aug 06 2015 01:39
umm can I see?
javielero
@javielero
Aug 06 2015 01:40
function factorialize(num) {
  x = 1;
  for (var i = num; i >= 1; i--){
    x *= i;  
  }

  return num;
}

factorialize(5);
i used x instead of answer
M Used
@mildused
Aug 06 2015 01:40
No
javielero
@javielero
Aug 06 2015 01:40
ok
M Used
@mildused
Aug 06 2015 01:40
firstly, all variables when first initialized must start with var
var x = 1;
it's better to keep the variables representative of what they are
var answer = 1;
javielero
@javielero
Aug 06 2015 01:41
ok got it
M Used
@mildused
Aug 06 2015 01:41
and you're not returning num, because we never changed num
what is our variable name for the factorial??
javielero
@javielero
Aug 06 2015 01:42
num
num is getting factorialized
M Used
@mildused
Aug 06 2015 01:42
right, but what variable stores the factorial?
multiplied out
javielero
@javielero
Aug 06 2015 01:42
you mean the answer?
M Used
@mildused
Aug 06 2015 01:43
sure
what is the variable name?
javielero
@javielero
Aug 06 2015 01:43
answer
M Used
@mildused
Aug 06 2015 01:43
yes
so we return
javielero
@javielero
Aug 06 2015 01:43
answer
M Used
@mildused
Aug 06 2015 01:43
right!
javielero
@javielero
Aug 06 2015 01:43
not num
M Used
@mildused
Aug 06 2015 01:43
yes!
javielero
@javielero
Aug 06 2015 01:43
very good, thank you
M Used
@mildused
Aug 06 2015 01:44
Clean it up and post it here for me to see please
javielero
@javielero
Aug 06 2015 01:44
function factorialize(num) {
 var answer = 1;
  for (var i = num; i >= 1; i--){
    answer *= i;  
  }

  return answer;
}

factorialize(5);
M Used
@mildused
Aug 06 2015 01:45
yeessssss
javielero
@javielero
Aug 06 2015 01:45
i thought we were supposed to used num to return
M Used
@mildused
Aug 06 2015 01:45
I think FCC needs to change that auto generator. You don't have to return the variable you take in, in fact, it's best to not even change the input parameter
javielero
@javielero
Aug 06 2015 01:47
thanks again
i think im in trouble; that was the second bonfire.
lol
M Used
@mildused
Aug 06 2015 01:48
@javielero You'll get the idea!
dc
@dcsan
Aug 06 2015 01:53
hey @javielero you shoudl say
thanks @mildused
CamperBot
@camperbot
Aug 06 2015 01:53
dcsan sends brownie points to @mildused :sparkles: :thumbsup: :sparkles:
:star: 34 | @mildused | http://www.freecodecamp.com/mildused
M Used
@mildused
Aug 06 2015 01:54
@thanks dcsan
oops haha
thanks @dcsan
CamperBot
@camperbot
Aug 06 2015 01:54
mildused sends brownie points to @dcsan :sparkles: :thumbsup: :sparkles:
:star: 32 | @dcsan | http://www.freecodecamp.com/dcsan
Deepanshu Kaushik
@daksh844
Aug 06 2015 01:57
Hello guys
Is any one ready to pair up for coding togethet?
M Used
@mildused
Aug 06 2015 02:00
@daksh844 You need help
Deepanshu Kaushik
@daksh844
Aug 06 2015 02:02
Nope I require a partner, so that I could code more regularly - as currently due to job I'm laggin behind in consistency
M Used
@mildused
Aug 06 2015 02:02
@daksh844 Where are you in the Map?
Deepanshu Kaushik
@daksh844
Aug 06 2015 02:04
@mildused Currently I'm on 4th Chapter of Jquery
M Used
@mildused
Aug 06 2015 02:05
when did you start
Deepanshu Kaushik
@daksh844
Aug 06 2015 02:06
10th of July this year
M Used
@mildused
Aug 06 2015 02:06
Cool
Kameron Robinson
@RobinsonKameron
Aug 06 2015 02:07
sum odd fibs
anyone want to pair
M Used
@mildused
Aug 06 2015 02:07
@RobinsonKameron I'll teach you it, can't pair
Deepanshu Kaushik
@daksh844
Aug 06 2015 02:07
@mildused but i think it's really slow, and want to spead up a bit - so that I could create a some projects before jumping on to javascript
Kameron Robinson
@RobinsonKameron
Aug 06 2015 02:07
Dont need a teacher, thank you though @mildused
Anyone want to pair program,
M Used
@mildused
Aug 06 2015 02:08
@daksh844 What's really slow?
Kameron Robinson
@RobinsonKameron
Aug 06 2015 02:08
that hasnt already dont the sssignment
:)
OOO
Youre right ;) @mildused
Kolloom
@Kolloom
Aug 06 2015 02:39
bonfire seek
CamperBot
@camperbot
Aug 06 2015 02:39

:fire:Bonfire: Seek and Destroy :link:

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

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

You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

Kolloom
@Kolloom
Aug 06 2015 02:41
I'm not sure how i can pack the supposed arguments 2, 3in to a single variable
Lightwaves
@Lightwaves
Aug 06 2015 02:43
@Kolloom you wouldn't you'd use an array
Kolloom
@Kolloom
Aug 06 2015 02:44
thought the [1,2,3,1,2,3] can be accessed with arr[0], and i could do slice
which is not the case
oh wait console.log(arr) only prints [1,2,3,1,2,3]?
Brock Hayes
@brockson007
Aug 06 2015 02:47
can someone check this?
$(document).ready(function(){
    $('.pull-me').eventHandler(.click());
    });
});
Lightwaves
@Lightwaves
Aug 06 2015 02:48
@Kolloom I suggest looking at the arguments object
Kolloom
@Kolloom
Aug 06 2015 02:49
@brockson007 the instruction only tells you to call the click()function when the doc is ready
Brock Hayes
@brockson007
Aug 06 2015 02:51
@Kolloom I don't see the problem
Chocobowings
@chocobowings
Aug 06 2015 02:53

@brockson007

$(document).ready(function()
{
   $(".pull-me").click(); 

    });

your eventHandler is the .click

Brock Hayes
@brockson007
Aug 06 2015 02:54
@chocobowings your a bit late. I just got it before you said something. Thanks for the help though!
:smile:
@Kolloom Thanks for the help
Chocobowings
@chocobowings
Aug 06 2015 02:54
@brockson007 :)
Brock Hayes
@brockson007
Aug 06 2015 02:54
The "duh" moment is real
Kolloom
@Kolloom
Aug 06 2015 03:01
This message was deleted
Kolloom
@Kolloom
Aug 06 2015 03:06

could use some help understanding argument object

function destroyer(arr) {
  return arr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);

so the argument arr only refers to the array in that function call ? I would think the [1, 2, 3, 1, 2, 3], 2, 3 is the argument being called, it would make sense that console.log(arr) would print [1, 2, 3, 1, 2, 3], 2, 3 , but when i do, [1,2,3,1,2,3] is all i get

E-Tank
@E-Tank
Aug 06 2015 03:11
Running through some more Codecademy stuff, and I'm having issues with this code. ```
// Write your code below!
var counter = 1;
var whileLoop = true;
for(i = 0; i < counter; i++){
console.log("This is a for loop.");
}
while(whileLoop = true){
console.log("This is a while loop.");
whileLoop = false;
}
do{
console.log("And this is a Do dohicky.");
}while(counter = 0);
```
Kolloom
@Kolloom
Aug 06 2015 03:12
wiki format
CamperBot
@camperbot
Aug 06 2015 03:12

: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

E-Tank
@E-Tank
Aug 06 2015 03:12
. . .You guys just saw that I did that, right?
Kolloom
@Kolloom
Aug 06 2015 03:13
``` must be on new line
E-Tank
@E-Tank
Aug 06 2015 03:13
// Write your code below!
var counter = 1;
var whileLoop = true;
for(i = 0; i < counter; i++){
 console.log("This is a for loop.");   
}
while(whileLoop = true){
 console.log("This is a while loop.");
  whileLoop = false;
}
do{
    console.log("And this is a Do dohicky.");
}while(counter = 0);
Keeps returning a token {
which I can't find.
Kolloom
@Kolloom
Aug 06 2015 03:14
could you post the link to the course?
that's an infinite loop for some reason
you are assigning whileLoop = true in the while loop
should be while (whileLoop === true)
E-Tank
@E-Tank
Aug 06 2015 03:16
Oh jesus. You're right.
Ugh.
Thank you
Kolloom
@Kolloom
Aug 06 2015 03:17
same goes to counter at the last line
E-Tank
@E-Tank
Aug 06 2015 03:17
Yeah, already fixed that.
Kolloom
@Kolloom
Aug 06 2015 03:17
alright you are good to go!
Jason Healy
@jhealy86
Aug 06 2015 03:35
@Kolloom you can just say while (whileLoop), it'll automatically evaluate it for true or false
for that matter, you could just say while (true) and include a break;, but then you make people mad
Kolloom
@Kolloom
Aug 06 2015 03:36
@jhealy86 oh indeed, thanks for the heads up
1 is evaluated as true right?
Carl Parrish
@carl-parrish
Aug 06 2015 03:38
 var keys =  { a: 1, b: 2 }.keys();
is returning the following error:
TypeError: Object #<Object> has no method 'keys'
I'm not sure how I'm using it wrong. here is the docs. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
So I get that it's saying that there is no keys() method for my object I'm just not sure why it's saying it isn't keys a prototype method for objects?
@Kolloom yes
Kolloom
@Kolloom
Aug 06 2015 03:41
Object.keys({ a:1, b:2})
obj is the input, which resides between parentheses.
Carl Parrish
@carl-parrish
Aug 06 2015 03:43
ah it's literally Object - I was thinking I was suppose to replace the word Object with the object I wanted the keys for
Kolloom
@Kolloom
Aug 06 2015 03:43
also Object.keys(obj) outputs the <b>value</b> of the keys
so assigning it to keys could be quite confusing
Carl Parrish
@carl-parrish
Aug 06 2015 03:44
thanks I might have been looking at that all night.
Kolloom
@Kolloom
Aug 06 2015 03:45
no problem :)
David Taylor
@cornjacket
Aug 06 2015 03:50
hello everyone
Kolloom
@Kolloom
Aug 06 2015 03:50
@cornjacket second time seeing you here!
Sean
@seanr707
Aug 06 2015 03:56
@carl-parrish that is usually the case, the giveaway is AnObject.prototype.blah
then you know to type variable.blah
Nickollas Coelho
@nicoelho
Aug 06 2015 04:01
Hey there! I'm stuck in the challenge 143. I have no idea of which formula should I use.
Feners4
@Feners4
Aug 06 2015 04:06
why is my tab arrow not showing in http://codepen.io/Feners4/pen/EjONEe
Craig McKenna
@craigdmckenna
Aug 06 2015 04:09
It's been 10+ years since I have done much CSS. Then, linking fonts was considered poor practice. Is this no longer the case? Thanks!
Rex Schrader
@SaintPeter
Aug 06 2015 04:11
@CraigMcKenna With HTML 5 and web fonts, it's now pretty widely supported - all of the modern browsers support it.
@CraigMcKenna Moreover, google offers a nice library of excellent fonts ready to use, hosted on their CDNs
Craig McKenna
@craigdmckenna
Aug 06 2015 04:13
Thanks SaintPeter!
Kolloom
@Kolloom
Aug 06 2015 04:14
do i really have to make an object with 20 + pairs for bonfire roman numeral?
CamperBot
@camperbot
Aug 06 2015 04:14
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
M Used
@mildused
Aug 06 2015 04:14
@Feners4 pm me
Tyler Haas
@tylerthehaas
Aug 06 2015 04:26
I’m having problems with the pomodoro clock. when I put the parseInt into the seconds variable it removes the seconds timer from the view. when I take it off it starts counting down from 0. help please!!
function Countdown(options) {
  var timer,
  instance = this,
  seconds = parseInt($('#time').val()),
  updateStatus = options.onUpdateStatus || function () {},
  counterEnd = options.onCounterEnd || function () {};

  function decrementCounter() {
    updateStatus(seconds);
    if (seconds === 0) {
      counterEnd();
      instance.stop();
    }
    seconds--;
  }

  this.start = function () {
    clearInterval(timer);
    timer = 0;
    timer = setInterval(decrementCounter, 1000);
  };

  this.stop = function () {
    clearInterval(timer);
  };
}

var myCounter = new Countdown({
    seconds: this.seconds,
    onUpdateStatus: function(sec){$('.time-left').html(sec)},// callback for each second
    onCounterEnd: function(){ alert('counter ended!');} // final action
});

$('#start').click(function(){
  myCounter.start();
});
Rex Schrader
@SaintPeter
Aug 06 2015 04:30
@haasDev What does $('#time').val() look like? What is the incoming format?
Tyler Haas
@tylerthehaas
Aug 06 2015 04:33
when I do a typeof it comes back as number when I pass it through parseInt but it’s a string prior to that
ahmeddin
@ahmeddin
Aug 06 2015 04:35
anyone done pig latin bonfire...
Rex Schrader
@SaintPeter
Aug 06 2015 04:36
@haasDev I mean is it just like a number? A time string?
@haasDev Is it strictly numeric?
Kolloom
@Kolloom
Aug 06 2015 04:36
@ahmeddin i did
Rex Schrader
@SaintPeter
Aug 06 2015 04:36
@ahmeddin Just ask your question
wiki format
CamperBot
@camperbot
Aug 06 2015 04:36

: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

Tyler Haas
@tylerthehaas
Aug 06 2015 04:36
I think so is there a way to find out?
oh you mean the user input?
Kolloom
@Kolloom
Aug 06 2015 04:38
I only done one bonfire today, I feel terrible being unproductive.
Rex Schrader
@SaintPeter
Aug 06 2015 04:38
@haasDev Yeah
Tyler Haas
@tylerthehaas
Aug 06 2015 04:40
yeah just a number
Rex Schrader
@SaintPeter
Aug 06 2015 04:41
@haasDev Are you expecting it to be minutes or seconds?
Tyler Haas
@tylerthehaas
Aug 06 2015 04:42
minutes but I’m not worried about that right now I will be doing some conversion later once I can get the countdown working correctly
It’ll work good if I hardcode the time into the seconds variable
Rex Schrader
@SaintPeter
Aug 06 2015 04:43
@haasDev Why not:
timer = setInterval(this.decrementCounter, 1000);
I'm a little confused that you have a mix of sort of objects and functions
@haasDev Did you mean to define decrementCounter as a member function of the countdown object?
ahmeddin
@ahmeddin
Aug 06 2015 04:44
i donno anything that i can do with this bonfire...pig latin
or i could think of..
Rex Schrader
@SaintPeter
Aug 06 2015 04:45
@ahmeddin So you're not even sure where to begin?
bonfire pig
CamperBot
@camperbot
Aug 06 2015 04:45

:fire:Bonfire: Pig Latin :link:

function translate(str) {
 return str;
}

translate("consonant");

Translate the provided string to pig latin.
<a href="http://en.wikipedia.org/wiki/Pig_Latin">Pig Latin</a> takes the first consonant (or consonant cluster) of an English word, moves it to the end of the word and suffixes an "ay".
If a word begins with a vowel you just add "way" to the end.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

ahmeddin
@ahmeddin
Aug 06 2015 04:45
like i wanted an indexOf method, that would return first instance of a,e,i,o,u .........
Rex Schrader
@SaintPeter
Aug 06 2015 04:46
@ahmeddin It may be easier to deal with it on a per-word basis.
@ahmeddin and a regular expresision is ideal for determining if something starts with a vowel.
ahmeddin
@ahmeddin
Aug 06 2015 04:46
or i will have to do indexOf for each vovel...
vowel*
Rex Schrader
@SaintPeter
Aug 06 2015 04:47
But it's only starting vowels you need to worry about
Remember that you can also invert a regular expression to say "not a vowel"
ahmeddin
@ahmeddin
Aug 06 2015 04:47
i dont know which vowel is starting vowel...
Tyler Haas
@tylerthehaas
Aug 06 2015 04:47
@SaintPeter yes that is what I am doing. Is there a better way?
Rex Schrader
@SaintPeter
Aug 06 2015 04:48
@haasDev What you are doing is fine . . . but you are not being consistent. Do:
this.decrementCounter = function() {
/* . . .  */
}
I gotta get
Sorry folks
TTYL
Woolwit
@Woolwit
Aug 06 2015 04:49
@Kolloom Just passing through before getting to work but saw your question about the argument object. I had the same question and got some help from @kmiasko It is confusing!
function d1(arr) { console.log(arr); }
function d2(arr) { console.log(arguments); }
function d3(arr, a, b) { console.log(arr, a, b); }

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

d2([1, 2, 3, 1, 2, 3], 2, 3);
[Array[6], 2, 3]

d3([1, 2, 3, 1, 2, 3], 2, 3);
[1, 2, 3, 1, 2, 3] 2 3
Tyler Haas
@tylerthehaas
Aug 06 2015 04:53
anyone else have an idea what I should do about my parseInt problem?
Ray McMahan
@arxene
Aug 06 2015 04:59
@haasDev What was the value of $('#time').val() ? As you mentioned, there's something wrong with the seconds so I'd guess either the value of $('#time').val() is invalid for parseInt() or parseInt() isn't being called correctly.
Kolloom
@Kolloom
Aug 06 2015 05:01
@Woolwit that's very helpful, thankyou!
Paul Dynowski
@pdynowski
Aug 06 2015 05:34
so, I'm working on the random quote zipline. i've got basic formatting, and my button seems to work - i just can't figure out what I'm supposed to run the query for the quotes on.
Tyler Haas
@tylerthehaas
Aug 06 2015 05:34
@arxene well the .val() call returns the number entered but the myCounter.seconds property returns undefined. The codepen is found at http://codepen.io/haasDev/pen/LVMmBL?editors=101
Paul Dynowski
@pdynowski
Aug 06 2015 05:36
and it is definitely possible that i'm missing something super-simple. probably even likely.
Tyler Haas
@tylerthehaas
Aug 06 2015 05:37
@pdynowski are you asking where to get the quote data?
Paul Dynowski
@pdynowski
Aug 06 2015 05:38
@haasDev yup
unless figuring that out is part of the puzzle i'm supposed to solve
Franky
@Coder1988
Aug 06 2015 05:41
waypoint Creating a slots machine
Tyler Haas
@tylerthehaas
Aug 06 2015 05:42
you’re supposed to use some sort of api to bring in the quotes
anyone know why myCounter.seconds returns undefined?
amwakatsuki
@amwakatsuki
Aug 06 2015 05:58

I'm stuck on Bonfire: Title Case a Sentence. I can't figure what I'm missing in my code
function titleCase(str) {
str=str.toLowerCase().split(' ');
var newString='';
var word = [];
for (var i=0; i< word.length; i++) {
word[i]=word[i].charAt(0).toUpperCase() + word[i].substr(1);
}
newString= word.join('');
return newString;
}

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

CamperBot
@camperbot
Aug 06 2015 05:58
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Bill
@kirah1314
Aug 06 2015 06:00
@amwakatsuki can you use ``` before and after your codes?
dc
@dcsan
Aug 06 2015 06:01
Explain forma
CamperBot
@camperbot
Aug 06 2015 06:01

: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

amwakatsuki
@amwakatsuki
Aug 06 2015 06:02
Let's try this again.
function titleCase(str) {
  str=str.toLowerCase().split(' ');
  var newString='';
  var word = [];
  for (var i=0; i< word.length; i++) {
     word[i]=word[i].charAt(0).toUpperCase() + word[i].substr(1);
  }
  newString= word.join('');
  return newString;
} 

titleCase("I'm a little tea pot");
Bill
@kirah1314
Aug 06 2015 06:04
@amwakatsuki your word returns [] and word[i] returns undefined
amwakatsuki
@amwakatsuki
Aug 06 2015 06:06
@kirah1314 what exactly does that mean? I'm new to coding and still learning a lot.
Bill
@kirah1314
Aug 06 2015 06:07
@kirah1314 charAt() works on strings but you declared word as a blank array using []
oops @amwakatsuki
Woolwit
@Woolwit
Aug 06 2015 06:09
@amwakatsuki I'm new to this myself, but I'd be lost without this tool... I just loaded your code in. You can step through and see the results step by step. Right now it's set up for us to pair, but only chat. Check it out... http://pythontutor.com/visualize.html#togetherjs=T2yU1qPuIp
amwakatsuki
@amwakatsuki
Aug 06 2015 06:10
@kirah1314 thanks. I'll look into fixing it.
Bill
@kirah1314
Aug 06 2015 06:11
@amwakatsuki you can use word = str.toLowerCase().split(' ');
Bill
@kirah1314
Aug 06 2015 06:16
n/m then you can't use word with charAt(). Basically you want to use charAt() with a string, and your only string is newString or you create another one
Bill
@kirah1314
Aug 06 2015 06:22
@amwakatsuki paste your new codes if you still need some help :thumbsup:
Seth
@itzsaga
Aug 06 2015 06:23
@amwakatsuki you can use RegExp to get it done with a lot less code. Don't want to throw you off your current path though.
utilize .replace
amwakatsuki
@amwakatsuki
Aug 06 2015 06:40
@Woolwit thanks for the help also thanks to @kirah1314
Woolwit
@Woolwit
Aug 06 2015 06:41
Hey @amwakatsuki that was fun. Glad I could help. I think we could have had even more people in there. Ciao for now.
Siddharth Gupta
@sidgupta234
Aug 06 2015 06:41
Could anyone give me the link to Linux pair programming gitter/!
Matt Huijsse
@mistamadd001
Aug 06 2015 06:44
@sidgupta234 the one I use is https://gitter.im/FreeCodeCamp/TeamViewer
Matthew Barber
@Honno
Aug 06 2015 06:44
Hey guys, just wondering, is this an effecient solution?
function diff(arr1, arr2) {
  var newArr = [];
  this.comparison = function(arrTest1, arrTest2) {
    for(i = 0; i < arrTest1.length; i++) {
      if(arrTest2.indexOf(arrTest1[i]) === -1) {
        newArr.push(arrTest1[i]);
      }
    }
  };
  comparison(arr1, arr2);
  comparison(arr2, arr1);
  return newArr;
}

diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
my first one was this http://pastebin.com/b3i0qDtf
wanted to do it again to make it better
but feel like there's still redundancy compared to other options
for bonfire difference of two arrays
Bill
@kirah1314
Aug 06 2015 06:48
@Honno , here's what I used for reference:
function diff(arr1, arr2) {

  var newArr = arr1.concat(arr2);

  return newArr.filter(function(filtered) { 

    return arr1.indexOf(filtered) < 0 || arr2.indexOf(filtered) < 0;  

  });
}
diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
Matthew Barber
@Honno
Aug 06 2015 06:48
thanks @kirah1314, that looks much better, gunna try and unerstand it
CamperBot
@camperbot
Aug 06 2015 06:48
honno sends brownie points to @kirah1314 :sparkles: :thumbsup: :sparkles:
:star: 93 | @kirah1314 | http://www.freecodecamp.com/kirah1314
Matthew Barber
@Honno
Aug 06 2015 06:49
brownie points lol?
thanks @Honno
CamperBot
@camperbot
Aug 06 2015 06:49
honno sends brownie points to @haasdev :sparkles: :thumbsup: :sparkles:
Matthew Barber
@Honno
Aug 06 2015 06:49
whoops
ah yes @kirah1314, simple now, I get it, ty!
Bill
@kirah1314
Aug 06 2015 06:50
@Honno you're welcome, any time!
George Tsoukatos
@Gts0uk
Aug 06 2015 07:43
any help with Largest Numbers in Arrays bonfire ?
Bill
@kirah1314
Aug 06 2015 07:44
@Gts0uk sure, what do you need help with?
George Tsoukatos
@Gts0uk
Aug 06 2015 07:46
This message was deleted
This message was deleted
This message was deleted
wiki code format
CamperBot
@camperbot
Aug 06 2015 07:46

: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

George Tsoukatos
@Gts0uk
Aug 06 2015 07:46
function largestOfFour(arr) {
   var largest = [];

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

    for (var j=0; j<big; j++) {

      if (arr[j]>arr.length){
          largest = arr[j];      
    }

    }
     return largest;
  }

}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Bill
@kirah1314
Aug 06 2015 07:48
@Gts0uk can you share what you're having issues with?
George Tsoukatos
@Gts0uk
Aug 06 2015 07:48
It's above
George Tsoukatos
@Gts0uk
Aug 06 2015 07:54
any help ?
Nepherius
@Nepherius
Aug 06 2015 07:54
 if (arr[j]>arr.length){
          largest = arr[j];      
    }
this looks odd
George Tsoukatos
@Gts0uk
Aug 06 2015 07:54
ok
fair enough
Nepherius
@Nepherius
Aug 06 2015 07:58
function largestOfFour(arr) {
    for (var i = 0; i < arr.length; i++) {
        var highest = 0;
        for (var j = 0; j < 4; j++) {
            current = arr[i][j];
            if (current > highest) {
                highest = current;
            }
        }
        arr[i] = highest;
    }
    return arr;
}
What I used.
George Tsoukatos
@Gts0uk
Aug 06 2015 08:01
hmmm
I was so close
shouldn't be var highest = [] ;
instead of 0 ?
Nepherius
@Nepherius
Aug 06 2015 08:19
no, you are returning highest number not an array
George Tsoukatos
@Gts0uk
Aug 06 2015 08:21
@Nepherius Ok I see! Thanks for your help :clap:
Nepherius
@Nepherius
Aug 06 2015 08:21
yw
Lawrence Jacob Siebert
@gryftir
Aug 06 2015 08:29
is there a linux compatible program for pair programming? Screen Hero seems to only be for Windows and Macs
Aniruddh Agarwal
@anrddh
Aug 06 2015 08:42
Guys
David Suilea
@Foryah
Aug 06 2015 08:42
@gryftir FreeCodeCamp/TeamViewer is a room for Linux users who wanna pair using TeamViewer or other Linunx technologies
Aniruddh Agarwal
@anrddh
Aug 06 2015 08:42
How do you determine the most valuable move for tic tac toe(minimax algorithm)
Anyone?
David Suilea
@Foryah
Aug 06 2015 08:46
@awesomeaniruddh Well, google MinMax Algorithm... Watch a video, there is a MIT Video Course explaining the algorithm... I don't think anybody has the time to write an article explaining how the algorithm works...
Jorge Almeida
@Jorgixhallo
Aug 06 2015 08:47
@awesomeaniruddh check private chat
ctcrnitv
@ctcrnitv
Aug 06 2015 09:28
I just did “Validate US phone numbers”, what is a better way to solve
function telephoneCheck(str) {
  var pattern = /1?\s?\(?\d{3}[\)]?[\s-]?\d{3}[\s-]?\d{4}/g;
  return(str.match(pattern) !== null && str.match(pattern).join() === str);
}
Matthew Barber
@Honno
Aug 06 2015 09:29
bonfire
CamperBot
@camperbot
Aug 06 2015 09:29
we're talking about bonfire :fire: Bonfire: Chunky Monkey
Matthew Barber
@Honno
Aug 06 2015 09:29
bonfire roman
CamperBot
@camperbot
Aug 06 2015 09:29

:fire:Bonfire: Roman Numeral Converter :link:

function convert(num) {
 return num;
}

convert(36);

Convert the given number into a roman numeral.
All <a href="http://www.mathsisfun.com/roman-numerals.html">roman numerals</a> answers should be provided in upper-case.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

Matthew Barber
@Honno
Aug 06 2015 09:29
how do I get into a bonfire chat?
bf links
Matthew Barber
@Honno
Aug 06 2015 09:29
ho
bf spoiler
CamperBot
@camperbot
Aug 06 2015 09:30
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
ctcrnitv
@ctcrnitv
Aug 06 2015 09:31
bf details
CamperBot
@camperbot
Aug 06 2015 09:31

:fire:Bonfire: Roman Numeral Converter :link:

function convert(num) {
 return num;
}

convert(36);
Convert the given number into a roman numeral.
All <a href="http://www.mathsisfun.com/roman-numerals.html">roman numerals</a> answers should be provided in upper-case.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
ctcrnitv
@ctcrnitv
Aug 06 2015 09:31
just one at a time?
nm going to bed
DjCrayJ
@DjCrayJ
Aug 06 2015 09:59
need help with mobile responsive image need to know how to create one
dormouss
@dormouss
Aug 06 2015 10:57
Hi folks. I'm working through the JavaScript Object Oriented lessons. A question about classes. What is the advantage of extending the prototype of the class over re-defining the class declaration?
DjCrayJ
@DjCrayJ
Aug 06 2015 11:06
how do i do this in the mobile response image Add a second image with the src of http://bit.ly/fcc-kittens2
ahmeddin
@ahmeddin
Aug 06 2015 11:08
hi
DjCrayJ
@DjCrayJ
Aug 06 2015 11:08
hi
ahmeddin
@ahmeddin
Aug 06 2015 11:08
FCC
can anyone help me in understanding the DNA pairing problem
Prashanth Chandra
@prashcr
Aug 06 2015 12:13

I have a line of ES6 Node.js that's a bit too long

res.on('end', () => fs.writeFile(encodeURIComponent(url), data.read(), () => console.log(url)));

How should I refactor this into a couple of shorter lines?

KieronDowie
@KieronDowie
Aug 06 2015 12:26
I'm on Bonfire Roman Numeral Converter. I don't see what I'm supposed to use Array.splice, indexOf and join for, any hints?
Matthew Barber
@Honno
Aug 06 2015 12:36
@KieronDowie I didn't use em heh
function convert(num) {
  var arrRoman = [];
  var romanBases = ["I", "X", "C", "M"];
  var romanHalves = ["V", "L", "D"];
  var numArray = num.toString(10).split("").map(Number).reverse();
  console.log(numArray);
  for(i = 0; i < numArray.length; i++) {
    var int = numArray[i];
    console.log(int);
    var value = "";
    if(int < 4) {
      for(j = 1; j <= int; j++) {
        value += romanBases[i];
      }
    } else if(int === 4) {
      value = romanBases[i] + romanHalves[i];
    } else if(int === 5) {
      value = romanHalves[i];
    } else if(int === 6) {
      value = romanHalves[i] + romanBases[i];
    } else if(int === 9) {
      value = romanBases[i] + romanBases[i + 1];
    } else if (5 > int < 9) {
      value = romanHalves[i] + (int - 5) * romanBases[i];
    }
    console.log(value);
    arrRoman.push(value);
  }
  var valRoman = arrRoman.reverse().join("");
  console.log(valRoman);
  return valRoman;
}

convert(36);
and I probably should of to make it more clean? xD
Ross Kaffenberger
@rossta
Aug 06 2015 12:42
@ahmeddin what are you having trouble with?
Ozy Design & Software
@OzySky
Aug 06 2015 12:45

Bonfire: Make a Person

var Person = function(firstAndLast) {
    this.fullName = firstAndLast;
    divided = firstAndLast.split(" ")
    this.first = divided[0]
    this.last = divided[1]
};

Person.prototype.setFirstName = function(first){this.first = first};
Person.prototype.getFirstName = function(){return this.first};

Person.prototype.setLastName = function(last){this.last = last};
Person.prototype.getLastName = function(){return this.last};

Person.prototype.setFullName = function(firstAndLast){this.fullName = firstAndLast};
Person.prototype.getFullName = function(){return this.fullName};

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

any idea why it returns
expect(Object.keys(bob).length).to.eql(6);expected 3 to deeply equal 6?

CamperBot
@camperbot
Aug 06 2015 12:45
Sorry, can't find a bonfire called make a personvar person functionfirstandlast thisfullname firstandlast divided firstandlastsplit thisfirst divided0 thislast divided1personprototypesetfirstname functionfirstthisfirst firstpersonprototypegetfirstname functionreturn thisfirstpersonprototypesetlastname functionlastthislast lastpersonprototypegetlastname functionreturn thislastpersonprototypesetfullname functionfirstandlastthisfullname firstandlastpersonprototypegetfullname functionreturn thisfullnamevar bob new personbob rossbobgetfullnameany idea why it returns expectobjectkeysboblengthtoeql6expected 3 to deeply equal 6. [ Check the map? ]
Matthew Barber
@Honno
Aug 06 2015 12:45
Oh @ahmeddin, I just did that, basically GCG will have to convert to [[GC], [CG], [GC]]
wasted an hour with it, didn't know what it actually wanted til I saw the errors down below haha
Jason Wood
@catapixel
Aug 06 2015 12:58
@ozydesign Your building on Person.prototype and the test is looking for you to build on Person
jordanelizaga
@jordanelizaga
Aug 06 2015 12:59
Hello, I am trying to write a regular javascript sentence cityName = cityName.replace(re,"%20");
in jquery but I get the error Uncaught TypeError: Cannot read property 'replace' of undefined. Help please?
Jason Wood
@catapixel
Aug 06 2015 13:02
There's a new room for giving and receiving constructive feedback from your fellow campers on Bonfires Solutions, Zipline apps and Basejump apps. It's called FreeCodeCamp/CodeReview (https://gitter.im/freecodecamp/CodeReview). Let's get it active.
Ross Kaffenberger
@rossta
Aug 06 2015 13:02
@ozydesign I believe that test is failing because it wants you to set the functions on this in the constructor (and not the first, last, full vars)
since you’re setting the functions on the prototype, they won’t be counted in the Object.keys(bob) check
Joris Labie
@labiej
Aug 06 2015 13:17
Where should I report errors related to the express.js waypoint?
Tahmid Zahin
@Zahin-10
Aug 06 2015 13:34
Imgur
can anyone tell me whats wrong with it
??
it's still showing cross
EphemeralArchitect
@EphemeralArchitect
Aug 06 2015 13:35
Can anyone recommend any good books to start reading once one has completed all of the FreeCodeCamp lessons?
Tahmid Zahin
@Zahin-10
Aug 06 2015 13:41
???
Ozy Design & Software
@OzySky
Aug 06 2015 13:43
var Person = function(firstAndLast) { 
    this.setFirstName = function(first){this.first = first};
    this.getFirstName = function(){return this.first};
    this.setLastName = function(last){this.last = last};
    this.getLastName = function(){return this.last};
    this.setFullName = function(firstAndLast){this.fullName = firstAndLast};
    this.getFullName = function(){return this.fullName};

};


var bob = new Person('Bob Ross');
bob.getFullName();
can anybody help me? (bonfire make a person)
Alyona Aganina
@AganyOK
Aug 06 2015 13:43
@Zahin-10 "cclass"
Tahmid Zahin
@Zahin-10
Aug 06 2015 13:46
oh god :P
how did i miss it
thnks btw :)
@AganyOK
Alyona Aganina
@AganyOK
Aug 06 2015 13:47
;)
justindobbs
@justindobbs
Aug 06 2015 14:12
@ozydesign you can also check if their are arguments...
i mean there
Ozy Design & Software
@OzySky
Aug 06 2015 14:14
but when i do that it shows 7 instead of six keys
justindobbs
@justindobbs
Aug 06 2015 14:18
@ozydesign you can do something like this: return this.firstName ? this.firstName : firstAndLast.split(" ")[0];
JMitnik
@JMitnik
Aug 06 2015 14:18
Hey guys, any recommended API for weather besides wunderground?
Aniruddh Agarwal
@anrddh
Aug 06 2015 14:18
openweathermap
JMitnik
@JMitnik
Aug 06 2015 14:19
@awesomeaniruddh thanks!
justindobbs
@justindobbs
Aug 06 2015 14:21
how to get out of comment mode
kineticdreams
@kineticdreams
Aug 06 2015 14:59
Hello!
devwillpatterson
@devwillpatterson
Aug 06 2015 15:00
is there someone here i could pm a quick question about
kineticdreams
@kineticdreams
Aug 06 2015 15:00
Does anyone have any idea why this code wouldn't pass:
function palindrome(str) {
  str = str.replace(/\,|\.|\s/g, '').toLowerCase();
  if(str.length <=1){
      return true;
  } else if(str.slice(0,1) === str.slice(-1)){
      str = str.slice(1, -1);
  } else {
      return false;
  }
  palindrome(str);
}


palindrome("eye");
Santiago Melo
@smeloa
Aug 06 2015 15:19

Can anyone help me with the Bonfire Make a Person. Current code looks like:

var Person = function(firstAndLast) {

  var firstName = firstAndLast.split(' ')[0];
  var lastName = firstAndLast.split(' ')[1];


  this.setFirstName = function(firstAndLast) { 
    firstName = firstAndLast.split(' ')[0];
    return firstName;
  };

  this.setLastName = function(FirstAndLast) { 
    lastName = firstAndLast.split(' ')[1];
    return lastName;
  };

  this.setFullName = function(firstAndLast) {
      return firstName + ' ' + lastName;
  };

  this.getFullName = function(firstAndLast) {
    return firstName + ' ' + lastName;
  };

  this.getFirstName = function() { 
    return firstName;
  };

  this.getLastName = function() { 
    return lastName;
  };


};

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

Currently these are the only two tests I am failing:

expect(bob.getLastName()).to.eql('Trees');expected 'Ross' to deeply equal 'Trees'
expect(bob.getFullName()).to.eql('George Carlin');expected 'Happy Ross' to deeply equal 'George Carlin'
CamperBot
@camperbot
Aug 06 2015 15:19
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
George Tsoukatos
@Gts0uk
Aug 06 2015 15:23
bonfire make a person
CamperBot
@camperbot
Aug 06 2015 15:23
Sorry, can't find a bonfire called make a person. [ Check the map? ]
George Tsoukatos
@Gts0uk
Aug 06 2015 15:23
bonfire Make a Person
CamperBot
@camperbot
Aug 06 2015 15:23
Sorry, can't find a bonfire called make a person. [ Check the map? ]
George Tsoukatos
@Gts0uk
Aug 06 2015 15:23
w/e camperbot
Moisés Man
@moigithub
Aug 06 2015 15:23
lol
Santiago Melo
@smeloa
Aug 06 2015 15:24
@moigithub can you help me?
Lightwaves
@Lightwaves
Aug 06 2015 15:30
Be nice to camperbot.
He's only trying to be a helpful little automation
Moisés Man
@moigithub
Aug 06 2015 15:30
en esa "clase" persona.. trabaja con 2 variables privadas (firstName y lastName)
tus SETters (guardar/asignar valor )
y GETters (recuperar/devolver valor )
deben trabajar con esas variables....
los getters no necesitan argumetos
y los Setters "normalmente" tienen 1 argumento, que tiene referencia al dato con el q van a trabajar.. ejemplo
var edad = 0;
this.guardaEdad = function(miEdad) { // setter, guarda dato en la variable edad
  edad = miEdad;
}
this.cualEsMiEdad = function() {  //getter, devuelve el dato que tiene la variable edad
   return edad;
}
Lightwaves
@Lightwaves
Aug 06 2015 15:31
Wow nice explaination in spanish
Moisés Man
@moigithub
Aug 06 2015 15:37
@smeloa en el caso del "nombre completo" este tiene 1 solo argumento "nombre apellido"
en el setter tendras que separar el nombre del apellido.. y asignar cada parte a su correspondiente variable....
y para el getter del "nombre completo" tendras q "agarrar" esas 2 variables.. y devolverlos como si fuesen 1 sola cadena (unirlos ) resultando "nombre apellido"
DTing
@dting
Aug 06 2015 15:39
@smeloa your setFullName function just returns the full name
Feners4
@Feners4
Aug 06 2015 15:41
@moigithub hey can you help me out with why my tab arrow wont work in http://codepen.io/Feners4/pen/EjONEe
DjCrayJ
@DjCrayJ
Aug 06 2015 15:48
Hello World
CamperBot
@camperbot
Aug 06 2015 15:48

welcome to FreeCodeCamp @DjCrayJ!

DjCrayJ
@DjCrayJ
Aug 06 2015 15:49
i need help
Sharon
@acodeinprogress
Aug 06 2015 16:13
@DjCrayJ What do you need help with?
DjCrayJ
@DjCrayJ
Aug 06 2015 16:13
they waypoint mobile responsive images
the not they
Lindell C. Bailey
@SamusBailey
Aug 06 2015 16:15
oh
Sharon
@acodeinprogress
Aug 06 2015 16:15
what's the problem you're having?
Jason Wood
@catapixel
Aug 06 2015 16:15
Does anyone have thoughts on using the "new technology" parts of the ECMAScript 2015 (ES6) standard in our solutions? For example, when writing a solution to repeat a string would you feel using String.prototype.repeat() to be legitimate or would you feel you should solve it in another way?
Lindell C. Bailey
@SamusBailey
Aug 06 2015 16:15
@DJ is this pertaining to the twitter bootstrap intro
DjCrayJ
@DjCrayJ
Aug 06 2015 16:15
like knowing how to do it
Lindell C. Bailey
@SamusBailey
Aug 06 2015 16:16
ok
@DjCrayJ DJ go ahead and anywhere on your editor under the ol list you crated earlier
put a new img tag
then in the src which is called the "source" i think
Put this equal to src http://bit.ly/fcc-kittens2
<img src=http://bit-ly/fcc-kittens2 />
thats what it should look like but please
src='....'
put single quotes around the link
M Used
@mildused
Aug 06 2015 16:20
@catapixel
'Hello'.repeat(3)
Lindell C. Bailey
@SamusBailey
Aug 06 2015 16:21
then add a class tag
Jason Wood
@catapixel
Aug 06 2015 16:21
@mildused Yes. Legit or no since it may not be supported by some browsers?
Moisés Man
@moigithub
Aug 06 2015 16:21

@Feners4 i dont understand SCSS.. but if u want a tab indicator.. u can do something like this

.activeMenu {
  border-bottom: 10px solid $red;
}

NO nested

DjCrayJ
@DjCrayJ
Aug 06 2015 16:22
ok i figured it out i just had to settle down and backtrace a lil bit
Lindell C. Bailey
@SamusBailey
Aug 06 2015 16:22
<img  src='put link here <3' class='img-responsive' />
sorry im trying to respond in a timely manner but im terrible with the keyboard i have to use today not at home :cactus:
M Used
@mildused
Aug 06 2015 16:23
@catapixel It's only supported in Chrome and Firefox. you'll get the majority, but to stick it safe, I would just write a simple loop
Lindell C. Bailey
@SamusBailey
Aug 06 2015 16:23
@DjCrayJ Oh Yeah :DDDDDD Noice m8t s0 pr0ud <3
Ozy Design & Software
@OzySky
Aug 06 2015 16:23
@catapixel i think it's a good idea, at least having as an alternative solution or maybe a different track altogther
Feners4
@Feners4
Aug 06 2015 16:24
@moigithub thats all I needed, thanks! I can now build with this..
Lindell C. Bailey
@SamusBailey
Aug 06 2015 16:24
@DjCrayJ we should be M80's xD ^_^
Jason Wood
@catapixel
Aug 06 2015 16:25
@mildused @ozydesign I already did it with a loop but .repeat(num) is just soooo much cleaner I felt like I might be cheating.
DjCrayJ
@DjCrayJ
Aug 06 2015 16:25
M80's?
Caroline Dikibo
@cdikibo
Aug 06 2015 16:27
I need help with bonfire #29 Spinal Tap Case
function spinalCase(str) {
  // "It's such a fine line between stupid, and clever."
  // --David St. Hubbins
str = str.toLowerCase();  
for(i=0; i<str.length; i++){
    if(str[i]===" "){
        return(str.replace(" ", "-"));
    }
}

}

spinalCase('This Is Spinal Tap');
Ozy Design & Software
@OzySky
Aug 06 2015 16:27
This message was deleted
CamperBot
@camperbot
Aug 06 2015 16:27
Sorry, can't find a bonfire called map the debris. [ Check the map? ]
Ozy Design & Software
@OzySky
Aug 06 2015 16:27
This message was deleted
CamperBot
@camperbot
Aug 06 2015 16:27
Sorry, can't find a bonfire called map the debris. [ Check the map? ]
Lindell C. Bailey
@SamusBailey
Aug 06 2015 16:28
lol M80's = Matty's so...:) think like a pirate would when address by another ship mate(m8t) .... aye matty but like your saying M and then Eighty , but with an s added so... put together we get M-Eighty's lol <3 @DjCrayJ
addressed :/
@cdikibo i saw someone last night who had the same bonfire# activity and they completed it but im not there yet i wish i could help
DjCrayJ
@DjCrayJ
Aug 06 2015 16:32
Lol
KieronDowie
@KieronDowie
Aug 06 2015 16:33
Hey, I'm doing Bonfire Convery HTML entities, and I can't see what I'm doing wrong? I'm getting this:
should escape characters: expected 'Dolce & Gabbana' to equal 'Dolce & Gabbana'
M Used
@mildused
Aug 06 2015 16:34
@KieronDowie Code would help
Moisés Man
@moigithub
Aug 06 2015 16:34
& should be &amp;
google for others html entities code...
Lindell C. Bailey
@SamusBailey
Aug 06 2015 16:34
@cdikibo HEY STILL NEED HELP :D
can help you @cdikibo
KieronDowie
@KieronDowie
Aug 06 2015 16:34
function convert(str) {
  str=str.replace("&","&amp");
  str=str.replace("<","&lt");
  str=str.replace(">","&gt");
  str=str.replace(/'/,"&apos");
  str=str.replace(/"/,"&quot");
  return str;
}
Moisés Man
@moigithub
Aug 06 2015 16:35
missing ; semicolon
Jason Wood
@catapixel
Aug 06 2015 16:35
@KieronDowie you've dropped the trailing semi-colon on your entities
KieronDowie
@KieronDowie
Aug 06 2015 16:35
@catapixel Ah, thanks a lot! :)
Ozy Design & Software
@OzySky
Aug 06 2015 16:37
@KieronDowie I fell there as well :smile:
@KieronDowie drove me crazy for like an hour!
KieronDowie
@KieronDowie
Aug 06 2015 16:38
@ozydesign Hey, glad to know I'm not alone. ^^
Moisés Man
@moigithub
Aug 06 2015 16:43
@cdikibo looks like u trying to replace all spaces for "-"
for(i=0; i<str.length; i++){
    if(str[i]===" "){
        return(str.replace(" ", "-"));
    }
}
JMitnik
@JMitnik
Aug 06 2015 16:47
function getLocation(){
  var arr=[];
  $.ajax({
    async: false,
    url:"//freegeoip.net/json/",
    type:"POST",
    dataType:"jsonp",
    success:function(location){
       arr.push(location.city);
    }
  });
  console.log(arr);
}
I don't understand: according console.log, my arr is empty. Yet, I set async to false. Why is it still empty then?
Moisés Man
@moigithub
Aug 06 2015 16:47
@cdikibo BUT.. if u return inside the loop.. it will exit ur loop and only do 1 replace
an easier way to replace all will be using regex with the "g" flag (no need loops)
str.replace(/a/g, "@") <--- will replace all "a" for "@"
@JMitnik add http: to ur url
M Used
@mildused
Aug 06 2015 16:49
@JMitnik have you tried $.getJSON
JMitnik
@JMitnik
Aug 06 2015 16:51
@mildused, I am now
```
function getLocation(){
  var arr=[];
  $.getJSON("https://freegeoip.net/json/",function(json){
    arr.push(json.city);
  });
  console.log(arr);
}
still empty array thoguh
M Used
@mildused
Aug 06 2015 16:52
You have to add ?callback=? to the end of the url
Moisés Man
@moigithub
Aug 06 2015 16:52
IF u use getJSON.. to make a jsonp request u neeed to add to ur URL "?callback=?"
JMitnik
@JMitnik
Aug 06 2015 16:53
(the url already worked though, if I log json.city, it will show me my city)
Just added ?callback=?, no difference
Once I want to push it to my array though, nothing happens
Moisés Man
@moigithub
Aug 06 2015 16:53
thats used for cross site request
DjCrayJ
@DjCrayJ
Aug 06 2015 16:53
What does the closing tag for div look like
M Used
@mildused
Aug 06 2015 16:53
try console.log json inside the loop
JMitnik
@JMitnik
Aug 06 2015 16:54
console.log json works inside the $.getjson
M Used
@mildused
Aug 06 2015 16:54
I usually put everything inside my json callbacks
it's a scope thing
JMitnik
@JMitnik
Aug 06 2015 16:54
I thought so yeah
Moisés Man
@moigithub
Aug 06 2015 16:55
asynchronous behavior
JMitnik
@JMitnik
Aug 06 2015 16:55
I want to use the location I got from there in other functions, would you say I should put everything in that function then?
so link everything related to my location in that function?
M Used
@mildused
Aug 06 2015 16:55
yeah
Moisés Man
@moigithub
Aug 06 2015 16:55
u send a request.. and server takes whatever time it need to (u cant control it ) and return data whenever it need to...
JMitnik
@JMitnik
Aug 06 2015 16:56
Yeah, I know
That's why I thought it would work if Async was set to false in jqeury.ajax()
Too bad, wish there was a good way to return value after API call
Thanks anyway guys !
M Used
@mildused
Aug 06 2015 16:57
Someone invite me to ScreenHero?
Brian Clark
@Zap2025
Aug 06 2015 16:58
@cdikibo are you still stuck on #29?
Filipe Oliveira
@fmoliveira
Aug 06 2015 17:02
@JMitnik if you want to do synchronous ajax, you've got to do something more than just setting the async parameter to false
@JMitnik take a look at an example here http://stackoverflow.com/a/6685294/2401947
@JMitnik though I recommend that you get familiar with javascript callbacks, as you'll use them a lot when you're in Node.js lessons
JMitnik
@JMitnik
Aug 06 2015 17:04
@fmoliveira Gotcha, thanks! I admit, still not very comfortable with javascript callbacks, so I should practice them more
Filipe Oliveira
@fmoliveira
Aug 06 2015 17:04
@JMitnik the function passed as parameter to jquery.ajax() is a callback function, and it's guaranteed that the function will be run exactly after the GET method finishes successfully. you can add an error callback function to, that would be caught when the GET fails for any reason (connection to the internet or website is offline)
@JMitnik yes it's common to feel a little bit confused with the callback model, but if you get comfortable with it sooner, it'll be easier for you to get used to Node.js :)
Javed
@JayBee007
Aug 06 2015 17:11
function translate(str) {
    var vowels = ["a","i","e","o","u"];
        for(var i = 0;i<vowels.length;i++){
            if(str.charAt(0) === vowels[i]){
                return str.charAt(0);
            }else{
                return "Nothing";
            }

        }

}

translate("eight");
why it always runs the else block...even if the starting letter is a vowel...
DTing
@dting
Aug 06 2015 17:39
@JayBee007 you are returning out of the function. If the first vowel isnt equal to the charAt 0
javielero
@javielero
Aug 06 2015 17:40
bonfire Check for Palindromes
CamperBot
@camperbot
Aug 06 2015 17:40

:fire:Bonfire: Check for Palindromes :link:

function palindrome(str) {
  // Good luck!
  return true;
}



palindrome("eye");

Return true if the given string is a palindrome. Otherwise, return false.
A palindrome is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing.
You'll need to remove punctuation and turn everything lower case in order to check for palindromes.
We'll pass strings with varying formats, such as "racecar", "RaceCar", and "race CAR" among others.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

Matthew Senko
@mpskierbg
Aug 06 2015 17:40
what does (!+num) mean?
Mendel Yaffe
@MYaffe
Aug 06 2015 17:41
Laurentiu Stanescu
@LaurentiuStanescu
Aug 06 2015 17:41
@camperbot because you have return false on else and the for stops on first letter from the array.
Mendel Yaffe
@MYaffe
Aug 06 2015 17:42
how do I get the console to print the result of my first function (which takes the second function into account)?
Laurentiu Stanescu
@LaurentiuStanescu
Aug 06 2015 17:42
@JayBee007 because you have return false on else and the for stops on first letter from the array.
@camperbot sorry :)
Javed
@JayBee007
Aug 06 2015 17:43
@LaurentiuStanescu Thanks..I have changed it to the following
javielero
@javielero
Aug 06 2015 17:43
for Check for Palindromes; after i use the recommended methods replace() and toLowerCase()
I am left with a string
Javed
@JayBee007
Aug 06 2015 17:43
https://repl.it/BA69/1
Mendel Yaffe
@MYaffe
Aug 06 2015 17:43
how do I get the console to print the result of my first function (which takes the second function into account)?
Javed
@JayBee007
Aug 06 2015 17:43
function getVowel(str){

    if(str.charAt(0) === "a" || str.charAt(0) === "i" || str.charAt(0) === "e" || str.charAt(0) === "o" || str.charAt(0) === "u"   ){
         return str + "way";
    }
    else{
        return "Nothing";
    }

}
getVowel("onsonant");
Tristanto
@rustyworks
Aug 06 2015 17:45
Is npm tutorial at Publish Again is broken ? I cannot advance my progress.
maxiedk
@maxiedk
Aug 06 2015 17:49
anyone done w/ bonfire 38?
Tristanto
@rustyworks
Aug 06 2015 17:54
Nvm I put trailing comma in json
Ozy Design & Software
@OzySky
Aug 06 2015 18:16
@maxiedk it's actually simpler then it looks
@maxiedk the hints are misleading
maxiedk
@maxiedk
Aug 06 2015 18:20
@ozydesign it's driving me crazy
function add() {

  sum = 0;

  if(arguments.length === 2)
  {
  for(i = 0; i < arguments.length; i++)
  {
    if(typeof arguments[i] === 'number')
    {
    sum += arguments[i];
    }
    else
      return undefined;
  }
    return sum;
  }
  else if(arguments.length === 1 && typeof arguments[0] === 'number')
  {
    console.log('stumped');

  }
  return undefined;
}

add(2, 3);
William Wagner
@wcwagner
Aug 06 2015 18:32
@maxiedk I just did bonfire38 yesterday, are you stumped on the returning a function part?
maxiedk
@maxiedk
Aug 06 2015 18:33
@Stfyou yes I am :smile:
William Wagner
@wcwagner
Aug 06 2015 18:34
@maxiedk I thought that was very hard to understand aswell, I'm pretty sure
return function(y){//check to see if y is a number here, and return arguments[0] + y}
Victoria G.
@GzkV
Aug 06 2015 18:37
can somebody help me out with the "boo hoo" bonfire? My code passes all the checks except one, and i'm confused, because it expects false to equal true, per the error message.
Omar
@oab00
Aug 06 2015 18:42
@GzkV false is a boolean like how true is
Victoria G.
@GzkV
Aug 06 2015 18:43
@oab00 I know that already. My code executes and passes all of the checks, except one.
Omar
@oab00
Aug 06 2015 18:43
@GzkV this one? assert.strictEqual(boo(false), true);
Joris Labie
@labiej
Aug 06 2015 18:44
bonfire boo
CamperBot
@camperbot
Aug 06 2015 18:44

:fire:Bonfire: Boo who :link:

function boo(bool) {
  // What is the new fad diet for ghost developers? The Boolean.
  return bool;
}

boo(null);

Check if a value is classified as a boolean primitive. Return true or false.
Boolean primitives are true and false.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

Victoria G.
@GzkV
Aug 06 2015 18:44
Yup.
Omar
@oab00
Aug 06 2015 18:44
false is a boolean so you should return true for it :)
Victoria G.
@GzkV
Aug 06 2015 18:44
AHHH
I'm running it against the -value- not the object type.
that makes more sense!
Joris Labie
@labiej
Aug 06 2015 18:45
typeof is useful
Matthew Barber
@Honno
Aug 06 2015 18:45
haha just did that, didn't know what it was asking for and wasting half an hour, but yeah all you need is typeof
function boo(bool) {
  if(typeof bool === "boolean") {
    return true;
  } else {
    return false;
  }
}

boo(null);
so simple heh
Victoria G.
@GzkV
Aug 06 2015 18:47
that explains it. Thank you!
Joris Labie
@labiej
Aug 06 2015 18:47
you can also use a one-liner
Randy Goldsmith
@Dueldrawer8
Aug 06 2015 18:49
var me = new me();
me.name= "Randy";
me.age= 29;
how do I create a new object?
says object doesn't support this action
Jennifer Stipe
@jenniferstipe
Aug 06 2015 18:51
Could anyone please be another set of eyes for me on my Chunky Monkey bonfire? My code works for tests 1,2, and 4 but not 3.
blob
Joris Labie
@labiej
Aug 06 2015 18:53
@Dueldrawer8 you cannot give a new variable the same name as an object
@jenprichard only works if your size evenly divides the length of the array
Jennifer Stipe
@jenniferstipe
Aug 06 2015 18:54
@Dueldrawer8 you should say var me = new Object(); or change "me" to something else.
Stuart Balcombe
@sbalcombe
Aug 06 2015 18:56
Hello everyone, does anyone have some time to give me a hand with a responsive css issue?
maxiedk
@maxiedk
Aug 06 2015 18:56
@Stfyou I feel like such a dum dum. thanks
Randy Goldsmith
@Dueldrawer8
Aug 06 2015 18:57
thank you @jenprichard @labiej
CamperBot
@camperbot
Aug 06 2015 18:57
dueldrawer8 sends brownie points to @jenprichard and @labiej :sparkles: :thumbsup: :sparkles:
Omar
@oab00
Aug 06 2015 19:13
@jenprichard have u figured it out yet
Jennifer Stipe
@jenniferstipe
Aug 06 2015 19:14
@oab00 Not yet, still plugging away at it. I put a bunch of console.log statements in to try and debug. :)
Omar
@oab00
Aug 06 2015 19:17
@jenprichard it's a really simple fix
here's where the problem is:
blob
x += size + 1; ?
Jennifer Stipe
@jenniferstipe
Aug 06 2015 19:18
@oab00 Ok I changed x++ to x += size in the for loop and that worked - is that what you meant?
Omar
@oab00
Aug 06 2015 19:18
yes exactly, congratz! :)
Jennifer Stipe
@jenniferstipe
Aug 06 2015 19:19
Thank you @oab00 :) :)
CamperBot
@camperbot
Aug 06 2015 19:19
jenprichard sends brownie points to @oab00 :sparkles: :thumbsup: :sparkles:
:star: 176 | @oab00 | http://www.freecodecamp.com/oab00
Lindell C. Bailey
@SamusBailey
Aug 06 2015 19:23
guys its day three of freecodecamp for me and ive already learned so much
im so thankful for this website in its entirty <--- my spelling "!"
i am now at JQuery im not sure if im going to fast or if this is the right speed
Matthew Barber
@Honno
Aug 06 2015 19:25
@SamusBailey yeah I keep on worrying whether my pace is right, currently I've blazed through the early stuff and the algorithm stuff is killing me
Dayne Wright
@daynewright
Aug 06 2015 19:25
@Honno @SamusBailey Yeah..the early stuff is faster than the functional javascript programming, but your pace is great! Keep it up!! :)
Lindell C. Bailey
@SamusBailey
Aug 06 2015 19:26
oh snap im sure the algorithm section is going to be a just war on my mind
Matthew Barber
@Honno
Aug 06 2015 19:26
been on this one for an hour, think I'm going to call it a day and think of a solution tomorrow lol
Joris Labie
@labiej
Aug 06 2015 19:27
which one @Honno ?
Matthew Barber
@Honno
Aug 06 2015 19:27
bonfire sorted union
CamperBot
@camperbot
Aug 06 2015 19:27

:fire:Bonfire: Sorted Union :link:

function unite(arr1, arr2, arr3) {
  return arr1;
}

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

Write a function that takes two or more arrays and returns a new array of unique values in the order of the original provided arrays.
In other words, all values present from all arrays should be included in their original order, but with no duplicates in the final array.
The unique numbers should be sorted by their original order, but the final array should not be sorted in numerical order.
Check the assertion tests for examples.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

Matthew Barber
@Honno
Aug 06 2015 19:27
agh its giving me a headache still just looking at it
Joris Labie
@labiej
Aug 06 2015 19:27
yuck
James Darrohn
@jdarrohn
Aug 06 2015 19:27
Need some help with Chunky Monkey
Matthew Barber
@Honno
Aug 06 2015 19:27
I think I know what to do, but I keep on getting mixed up
bonfire chunky monkey
CamperBot
@camperbot
Aug 06 2015 19:27

: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.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

Matthew Barber
@Honno
Aug 06 2015 19:27
ah yeah, got this I think
James Darrohn
@jdarrohn
Aug 06 2015 19:27
Can I show you?
What i HAve?
function chunk(arr, size) {

  var subArray = [];
  var multiArray = [];

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

    for(j = (i*size); j < size; j++){

      subArray.push(arr[j]);

    } 

  }  

  multiArray.push(subArray); 

  return multiArray; //returns [[ 'a','b']]
}

chunk(['a', 'b', 'c', 'd'], 2);
i know the (i*size) is wrong
i was trying to get it to start at the next set of 2, know what i mean?
Matthew Barber
@Honno
Aug 06 2015 19:28
function chunk(arr, size) {
  // Break it up.
  var newArrLength = Math.ceil(arr.length / size);
  var newArr = [];
  for(i = 0; i < newArrLength; i++) {
    var newArrAdd = [];
    var step = i * size;
    for(j = 0; j < size; j++) {
      var pos = j + step;
      if(typeof arr[pos] !== 'undefined') {
        newArrAdd.push(arr[pos]);
      }
    }
    newArr.push(newArrAdd);
  }
  return newArr;
}

chunk(['a', 'b', 'c', 'd'], 2);
Just looking at what I did first heh
I think my solution isn't very elegant
ugh I'm sorry I'm done for the day, I can't make sense of either code bits right now xD
James Darrohn
@jdarrohn
Aug 06 2015 19:30
I hear ya
I am getting close
I really just want to get this one done
then I am playing Xbox
We did something similar let me see if I can smooth this out
keagan goetsch
@misterrorypond
Aug 06 2015 19:36
help? many issues with getting my speech bubble and cat in a grid
I've just screwed around with padding, etc to where it looks OK on my tablet and pc, but the fact that they aren't moving relative to each other is very frustrating. i need help with gridding these two up/making them center properly
i've tried cols and row and container-fluid but i just can't get it right
suggestions would be nice
http://s.codepen.io/misterrorypond/debug/aOXRBW?
CamperBot
@camperbot
Aug 06 2015 19:36
no wiki entry for: many issues with getting my speech bubble and cat in a gridive just screwed around with padding etc to where it looks ok on my tablet and pc but the fact that they arent moving relative to each other is very frustrating i need help with gridding these two upmaking them center properlyive tried cols and row and container-fluid but i just cant get it rightsuggestions would be nicehttpscodepeniomisterroryponddebugaoxrbw
:pencil: click here to create one now!after creating your page type update to reload it here
Jennifer Stipe
@jenniferstipe
Aug 06 2015 19:37
@Honno My Chunky Monkey was giving me fits until I was shown that you can use x += size in a for loop like this: for (x=size; x < arr.length; x += size)
Dan Stockham
@DanStockham
Aug 06 2015 19:38
I don't understand why would my variables a nd b get undefined?
for(var i = arr[0]; i <= arr[1]; i++) {

    range.push(i);
    console.log(range);

      while( b !== 0) {
      a = range[i];
        console.log(a);
      b = range[i + 1];
        console.log(b);

      r = b;

      b = a % b;

      a = r;


  }
  }
Joris Labie
@labiej
Aug 06 2015 19:39
because your for loop^goes outside of the bounds of your array
Liz Rezes
@queenlizo
Aug 06 2015 19:40
This message was deleted
Joris Labie
@labiej
Aug 06 2015 19:40
String.prototype.replace() is what you want to look up
Liz Rezes
@queenlizo
Aug 06 2015 19:41
function replace(str, before, after) {
    var sentArr = str.split("");
    var myArray =  sentArr.indexOf(before);


    if (myArray > -1) {
        sentArr.splice(myArray, 1[before], after);
    }
    //myString = sentArr.join(['']);


 return sentArr;
}

replace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");
Dan Stockham
@DanStockham
Aug 06 2015 19:41
@labiej I don't understand the for loop is only going to the highest value in the parameter array. Then it is passing that valuing into the while loop to find the gcd.
Moisés Man
@moigithub
Aug 06 2015 19:41
b = range[i + 1]; <-- it goes +1 the top range
Liz Rezes
@queenlizo
Aug 06 2015 19:41
@labiej do you think that i need splice at all?
Joris Labie
@labiej
Aug 06 2015 19:42
@queenlizo it can be used but replace is the easy one
Liz Rezes
@queenlizo
Aug 06 2015 19:42
@labiej Ah. OK. Thanks!
Dan Stockham
@DanStockham
Aug 06 2015 19:45
@moigithub I'm still stumped. How am I going to add the item to my variables then?
Stein Gee
@Stiino0
Aug 06 2015 19:57
Bonfire where art thou
CamperBot
@camperbot
Aug 06 2015 19:57

: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.

type: bf details bf links bf spoiler

Stein Gee
@Stiino0
Aug 06 2015 19:57
Could someone please elaborate what exactly is asked of me? I really don't know where to start
the debugging tells me the following, which tells me nothing more unfortunately :( should return an array of objects: expected [] to deeply equal [ Array(1) ]
@labiej Can you help? I thought I understood late yesterday evening but I don't :D
Matthew Senko
@mpskierbg
Aug 06 2015 20:01
function replace(str, before, after) {
 var arr = str.split(' ');
 for(var i = 0; i< arr.length; i++){
     if(arr[i]===before){
         arr[i] = after;


     }
     str1=arr.join(" ")
 }
  return str1;
}

replace("He is Sleeping on the couch", "Sleeping", "sitting");
So i need to replace the before word in teh string with teh after word however i need to keep the case sensitvity of the before word on the second. is there a method or some prototype that does that?
Moisés Man
@moigithub
Aug 06 2015 20:03
whats GIT command to discard changes ?
Arsalan Sabir
@aayanqazi
Aug 06 2015 20:03
Hello WOrld
CamperBot
@camperbot
Aug 06 2015 20:03

welcome to FreeCodeCamp @aayanqazi!

Moisés Man
@moigithub
Aug 06 2015 20:03
or how can i force a git pull... (not interested in local changes )
Ross Kaffenberger
@rossta
Aug 06 2015 20:04
git stash save —keep-index
David Suilea
@Foryah
Aug 06 2015 20:05

@moigithub I think to discard changes you can do

git reset --hard HEAD

Not sure though, google it ;)

Moisés Man
@moigithub
Aug 06 2015 20:05
thanks @rossta @Foryah :)
CamperBot
@camperbot
Aug 06 2015 20:05
moigithub sends brownie points to @rossta and @foryah :sparkles: :thumbsup: :sparkles:
Stein Gee
@Stiino0
Aug 06 2015 20:06
Bonfire where art thou
CamperBot
@camperbot
Aug 06 2015 20:06

: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.

type: bf details bf links bf spoiler

David Suilea
@Foryah
Aug 06 2015 20:06
@mpskierbg you can check if a letter is upper case with this trick :
if(a[0] === a[0].toUpperCase())
Stein Gee
@Stiino0
Aug 06 2015 20:06
bf spoiler
CamperBot
@camperbot
Aug 06 2015 20:06
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Matthew Senko
@mpskierbg
Aug 06 2015 20:07
@Foryah i need to switch the after to uppercase if the before is uppercase.
Nick Hess
@hessproject
Aug 06 2015 20:07
so question: i have a json file, data, and i want to iterate through data.query.pages (of which each entry is an object with a pageID). and get data.query.pages.insertpageID.title. whats the best way to iterate through data.query.pages?
Joris Labie
@labiej
Aug 06 2015 20:08
@Stiino0 still here?
Stein Gee
@Stiino0
Aug 06 2015 20:08
@labiej yessir
David Suilea
@Foryah
Aug 06 2015 20:08
@mpskierbg yeah... that's right... So, chech the before, and if you need to switch it... you can try something like this :
newString = before[0].toUpperCase() + before.slice(1);
Joris Labie
@labiej
Aug 06 2015 20:08
right, you have 2 arguments. A collection of objects
and a test-object
you want to return those objects in the collection that have the properties of the test-object
Stein Gee
@Stiino0
Aug 06 2015 20:09
oh I didn't even catch that... Now I see where the [ ends...
David Suilea
@Foryah
Aug 06 2015 20:09
@mpskierbg sorry... you need to change the case to the after, not to the before :)
@mpskierbg but you got the point ;)
Stein Gee
@Stiino0
Aug 06 2015 20:09
so the last: Capulet?
Joris Labie
@labiej
Aug 06 2015 20:10
And check that the value of the properties are the same
yep
Stein Gee
@Stiino0
Aug 06 2015 20:12
ok, I think I need to do the following, correct me if wrong: Use a for loop to loop through the elements, then check the hasOwnProperty("last") matches with the hasOwnProperty of the keys 0, 1, 2?
@labiej
Feners4
@Feners4
Aug 06 2015 20:21
help with why my pictures and info are not alligned properly in http://codepen.io/Feners4/pen/XbOxoa
CamperBot
@camperbot
Aug 06 2015 20:21
no wiki entry for: with why my pictures and info is not alligned properly in httpcodepeniofeners4penxboxoa
:pencil: click here to create one now!after creating your page type update to reload it here
Joris Labie
@labiej
Aug 06 2015 20:23
@Stiino0 You're right
Only need to make it "dynamic" once it works
Stein Gee
@Stiino0
Aug 06 2015 20:23
doesn't the for loop make it dynamic?
Joris Labie
@labiej
Aug 06 2015 20:24
it does but I mean not check for "last" explicitly
because there are other keys in the test-cases
Stein Gee
@Stiino0
Aug 06 2015 20:24
there "might" be other keys in the test-cases
right? :D
Joris Labie
@labiej
Aug 06 2015 20:24
yep
Stein Gee
@Stiino0
Aug 06 2015 20:25
kk
so far:
Joris Labie
@labiej
Aug 06 2015 20:25
or they "can" have another name
Stein Gee
@Stiino0
Aug 06 2015 20:25
function where(collection, source) {
  var arr = [];

  for (i=0;i<collection.length;i++){
    if (collection[i].hasOwnProperty("last")){
      arr.push(collection[i]);
    }
  }

  return arr;
}

where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });
Joris Labie
@labiej
Aug 06 2015 20:25
also check the value of the object.last
that should match as well
Stein Gee
@Stiino0
Aug 06 2015 20:26
I was thinking if (collection[i].hasOwnProperty("last") === "Capulet"){
but that doesn't work, returns an empty array
Joris Labie
@labiej
Aug 06 2015 20:28
collection[i].hasOwnProperty("last") returns a boolean
Stein Gee
@Stiino0
Aug 06 2015 20:28
Yes, so it pushes every element in the array because they all are true for the moment
Which isn't complete ofcourse, know that
Vicente
@pouyio
Aug 06 2015 20:30
This message was deleted
Joris Labie
@labiej
Aug 06 2015 20:30
@Stiino0 indeed, you need another test for the value
Stein Gee
@Stiino0
Aug 06 2015 20:30
am thinking how
Joris Labie
@labiej
Aug 06 2015 20:30
how do you access the data in the object?
Matthew Senko
@mpskierbg
Aug 06 2015 20:31
@Foryah thanks. that helped
David Suilea
@Foryah
Aug 06 2015 20:31
@mpskierbg anytime ;)
Stein Gee
@Stiino0
Aug 06 2015 20:32
was thinking: source.hasOwnProperty("last")
but that isn't right
Joris Labie
@labiej
Aug 06 2015 20:33
source.last = ?
Stein Gee
@Stiino0
Aug 06 2015 20:35
Still don't see it, srr. if (collection[i].hasOwnProperty("last") === source.last){
Joris Labie
@labiej
Aug 06 2015 20:35
but now you need to access the property-data in your collection
Vicente
@pouyio
Aug 06 2015 20:36
Hi all!
I'm on bonfire 17.Seek and Destroy and kinda stuck, how can I access to the last 2 arguments on the function?
function destroyer(arr) {
...
}
destroyer([7, 6, 8, 9, 11, 20], 2, 3);
Joris Labie
@labiej
Aug 06 2015 20:36
arguments contains all arguments passed
Steve Tang
@Thescuba
Aug 06 2015 20:36
how is everyone taking screen shots of their code?
Joris Labie
@labiej
Aug 06 2015 20:37
bonfire seek
CamperBot
@camperbot
Aug 06 2015 20:37

:fire:Bonfire: Seek and Destroy :link:

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

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

You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

Joris Labie
@labiej
Aug 06 2015 20:37
bf links
CamperBot
@camperbot
Aug 06 2015 20:37
Joris Labie
@labiej
Aug 06 2015 20:38
it's even in the hint @pouyio
help code
help markdown
CamperBot
@camperbot
Aug 06 2015 20:38
no wiki entry for: markdown
:pencil: click here to create one now!after creating your page type update to reload it here
Joris Labie
@labiej
Aug 06 2015 20:38
help paste code
CamperBot
@camperbot
Aug 06 2015 20:38
no wiki entry for: paste code
:pencil: click here to create one now!after creating your page type update to reload it here
Stein Gee
@Stiino0
Aug 06 2015 20:38
@labiej access the property-data in my collection...
now I'm lost again
Logan Tegman
@ltegman
Aug 06 2015 20:39
Stein Gee
@Stiino0
Aug 06 2015 20:39
collection.last === source.last?
Joris Labie
@labiej
Aug 06 2015 20:40
Yes
Stein Gee
@Stiino0
Aug 06 2015 20:40
uhm in a second if clause then?
and then push to the array when true?
Joris Labie
@labiej
Aug 06 2015 20:40
indeed
Stein Gee
@Stiino0
Aug 06 2015 20:40
second if clause? or use && operator in my first if clause
Joris Labie
@labiej
Aug 06 2015 20:41
both work
Vicente
@pouyio
Aug 06 2015 20:42
@labiej I tried arr[x] but it only returns numbers from first array, when I try to call last positions it returns undefined
Joris Labie
@labiej
Aug 06 2015 20:42
bf links
CamperBot
@camperbot
Aug 06 2015 20:42
Sorry, can't find a bonfire called links. [ Check the map? ]
Joris Labie
@labiej
Aug 06 2015 20:42
bonfire seek
CamperBot
@camperbot
Aug 06 2015 20:42
Sorry, can't find a bonfire called seek link. [ Check the map? ]
Joris Labie
@labiej
Aug 06 2015 20:42
bonfire seek
CamperBot
@camperbot
Aug 06 2015 20:42

:fire:Bonfire: Seek and Destroy :link:

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

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

You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

Joris Labie
@labiej
Aug 06 2015 20:42
bf links
CamperBot
@camperbot
Aug 06 2015 20:42
Joris Labie
@labiej
Aug 06 2015 20:43
The Arguments object has all the info you need
Vicente
@pouyio
Aug 06 2015 20:43
I'll keep looking, thanks
Stein Gee
@Stiino0
Aug 06 2015 20:44
  for (i=0;i<collection.length;i++){
    if (collection[i].hasOwnProperty("last") && collection.last === source.last){
      arr.push(collection[i]);
    }
  }

  return arr;
unfortunately doesn't work, gives empty array
Joris Labie
@labiej
Aug 06 2015 20:45
What's inside collection ?
If you evaluate collectionhasOwnProperty("last") what do you get?
Stein Gee
@Stiino0
Aug 06 2015 20:46
ermahgerd
if (collection[i].hasOwnProperty("last") && collection[i].last === source.last){
      arr.push(collection[i]);
    }
Joris Labie
@labiej
Aug 06 2015 20:46
PEBKAC!
xD
Stein Gee
@Stiino0
Aug 06 2015 20:47
what's that lol :D
K now it returns the correct object
so the first "target" works
Joris Labie
@labiej
Aug 06 2015 20:47
problem exists between keyboard and chair
xD
Stein Gee
@Stiino0
Aug 06 2015 20:47
Hahaha thx sir
now I need to get the second to work as well
Joris Labie
@labiej
Aug 06 2015 20:47
the keys()method is key there
Stein Gee
@Stiino0
Aug 06 2015 20:48
should return with multiples: expected [] to deeply equal [ { a: 1 }, { a: 1 }, { a: 1, b: 2 } ]
What is required still of me?
Joris Labie
@labiej
Aug 06 2015 20:48
the name of the key has changed
Stein Gee
@Stiino0
Aug 06 2015 20:48
I thought so to use the keys method
from first, last to a, b?
Joris Labie
@labiej
Aug 06 2015 20:48
yeah
Stein Gee
@Stiino0
Aug 06 2015 20:48
great! why was this done :D
Joris Labie
@labiej
Aug 06 2015 20:49
that's why you want to make use of keys()
Stein Gee
@Stiino0
Aug 06 2015 20:49
K i'll try, you still here for another 5-10 minutes? :astonished:
Joris Labie
@labiej
Aug 06 2015 20:49
I will be
might not answer immediately
Stein Gee
@Stiino0
Aug 06 2015 20:50
np
Joris Labie
@labiej
Aug 06 2015 20:50
Doing a little write up for the guy I'm pairing with
Stein Gee
@Stiino0
Aug 06 2015 20:50
Nice
Would you pair with me next time? You're a great help
you'd be*
Aleksandar B.
@aleksandar-b
Aug 06 2015 20:52
I need a mentor to guide me through Functional programming exercises... thanks
George Tsoukatos
@Gts0uk
Aug 06 2015 20:54
@samosale I know just the guy
He is Javascript engineer at Spotify.
Aleksandar B.
@aleksandar-b
Aug 06 2015 20:56
yeah, i have watched his videos many times, but the Functional Programming part is much harder than his video content
George Tsoukatos
@Gts0uk
Aug 06 2015 20:56
@samosale oh ok!
@samosale I gueess read a book ? :P
Aleksandar B.
@aleksandar-b
Aug 06 2015 20:57
@Gts0uk Can you suggest me some ?
@Gts0uk Have you understand his video on reduce part 2? How reduce is able to override same property name, is not clear to me..
Germán Lugo
@Chococoin
Aug 06 2015 21:00
Hi people!!! I need a huge help with an easy code, but it's killing me.
Stein Gee
@Stiino0
Aug 06 2015 21:00
@labiej I've been reading up
Germán Lugo
@Chococoin
Aug 06 2015 21:00
var bob = {
    firstName: "Bob",
    lastName: "Jones",
    phoneNumber: "(650) 777-7777",
    email: "bob.jones@example.com"
};

var mary = {
    firstName: "Mary",
    lastName: "Johnson",
    phoneNumber: "(650) 888-8888",
    email: "mary.johnson@example.com"
};

var contacts = [bob, mary];

var Person = function(firstName, lastName, phoneNumber, email){
        this.firstName = firstName;
        this.lastName = lastName;
        this.phoneNumber = phoneNumber;
        this.email = email;
}
function printPerson(person) {
    console.log(person.firstName + " " + person.lastName);
}

function list() {
    var contactsLength = contacts.length;
    for (var i = 0; i < contactsLength; i++) {
        printPerson(contacts[i]);
    }
}

function add(firstName, lastName, phoneNumber, email){

    contacts[contacts.lenght] = new Person(firstName, lastName, phoneNumber, email);
}

/*Create a search function
then call it passing "Jones"*/

function search(lastName){
    var index = contacts.length;
    for(var i = 0; i < index; i++){
        if(contacts[i].lastName === lastName){
            printPerson(contacts[i]);
        }
    }
}

search("Jones");

add('Jose','Perez','34484848','joseperez@gamil.com');
list();
Stein Gee
@Stiino0
Aug 06 2015 21:01
and I don't know how to change it... :(
I know how to get them
George Tsoukatos
@Gts0uk
Aug 06 2015 21:01
@samosale haven't watch that yet xD
@samosale see chapter 6 of eloquent JS
there is also a book called Functional JavaScript
Germán Lugo
@Chococoin
Aug 06 2015 21:02
I don't know why the obj that I add into de array comes as UNDEFINED. Is there a way to avoid that?
Joris Labie
@labiej
Aug 06 2015 21:03
@Stiino0 you are interested in var keys = source.keys()
you want to check for each object in collection whether it has the keys and the correct values
Stein Gee
@Stiino0
Aug 06 2015 21:04
Don't I need to check collection.keys then? cause it contains first and last
both
Joris Labie
@labiej
Aug 06 2015 21:05
no, you want to filter out those objects in collection that have the same property as source
Say you have a collection of people with first and last name
You want those people with lastname: "something" to be returned
Stein Gee
@Stiino0
Aug 06 2015 21:08
In our case: source "Capulet"
?
to be returned?
Germán Lugo
@Chococoin
Aug 06 2015 21:09
@labiej Yes, I have a constructor for that
var Person = function(firstName, lastName, phoneNumber, email){
        this.firstName = firstName;
        this.lastName = lastName;
        this.phoneNumber = phoneNumber;
        this.email = email;
Joris Labie
@labiej
Aug 06 2015 21:09
you want everybody with lastName "Capulet" in the first test
Germán Lugo
@Chococoin
Aug 06 2015 21:09
Oh sorry!
Shouvik Roy
@royshouvik
Aug 06 2015 21:09
any AngularJS expert here?
Joris Labie
@labiej
Aug 06 2015 21:09
But you want to generalize so you can use it for other objects as well
Omar
@oab00
Aug 06 2015 21:09
@Chococoin use contacts.push(new person); instead of contacts[whatever] = new person;
ACTUALLY
sorry
you have a typo
keep it as it is but fix lenght to length
Germán Lugo
@Chococoin
Aug 06 2015 21:11
@oab00 Oh my godness!
Thank!
Stein Gee
@Stiino0
Aug 06 2015 21:11
@labiej I really don't see it
Omar
@oab00
Aug 06 2015 21:11
:)
Stein Gee
@Stiino0
Aug 06 2015 21:11
srr :)
I again don't see what is asked of me: should return with multiples: expected [] to deeply equal [ { a: 1 }, { a: 1 }, { a: 1, b: 2 } ]
Germán Lugo
@Chococoin
Aug 06 2015 21:12
Yes it was the problem!!! Thank a lot!!!
Omar
@oab00
Aug 06 2015 21:13
np!!!!
Joris Labie
@labiej
Aug 06 2015 21:13
it asks you to ignore multiple, just loop over each object regardless of duplicates
it's a red herring so to speak
just try to find those objects that match {a: 1}
var keys = source.keys();
  for (i=0;i<collection.length;i++){
/* insert something here for maximal usefulness */
    if (collection[i].hasOwnProperty(/* Change this */) && collection[/* and this */] === source[/* and this as well */]){
      arr.push(collection[i]);
    }
  }

  return arr;
Stein Gee
@Stiino0
Aug 06 2015 21:15
How could they match a: 1 if I currently have first: "string"
Joris Labie
@labiej
Aug 06 2015 21:17
@Stiino0 check the snippet again, I indicated where changes should be applied
Stein Gee
@Stiino0
Aug 06 2015 21:18
I see, but I still don't know what to do
You want me to change the code so that it's dynamic?
Steve Tang
@Thescuba
Aug 06 2015 21:19
@labiej Thank you so much, that was very helpful
Joris Labie
@labiej
Aug 06 2015 21:19
indeed
Stein Gee
@Stiino0
Aug 06 2015 21:19
doesn't only check on last
Joris Labie
@labiej
Aug 06 2015 21:19
it should work as a search/match for an arbitrary amount of keys and whatever the name of the key is
Stein Gee
@Stiino0
Aug 06 2015 21:20
oh, so the second "part" of the challenge is just a check to see if the code works dynamically with other key names etc.?
I'm such a fool.. Every Bonfire so far has had those checks
CamperBot
@camperbot
Aug 06 2015 21:21
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Shouvik Roy
@royshouvik
Aug 06 2015 21:23
anyone knows how to post process AngularJS views to combine multiple views into one?
Hey @camperbot , how are you doing?
@camperbot hello
ok, so you are kinda shy, I see
Moisés Man
@moigithub
Aug 06 2015 21:26
@royshouvik probably u can use ng-include
Joris Labie
@labiej
Aug 06 2015 21:26
@Stiino0 indeed
Stein Gee
@Stiino0
Aug 06 2015 21:26
@labiej I think I'm getting closer
function where(collection, source) {
  var arr = [];

  for (i=0;i<collection.length;i++){
    var keys = Object.keys(source);

    if (collection[i].hasOwnProperty(keys) && collection[i].hasOwnProperty(keys) === keys){
      arr.push(collection[i]);

    }
  }

  return arr;
}
Shouvik Roy
@royshouvik
Aug 06 2015 21:27
yeah , but I have 40 - 50 views, and want some way to combine them into one file
Joris Labie
@labiej
Aug 06 2015 21:27
@Stiino0 almost, keys is usually an array
also it's better for your performance to move var keys = ... outside the loop
that way it has to be made only once
Aleksandar B.
@aleksandar-b
Aug 06 2015 21:30
bonfire Sorted Unions
CamperBot
@camperbot
Aug 06 2015 21:30
Sorry, can't find a bonfire called sorted unions. [ Check the map? ]
Moisés Man
@moigithub
Aug 06 2015 21:30
ng-include usually u use when u have for example... a header.. a footer and body... since header and footer can be repeated on all views, u can use ngInclude...
but.. 40-50 views ? are all those part of same document ? or differents views/path ?
@royshouvik
Russell Westberry
@russbus
Aug 06 2015 21:30
Is there a reason I should use substr over slice in Bonfire: Confirm the Ending?
Shouvik Roy
@royshouvik
Aug 06 2015 21:31
different ones, but never mind , I found https://www.npmjs.com/package/grunt-angular-templates
Stein Gee
@Stiino0
Aug 06 2015 21:31
@labiej which part is still incorrect? I'm guessing the collection[i].hasOwnProperty(keys) === keys
Joris Labie
@labiej
Aug 06 2015 21:35
The usage of keys mostly
you are interested in keys[0] for hasOwnProperty
try using console.log to see what new functions actually do
Stein Gee
@Stiino0
Aug 06 2015 21:36
hasOwnProperty(keys[0]?
Joris Labie
@labiej
Aug 06 2015 21:37
remember keys is not a string but an array of strings
Stein Gee
@Stiino0
Aug 06 2015 21:38
aaaaaaaaaaaargh
This Bonfire only has 1 flame, just like the 2 before this... why is this one so hard :( :'(
Logan Tegman
@ltegman
Aug 06 2015 21:38
@russbus I can't think of a reason to. In fact, the ability of slice to accept a negative start point makes it perfect for that bonfire. Some implementations of substring will accept a negative value, but I don't believe it is specced that way.
Joris Labie
@labiej
Aug 06 2015 21:39
Because it's more of a continuous process
but they have a finite amount of levels
Stein Gee
@Stiino0
Aug 06 2015 21:40
true
But I'm stuck again, even though ur giving such good tips :D
Logan Tegman
@ltegman
Aug 06 2015 21:40
@russbus Scratch that, substring and substr have different rules. That's confusing. substr will accept a negative, but substring won't.
Stein Gee
@Stiino0
Aug 06 2015 21:41
@labiej I can't go to sleep before I finish this one
I won't :D
Jason Arnold
@thejasonfile
Aug 06 2015 21:41
Are there rooms dedicated to each of the Bonfires?
I thought I saw something like that on the live stream this past Saturday.
Joris Labie
@labiej
Aug 06 2015 21:42
there should be but probably quite deserted @jasonarnoldnyc
Russell Westberry
@russbus
Aug 06 2015 21:43
@ltegman Yeah, on the surface, it looks like both work identically without a second argument. I just wondered why substr was mentioned in the more information portion over slice. (I probably read too much into things.)
Jason Arnold
@thejasonfile
Aug 06 2015 21:43
@labiej Okay, thanks.
ctcrnitv
@ctcrnitv
Aug 06 2015 21:46
any recommendations for a framework to learn for the Build a Random Quote Machine?
Logan Tegman
@ltegman
Aug 06 2015 21:46
@russbus I doubt there was a specific reason. Especially since, according to JSPerf they both have nearly identical runtimes.
Joris Labie
@labiej
Aug 06 2015 21:48
@skr5e jQuery is sufficient
I would even advise using basic stuff for the first few ziplines
Russell Westberry
@russbus
Aug 06 2015 21:50
@ltegman I always make the mistake of assuming things are the way they are for a very specific reason and somebody knows something I don't, which typically leads to Google rabbit holes.
Logan Tegman
@ltegman
Aug 06 2015 21:52
@russbus Haha, yeah, I don't think that's a good road to go down (well, it is for learning the API, but not necessarily for solving the bonfire). They may have been fixed by now but I remember doing a couple bonfires where the links made absolutely no sense for the challenge, atleast not for getting an efficient solution.
CamperBot
@camperbot
Aug 06 2015 21:52
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Stein Gee
@Stiino0
Aug 06 2015 22:06
THANKS @labiej for all the help today. <3
CamperBot
@camperbot
Aug 06 2015 22:06
stiino0 sends brownie points to @labiej :sparkles: :thumbsup: :sparkles:
Stein Gee
@Stiino0
Aug 06 2015 22:06
I'm off to bed, evening all and good luck with the Bonfires/ziplines/Basejumps/...!!
Cristi Rusu
@CristiInfo
Aug 06 2015 22:07
@Stiino0 ty
Rafael J. Rodriguez
@Rafase282
Aug 06 2015 22:10
hello
Craig McKenna
@craigdmckenna
Aug 06 2015 22:13
Howdy @Rafase282
Rafael J. Rodriguez
@Rafase282
Aug 06 2015 22:14
@CraigMcKenna trying to determine if I foudn a bug or need a break
Craig McKenna
@craigdmckenna
Aug 06 2015 22:15
What are you working on?
Jelani Thompson
@JelaniThompson
Aug 06 2015 22:15
Hey there!
Think I'm almost done with the bonfire I was working on yesterday
CamperBot
@camperbot
Aug 06 2015 22:15
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Jelani Thompson
@JelaniThompson
Aug 06 2015 22:15
I got kinda frustrated and walked away from it
But now I've been using @AlexWulkan's tutorials on Wulkan.me
It kinda helped
This is my code now
function mutation(arr) {
  var firstElement = arr[0].toLowerCase();
  var secondElement = arr[1].toLowerCase();

  //Loop through the first AND second elements
  for (var i = 0; i < firstElement.length; i++) {
    //Check if the characters present in firtElement are also in the second one
    var check = firstElement.indexOf(secondElement[i]);
    //-1 means the element is not present
    if (check === -1) {
      return false;
    }

    return true;
  }


  return arr;
}

mutation(['hello', 'Hello']);
Most of it is working
But does anyone know why it isn't running?
Like it's running, but it's not returning the correct thing
I've already tried an else statement, but that hasn't been working out for me either lol
Craig McKenna
@craigdmckenna
Aug 06 2015 22:18
Is it supposed to compare Strings?
Jelani Thompson
@JelaniThompson
Aug 06 2015 22:19
It's this bonfire
Bonfire Mutations
CamperBot
@camperbot
Aug 06 2015 22:19

:fire:Bonfire: Mutations :link:

function mutation(arr) {
  return arr;
}

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

Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.
For example, ['hello', 'Hello'], should return true because all of the letters in the second string are present in the first, ignoring case.
The arguments ['hello', 'hey'] should return false because the string 'hello' does not contain a 'y'.
Lastly, ['Alien', 'line'], should return true because all of the letters in 'line' are present in 'Alien'.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

DTing
@dting
Aug 06 2015 22:20
@JelaniThompson what test cases are failing?
Craig McKenna
@craigdmckenna
Aug 06 2015 22:20
I could be wrong but I don't think a loop is necessary.
Jelani Thompson
@JelaniThompson
Aug 06 2015 22:21
expect(mutation(['hello', 'hey'])).to.be.false;expected true to be false
Craig McKenna
@craigdmckenna
Aug 06 2015 22:21
Nevermind I get it now
Moisés Man
@moigithub
Aug 06 2015 22:21
@JelaniThompson u using i variable as index to iterate secondElement
but.... i values are based on firstElement.length; i++
so.. it will work if both words have same length.. but if not..
Jelani Thompson
@JelaniThompson
Aug 06 2015 22:21
Yeah, the for loop is just to mainly loop through the individual characters in the string
Joris Labie
@labiej
Aug 06 2015 22:22
@CraigMcKenna it is possible without (explicit) loops
Moisés Man
@moigithub
Aug 06 2015 22:22
@JelaniThompson
"hello".length == 5
"hey"[5] <-- hey only have 3 characters...
Jelani Thompson
@JelaniThompson
Aug 06 2015 22:23
I switched it up because I figured out that it was returning the array instead, but like now what
function mutation(arr) {
  var firstElement = arr[0].toLowerCase();
  var secondElement = arr[1].toLowerCase();

  //Loop through the first AND second elements
  for (var i = 0; i < firstElement.length; i++) {
    //Check if the characters present in firtElement are also in the second one
    var check = firstElement.indexOf(secondElement[i]);
    //-1 means the element is not present
    if (check === -1) {
      return false;
    }
  }

    return true;

}

mutation(['hello', 'Hello']);
DTing
@dting
Aug 06 2015 22:23
@JelaniThompson the problem is that you return out of the entire mutation function after checking the first letter of firstElement
Jelani Thompson
@JelaniThompson
Aug 06 2015 22:23
lol
DTing
@dting
Aug 06 2015 22:23
oh nm
Craig McKenna
@craigdmckenna
Aug 06 2015 22:23
Wat if you break the characters into arrays and sort then compare?
DTing
@dting
Aug 06 2015 22:25
This message was deleted
err
This message was deleted
This message was deleted
Bill
@kirah1314
Aug 06 2015 22:26
@JelaniThompson
function mutation(arr) {
  var firstElement = arr[0].toLowerCase();
  var secondElement = arr[1].toLowerCase();

  //Loop through the first AND second elements
  for (var i = 0; i < secondElement.length; i++) {
    //Check if the characters present in firtElement are also in the second one
    var check = firstElement.indexOf(secondElement[i]);
    //-1 means the element is not present
    if (check === -1) {
      return false;
    }  
  }
return true;
}
mutation(['hello', 'hey']);
DTing
@dting
Aug 06 2015 22:26
orrrr.. im just wrong
Bill
@kirah1314
Aug 06 2015 22:26
use secondElement.length
DTing
@dting
Aug 06 2015 22:26
what i said the first time... haha
Bill
@kirah1314
Aug 06 2015 22:27
@dting :thumbsup:
DTing
@dting
Aug 06 2015 22:28
@kirah1314 :thumbsup:
I need to read more carefully =P
Jelani Thompson
@JelaniThompson
Aug 06 2015 22:29
Oh OK, thanks so much @kirah1314 :)
Kolloom
@Kolloom
Aug 06 2015 22:46
anybody have done bonfire roman numeral without using lots of pairs?
CamperBot
@camperbot
Aug 06 2015 22:46
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Logan Tegman
@ltegman
Aug 06 2015 22:49
@Kolloom You only need to use boundary pairs (so you don't need an entry for every single value) but I don't think it's possible without any conversion table at all.
Marc Davenport
@oneate7
Aug 06 2015 22:49
@Kolloom - Depends on what you mean by lots of pairs? Every solution I've seen starts with an array to spell out the conversion.
Dan Stockham
@DanStockham
Aug 06 2015 22:51
I really need help with Least Common Multiple bonfire...
I been at it for 9 hours now.
Kolloom
@Kolloom
Aug 06 2015 22:51
I got it by an object for the tenth value and another for value < 10
two "1 to 10" pairs so to speak
Logan Tegman
@ltegman
Aug 06 2015 22:52
@DanStockham I can try and help. What's the problem you're running into?
Dan Stockham
@DanStockham
Aug 06 2015 22:53
Well, doing the actually calculation works fine. However, the test require that you input a range of values within the parameter arr. So if you have an array of [1, 5] then you would plug in 1, 2, 3, 4, 5 and find the smallest multiple.
Europaradise
@europaradise
Aug 06 2015 22:55
I am lost on the zipline for creating a code pen....Can you help me?
Logan Tegman
@ltegman
Aug 06 2015 22:56
@DanStockham And what issues is that causing you? Maybe share your code if it's hard to explain.
@europaradise What do you need help with?
Dan Stockham
@DanStockham
Aug 06 2015 22:57
This would be the actual calculation. No trouble, figured that out after doing a little bit of research:
function smallestCommons(arr) {
 var a;
 var b;
 var r;
 var lcm;

  while(b !== 0) {

    r = b;
    b = a % b;
    a = r;    
  }

   lcm = (arr[0]*arr[1]) / a;

   return lcm; //least common multiple is 5

}


smallestCommons([1,5]);
Europaradise
@europaradise
Aug 06 2015 22:58
@ltegman Where must I start? Am I to reverse what an end user does when querying something? I did create an account and understand the rules of doing one's own work or using MIT opensource resource. However, I am a little lost..
Dan Stockham
@DanStockham
Aug 06 2015 22:59

However, I need to input a range of values within the function:

function smallestCommons(arr) {
  var a;
  var b;
  var r;
  var lcm;
  var range = [];

  arr.sort(function(a, b) {
    return a - b;


  });

  for(var i = arr[0]; i < arr[1]; i++) {

    a = i;
    console.log(a);
    b = i + 1;
    console.log(b);

    while(b !== 0) {
    r = b;
    console.log(r);
    b = a % b;
    console.log(b);
    a = r;
    console.log(a);
    }
  }


  lcm = leastCommonMult(a, b);
}

function leastCommonMult(a , b) {

  return ((a*b) / smallestCommons(a, b));

}


smallestCommons([1,13]);

This obivously doesn't work because goes through an infinitely loop I think.

Logan Tegman
@ltegman
Aug 06 2015 23:00
@europaradise Which zipline are you trying to do? They all use codepen.
Europaradise
@europaradise
Aug 06 2015 23:01
@ltegman The very first one. Wikipedia Viewer
@europaradise I think I am lost on understanding reverse engineering...I googled that and came up with reversing the order in which a person would input information...
Logan Tegman
@ltegman
Aug 06 2015 23:03
@europaradise Reverse engineering just means you need to recreate it without looking at the source code. Not visually, but the functionality has to be there in whatever you create.
Europaradise
@europaradise
Aug 06 2015 23:04
@ltegman ok...the functionality of the( http://codepen.io/) page? I am to recreate this page with an input box?
Joris Labie
@labiej
Aug 06 2015 23:06
you are to recreate the example
Europaradise
@europaradise
Aug 06 2015 23:06
@labiej The example of that blue page? or another example of an image of some sort?
Babajide Fowotade
@andela-bfowotade
Aug 06 2015 23:07
@europaradise would you like to pair program? so i’d show you through what exactly you should do?
Europaradise
@europaradise
Aug 06 2015 23:07
@andela-bfowotade ok...How do we pair program?
Babajide Fowotade
@andela-bfowotade
Aug 06 2015 23:08
screenhero for mac/windows, team viewer for linux, which do you use? @europaradise
Europaradise
@europaradise
Aug 06 2015 23:08
@andela-bfowotade I am using windows 10
Babajide Fowotade
@andela-bfowotade
Aug 06 2015 23:08
okay, what’s your email, i’d invite you to download screenhero
dm me @europaradise
Europaradise
@europaradise
Aug 06 2015 23:09
@europaradise ok...
Omar
@oab00
Aug 06 2015 23:15
@DanStockham I'd like to help you but I don't remember how I solved this bonfire exactly
looking through my solution I went about it something like this
a for loop that goes on from 1 to infinity (a large number that you specify say 1 million)
and for each number in that for loop check if it is divisible by all the numbers in the range of the given array
if one of them isn't divisible skip to the next number in the infinity range
other wise pass the check for that number
Logan Tegman
@ltegman
Aug 06 2015 23:17
@DanStockham You always end your smallestCommons function by calling leastCommonMult but every call to leastCommonMult calls smallestCommons so you've created an infinite loop. You also pass individual arguments for smallestCommons from lestCommonMult but you need to pass them like [a,b] to match the array type it's expecting.
Dan Stockham
@DanStockham
Aug 06 2015 23:21
@Itegman So I need to do a for loop that iterates the values then pass it to leastCommonMult.
DTing
@dting
Aug 06 2015 23:23

@DanStockham I solved mine in a very similar fashion to the answer you have.

i split out my functions to gcd and lcm:

function gcd(a, b) {
    while (b !== 0) {
        a = [b, b = a % b][0];
    }
    return a;
}

function lcm(a, b) {
    return (a * b) / gcd(a, b);
}

Then created the range like you did by sorting the input arr and creating an array filled with the ints in the range then calling range.reduce(lcm)

Logan Tegman
@ltegman
Aug 06 2015 23:26
a = [b, b = a % b][0]; seems a little unnecessarily clever, but I guess if you're only writing it for yourself and not for a shared codebase it doesn't really matter. Definitely is a neat little trick.
Dan Stockham
@DanStockham
Aug 06 2015 23:26
The problem is I have an array for an input parameter.
keagan goetsch
@misterrorypond
Aug 06 2015 23:26
ok let's see if i can get some help here - my timer works perfectly for me! No issues, and functionality is perfect. I'm using firefox on linux. My tablet and other pc won't run it in chrome at all and the columns are horrid. Here's a working screencap so you can see the intended - http://imgur.com/bZb5RfB, and here's the link to the pen http://codepen.io/misterrorypond/full/aOXRBW
DTing
@dting
Aug 06 2015 23:27
@DanStockham just do the obvious do a for loop
@DanStockham
  var rng = [];
  for (var i = arr[0]; i <= arr[1]; i++) {
    rng.push(i);
  }
@misterrorypond see http://rawgit.com/faq for why
@misterrorypond the columns look fine on osx chrome
unless you are talking about a really narrow layout. then they overlap
keagan goetsch
@misterrorypond
Aug 06 2015 23:32
@dting it doesn't work in full, but it works in debug. is that something i should be concerned about?
DTing
@dting
Aug 06 2015 23:33
@misterrorypond the full page isnt showing you updated the url
@misterrorypond should work tho did you save?
keagan goetsch
@misterrorypond
Aug 06 2015 23:33
i saved!
debug works
DTing
@dting
Aug 06 2015 23:34
@misterrorypond the full is working for me now but says jquery is not defined in the console
keagan goetsch
@misterrorypond
Aug 06 2015 23:34
hmmm
DTing
@dting
Aug 06 2015 23:34
there might be a delay. you should put it back into the config instead of the <head> and wait a minute.
keagan goetsch
@misterrorypond
Aug 06 2015 23:35
alright
it's back in the config so wait a few seconds
Dan Stockham
@DanStockham
Aug 06 2015 23:35
@dting Another issue I'm running into as well is that I'm not sure how pull the values from the range array and plug them into a and b.
DTing
@dting
Aug 06 2015 23:35
@misterrorypond looks like it's working
sinsukh
@sinsukh
Aug 06 2015 23:36
Screen Shot 2015-08-06 at 7.35.13 PM.png
hi guys, not sure why this code isn't working. Just started on bonfires recently
keagan goetsch
@misterrorypond
Aug 06 2015 23:36
@dting ok - i have no clue why the jquery is not defined is happening
DTing
@dting
Aug 06 2015 23:36
@misterrorypond thats not showing up anymore for me you look good on my end
keagan goetsch
@misterrorypond
Aug 06 2015 23:36
@dting Thanks so much for your input! Much appreciated and needed!
Joris Labie
@labiej
Aug 06 2015 23:37
@Singhsukh any errors?
DTing
@dting
Aug 06 2015 23:37
@DanStockham hmm what do you mean, post what you got.
@misterrorypond nos
Logan Tegman
@ltegman
Aug 06 2015 23:37
@Singhsukh Some of the test cases have whitespace that you need to remove.
DTing
@dting
Aug 06 2015 23:37
@misterrorypond nps
Logan Tegman
@ltegman
Aug 06 2015 23:38
@Singhsukh well, whitespace and punctuation.
sinsukh
@sinsukh
Aug 06 2015 23:38
@labiej @ltegman yes. the errors are ones with whitespace. Don't know how to do that
Dan Stockham
@DanStockham
Aug 06 2015 23:38
@dting
function gcd(arr) {
  var a;
  var b; 
  var rng = [];
  arr.sort(function(a, b) {
    return a - b;

  });

  for(var i = arr[0]; i < arr[1]; i++) {
    rng.push(i);

  }

  a = //I tried using arr[i] but the while keeps getting NaN and undefined passed in there.
  b = // same case here

  while (b !== 0) {
      a = [b, b = a % b][0];
  }

  return a;

}

function lcm(a, b) {
    return (a * b) / gcd(a, b);
}

gcd([1, 5]);
keagan goetsch
@misterrorypond
Aug 06 2015 23:39
This message was deleted
Joris Labie
@labiej
Aug 06 2015 23:39
@Singhsukh the replace-method is what you need
DTing
@dting
Aug 06 2015 23:39
@DanStockham you dont want to create the range in the gcd function. You want to do that in your smallestCommon function. the gcd function is a helper function for your lcm
if that makes sense.
Dan Stockham
@DanStockham
Aug 06 2015 23:41
@dting That's what I want to do but... nevermind I think I need to do a slice on the array
This message was deleted
DTing
@dting
Aug 06 2015 23:44
so pseudo code:
function gcd (a, b):
   returns gcd of a and b

function lcm(a, b):
   returns lcm of a and b

function smallestCommonMultiple(arr)
  sort arr
  create range from arr[0] to arr[1]
  return range.reduce(lcm)
right now you have your smallestCommons function and your gcd function mixed together
sinsukh
@sinsukh
Aug 06 2015 23:45
@labiej thanks. it worked
Joris Labie
@labiej
Aug 06 2015 23:46
good job
Dan Stockham
@DanStockham
Aug 06 2015 23:49
@dting I think it is starting make more sense now.
DTing
@dting
Aug 06 2015 23:50
@DanStockham nice
Parth Mangwani
@parthm17
Aug 06 2015 23:50
Need help with this, how do I add the div with id?
Dan Stockham
@DanStockham
Aug 06 2015 23:56
@dting
function gcd(a,b) {
  var x;
  var y; 

  while (y !== 0) {
      x = [y, y = x % y][0];
  }

  return x;

}

function lcm(a, b) {
    return (a * b) / gcd(a, b);
}

function smallestCommonMultiple(arr) {
  var rng = [];

  arr.sort(function(a, b) {
    return a - b;
 });


  for(var i = arr[0]; i < arr[1]; i++) {
    rng.push(i);

  }

  return rng.reduce(function(previousValue, currentValue, index, array) {
    return lcm(currentValue, previousValue);

  });
}

smallestCommonMultiple([1, 5]);
How am I looking so far?
DTing
@dting
Aug 06 2015 23:58
@DanStockham i think you need to change the arguments for gcd
@DanStockham you have a and b but you are using x and y