These are chat archives for FreeCodeCamp/Help

4th
Aug 2015
dc
@dcsan
Aug 04 2015 00:00
maybe not :)
depends which way you want to do the match
one of those args is a lot longer ... be careful
arg1 is actually an array
Jorge Almeida
@Jorgixhallo
Aug 04 2015 00:01
now i was trying just a simple cicle
for (var i=0....)
for(var z in collection[i]){
        console.log(collection[0].z);
      }
since var z was giving me 'first' and last too
i tough i could access the values like this
dc
@dcsan
Aug 04 2015 00:02
i dont think you need to do that
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 00:02
@dcsan you're counting from 1? :O
dc
@dcsan
Aug 04 2015 00:02
in the end i think collection.filter is all you need
no nesting
you're confused because trying to match with the nesting inside collection
i think source is better to use as the matchin item
and then just filter collection against that
anyway i think thats giving away too much
log your arguments coming in, that may clarify
Jorge Almeida
@Jorgixhallo
Aug 04 2015 00:03
to make the filter you always need a function? or can you make it without one?
CamperBot
@camperbot
Aug 04 2015 00:03
Archives for Help
dc
@dcsan
Aug 04 2015 00:03
you need to give it a function
find filter
CamperBot
@camperbot
Aug 04 2015 00:03
find filter
nothing found
dc
@dcsan
Aug 04 2015 00:03
wiki filter
CamperBot
@camperbot
Aug 04 2015 00:03
no wiki entry for: filter
:pencil: click here to create one now!after creating your page type update to reload it here
Nic Galluzzo
@ngalluzzo
Aug 04 2015 00:04
I don’t think that should be a wiki entry, instead should like to MDN… why re-invent the wheel there?
link**
dc
@dcsan
Aug 04 2015 00:05
update
CamperBot
@camperbot
Aug 04 2015 00:05
updating wiki...
dc
@dcsan
Aug 04 2015 00:05
well, its nice to have the content inline in the chat
Jorge Almeida
@Jorgixhallo
Aug 04 2015 00:05
wiki filter
CamperBot
@camperbot
Aug 04 2015 00:05

:pencil: js filter [edit]

The filter() method creates a new array with all elements that pass the test implemented by the provided function

arr.filter(callback[, thisArg])

MDN link
:pencil: read more about js filter on the FCC Wiki

you're welcome
pixy magic :)
Jorge Almeida
@Jorgixhallo
Aug 04 2015 00:07
now that I'm reviewing filter that might be the best alternative. I gess that the links on the "bonefire" are a bit influentive
Juan D
@Tiroloco49
Aug 04 2015 00:07
wiki jquery
CamperBot
@camperbot
Aug 04 2015 00:07
no wiki entry for: jquery
:pencil: click here to create one now!after creating your page type update to reload it here
dc
@dcsan
Aug 04 2015 00:07
@Tiroloco49 do you want to make a quick entry?
Juan D
@Tiroloco49
Aug 04 2015 00:07
wiki JQuery
CamperBot
@camperbot
Aug 04 2015 00:07
no wiki entry for: jquery
:pencil: click here to create one now!after creating your page type update to reload it here
Juan D
@Tiroloco49
Aug 04 2015 00:08
yrah
why not
dc
@dcsan
Aug 04 2015 00:08
it doesnt have to be perfect
other people will add to it later
Kolloom This message was deleted
CamperBot
@camperbot
Aug 04 2015 00:08
type bonfire name to get some info on that bonfire here
Juan D
@Tiroloco49
Aug 04 2015 00:09
any advices? i'll do some research and build somehting
dc
@dcsan
Aug 04 2015 00:09
explain example
CamperBot
@camperbot
Aug 04 2015 00:09

:pencil: example [edit]

This is an example wiki entry. Break it up with a ## H2 heading as content up that will show in the chat, but the rest is on the wiki.

console.log("less is more!");
HappyCamping -{ Happy Camping! :+1: }
https://github.com/camperbot

:pencil: read more about example on the FCC Wiki

dc
@dcsan
Aug 04 2015 00:09
just keep it short ~ 2 lines
so it doesn't interrupt the chat too much
you can add as much detail as you like below the first H2
that will show up only on the wiki
Kolloom
@Kolloom
Aug 04 2015 00:10
does filter works on items that has no property last?
Nic Galluzzo
@ngalluzzo
Aug 04 2015 00:11
if you make it so! @Kolloom
Jorge Almeida
@Jorgixhallo
Aug 04 2015 00:12
Bill
@kirah1314
Aug 04 2015 00:13
bonfire Finders Keepers
CamperBot
@camperbot
Aug 04 2015 00:13

:fire:Bonfire: Finders Keepers :link:

function find(arr, func) {
  var num = 0;
  return num;
}

find([1, 2, 3, 4], function(num){ return num % 2 === 0; });

Create a function that looks through an array (first argument) and returns the first element in the array that passes a truth test (second argument).

for more info: bf details bf links bf script bf wiki bf spoiler

Bill
@kirah1314
Aug 04 2015 00:13
bf spoiler
CamperBot
@camperbot
Aug 04 2015 00:13
[0] Create a function that looks through an array (first argument) and returns the first element in the array that passes a truth test (second argument).
Kolloom
@Kolloom
Aug 04 2015 00:14
I used an extra if to check the property, guess it's not necessary then
Evan Davis
@davisec52
Aug 04 2015 00:17

Hi, everybody. I'm working on the bonfire Exact Change at
http://www.freecodecamp.com/challenges/bonfire-exact-change.
My solution below returns correct change sorted from highest
to lowest. However, it does not pass two of the tests. I'd
appreciate it if someone would tell me what is expected from
the tests and what the correct responses should be.

Here are the tests that are failing:

assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['QUARTER', 0.50]], 'return correct change');return correct change: expected [ 'QUARTER', 0.5 ] to deeply equal [ [ 'QUARTER', 0.5 ] ]
assert.deepEqual(drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['TWENTY', 60.00], ['TEN', 20.00], ['FIVE', 15], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ], 'return correct change with multiple coins and bills');return correct change with multiple coins and bills: expected [ Array(7) ] to deeply equal [ Array(7) ]

Here is my code:
and here is a link to repl.it to see a working model: http://repl.it/BACR/2


var reg = {
    total: function(cid){
        var cashAmts = [];
        cid.forEach(function(v){
            cashAmts.push(v[1]);
        });
            var sum = cashAmts.reduce(function(a, b){return a + b;
            }).toFixed(2);
            return +sum;
    },

    denomMap:  [
        100, 'ONE HUNDRED', 20, 'TWENTY', 10, 'TEN', 5, 'FIVE', 1, 'ONE', 0.25, 'QUARTER', 0.1, 'DIME', 0.05, 'NICKEL', 0.01, "PENNY"
    ],

    combine: [],

    display: function(change) {
        var num = change;
        var value = '';
        for (var i = 0; change > 0 && i < this.denomMap.length; i += 2) {
            while (change >= this.denomMap[i]) {
                change += this.denomMap[i + 1];
                change = change.replace(/\d+/g, "");
                change = change.replace(/\./g, "");
                value += this.denomMap[i];
                var div = Math.floor(num/+value) * this.denomMap[i];
                var temp = [change, div];
                this.combine.push(temp);
                num = (num - div).toFixed(2);
                num = +num;
                this.display(num);
            }
        }

        return this.combine;
    }
};

function drawer(price, cash, cid){
            var change = cash - price;
            change = change.toFixed(2);
            change = +change;
            if(cash < price){
                return price;
            }
            else if(reg.total(cid) < change){
                return "Insufficient Funds";
            }
            else if(reg.total(cid) === change){
                return "Closed";
            }
            else if(reg.total(cid) > change){
                console.log(change);
                return reg.display(change);
            }
    }
drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]])

drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]);
Kolloom
@Kolloom
Aug 04 2015 00:17
oh if filter got more than 2 positives, does it return many arrays or an array that contains many array?
Feners4
@Feners4
Aug 04 2015 00:17
help with why I'm getting blank spaces in http://codepen.io/Feners4/pen/EjONEe
CamperBot
@camperbot
Aug 04 2015 00:17
no wiki entry for: with why im getting blank spaces in httpcodepeniofeners4penejonee
:pencil: click here to create one now!after creating your page type update to reload it here
Nic Galluzzo
@ngalluzzo
Aug 04 2015 00:17
depends if youre in a for loop or what
Bill
@kirah1314
Aug 04 2015 00:17
how do i reference argument 2 from argument 1? on bonfire Finders Keepers?
CamperBot
@camperbot
Aug 04 2015 00:17
type bonfire name to get some info on that bonfire here
Nic Galluzzo
@ngalluzzo
Aug 04 2015 00:17
it’ll return an array of positive matche
matches
Kolloom
@Kolloom
Aug 04 2015 00:19
an multi dimension array then?
Nic Galluzzo
@ngalluzzo
Aug 04 2015 00:19
if you’re filtering an array in an array then yup
Jorge Almeida
@Jorgixhallo
Aug 04 2015 00:22
bonfire were
CamperBot
@camperbot
Aug 04 2015 00:22
can't find a bonfire called were
Jorge Almeida
@Jorgixhallo
Aug 04 2015 00:26
bonfire Were art thou
CamperBot
@camperbot
Aug 04 2015 00:26
can't find a bonfire called were art thou
Kolloom
@Kolloom
Aug 04 2015 00:26
I feel sad I couldn't help the 2 persons above
bf where
CamperBot
@camperbot
Aug 04 2015 00:26

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

for more info: bf details bf links bf script bf wiki bf spoiler

Juan D
@Tiroloco49
Aug 04 2015 00:26
wiki jquery
CamperBot
@camperbot
Aug 04 2015 00:26
no wiki entry for: jquery
:pencil: click here to create one now!after creating your page type update to reload it here
Juan D
@Tiroloco49
Aug 04 2015 00:26
update
CamperBot
@camperbot
Aug 04 2015 00:26
updating wiki...
Juan D
@Tiroloco49
Aug 04 2015 00:26
status
CamperBot
@camperbot
Aug 04 2015 00:27
botstatus
Juan D
@Tiroloco49
Aug 04 2015 00:27
botstatus
CamperBot
@camperbot
Aug 04 2015 00:27
All bot systems are go!
botVersion: 0.0.5b
env: prod
botname: camperbot
Juan D
@Tiroloco49
Aug 04 2015 00:27
wiki jquery
CamperBot
@camperbot
Aug 04 2015 00:27

:pencil: jquery [edit]

It's the most used library in JavaScript. Is used to handle events, create animations, etc. to create dynamic web applications and pages.
$() -> tells js we'll be using jQuery document tells jQuery to work with our HTML
.ready -> makes the jQuery wait untill the page is completely loaded
:pencil: read more about jquery on the FCC Wiki
dc
@dcsan
Aug 04 2015 00:27
thanks @Tiroloco49
CamperBot
@camperbot
Aug 04 2015 00:27
dcsan sends karma to tiroloco49 :thumbsup: :sparkles: :sparkles:
Juan D
@Tiroloco49
Aug 04 2015 00:28
update
CamperBot
@camperbot
Aug 04 2015 00:28
updating wiki...
dc
@dcsan
Aug 04 2015 00:28
you could maybe put backticks around the code parts?
Juan D
@Tiroloco49
Aug 04 2015 00:28
wiki backticks
CamperBot
@camperbot
Aug 04 2015 00:28
no wiki entry for: backticks
:pencil: click here to create one now!after creating your page type update to reload it here
Juan D
@Tiroloco49
Aug 04 2015 00:28
what is that?
wiki jquery
CamperBot
@camperbot
Aug 04 2015 00:28

:pencil: jquery [edit]

It's the most used library in JavaScript. Is used to handle events, create animations, etc. to create dynamic web applications and pages.
$() -> tells js we'll be using jQuery. || document tells jQuery to work with our HTML
.ready -> makes the jQuery wait untill the page is completely loaded
:pencil: read more about jquery on the FCC Wiki
dc
@dcsan
Aug 04 2015 00:28
explain formatting
Robert
@rc242
Aug 04 2015 00:28
heyo.
CamperBot
@camperbot
Aug 04 2015 00:28

:pencil: code formatting [edit]

Steps to format your code for pasting in the chat room.

Inline code

This an inline `<paste code here>` code formatting.

^single backtick at start and end around the inline 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

dc
@dcsan
Aug 04 2015 00:28
for inline code
@Tiroloco49 we also have another room
for testing out workign on the bot ... keeps the main chat a bit more clear
Jelani Thompson
@JelaniThompson
Aug 04 2015 00:35
Hey guys, does anyone know why this is returning empty brackets?
function slasher(arr, howMany) {

  var array = [];

    //If howMany is less than 1, return the original array because nothing is being cut
    if (howMany < 1) {
      return arr;
    }

    if (arr.length > howMany) {
      var splicedArray = array.splice(howMany, arr.length);
      array.push(splicedArray);
    }

  return array;
}

slasher([1, 2, 3], 2);
I have two green checkmarks now, but I have one error and I think it's related to the empty brackets
Also still have no idea why my code is purple and white
Franco Zapata
@Francozt01
Aug 04 2015 00:36
@JelaniThompson i used splice and slice to do that without if statements or for loops
Joris Labie
@labiej
Aug 04 2015 00:37
Before I go to bed I'll just drop this here http://codepen.io/labiej/blog/
Trying to keep up with a blog about my experiences during the ziplines
Jelani Thompson
@JelaniThompson
Aug 04 2015 00:37
Yeah, but at this point I just wanna get the program working
Oh, that's a cool blog you got there, haha
Franco Zapata
@Francozt01
Aug 04 2015 00:39
@JelaniThompson arr.splice(0,howMany); return arr.slice(");
Rowvin Dizon
@r0wvin
Aug 04 2015 00:39
<script>
  $(document).ready(function() {
    $('#target1').css('color', 'red');
    $('#target1').prop('disabled', true);
    $('#target4').remove();
    $('#target2').appendTo('#right-well');
    $('#target5').clone().appendTo('#left-well');
    $('#target1').parent().css('background-color', 'red');
    $('#right-well').children().css('color', 'green');
  });
</script>

<!-- You shouldn't need to modify code below this line -->

<div class='container-fluid'>
  <h3 class='text-primary text-center'>jQuery Playground</h3>
  <div class='row'>
    <div class='col-xs-6'>
      <h4>#left-well</h4>
      <div class='well' id='left-well'>
        <button class='btn btn-default target' id='target1'>#target1</button>
        <button class='btn btn-default target' id='target2'>#target2</button>
        <button class='btn btn-default target' id='target3'>#target3</button>
      </div>
    </div>
    <div class='col-xs-6'>
      <h4>#right-well</h4>
      <div class='well' id='right-well'>
        <button class='btn btn-default target' id='target4'>#target4</button>
        <button class='btn btn-default target' id='target5'>#target5</button>
        <button class='btn btn-default target' id='target6'>#target6</button>
      </div>
    </div>
  </div>
</div>
Can anyone help me figure out whats wrong here? It's not passing.
Jorge Almeida
@Jorgixhallo
Aug 04 2015 00:40
@kyrize it's bugged
FreeCodeCamp/freecodecamp#1480
Rowvin Dizon
@r0wvin
Aug 04 2015 00:40
Ahhh thanks @Jorgixhallo
steelo808
@steelo808
Aug 04 2015 00:41
How do you stop the notification
Rowvin Dizon
@r0wvin
Aug 04 2015 00:41
@steelo808 Top right options for notifications haha
Feners4
@Feners4
Aug 04 2015 00:45
if I want to delete an object before I push it into a $scope variable array, what would be the best way to do it?
Bill
@kirah1314
Aug 04 2015 00:45
@JelaniThompson FYI, there's no need for your first if statement
Jelani Thompson
@JelaniThompson
Aug 04 2015 00:45
@kirah1314 I just needed it for validation purposes
It fixed one of the checkmarks
Bill
@kirah1314
Aug 04 2015 00:47
@JelaniThompson
function slasher(arr, howMany) {

  var array = [];

    if (arr.length > howMany) {
      var splicedArray = arr.splice(0, howMany); 
      return arr.slice();
    }
  return array;
}
slasher([1, 2, 3], 1);
Joris Labie
@labiej
Aug 04 2015 00:48
Bill
@kirah1314
Aug 04 2015 00:49
I modified it using what Franco mentioned above. I finished mine using a for loop
Franco Zapata
@Francozt01
Aug 04 2015 00:49
function slasher(arr, howMany) { arr.splice(0, howMany); return arr.slice(""); }
Jelani Thompson
@JelaniThompson
Aug 04 2015 00:51
Thanks Kirah!
Why are we returning arr.slice though?
Joris Labie
@labiej
Aug 04 2015 00:51
function slasher(arr, howMany){ return arr.splice(howMany);}
that works too
Evan Davis
@davisec52
Aug 04 2015 00:51
Hi. Is there anyone here who might be able to advise on the bonfire, "Exact Change"? My code gives correct change for all tests but is still not passing two of the tests. I've posted the code above but would be happy to post it again. Here is a link to a model on replit: http://repl.it/BACR/2
Jelani Thompson
@JelaniThompson
Aug 04 2015 00:53
Like I mean, why are we returning it with no arguments
That's what I'm kinda confused about XD
Joris Labie
@labiej
Aug 04 2015 00:58
@davisec52 if you look closely there are too many elements in your array. You should try to add some console.log's in strategic places
Bill
@kirah1314
Aug 04 2015 00:59
@JelaniThompson the slice() can be deleted, just return arr;
Jelani Thompson
@JelaniThompson
Aug 04 2015 01:00
Oh OK, thanks again
I don't know why all the seemingly difficult questions have such simplistic answers lol;
Evan Davis
@davisec52
Aug 04 2015 01:01
@labiej Thank you for the hint.
Suzanne Atkinson
@AdventureBear
Aug 04 2015 01:01
anyone great with routing/express/basjumps, etc
?
Bill
@kirah1314
Aug 04 2015 01:03
@JelaniThompson splice() chopped off n elements from arr and then you just return what's left :)
Jelani Thompson
@JelaniThompson
Aug 04 2015 01:06
Oh OK, thanks! For some reason I thought the second parameter in splice started removing from the left side of the array
But then I read W3schools page and it said you have to put a negative value for it to do that
Oopsies
Alfredo J Moreno
@Junmr4
Aug 04 2015 01:09
hey can someone help me with bon fire Bonfire: Truncate a string
Bill
@kirah1314
Aug 04 2015 01:10
@JelaniThompson array.splice(start, deleteCount), it starts at the index you want it to start with and deletes from left to right if you put a deleteCount
Evan Davis
@davisec52
Aug 04 2015 01:11
@labiej Hi. could you be a little more specific? I really don't see anything out of place in the denomMap array.
Bill
@kirah1314
Aug 04 2015 01:11
if you just put splice(0) then it removes the element on index 0
Dieison Stein
@dieisonstein
Aug 04 2015 01:14
hey guys, quick question, is there a program that i can download so i can train the codes that im learning?
Jelani Thompson
@JelaniThompson
Aug 04 2015 01:20
What do you mean by train?
Like practice?
Adam
@stwaldo
Aug 04 2015 01:22
bonfire pairwise
CamperBot
@camperbot
Aug 04 2015 01:22
can't find a bonfire called pairwise
Franco Zapata
@Francozt01
Aug 04 2015 01:24
falsey bouncer
bf falsey bouncer
CamperBot
@camperbot
Aug 04 2015 01:25

:fire:Bonfire: Falsey Bouncer :link:

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  return arr;
}

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

Remove all falsey values from an array.

for more info: bf details bf links bf script bf wiki bf spoiler

shawne90
@shawne90
Aug 04 2015 01:26
@shawne90
Hey
https://www.codecademy.com/courses/web-beginner-en-v6phg/0/3
I keep getting an error that says "It looks like you didn't insert your <p> after the <div> with ID #one."
but I inputted the following code: $('#one').after('<p>Hello</p>');
is that not right?
Sean Rodman
@srodman7689
Aug 04 2015 01:27
bonfire Make a Person
CamperBot
@camperbot
Aug 04 2015 01:27
can't find a bonfire called make a person
Sean Rodman
@srodman7689
Aug 04 2015 01:27
bonfire Make a Person
CamperBot
@camperbot
Aug 04 2015 01:27
can't find a bonfire called make a person
dc
@dcsan
Aug 04 2015 01:28
bonfire person
CamperBot
@camperbot
Aug 04 2015 01:28
can't find a bonfire called person
Franco Zapata
@Francozt01
Aug 04 2015 01:28
@shawne90 paste he whole code
dc
@dcsan
Aug 04 2015 01:28
maybe its an advanced bonfire?
Franco Zapata
@Francozt01
Aug 04 2015 01:28
the
shawne90
@shawne90
Aug 04 2015 01:28
ok i'll try that
Franco Zapata
@Francozt01
Aug 04 2015 01:29
@shawne90 let me see ur entire code
Prashanth Chandra
@prashcr
Aug 04 2015 01:29
help
CamperBot
@camperbot
Aug 04 2015 01:29

Hi this is CamperBot! I can assist you in this chatroom :smile:

Basic commands:

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

:unlock: CamperBot info and tips the power of camperbot!

:pencil: read more about camperbot on the FCC Wiki

Sean Rodman
@srodman7689
Aug 04 2015 01:29
Difficulty is 3 so I guess so...
Franco Zapata
@Francozt01
Aug 04 2015 01:29
Make a Person is a bonfire intermediate
Sean Rodman
@srodman7689
Aug 04 2015 01:29
oh ok.
Adam
@stwaldo
Aug 04 2015 01:30
wiki reduce
CamperBot
@camperbot
Aug 04 2015 01:30
no wiki entry for: reduce
:pencil: click here to create one now!after creating your page type update to reload it here
shawne90
@shawne90
Aug 04 2015 01:30
@Francozt01 ok one sec
Adam
@stwaldo
Aug 04 2015 01:30
wiki Array.reduce()
CamperBot
@camperbot
Aug 04 2015 01:30
no wiki entry for: arrayreduce
:pencil: click here to create one now!after creating your page type update to reload it here
Sean Rodman
@srodman7689
Aug 04 2015 01:30
I have everything working except for it expects the length to be 6 and instead I have only gotten it down to 7...
Jennifer Pazos
@jmb521
Aug 04 2015 01:30
anyone able to pair for Bonfire Where art thou?
Bill
@kirah1314
Aug 04 2015 01:30
wiki some
CamperBot
@camperbot
Aug 04 2015 01:30
no wiki entry for: some
:pencil: click here to create one now!after creating your page type update to reload it here
Franco Zapata
@Francozt01
Aug 04 2015 01:30
wiki reduce()
CamperBot
@camperbot
Aug 04 2015 01:30
no wiki entry for: reduce
:pencil: click here to create one now!after creating your page type update to reload it here
Franco Zapata
@Francozt01
Aug 04 2015 01:30
methods
dc
@dcsan
Aug 04 2015 01:30
the wiki is really early days...
Franco Zapata
@Francozt01
Aug 04 2015 01:30
wiki camperbot
CamperBot
@camperbot
Aug 04 2015 01:30

:pencil: camperbot [edit]

Hi this is CamperBot! I can assist you in this chatroom :smile:

Basic commands:

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

:unlock: CamperBot info and tips the power of camperbot!

:pencil: read more about camperbot on the FCC Wiki

dc
@dcsan
Aug 04 2015 01:31
we could use some help from people adding entries to it
btw if you just want to play with camperbot try the testing channel
dcsan @dcsan :frown: Sorry
shawne90
@shawne90
Aug 04 2015 01:31
@Francozt01 Hey I figured it out, I just forgot to input the paragraph into my html doc
thanks buddy
Franco Zapata
@Francozt01
Aug 04 2015 01:31
@shawne90 np! keep going
Sean Rodman
@srodman7689
Aug 04 2015 01:33
@Francozt01 do you think you could help me out with the Make a Person bonfire?
Franco Zapata
@Francozt01
Aug 04 2015 01:34
@srodman7689 i haven't done it yet
Sean Rodman
@srodman7689
Aug 04 2015 01:34
oh ok. thanks.
Franco Zapata
@Francozt01
Aug 04 2015 01:35
good luck
Jelani Thompson
@JelaniThompson
Aug 04 2015 01:35
So, question. How many bonfires do you guys do/recommend doing on an average per day?
CamperBot
@camperbot
Aug 04 2015 01:35
type bonfire name to get some info on that bonfire here
Sean Rodman
@srodman7689
Aug 04 2015 01:37
I do as many as possible personally. But I would say that when you start to get frustrated step away and come back later.
Kolloom
@Kolloom
Aug 04 2015 01:37
I don't think this should be measured by number of bonfire done everyday since they do vary on difficulties.
DTing
@dting
Aug 04 2015 01:38
@srodman7689 what issues are you having with that bonfire?
CamperBot
@camperbot
Aug 04 2015 01:38
type bonfire name to get some info on that bonfire here
Kolloom
@Kolloom
Aug 04 2015 01:39
I got 7 for the first day into algorithms, now that I have finished all the easy ones, I'd be happy if I could do 1 everyday
Sean Rodman
@srodman7689
Aug 04 2015 01:39
Just the length of the object. I figured it out though.
Jorge Almeida
@Jorgixhallo
Aug 04 2015 01:39
Hey:)\color{#F90}{Hey :)}
Kolloom
@Kolloom
Aug 04 2015 01:40
fancy
Sean Rodman
@srodman7689
Aug 04 2015 01:40
thx for asking though @dting
shawne90
@shawne90
Aug 04 2015 01:47
jq sucks
lol
Jelani Thompson
@JelaniThompson
Aug 04 2015 01:47
Lol, for me I try to get 2-3
I find that when I start to get frustrated, I tend to retain less of the knowledge though lol
Jalk65
@Jalk65
Aug 04 2015 01:48
Hi. Is there a forum or area to go to ask questions about code from the JS code academy classes? Without signing up for JS?
I meant signing up for Code Academy
Jorge Almeida
@Jorgixhallo
Aug 04 2015 01:51
@Jalk65 you can't acces Q&A on CodeCademy without sign up? If not, we can help you here anyway
Adam
@stwaldo
Aug 04 2015 01:52
I think you can access the Q&A, but you need an accout to ask questions on it
laugmo
@laugmo
Aug 04 2015 01:57
hello, I am trying to run cd ~/workspace/dist && heroku config:set NODE_ENV=production && heroku addons:add mongolab in my basejump project but the system response is bash: cd: /home/ubuntu/workspace/dist: No such file or directory. Has anyone had this problem when tying to add the project to heroku??
Rex Schrader
@SaintPeter
Aug 04 2015 01:58
Humm @laugmo, let me look at mine
@laugmo It looks like dist is created in a prior step. You may want to ask in FreeCodeCamp/HelpBasejumps
DTing
@dting
Aug 04 2015 02:00
@laugmo dis is created when you run grunt
@laugmo grunt's build task is what creates the dist folder either that or you didn't run yo angular-fullstack:heroku
laugmo
@laugmo
Aug 04 2015 02:04
I might have missed that previous step
thanks ;-)
CamperBot
@camperbot
Aug 04 2015 02:04
laugmo sends brownie points to @ :sparkles: :thumbsup: :sparkles:
Sean Rodman
@srodman7689
Aug 04 2015 02:05
Map the debris was awesome!!!!!
Lightwaves
@Lightwaves
Aug 04 2015 02:06
It's pretty cool if you understand it
Sean Rodman
@srodman7689
Aug 04 2015 02:08
It took me a minute but I got it lol.
well it took more than a minute. it took about 20 of them lol.
Adam
@stwaldo
Aug 04 2015 02:11
Trying bonfire pairwise, but my code’s failing the third test: pairwise([1,1,1], 2)
CamperBot
@camperbot
Aug 04 2015 02:11
type bonfire name to get some info on that bonfire here
Adam
@stwaldo
Aug 04 2015 02:13
Oooo, wait a min - arr.indexOf(searchElement[, fromIndex = 0])
Liz Rezes
@queenlizo
Aug 04 2015 02:16
bonfire Chunky Monkey
CamperBot
@camperbot
Aug 04 2015 02:16

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

for more info: bf details bf links bf script bf wiki bf spoiler

Liz Rezes
@queenlizo
Aug 04 2015 02:16
bf details
CamperBot
@camperbot
Aug 04 2015 02:16

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

Array.push())


  • bonfire info for more info
  • bonfire links
  • bonfire script for the script
  • bonfire spoiler for some clues on how to solve it
  • bonfire wiki for related info from the wiki
Jorge Almeida
@Jorgixhallo
Aug 04 2015 02:16
bonfire script
CamperBot
@camperbot
Aug 04 2015 02:16
function chunk(arr, size) {
  // Break it up.
  return arr;
}

chunk(['a', 'b', 'c', 'd'], 2);
Darrell Wong
@darrell1226
Aug 04 2015 02:18
I still don't understand why I keep getting error messages when I attempt to get information from an API. Is there a difference between .getJSON, .get, .ajax? And why do we need to add ?callback=? to some. Also I'm getting an error message now when calling to https://en.wikipedia.org/w/api.php?action=query&titles=Main%20Page&prop=revisions&rvprop=content&format=json?callback=?. It says refused to execute script because it's MIME type (text/html) is not executable and strict MIME type checking is enabled. So does that mean the data is not JSON format and I need to try another way to get it?
Matt Everson
@matteverson
Aug 04 2015 02:20
@darrell1226 callback=? is special. jQuery is designed to replace that ? with a function it generates to return the result as an object. Otherwise, and here's the key for you - there should only be one ? in a URL, to indicate the end of the URL and the start of the querystring.
Brock Hayes
@brockson007
Aug 04 2015 02:20
$(document).ready(function)() {
    $('div').mouseenter(function() {
       $('div').fadeTo('fast',1);
    });
});
can someone figure out what's wrong?
Franco Zapata
@Francozt01
Aug 04 2015 02:21
@brockson007 the <link > to JQuery file.. inside the <head> Tags </head>
Matt Everson
@matteverson
Aug 04 2015 02:22
@darrell1226 That message will happen when wikipedia can't see the format=json in your querystring, so it returns html by default.
Jorge Almeida
@Jorgixhallo
Aug 04 2015 02:24
@brockson007 ready(function-->)\huge)<--() {
Brock Hayes
@brockson007
Aug 04 2015 02:27
@Jorgixhallo Someone else got it. Thanks for trying
@Jorgixhallo I forgot to put the<script> in the body in the html
Darrell Wong
@darrell1226
Aug 04 2015 02:39
@matteverson I tried moving it around but now I get an error that says refused to execute script because MIME type (application/json) is not executable. What should I change in my API query?
$.getJSON('https://en.wikipedia.org/w/api.php?action=query&titles=Main%20Page&prop=revisions&rvprop=content?callback=?&format=json', function(data){
  $('#container').html(data);
});
Jalk65
@Jalk65
Aug 04 2015 02:40
var slaying = true
var youHit = Math.floor(Math.random() 2)
var damageThisRound = Math.floor(Math.random()
5+1)
while(slaying){
if (youHit===1){console.log("Congrats!Good hit!");}
totalDamage += damageThisRound;
if (totalDamage >= 4){console.log("You win!")
slaying=false}
else {youHit = Math.floor(Math.random()*2)}
else {console.log("You died.");
slaying = false;
}
}
Rafael J. Rodriguez
@Rafase282
Aug 04 2015 02:40
var slaying = true
var youHit = Math.floor(Math.random() * 2)
var damageThisRound = Math.floor(Math.random()*5+1)
while(slaying){
    if (youHit===1){console.log("Congrats!Good hit!");}
    totalDamage += damageThisRound;
        if (totalDamage >= 4){console.log("You win!")
        slaying=false}
    else {youHit = Math.floor(Math.random()*2)}
    else {console.log("You died.");
    slaying = false;
    }
}
@Jalk65 easier to read
Jalk65
@Jalk65
Aug 04 2015 02:41
For the above code I get an error that reads an expression was expected but found an else, any iiideas why?
Rafael J. Rodriguez
@Rafase282
Aug 04 2015 02:41
yes
spacing is wrong
and you shoudl use if, else if else
Kolloom
@Kolloom
Aug 04 2015 02:41
This message was deleted
Jalk65
@Jalk65
Aug 04 2015 02:42
spacing where? I thought spacing didn't matter in JS?
Kolloom
@Kolloom
Aug 04 2015 02:43
function diff(arr1, arr2) {
  var newArr = [],
      arr_all = arr1.concat(arr2).sort();
  //console.log('arr_all: ' + arr_all);

  for (var i = 0; i < arr_all.length; i++) {
      //console.log(arr_all[i]);
      if (arr1.indexOf(arr_all[i]) < 0) {
          newArr.push(arr_all[i]);
      }
  }

  for (var n = 0; n < arr_all.length; n++) {
      //console.log(arr_all[n]);
      if (arr2.indexOf(arr_all[n]) < 0) {
          newArr.push(arr_all[n]);
      }
  }

  //console.log("final: " + newArr);
  return newArr;
}
doing bonfire diff, couldn't pass the last test.What am i doing wrong here?
CamperBot
@camperbot
Aug 04 2015 02:43
type bonfire name to get some info on that bonfire here
Jalk65
@Jalk65
Aug 04 2015 02:43
also the first second if and first else are inside the first if statement. Should I still use elif?
DTing
@dting
Aug 04 2015 02:45
@Kolloom you need to remove the duplicate values
Jalk65
@Jalk65
Aug 04 2015 02:45
sorry @Kollom I'm not that far along yet.
Rafael J. Rodriguez
@Rafase282
Aug 04 2015 02:45
@Jalk65 , try using a text editor that support javascript
Darrell Wong
@darrell1226
Aug 04 2015 02:46
Does anyone have an API query that works for Wikipedia?
Kolloom
@Kolloom
Aug 04 2015 02:46
@dting petty sure I did that
the error message is not helping either
DTing
@dting
Aug 04 2015 02:47
hmm lemme see
Kolloom
@Kolloom
Aug 04 2015 02:48
works in repl.it though
Jalk65
@Jalk65
Aug 04 2015 02:48
@Rafase282 OK, I'll try that.
Rafael J. Rodriguez
@Rafase282
Aug 04 2015 02:48
@Jalk65 check this http://repl.it/zll/80
Jalk65
@Jalk65
Aug 04 2015 02:49
Thanks for your help and the reformatting.
CamperBot
@camperbot
Aug 04 2015 02:49
jalk65 sends brownie points to @ :sparkles: :thumbsup: :sparkles:
Rafael J. Rodriguez
@Rafase282
Aug 04 2015 02:49
I don't know what youa re tryignt o do yet but the syntax is all wrong, so the last else is part of the very first one or what?
ninjatron
@ninjatron
Aug 04 2015 02:51
hey
Rafael J. Rodriguez
@Rafase282
Aug 04 2015 02:51
hey you?
Grace
@dogbot101
Aug 04 2015 02:52
@Kolloom It is returning final: cookie monster,elmo,snuffleupagus but needs to return ['snuffleupagus', 'cookie monster', 'elmo']
DTing
@dting
Aug 04 2015 02:52
@Kolloom i got it. Dont sort.
Jalk65
@Jalk65
Aug 04 2015 02:52
@Rafase282 yes the first if has the second if and else embedded and then ends with the last else. Does that make sense?
DTing
@dting
Aug 04 2015 02:52
@Kolloom if you remove your .sort() call your function passes the test
Rafael J. Rodriguez
@Rafase282
Aug 04 2015 02:52
@Jalk65 what else goes inside the first if?
Suzanne Atkinson
@AdventureBear
Aug 04 2015 02:53
basejump help anyone?
ninjatron
@ninjatron
Aug 04 2015 02:53
bonfire: arguments optional
CamperBot
@camperbot
Aug 04 2015 02:53
/me :frown: Sorry, can't find a bonfire called argument optional. Check the map?
Kolloom
@Kolloom
Aug 04 2015 02:54
@dogbot101 the newArr starts as empty array, I only uses push here, the final is just console.log
Grace
@dogbot101
Aug 04 2015 02:54
Yes,
Rafael J. Rodriguez
@Rafase282
Aug 04 2015 02:54
you have to watch the white space, check
ninjatron
@ninjatron
Aug 04 2015 02:54
how do i ask for user input?
Grace
@dogbot101
Aug 04 2015 02:55
Regardless, I agree with @dting . You might want to remove your .sort() . I was using your console.log to see what was wrong. It looks like it is returning the items in the wrong order for the last test
Kolloom
@Kolloom
Aug 04 2015 02:55
@dting I don't know if that's a bug at all, but it does works, thanks
Jalk65
@Jalk65
Aug 04 2015 02:55
@Rafase282 the first if checks to see if the player hit, if he did then it acknowledges the hit, prints a congrats message and checks total damage
Kolloom
@Kolloom
Aug 04 2015 02:56
so the output should be in exact order? @dogbot101
that's not mentioned in the description of the bonfire at all
Alfredo J Moreno
@Junmr4
Aug 04 2015 02:57
am i heading in the right direction
CamperBot
@camperbot
Aug 04 2015 02:57
type bonfire name to get some info on that bonfire here
Grace
@dogbot101
Aug 04 2015 02:57
@Kolloom The difference between an empty array and ['snuffleupagus', 'cookie monster', 'elmo'], is ['snuffleupagus', 'cookie monster', 'elmo']. Yes, it seems order does matter for it to pass.
Alfredo J Moreno
@Junmr4
Aug 04 2015 02:57
function truncate(str, num) {
  // Clear out that junk in your trunk
  if(str > num.length) {

  }
  return str;
}

truncate('A-tisket a-tasket A green and yellow basket', 11);
am im doing good and heading the right way ?
Kolloom
@Kolloom
Aug 04 2015 02:59
@dogbot101 they should have clarified in that bonfire though
Grace
@dogbot101
Aug 04 2015 02:59
@Kolloom Yes, sometimes I take a look at the tests if I don't quite understand the description. I've found it to be helpful.
Matt Everson
@matteverson
Aug 04 2015 02:59

@darrell1226

$.getJSON('https://en.wikipedia.org/w/api.php?action=query&titles=Main%20Page&prop=revisions&rvprop=content&format=json&callback=?', function(data){
  $('#container').html(data);
});

something more like this. callback=? is just a key and value, like any other element in the querystring

Kolloom
@Kolloom
Aug 04 2015 03:01
that's a helpful tip, thank you @dogbot101
Grace
@dogbot101
Aug 04 2015 03:02
@Junmr4 I have a few questions about your code
Dayne Wright
@daynewright
Aug 04 2015 03:03
I have been trying for hours and I think I just need someone to walk me through how to complete steam roller with reduce() and recursion. :worried:
Grace
@dogbot101
Aug 04 2015 03:03
Why are you using num.length?
gazzer82
@gazzer82
Aug 04 2015 03:06
Hi all, i'm a little stuck on the Make a Person Bonfire, help greatly appreciated!
Kolloom
@Kolloom
Aug 04 2015 03:07
@Daynewr im struggling with that bonfire too
gazzer82
@gazzer82
Aug 04 2015 03:07
I have all the test cases returning correct, other than the first one "expected 3 to deeply equal 6"
Matt Everson
@matteverson
Aug 04 2015 03:07
@Daynewr In any recursive function you need two branches. One returns right away when it shouldn't recurse anymore, and the other is the meat of what you want the function to do, ending with a return steamroller(stuff)
gazzer82
@gazzer82
Aug 04 2015 03:08
Which i don't understand as the object only has firstName, lastName and fullName as attributes. Making three not six?
Nic Galluzzo
@ngalluzzo
Aug 04 2015 03:08
you need 3 gets and 3 sets
setFirstName, getFirstName
gazzer82
@gazzer82
Aug 04 2015 03:09
Hi @ngalluzzo that i have.
Darrell Wong
@darrell1226
Aug 04 2015 03:09
@matteverson thanks.
gazzer82
@gazzer82
Aug 04 2015 03:09
three sets and three gets, all those test cases are passing?
Grace
@dogbot101
Aug 04 2015 03:09
Also, @Junmr4 , it might help to think about two scenarios, if the string length is less than or equal to num, and another scenario if the string length is too long, and you need to shorten the string and add "..."
Nic Galluzzo
@ngalluzzo
Aug 04 2015 03:09
you may have 3 properties and 3 methods
post your code?
gazzer82
@gazzer82
Aug 04 2015 03:10
Here's my code
This message was deleted
This message was deleted
Matt Everson
@matteverson
Aug 04 2015 03:10
@Daynewr In steamroller, the ending condition is that the item is no longer an array. Which is good, because if you want to use reduce() in the alternate branch, then that will only work on an array ;)
gazzer82
@gazzer82
Aug 04 2015 03:10
var Person = function(firstAndLast) {
  this.privateFullName = firstAndLast;
  var names = firstAndLast.split(" ");
  this.privateFirstName = names[0];
  this.privateLastName = names[1];
};

Person.prototype.getFullName = function(){
  return this.privateFullName;
};

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

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

Person.prototype.setFullName = function(name){
  this.privateFullName = name;
};

Person.prototype.setFirstName = function(name){
  this.privateFirstName = name;
};

Person.prototype.setLastName = function(name){
  this.privateLastName = name;
};

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

bob.getFullName();
@ngalluzzo
Nic Galluzzo
@ngalluzzo
Aug 04 2015 03:11
you can’t use Prototypes @gazzer82
you need to use the object constructor @gazzer82
gazzer82
@gazzer82
Aug 04 2015 03:12
Ah that makes sense, as the private var's made no sense with Object.Prototype.
Thanks
CamperBot
@camperbot
Aug 04 2015 03:12
gazzer82 sends brownie points to @ :sparkles: :thumbsup: :sparkles:
Logan Tegman
@ltegman
Aug 04 2015 03:13
@gazzer82 You want to be mindful about the fact that your functions for setting the first and last name aren’t updating the fullname and the setfullname isn’t update the first and last.
Best to just keep one record (either the full name or separate first and last) to remove that duplication and possiblity for conflicts.
Matt Everson
@matteverson
Aug 04 2015 03:14
@Daynewr What you want that reduce to return is a single array containing all the items. So when you call steamroller() recursively it will give you a single array. So...we need a function that concatenates elements of one array to another. (The previous items in the reduce to the results of a recursive steamroller call)
Dayne Wright
@daynewright
Aug 04 2015 03:15
@so you need two functions ultimately?
Matt Everson
@matteverson
Aug 04 2015 03:16
@Daynewr Yes, but it's built in.
gazzer82
@gazzer82
Aug 04 2015 03:18
@ltegman yes i initially just had the string being split and was just storing the firstName and lastName separately, just got to that point trying to work out why the tests weren't completing.
@ngalluzzo and @ltegman this is what i have now.
var Person = function(firstAndLast) {
  var names = firstAndLast.split(" ");
  var firstName = names[0];
  var lastName = names[1];
  this.getFullName = function(){
    return firstName + ' ' + lastName;
  };
  this.getLastName = function(){
    return lastName;
  };
  this.getFirstName = function(){
    return firstName;
  };
  this.setFullName = function(name){
    names = name.split(" ");
    firstName = names[0];
    lastName = names[1];
  };
  this.setFirstName = function(name){
    firstName = name;
  };
  this.setLastName = function(name){
    lastName = name;
  };
};

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

bob.getFullName();
Should i move the methods into an external object and use it to extend Person?
Nic Galluzzo
@ngalluzzo
Aug 04 2015 03:23
your variables don’t match for setFullName
Logan Tegman
@ltegman
Aug 04 2015 03:23
@gazzer82 I don’t think so. Looks good -- although again, best practice would be to remove the variable duplication.
Nic Galluzzo
@ngalluzzo
Aug 04 2015 03:23
@gazzer82
your argument is name but you’re splitting names
gazzer82
@gazzer82
Aug 04 2015 03:26
@ngalluzzo sorry wrong version, this is my final version, how dos this look?
var Person = function(firstAndLast) {
  var names = firstAndLast.split(" ");
  var firstName = names[0];
  var lastName = names[1];
  this.getFullName = function(){
    return firstName + ' ' + lastName;
  };
  this.getLastName = function(){
    return lastName;
  };
  this.getFirstName = function(){
    return firstName;
  };
  this.setFullName = function(name){
    names = name.split(" ");
    firstName = names[0];
    lastName = names[1];
  };
  this.setFirstName = function(name){
    firstName = name;
  };
  this.setLastName = function(name){
    lastName = name;
  };
};

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

console.log(bob.getLastName());
Liz Rezes
@queenlizo
Aug 04 2015 03:26
I'm doing the bonfire Chunky Monkey. I'm supposed to split up the array into 2 chunks, but I can't get it to work. Any suggestions?
function chunk(arr, size) {
  // Break it up. 
  var myArray = [];
  for (var i=0; i < arr.length; i++) {
    myArray.push(arr.slice(0,size));
  }

  if (arr.length) {
    myArray.push(arr);
  }
  return myArray;
}

chunk(['a', 'b', 'c', 'd'], 2);
Marcos Xavier
@marcosxpfreitas
Aug 04 2015 03:26
hello
Kolloom
@Kolloom
Aug 04 2015 03:28
@queenlizo what does if (arr.length) do?
Darrell Wong
@darrell1226
Aug 04 2015 03:28
I'm having trouble with Bonfire: No repeats please. Running the code says "aab" has two permutations. But I calculate three: aab, aba, and baa. I'm not understanding this.
gazzer82
@gazzer82
Aug 04 2015 03:28
@ltegman see above, does that fix the variable duplication?
Liz Rezes
@queenlizo
Aug 04 2015 03:29
@Kolloom Ha! That I don't know.
Darrell Wong
@darrell1226
Aug 04 2015 03:29
Nevermind, I read the instructions wrong.
Logan Tegman
@ltegman
Aug 04 2015 03:29
@gazzer82 You solved the problem of them getting out of sync with eachother, but you’re still storing the full name in two different places (separate and full) which is something you want to avoid. You never want to store the same data in more than one place.
Adam
@stwaldo
Aug 04 2015 03:29
@queenlizo are you using slice correctly? I think the second argument is the index of the last chunk, not the size of the slice
@queenlizo So when you have a static argument like arr. slice(i, 2) it’s always going to slice to the element at index 2
gazzer82
@gazzer82
Aug 04 2015 03:30
@ltegman do you mean the names var at the beginning of the function? How would you go about accessing the first and last name of the string sent without storing it in a var?
Should i just make the call split twice?
Liz Rezes
@queenlizo
Aug 04 2015 03:31
@stwaldo When I change it to myArray.push(size);, it returns this: myArray.push(size);
wooops
Argh. Can't copy and paste it. Suffice to say that it doesn't work. :(
Adam
@stwaldo
Aug 04 2015 03:32
@queenlizo I think you’re fine using slice, you just have to update the second argument so that it moves with your counter, like …slice(i, i+size)
Logan Tegman
@ltegman
Aug 04 2015 03:32
@gazzer82 You could either only store the full name and split it whenever you need to set or get a single name, or store the individuals and concatenate or split when you need to get or set the full name.
Liz Rezes
@queenlizo
Aug 04 2015 03:32
@stwaldo Ah. I used that argument before. Let me try again
gazzer82
@gazzer82
Aug 04 2015 03:32
@ltegman so changing it to something like this:
var Person = function(firstAndLast) {
  //var names = firstAndLast.split(" ");
  var firstName = firstAndLast.split(" ")[0];
  var lastName = firstAndLast.split(" ")[1];
  this.getFullName = function(){
    return firstName + ' ' + lastName;
  };
  this.getLastName = function(){
    return lastName;
  };
  this.getFirstName = function(){
    return firstName;
  };
  this.setFullName = function(name){
    firstName = name.split(" ")[0];
    lastName = name.split(" ")[1];
  };
  this.setFirstName = function(name){
    firstName = name;
  };
  this.setLastName = function(name){
    lastName = name;
  };
};

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

console.log(bob.getLastName());
Liz Rezes
@queenlizo
Aug 04 2015 03:34
@stwaldo Nope. It's ok. I think that I'm going to go do something else for a while to clear my brain. Thanks for your help!
Logan Tegman
@ltegman
Aug 04 2015 03:35
@gazzer82 Yup — looks great.
Adam
@stwaldo
Aug 04 2015 03:35
@queenlizo np! Good luck :-)
gazzer82
@gazzer82
Aug 04 2015 03:35
Great, thanks for the help and advice, really appreciated!
Logan Tegman
@ltegman
Aug 04 2015 03:36
@gazzer82 No problem :smile:
gazzer82
@gazzer82
Aug 04 2015 03:37
@ltegman I guess in theory i should also check that when i get a fullName string it can actually be split before trying to set the firstName and lastName, or is that unneeded as they will just get set to undefined?
if(firstAndLast.split(" ").length === 2)
Logan Tegman
@ltegman
Aug 04 2015 03:38
@gazzer82 Up to you — I don’t think any of the bonfires require input checking in order to pass the tests, but stuff like that is a really good thought process to have for when you start making apps in the wild and definitely doesn’t hurt to start practicing now.
gazzer82
@gazzer82
Aug 04 2015 03:39
Ok cool, thanks.
Out of interest @ltegman are you doing FreeCodeCamp?
Logan Tegman
@ltegman
Aug 04 2015 03:41
@gazzer82 Yup — I’ve been programming on and off for a couple years now, but I want to finally turn it into a career, so I’m hoping this can help me get there. I’m halfway through the ziplines right now.
ninjatron
@ninjatron
Aug 04 2015 03:42
i am not sure i understand Bonfire: Arguments Optional
gazzer82
@gazzer82
Aug 04 2015 03:43
@ltegman Ditto, but i've been almost exclusively Objective C, so this is a bit of a change. Similar in wanting to make a change, kinda now or never time really. Thinking i might go and do a residential bootcamp course afterwards if all goes to plan, maybe even Hack Reactor if they let me in. How long did it take you to get to the Ziplines?
Finally decided to see if i can make some money from my Hobby, and see how i measure up to everyone else.
Logan Tegman
@ltegman
Aug 04 2015 03:45
@gazzer82 Oh yeah, that sounds like quite a change. I came from C# primarily, but I had done web stuff in college. I’m planning to do the same thing with an in-person bootcamp early next year. There’s one near me in Seattle called Code Fellows that seems to have good reviews, so I’m excited for that! I think it took me about 11 days to get to the ziplines.
I used to get to do some dev stuff at my job, but as time has gone on that has moved to people who were actually hired to be devs, so I’m anxious to move on and make software something that is my full time gig!
gazzer82
@gazzer82
Aug 04 2015 03:50
Ah ok, hadn't heard of Code Fellows but i'll check them out, are they Javascript or Ruby orientated? My job has nothing really to do with this at all, but i have done a decent amount of iOS OS X stuff for people on the side. Had to do a full stack setup a few months ago and used Meteor, but realised that if i was gong to do this i really needed to learn Javascript first. If i was going to spend that much money on a bootcamp i wanted to make sure i was going in as up to speed as i could be, and saw this on Product Hunt and it looked ideal!
CamperBot
@camperbot
Aug 04 2015 03:50
we have a meteor channel here: camperbot/meteorJS
Logan Tegman
@ltegman
Aug 04 2015 03:53
@gazzer82 Yeah, same here. I want to make sure I’m prepped to excel if I’m paying for something. Code Fellows does a bunch of different stacks, Ruby, JS, Swift, Python, and Front-End. That’s fun you’ve got a chance to dive into it on the side. How was your experience with clients? I did a website for a client a while back and absolutely hated the experience of working with them.
Sarah
@sholdgrafer
Aug 04 2015 03:59
Hey everyone! I just finished for loops and Arrays in beginning JS, but I'm not feeling like I really "get" what I did all that well. Would you guys recommend moving on, or maybe doing those sections again?
Abhisek Pattnaik
@abhisekp
Aug 04 2015 04:01

Why isn't this working Bonfire: Title Case?
The toUpperCase() isn't working.

function titleCase(str) {
  str = str.toLowerCase();
  var words = /(\w)([\w']*)/g;
  str = str.replace(words, ('$1').toUpperCase() + '$2');

  return str;
}

console.log(titleCase("I'm a little tea pot"));
// should output: "I'm A Little Tea Pot"
// but outputs: "i'm a little tea pot"

https://coderpad.io/DEKZ6YNZ

CamperBot
@camperbot
Aug 04 2015 04:01
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
gazzer82
@gazzer82
Aug 04 2015 04:01
@ltegman will definitely check them out then, i like JS, but Ruby is also well on my Radar. Most of the stuff i've done has been for tech savvy friends who own companies so not too bad. But my day to day involves dealing with clients all the time, in quite high stress environments, often being shouted at, so that bit i find quite easy :)
ninjatron
@ninjatron
Aug 04 2015 04:02
bonfire arguments optional
CamperBot
@camperbot
Aug 04 2015 04:02

:fire:Bonfire: Arguments Optional :link:

function add() {
  return false;
}

add(2,3);

Create a function that sums two arguments together. If only one argument is provided, return a function that expects one additional argument and will return the sum.

for more info: bf details bf links bf script bf wiki bf spoiler

ninjatron
@ninjatron
Aug 04 2015 04:03
bf details
CamperBot
@camperbot
Aug 04 2015 04:03

:fire:Bonfire: Arguments Optional :link:

function add() {
  return false;
}

add(2,3);

Create a function that sums two arguments together. If only one argument is provided, return a function that expects one additional argument and will return the sum.
For example, add(2, 3) should return 5, and add(2) should return a function that is waiting for an argument so that <code>var sum2And = add(2); return sum2And(3); // 5</code>
If either argument isn't a valid number, return undefined.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:

Global Function Object,
Arguments object


  • bonfire info for more info
  • bonfire links
  • bonfire script for the script
  • bonfire spoiler for some clues on how to solve it
  • bonfire wiki for related info from the wiki
Logan Tegman
@ltegman
Aug 04 2015 04:03
@sholdgrafer It sort of depends on your learning style, but I personally would recommend moving on and just looking up more stuff about loops and arrays if you run into trouble. I think you’ll only really get it once you start applying it more and more. If you find yourself getting overwhelmed or confused by loops and arrays in the later stuff you can always go back again.
Kolloom
@Kolloom
Aug 04 2015 04:03
@sholdgrafer i'd say move on, there's no shortage of loops and arrays in the later courses, they have a bunch of review sections too later down the line (assume you are talking about codecademy)
ninjatron
@ninjatron
Aug 04 2015 04:03
bonfire info
CamperBot
@camperbot
Aug 04 2015 04:03

:fire:Bonfire: Arguments Optional :link:

function add() {
  return false;
}

add(2,3);

Create a function that sums two arguments together. If only one argument is provided, return a function that expects one additional argument and will return the sum.

for more info: bf details bf links bf script bf wiki bf spoiler

ninjatron
@ninjatron
Aug 04 2015 04:03
bonfire script
CamperBot
@camperbot
Aug 04 2015 04:03
function add() {
  return false;
}

add(2,3);
ninjatron
@ninjatron
Aug 04 2015 04:03
bonfire links
ninjatron
@ninjatron
Aug 04 2015 04:04
bf spoiler
CamperBot
@camperbot
Aug 04 2015 04:04
[0] Create a function that sums two arguments together. If only one argument is provided, return a function that expects one additional argument and will return the sum.
ninjatron
@ninjatron
Aug 04 2015 04:04
bf spoiler
CamperBot
@camperbot
Aug 04 2015 04:04
[1] For example, add(2, 3) should return 5, and add(2) should return a function that is waiting for an argument so that <code>var sum2And = add(2); return sum2And(3); // 5</code>
Sarah
@sholdgrafer
Aug 04 2015 04:04
Thanks Itegman and Kollom! I wasn't sure what was coming up and didn't want to waste time redoing things if I would get more review later on!
CamperBot
@camperbot
Aug 04 2015 04:04
sholdgrafer sends brownie points to @ :sparkles: :thumbsup: :sparkles:
ninjatron
@ninjatron
Aug 04 2015 04:04
bf spoiler
CamperBot
@camperbot
Aug 04 2015 04:04
[2] If either argument isn't a valid number, return undefined.
ninjatron
@ninjatron
Aug 04 2015 04:04
bf spoiler
CamperBot
@camperbot
Aug 04 2015 04:04
[3] Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
ninjatron
@ninjatron
Aug 04 2015 04:04
bf spoiler
CamperBot
@camperbot
Aug 04 2015 04:04
no more hints! Let's start again.
ninjatron
@ninjatron
Aug 04 2015 04:05
i don't understand bf arguments optional
Kolloom
@Kolloom
Aug 04 2015 04:05
neither do i
ninjatron
@ninjatron
Aug 04 2015 04:05
it says if 1 argument is provided return a function and expect input
how do i get the input?
Matt Everson
@matteverson
Aug 04 2015 04:06
@ninjatron The function you return will be called with the input
Logan Tegman
@ltegman
Aug 04 2015 04:06
@abhisekp It looks like you’re only capitilzing the first word but the challenge requires to to capitalize all of them.
Matt Everson
@matteverson
Aug 04 2015 04:06
The test looks like this:
var func = add(1);
func(2)
^ should print 3
Feners4
@Feners4
Aug 04 2015 04:07
how can I center the top text without altering everything below http://codepen.io/Feners4/pen/EjONEe?
Matt Everson
@matteverson
Aug 04 2015 04:08
@ninjatron Look up currying, and expect to do a bit of work before you fully get it. It's complicated, but that's what that bf is trying to teach.
ninjatron
@ninjatron
Aug 04 2015 04:08
i know currying
Matt Everson
@matteverson
Aug 04 2015 04:09
Great, then add() just returns a curried function if there's only one argument.
Logan Tegman
@ltegman
Aug 04 2015 04:09
@ninjatron @matteverson I think that challenge is actually teaching closures.
Abhisek Pattnaik
@abhisekp
Aug 04 2015 04:09
@ltegman Actually, I'm capitalizing the '$1' and passing it into replace so it doesn't make any difference. LoLz. Silly me. :P
Logan Tegman
@ltegman
Aug 04 2015 04:10
Or I guess it’s teaching both closures and currying at the same time xD
Zion
@learnor
Aug 04 2015 04:10
Any one have done the HTML convert? Maybe you can help me with my code.
function convert(str) {
  // &colon;&rpar;

  var re = [/&/g,/</g,/>/g,/"/g,/'/g];
  var replacer = ['&amp','&lt','&gt','&quot','&apos'];
  for (var i in re){
    str = str.replace(re[i],replacer[i]);
    console.log(re[i],replacer[i]);
    console.log(str);
  }
  return str;
}

convert('Dolce & Gabbana');
ninjatron
@ninjatron
Aug 04 2015 04:11
why the heck wouldn't it tell what it's trying to teach and let people guess then?
u guys know more JS yet you couldn't agree what it's trying to teach
Logan Tegman
@ltegman
Aug 04 2015 04:11
@ninjatron That lesson needs work. When the FCC update is released the wording on that challenge is going to be better.
Abhisek Pattnaik
@abhisekp
Aug 04 2015 04:12
Any suggestions on how to do the Bonfire: Title Case more efficiently than array split and join? e.g. using regex
CamperBot
@camperbot
Aug 04 2015 04:12
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
ninjatron
@ninjatron
Aug 04 2015 04:13
here is another question
if arguments.length < 2
i return func
curried func
but of course then max stack size exceeds
since there is always less 2 args
Zion
@learnor
Aug 04 2015 04:14
bonfire Convert HTML Entities
CamperBot
@camperbot
Aug 04 2015 04:14

:fire:Bonfire: Convert HTML Entities :link:

function convert(str) {
  // &colon;&rpar;
  return str;
}

convert('Dolce & Gabbana');

Convert the characters "&", "<", ">", '"' (double quote), and "'" (apostrophe), in a string to their corresponding HTML entities.

for more info: bf details bf links bf script bf wiki bf spoiler

ninjatron
@ninjatron
Aug 04 2015 04:15
how to deal with that?
Zion
@learnor
Aug 04 2015 04:15
bf details
CamperBot
@camperbot
Aug 04 2015 04:15

:fire:Bonfire: Convert HTML Entities :link:

function convert(str) {
  // &colon;&rpar;
  return str;
}

convert('Dolce & Gabbana');

Convert the characters "&", "<", ">", '"' (double quote), and "'" (apostrophe), in a string to their corresponding HTML entities.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:

RegExp,
HTML Entities


  • bonfire info for more info
  • bonfire links
  • bonfire script for the script
  • bonfire spoiler for some clues on how to solve it
  • bonfire wiki for related info from the wiki
Zion
@learnor
Aug 04 2015 04:15
bf spoiler
CamperBot
@camperbot
Aug 04 2015 04:15
[0] Convert the characters "&", "<", ">", '"' (double quote), and "'" (apostrophe), in a string to their corresponding HTML entities.
Zion
@learnor
Aug 04 2015 04:16
bf script
CamperBot
@camperbot
Aug 04 2015 04:16
function convert(str) {
  // &colon;&rpar;
  return str;
}

convert('Dolce & Gabbana');
Zion
@learnor
Aug 04 2015 04:16
bf wili
CamperBot
@camperbot
Aug 04 2015 04:16
:frown: Sorry, can't find a bonfire called wili. Check the map?
Zion
@learnor
Aug 04 2015 04:17
bf wili
CamperBot
@camperbot
Aug 04 2015 04:17
:frown: Sorry, can't find a bonfire called wili. Check the map?
Zion
@learnor
Aug 04 2015 04:17
bf wiki
Luis Felipe López G.
@luishendrix92
Aug 04 2015 04:17
I'm guessing that bonfire could be solved using an array of regular expressions to use in a replace() function?
Zion
@learnor
Aug 04 2015 04:17
bf Convert HTML Entities
CamperBot
@camperbot
Aug 04 2015 04:17

:fire:Bonfire: Convert HTML Entities :link:

function convert(str) {
  // &colon;&rpar;
  return str;
}

convert('Dolce & Gabbana');

Convert the characters "&", "<", ">", '"' (double quote), and "'" (apostrophe), in a string to their corresponding HTML entities.

for more info: bf details bf links bf script bf wiki bf spoiler

Zion
@learnor
Aug 04 2015 04:17
bf links
CamperBot
@camperbot
Aug 04 2015 04:17
Zion
@learnor
Aug 04 2015 04:17
bf wiki
Luis Felipe López G.
@luishendrix92
Aug 04 2015 04:17
and iterating through the array using map
Darrell Wong
@darrell1226
Aug 04 2015 04:23
I'm having problems with Bonfire: No repeats please. I only see one solution were there are no consecutive repeats. That is aba. All other combinations produce a repeat of 'aa'. Why does the solution say there are two permutations?
CamperBot
@camperbot
Aug 04 2015 04:23
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Luis Felipe López G.
@luishendrix92
Aug 04 2015 04:23
Actually it could be a bidimensional array or an object {toReplace: Array of regexps, replaceWith: array of strings} or [{toReplace: regexp 1, replaceWith: string 1}, {toReplace: regexp n+1, replaceWith: string n+1}] and call str.replace(this[i].toReplace, this[i].replaceWith)
Darrell Wong
@darrell1226
Aug 04 2015 04:24
bonfire no repeats please
CamperBot
@camperbot
Aug 04 2015 04:24
:frown: Sorry, can't find a bonfire called no repeats please. Check the map?
Zion
@learnor
Aug 04 2015 04:28
@luishendrix92 Many thanks.
ninjatron
@ninjatron
Aug 04 2015 04:30
@learnor you just need to use regExp and replace
like this str = str.replace(/&/g, '&amp;');
dc
@dcsan
Aug 04 2015 04:37
bonfire repeat
CamperBot
@camperbot
Aug 04 2015 04:37

:fire:Bonfire: Repeat a string repeat a string :link:

function repeat(str, num) {
  // repeat after me
  return str;
}

repeat('abc', 3);

Repeat a given string (first argument) n times (second argument). Return an empty string if n is a negative number.

for more info: bf details bf links bf script bf wiki bf spoiler

Alexandro Perez
@AlexandroPerez
Aug 04 2015 05:19
This message was deleted
I came up with a way that doesn't use $.getJSON(), but I don't know How I'm supposed to use $.getJSON() to make it easier.
Where can I find a way to use jQuery $.getJSON() to create a dynamic twitter button for Zipline Random Quote Machine?
Luis Felipe López G.
@luishendrix92
Aug 04 2015 05:21
I finally solved the damned sorted union bonfire, took me hours of frustration and sleeping through it to come up with an algorithm to solve it... I hope in a near future I can reduce these lines of code into a better and more gorgeous piece of art:
function unite(arr1, arr2, arr3) {
  var args = Array.prototype.slice.call(arguments, 0),
      union = args.reduce(function(previousArray, currentArray) {
        return previousArray.concat(currentArray);
      });

  function getUnique(arr) {
    for (evaluated=0; evaluated < (arr.length-1); evaluated++) {
      for (compared=evaluated+1; compared < arr.length; compared++) {
        if (arr[evaluated] == arr[compared])
          arr[compared] = null;
      }
    }
    return arr.filter(function(number) { return number !== null; });
  }

  return getUnique(union);
}

unite([1, 2, 3], [5, 2, 1, 4], [2, 1]);
CamperBot
@camperbot
Aug 04 2015 05:21
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Alexandro Perez
@AlexandroPerez
Aug 04 2015 05:22
bonfire random qoute machine
CamperBot
@camperbot
Aug 04 2015 05:22
:frown: Sorry, can't find a bonfire called random qoute machine. Check the map?
Luis Felipe López G.
@luishendrix92
Aug 04 2015 05:23
help zipline
Alexandro Perez
@AlexandroPerez
Aug 04 2015 05:23
ziplnie Random Quote Machine
dc
@dcsan
Aug 04 2015 05:23
we dont have a 'zipline' command yet
Alexandro Perez
@AlexandroPerez
Aug 04 2015 05:23
... :worried:
dc
@dcsan
Aug 04 2015 05:23
and only data loaded on the first set of bonfires
you can help if you would like :)
Alexandro Perez
@AlexandroPerez
Aug 04 2015 05:24
How?
Guillermo Hernandez Jr
@guillermohernandez
Aug 04 2015 05:24
I was wondering if someone can help me with a javascript situation. It's not for freecodecamp, it's for a job I'm taking on and I want to make sure I can do it
Alfredo J Moreno
@Junmr4
Aug 04 2015 05:27

i need help im stuck here ```
function truncate(str, num) {
// Clear out that junk in your trunk
if(str > num.length) {
}
return str;
}

truncate('A-tisket a-tasket A green and yellow basket', 11);

function truncate(str, num) {
  // Clear out that junk in your trunk
  if(str > num.length) {
  }
  return str;
}

truncate('A-tisket a-tasket A green and yellow basket', 11);
i need help here..
ctcrnitv
@ctcrnitv
Aug 04 2015 05:38
if anyone could help me on number 12 of this tutorial
when you copy + paste the solution to codepen
This message was deleted
end up with TypeError: movieList.videos.map(...).concatAll is not a function
In general I’m just getting all kinds of problems using concatAll with online code editors like codepen, jsfiddle, etc
Joseph Chananga Myalla
@sojelee
Aug 04 2015 05:46
@matteverson have gone through arguments optional
Darrell Wong
@darrell1226
Aug 04 2015 05:49
@skr5e you also have to copy and past the concatAll function if the current function does not have that as reference
Alfredo J Moreno
@Junmr4
Aug 04 2015 05:50
function truncate(str, num) {
  // Clear out that junk in your trunk
  if(str > num.length) {
  }
  return str;
}

truncate('A-tisket a-tasket A green and yellow basket', 11);
how do i proceed from here ?
ninjatron
@ninjatron
Aug 04 2015 05:51
you don't type num.length
str.length > num
Darrell Wong
@darrell1226
Aug 04 2015 05:52
Can anyone help me with Bonfire No repeats please?
Woolwit
@Woolwit
Aug 04 2015 05:52

Can someone tell me why this doesn't work?

function diff(arr1, arr2) {
  console.log(arr1); \\[]
  console.log(arr2); \\[ 'snuffleupagus', 'cookie monster', 'elmo' ]
  if ((arr1 || arr2) == []) {
    console.log('Kick me hard.');
  } 
}
diff([], ['snuffleupagus', 'cookie monster', 'elmo'])

Thanks! By 'doesn't work, I mean it never logs 'Kick me hard'. arr1 is an empty array, but it won't compare to [] using the OR || ?

ctcrnitv
@ctcrnitv
Aug 04 2015 05:52
@darrell1226 I see, I assumed concatAll was a built-in function on arrays
Darrell Wong
@darrell1226
Aug 04 2015 05:52
Nevermind, going to bed.
concat is but concatAll is a created function
ctcrnitv
@ctcrnitv
Aug 04 2015 05:53
got it, thanks
Caroline Dikibo
@cdikibo
Aug 04 2015 05:55
Can anyone help with this? Bonfire #34
function drop(arr, func) {
  // Drop them elements.
  while(func === false) {
    arr.shift();
    func++;
    if(func === true){
      continue;
    }
  }
  return arr;
}

drop([1, 2, 3], function(n) {return n < 3; });
jds11235
@jds11235
Aug 04 2015 05:56
anyone here gotten to the part on codepen?
@cdikibo you cant perform an increment operation on a function, which may be causing your issue
Joseph Chananga Myalla
@sojelee
Aug 04 2015 05:58
@cdikibo can you go through the documentation on @cdikibo how a filter functions work and try to apply it yo your code
ninjatron
@ninjatron
Aug 04 2015 06:02
@Woolwit (arr1 || arr2) defaults to true i am pretty sure
Woolwit
@Woolwit
Aug 04 2015 06:03
Will check that out.
ninjatron
@ninjatron
Aug 04 2015 06:03
it doesn't mean either arr1 or arr2, rather it means if arr1 or arr2 is true
@cdikibo func can't be false without an argument
and you can't add to func
func is just a function
Woolwit
@Woolwit
Aug 04 2015 06:08
Thanks @ninjatron Hmm, how to construct a simple check of the arguments to see if one of them is an empty array... 'hello drawing board'.
CamperBot
@camperbot
Aug 04 2015 06:08
woolwit sends brownie points to @ninjatron :sparkles: :thumbsup: :sparkles:

could not find receiver for ninjatron

this feature is linked to our beta site, so it may not have all users til we go live with the new release. Also check that FCC ID matches githubID!

ninjatron
@ninjatron
Aug 04 2015 06:10
@Woolwit why do you bother checking if one is an empty array?
just create an empty array and push unique values to that array
Woolwit
@Woolwit
Aug 04 2015 06:15
Yes, I could start near the beginning again. I'm a few hours into the Diff Two Arrays Bonfire, and my solution passed every test but the one with the empty array. But now I'm curious... Why doesn't this make it to the console.log?
function diff(arr1, arr2) {
  if (arr1 == []) {
    console.log('Kick me hard.');
  } 
}
diff([], ['snuffleupagus', 'cookie monster'])
ninjatron
@ninjatron
Aug 04 2015 06:19
i don't know if it's the case with JS as well
but in C++ an array is a pointer
so it just points to a specific location in memory
therefore you can't compare arrays the way you do
so if you wanted to compare 2 arrays you would have to check each index
of both arrays
Woolwit
@Woolwit
Aug 04 2015 06:21
Thanks again @ninjatron I will explore that.
CamperBot
@camperbot
Aug 04 2015 06:21
woolwit sends brownie points to @ninjatron :sparkles: :thumbsup: :sparkles:

could not find receiver for ninjatron

this feature is linked to our beta site, so it may not have all users til we go live with the new release. Also check that FCC ID matches githubID!

Logan Tegman
@ltegman
Aug 04 2015 06:22
@Woolwit if you are trying to check for an empty array you’ll want to use array.length property.
Jasper Francisco
@LegitStudent
Aug 04 2015 06:22
How is sym([1, 2, 5], [2, 3, 5], [3, 4, 5]) equal to [1, 4, 5] in the symmetric differences bonfire? There's a 5 in all 3 arrays.
Logan Tegman
@ltegman
Aug 04 2015 06:24
@LegitStudent In a symmetric difference of 3 anything in all three is included in the set. I think of it as the first two fives cancelling eachother out (like they would in a set of two) which leaves the last one in the set with nothing to cancel it.
Woolwit
@Woolwit
Aug 04 2015 06:29
Thanks @ltegman I will try that. But now I'm even curiouser.
function diff(arr1, arr2) {
  console.log(arr1);//[]
  console.log(arr1 == []); //false
  console.log(arguments[0]); //[]
  console.log(arguments[0]==[]);//false
  if (arr1 == []) {
    console.log('Kick me hard.');
  } 
}
diff([], ['snuffleupagus', 'cookie monster'])
CamperBot
@camperbot
Aug 04 2015 06:29
woolwit sends brownie points to @ltegman :sparkles: :thumbsup: :sparkles:
ltegman ltegman
:star: 158 no bio set
dc
@dcsan
Aug 04 2015 06:44
about @ltegman
CamperBot
@camperbot
Aug 04 2015 06:44
dc
@dcsan
Aug 04 2015 06:46
about @ltegman
CamperBot
@camperbot
Aug 04 2015 06:46
:star: 158 | @ltegman | http://www.freecodecamp.com/ltegman
dc
@dcsan
Aug 04 2015 06:47
wow you've really done all the challenges!
Jasper Francisco
@LegitStudent
Aug 04 2015 06:49
@ltegman Got the bonfire, thanks!
Logan Tegman
@ltegman
Aug 04 2015 06:49
@dcsan Haha, yep — I’ve been programming on and off for almost 10 years, so a lot of it was refresher. Slowed down now that I’ve got to the ziplines XD
@LegitStudent Awesome, congrats!
Joseph Chananga Myalla
@sojelee
Aug 04 2015 07:07
@ltegman great, can you hint me on bonfire arguments optional stuck for long time
dema
@GitDema
Aug 04 2015 07:09
hi all
who can help me about linux 1
1 question!
Joseph Chananga Myalla
@sojelee
Aug 04 2015 07:14
any oone help on bonfire arguments optional
ronald
@ronstarcool
Aug 04 2015 07:15
question: <form action="/submit-cat-photo">
<label name='indoor-outdoor'><button type='radio' name='indoor-outdoor'>Indoor</label>
<label name='indoor-outdoor'><button type='radio' name='indoor-outdoor'>Outdoor</label>
<input type='text' placeholder='cat photo URL' required>
<button type='submit'>Submit</button>
</form>
Tristanto
@rustyworks
Aug 04 2015 07:15
is zip function in http://jhusain.github.io/learnrx/ doesn't work ?
ronald
@ronstarcool
Aug 04 2015 07:15
whats wrong whit this?
I think its just fine?
but it makes the </form> pink
ronald
@ronstarcool
Aug 04 2015 07:53
solved
Matthew Barber
@Honno
Aug 04 2015 08:04
haha @ronstarcool, solved after 45 minutes? :o
Stein Gee
@Stiino0
Aug 04 2015 08:04
He was quicker, just forgot to mention here that It was solved :D
I guess?
Matthew Barber
@Honno
Aug 04 2015 08:07
I hope so, those kind of problems kill it for me lol @Stiino0
IT SEEMS RIGHT BUT I USED A COLON INSTEAD OF A SEMICOLON AGGGHH
Stein Gee
@Stiino0
Aug 04 2015 08:15
:)
the issue was <button type="radio">
it had to be <input type="radio">
Can someone give me their opinion on what I've got so far?
It's been kind of difficult, but fun at the same time when I get it to work they way I want it to
Omar
@oab00
Aug 04 2015 08:25
@AlexandroPerez are you going to pull the quotes from an external api or just ones you have stored in the script ?
otherwise the design and twitter button works great good job! :smile:
Alexandro Perez
@AlexandroPerez
Aug 04 2015 08:26
for now I got it to work with what I have stored on a script (array)
I'm still having trouble with the way JSON works though
ronald
@ronstarcool
Aug 04 2015 08:26
y, i got it a little sooner, but still took me 20minutes orso.
Omar
@oab00
Aug 04 2015 08:28
@AlexandroPerez what troubles do u have? have u found a quote api somewhere?
Joseph Chananga Myalla
@sojelee
Aug 04 2015 08:28
can any one check my code on arguments optinal i am getting weird reults
Omar
@oab00
Aug 04 2015 08:29
@sojelee sure whats ur code
Alexandro Perez
@AlexandroPerez
Aug 04 2015 08:30
@oab00 Actually I was having trouble with understanding the connection between $.getJSON and the twitter button... but it seems I am supposed to be able to use $.getSON() to get quotes from an API
Joseph Chananga Myalla
@sojelee
Aug 04 2015 08:30
bonfire arguments optional is driving me crazy, please help
CamperBot
@camperbot
Aug 04 2015 08:30
:frown: Sorry, can't find a bonfire called arguments optional is driving me crazy please help. Check the map?
ronald
@ronstarcool
Aug 04 2015 08:31
helpfull guy that
Alexandro Perez
@AlexandroPerez
Aug 04 2015 08:31
I did a lot of RSAP to figure out how to create a dynamic twitter button with no luck, so I ended up doing it another way. But it seems that they zipline meant the use of $.getJSON() for other purposes
ronald
@ronstarcool
Aug 04 2015 08:32
If I new ANYTHING about json, i'd try to help you..
Joseph Chananga Myalla
@sojelee
Aug 04 2015 08:33
@camperbot i mean arguments optional my friend
Alexandro Perez
@AlexandroPerez
Aug 04 2015 08:33
from what I understand so far, is some sort of way to store information in a text file.
kind of like javascript object syntax, but only to store key-value pairs in a simple file
I don't understand how API's make use of it, or what I'm supposed to do with them yet, though... :fearful:
Omar
@oab00
Aug 04 2015 08:35
you send a $.getJSON to an API then they send you back a .json file that contains the quote you need
Alexandro Perez
@AlexandroPerez
Aug 04 2015 08:35
BTW, it took me a long time to figure out how to make the twitter button work for each randomly generated quote.
Omar
@oab00
Aug 04 2015 08:35
after that you show the quote to the user and send $.getJSON again when the user presses for new quote
Alexandro Perez
@AlexandroPerez
Aug 04 2015 08:37
It seems that taking that approach from the beginning would've saved me a lot of time.
I'll try that approach now.
Omar
@oab00
Aug 04 2015 08:38
@AlexandroPerez for example the website http://quotesondesign.com/ has an API button on the bottom right
if you go to this URL using a browser it returns a JSON with a random quote:
http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1
Alexandro Perez
@AlexandroPerez
Aug 04 2015 08:38
Like using qoutes from here:
https://theysaidso.com/api/#random
Omar
@oab00
Aug 04 2015 08:38
or that
Stein Gee
@Stiino0
Aug 04 2015 08:38
I'm completely lost with bonfire http://www.freecodecamp.com/challenges/bonfire-mutations :(
Alexandro Perez
@AlexandroPerez
Aug 04 2015 08:39
:laughing: and here I was creating an object in javascript to return a random quote that I typed manually into the script...
Omar
@oab00
Aug 04 2015 08:40
but that website u linked has a really tiny limit 10 API calls per hourunless u pay :worried:
Alexandro Perez
@AlexandroPerez
Aug 04 2015 08:41
@oab00 I guess I'll have to look for others, or use the one you linked
Omar
@oab00
Aug 04 2015 08:43
I used that one for my zipline but it's a bit terrible sometimes it returns quotes with very large length -,-
but good thing it's quotes about website designing
@sojelee what's ur code like so far?
@Stiino0 what u got so far :o
Matthew Barber
@Honno
Aug 04 2015 08:44
Hey guys, I'm mid way the javascript course in codecademy, and FCC now wants me to do bonfires?
should I do that or finish the code course first?
I don't get it, will FCC get back to the js stuff?
*more advance js stuff
because on the map it still has js courses right belows the ones I've completed tis all
Omar
@oab00
Aug 04 2015 08:47
@Honno the map is organised from top to bottom it shouldn't make u jump from a point to point .. but you can of course skip things if you feel like you already know them
if it made u jump then it's probably a bug somewhere
Matthew Barber
@Honno
Aug 04 2015 08:47
@oab00 Well it skipped some stuff haha :x, thanks for the clarification
Mhmk, I'll take note and see if it's already been reported later
Joseph Chananga Myalla
@sojelee
Aug 04 2015 08:50
@Stiino0 I have some problem on return the function when there is only one number to add
Stein Gee
@Stiino0
Aug 04 2015 08:51
@oab00 I got
function mutation(arr) {

var first = arr[0].toLowerCase();
var second = arr[1].toLowerCase();

for (var i = 0; i < second.length; i++){
  if (first.indexOf(second[i] === -1)){
     return false;
  }
  return true;
 }
}

mutation(['hello', 'hey']);
Joseph Chananga Myalla
@sojelee
Aug 04 2015 08:53
@Stiino0 can you help on arguments optional
Stein Gee
@Stiino0
Aug 04 2015 08:53
Nope, i'm not even there :) @sojelee I think you mean @oab00 to ask the question to!
Joseph Chananga Myalla
@sojelee
Aug 04 2015 08:55
@Stiino0 on thanx
Omar
@oab00
Aug 04 2015 08:58
@Stiino0 you should take out that comparison from the indexOf function
if (first.indexOf(second[i] === -1)) to if (first.indexOf(second[i]) === -1)
this way you get the actual index if it's found :)
Stein Gee
@Stiino0
Aug 04 2015 08:59
@oab00 What's the difference? 1 less closing bracket? then I get an error stating that the if clause isn't closed correctly
Tiago Bernardo
@Tiago-OP
Aug 04 2015 08:59
Hi people
need some help on Bonfire: Where art thou
Difficulty
CamperBot
@camperbot
Aug 04 2015 08:59
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Tiago Bernardo
@Tiago-OP
Aug 04 2015 08:59
Bonfire Where art thou
Difficulty
CamperBot
@camperbot
Aug 04 2015 08:59
:frown: Sorry, can't find a bonfire called where art thoudifficulty. Check the map?
Tiago Bernardo
@Tiago-OP
Aug 04 2015 09:00
Bonfire: Where art thou
CamperBot
@camperbot
Aug 04 2015 09:00

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

for more info: bf details bf links bf script bf wiki bf spoiler

Omar
@oab00
Aug 04 2015 09:01
@Stiino0
because first.indexOf(second[i] === -1) is like saying first.indexOf(true) or false
while first.indexOf(second[i]) === -1 is whatever-the-function-returns === -1
Stein Gee
@Stiino0
Aug 04 2015 09:01
This message was deleted
Omar
@oab00
Aug 04 2015 09:02
add another bracket :o
Tiago Bernardo
@Tiago-OP
Aug 04 2015 09:02
someone
Stein Gee
@Stiino0
Aug 04 2015 09:03
Yes @oab00 got it, the bracket was behind second[i]... didn't quite get that
I understand now that it needs to come behind the second[i] thx to your explanation!
Omar
@oab00
Aug 04 2015 09:05
yeah you don't want to put the comparison inside the function .. instead u want to make the function one of the things to compare
matejhegedus
@matejhegedus
Aug 04 2015 09:05
@Tiago-OP Have you looked at the documentation pages linked in the Bonfire's description? Is there something specific you need help with?
Omar
@oab00
Aug 04 2015 09:05
@Tiago-OP what's ur code so far ?
@sojelee still stuck with arguments optional? :o
Joseph Chananga Myalla
@sojelee
Aug 04 2015 09:33
@Tiago-OP yes still stuck can post code
C0untZero
@C0untZero
Aug 04 2015 09:39
Waypoint: Build an Address Book
hi guys, im stuck on a basic waypoint
im currently on codecamp
and my code works and produces the needed outpu
t
but i keep getting Oops, try again. Make sure that the list() function still exists! Your code threw the following error when checking if you called list(): Error: Line 32: Unexpected identifier
i looked on stackoverflow but no dice
Elizabeth Hatleli
@TheHighPriestess
Aug 04 2015 09:44
I get that sometimes too on codeacademy....something works fine but codeacademy says that it doesn't.
Sometimes it helps to refresh the page. Other times...it doesn't..and then I just move on. If it's working ....
C0untZero
@C0untZero
Aug 04 2015 09:47
i just figured it out, it seems that code academy is not recognizing for...of as a valid way of iteration over arrays, they only check for the for (var i; i ?; i++) loops
thanks anyway :D
Elizabeth Hatleli
@TheHighPriestess
Aug 04 2015 09:47
I've skipped over stuff before...for this reason. Codeacademy is a great tool...but every now and then....
Omar
@oab00
Aug 04 2015 09:48
@C0untZero very small error
C0untZero
@C0untZero
Aug 04 2015 09:48
im a bit obsessive with getting all the badges and achievements :)
Omar
@oab00
Aug 04 2015 09:48
line 32 change for (var contact of contacts) to for (var contact in contacts)
ah u already got it nvm xD
C0untZero
@C0untZero
Aug 04 2015 09:49
@oab00 you cant use for in loops on javascript arrays
thats why i used for of
Omar
@oab00
Aug 04 2015 09:50
yes you can
C0untZero
@C0untZero
Aug 04 2015 09:50
:)
Omar
@oab00
Aug 04 2015 09:50
and of is not a javascript identifier :/
MDN says otherwise :)
Omar
@oab00
Aug 04 2015 09:51
ah ES6 !
not well supported yet
but thanks that's good to know :)
C0untZero
@C0untZero
Aug 04 2015 09:51
yeah, is why codeacademy was not recognizing it as a valid solution
even though the output was correct
Omar
@oab00
Aug 04 2015 09:51
but anyways for ... in works on arrays but it's not recommended
Jorge Almeida
@Jorgixhallo
Aug 04 2015 09:56
wiki for..of
CamperBot
@camperbot
Aug 04 2015 09:56
no wiki entry for: forof
:pencil: click here to create one now!after creating your page type update to reload it here
Jorge Almeida
@Jorgixhallo
Aug 04 2015 09:56
wiki for of
CamperBot
@camperbot
Aug 04 2015 09:56
no wiki entry for: for of
:pencil: click here to create one now!after creating your page type update to reload it here
Jorge Almeida
@Jorgixhallo
Aug 04 2015 10:00
wiki for of
CamperBot
@camperbot
Aug 04 2015 10:00
no wiki entry for: for of
:pencil: click here to create one now!after creating your page type update to reload it here
Jorge Almeida
@Jorgixhallo
Aug 04 2015 10:00
wiki forof
CamperBot
@camperbot
Aug 04 2015 10:00

:pencil: forof [edit]

The for..or The for...of statement creates a loop Iterating over iterable objects (including Array, Map, Set, arguments object and so on), invoking a custom iteration hook with statements to be executed for the value of each distinct property.

for (variable of object) {
  statement
}
Parameter
variable On each iteration a value of a different property is assigned to variable.
object Object whose enumerable properties are iterated.

MDN link | MSDN link
:pencil: read more about forof on the FCC Wiki

Jorge Almeida
@Jorgixhallo
Aug 04 2015 10:02
wiki for of
CamperBot
@camperbot
Aug 04 2015 10:02

:pencil: for of [edit]

The for..or statement creates a loop Iterating over iterable objects (including Array, Map, Set, arguments object and so on), invoking a custom iteration hook with statements to be executed for the value of each distinct property.

for (variable of object) {
  statement
}
Description
variable On each iteration a value of a different property is assigned to variable.
object Object whose enumerable properties are iterated.

MDN link | MSDN link
:pencil: read more about for of on the FCC Wiki

Jorge Almeida
@Jorgixhallo
Aug 04 2015 10:02
feel free to add what you guys think it's needed
Hemedi
@Hemedi
Aug 04 2015 10:03
I'm having trouble on bonfire: title case a sentence
Help anyone
CamperBot
@camperbot
Aug 04 2015 10:03
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Jorge Almeida
@Jorgixhallo
Aug 04 2015 10:04
bonfire case a
CamperBot
@camperbot
Aug 04 2015 10:04

:fire:Bonfire: Title Case a Sentence :link:

function titleCase(str) {
  return str;
}

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

Return the provided string with the first letter of each word capitalized.

for more info: bf details bf links bf script bf wiki bf spoiler

Jorge Almeida
@Jorgixhallo
Aug 04 2015 10:05
bf links
CamperBot
@camperbot
Aug 04 2015 10:05

links:

String.charAt())

Hemedi
@Hemedi
Aug 04 2015 10:05
I'm having trouble on bonfire: title case a sentence
Help anyone
Jorge Almeida
@Jorgixhallo
Aug 04 2015 10:06
@Hemedi going to give you some hints. You already did the previous ones right?
I suggests using split() and join() and charAt(). If you still can't figure this out tell us :)
amir
@Rimabo
Aug 04 2015 10:10
Can someone help me understand the task to the bonfire: Arguments Optional. I dont understand the "If only one argument is provided, return a function that expects one additional argument and will return the sum." part.
Joseph Chananga Myalla
@sojelee
Aug 04 2015 10:16
@Aubaroo stuck on it for a second day, i have written some code already?
@Aubaroo but i am not passing all the tests
amir
@Rimabo
Aug 04 2015 10:17
@sojelee No, I just started just now, I was reading the instructions and I just dont understand the second part...
Tiago Bernardo
@Tiago-OP
Aug 04 2015 10:18
Hi people
any tips on Bonfire: Where art thou ?
Omar
@oab00
Aug 04 2015 10:19
what code do u have so far @Tiago-OP
Ozy Design & Software
@OzySky
Aug 04 2015 10:20
for loop is your friend ;)
Tiago Bernardo
@Tiago-OP
Aug 04 2015 10:20
none
Omar
@oab00
Aug 04 2015 10:20
:worried:
Tiago Bernardo
@Tiago-OP
Aug 04 2015 10:20
i dont have any ideia how to do it xD
its the objects thing that confuses me
Ozy Design & Software
@OzySky
Aug 04 2015 10:21
start looping the the values and comparing each one to the value provided
Tiago Bernardo
@Tiago-OP
Aug 04 2015 10:22
i can loop them
but how can i compare
Ozy Design & Software
@OzySky
Aug 04 2015 10:22
look up for in loops
on MDN
Tiago Bernardo
@Tiago-OP
Aug 04 2015 10:22
when the first list has 2 propertys
first has first name and last name
the second argument
only has last name
thats the problem
i think
Omar
@oab00
Aug 04 2015 10:24
try this:
  var keys = Object.keys(collection[0]);
  console.log(keys);
  console.log(source.hasOwnProperty(keys[1]));
lots of edits xD
Tiago Bernardo
@Tiago-OP
Aug 04 2015 10:26
thanks
i think i get it now
i was trying Object.keys(collection)
and it gave me only 0,1,2
im so nub xD
Omar
@oab00
Aug 04 2015 10:28
This message was deleted
actually nvm
good luck :)
Godfrey Chiu
@ggwc82
Aug 04 2015 10:34
has anyone here done the twitch API zipline, and did you use angular or just jQuery?
Joris Labie
@labiej
Aug 04 2015 10:36
I did it with jQuery. I know @Feners4 is using Angular
Joseph Chananga Myalla
@sojelee
Aug 04 2015 10:46
help check my code arguments optional
CamperBot
@camperbot
Aug 04 2015 10:46
no wiki entry for: check my code arguments optional
:pencil: click here to create one now!after creating your page type update to reload it here
Omar
@oab00
Aug 04 2015 10:47
@ggc100 I did it in angular with just 25 lines of code ;)
Joseph Chananga Myalla
@sojelee
Aug 04 2015 10:47

function add(){

var arg0, arg1;

arg0=parseInt(arguments[0]);

if(arguments.length===2) {

  arg1=parseInt(arguments[1]);

if(isNaN(arg0) || isNaN(arg1)){

  return undefined;

} else{
        return arg0+arg1;

}

}else{

    if(isNaN(arg0)){
      return undefined;
    } else{

      return function(x){ return arg0 + parseInt(x); };
    }

}
}

my code is not passing all the test, can't figure out why
Omar
@oab00
Aug 04 2015 10:52
I'll look into it
Tiago Bernardo
@Tiago-OP
Aug 04 2015 10:53
done it
thanks everyone
Omar
@oab00
Aug 04 2015 10:55
@sojelee for the add(2, '3') case it's because you're doing
arg1=parseInt(arguments[1]); before checking if the value is a number
@sojelee you should put the isNaN(arg#) checking before parseInt(arg#)
actually.. isNaN seems ot be acting weird maybe you should replace it with typeof instead
console.log(typeof arguments[1] !== 'number');
Joseph Chananga Myalla
@sojelee
Aug 04 2015 11:16
@oab00 thank you very much for helping, i have spend 18 hours on this, will try and give you a feed back, thank
Matt Huijsse
@mistamadd001
Aug 04 2015 11:20
oh fyi typeof(isNan) === 'number' go figure
Godfrey Chiu
@ggwc82
Aug 04 2015 11:44
can someone please help me figure out why angular isn't activated in my codepen? http://codepen.io/ggc100/pen/MwZPqo?editors=101
I activated it in settings, which worked when my js wasn't in the (function(){}) enclosure
however, I turned that off and wanted to make sure my code was complete, but it doesn't work for some reason?
C0untZero
@C0untZero
Aug 04 2015 11:49
oh, a twitch stream checker, nice
Godfrey Chiu
@ggwc82
Aug 04 2015 11:50
aha! got it working
as per angular codeschool course, if you're putting all your angular code in one .js file, your enclosure needs to be: (function() {........}) ();
Tiago Bernardo
@Tiago-OP
Aug 04 2015 11:51
people how can i use .filter() to filter a array of numbers with another array of numbers?
Godfrey Chiu
@ggwc82
Aug 04 2015 11:51
just basically forgot the extra enclosure brackets!
Matthew Barber
@Honno
Aug 04 2015 11:54

function Person(name, age) { this.name = name; this.age = age; this.species = "Homo Sapiens"; } var sally = Person("Sally Bowles", 39); var holden = Person("Holdren Caulfield", 16); console.log("sally's species is " + sally.species + " and she is " + sally.age); console.log("holden's species is " + holden.species + " and he is " + holden.age);

returns TypeError: Cannot read property 'species' of undefined

Why's that? :(

code aint pretty! xD
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 11:56
Surround it with ```
Matthew Barber
@Honno
Aug 04 2015 11:57
function Person(name, age) { this.name = name; this.age = age; this.species = "Homo Sapiens"; } var sally = Person("Sally Bowles", 39); var holden = Person("Holdren Caulfield", 16); console.log("sally's species is " + sally.species + " and she is " + sally.age); console.log("holden's species is " + holden.species + " and he is " + holden.age);
huh
this is killing me
OH
new >.>
Joris Labie
@labiej
Aug 04 2015 12:03
function Person(name, age) {
  this.name = name;
  this.age = age;
  this.species = "Homo Sapiens";
}
var sally = Person("Sally Bowles", 39);
var holden = Person("Holdren Caulfield", 16);
console.log("sally's species is " + sally.species + " and she is " + sally.age);
console.log("holden's species is " + holden.species + " and he is " + holden.age);
newline after the first set of backticks and before the second set
I see you solved it yourself with the new :-)
Evan Davis
@davisec52
Aug 04 2015 12:08

Good morning, everybody. I'm working on the bonfire, "Exact Change",
http://www.freecodecamp.com/challenges/bonfire-exact-change.
I posted this question last night but it did not get any traction.

My solution below returns correct change sorted from highest
to lowest. However, it does not pass two of the tests. I'd
appreciate it if someone could help me understand what
is expected from the tests and what the correct responses should be.

Here are the tests that are failing:

assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['QUARTER', 0.50]], 'return correct change');return correct change: expected [ 'QUARTER', 0.5 ] to deeply equal [ [ 'QUARTER', 0.5 ] ]
assert.deepEqual(drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['TWENTY', 60.00], ['TEN', 20.00], ['FIVE', 15], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ], 'return correct change with multiple coins and bills');return correct change with multiple coins and bills: expected [ Array(7) ] to deeply equal [ Array(7) ]

Here is my code:
and here is a link to repl.it to see a working model: http://repl.it/BACR/2


var reg = {
    total: function(cid){
        var cashAmts = [];
        cid.forEach(function(v){
            cashAmts.push(v[1]);
        });
            var sum = cashAmts.reduce(function(a, b){return a + b;
            }).toFixed(2);
            return +sum;
    },

    denomMap:  [
        100, 'ONE HUNDRED', 20, 'TWENTY', 10, 'TEN', 5, 'FIVE', 1, 'ONE', 0.25, 'QUARTER', 0.1, 'DIME', 0.05, 'NICKEL', 0.01, "PENNY"
    ],

    combine: [],

    display: function(change) {
        var num = change;
        var value = '';
        for (var i = 0; change > 0 && i < this.denomMap.length; i += 2) {
            while (change >= this.denomMap[i]) {
                change += this.denomMap[i + 1];
                change = change.replace(/\d+/g, "");
                change = change.replace(/\./g, "");
                value += this.denomMap[i];
                var div = Math.floor(num/+value) * this.denomMap[i];
                var temp = [change, div];
                this.combine.push(temp);
                num = (num - div).toFixed(2);
                num = +num;
                this.display(num);
            }
        }

        return this.combine;
    }
};

function drawer(price, cash, cid){
            var change = cash - price;
            change = change.toFixed(2);
            change = +change;
            if(cash < price){
                return price;
            }
            else if(reg.total(cid) < change){
                return "Insufficient Funds";
            }
            else if(reg.total(cid) === change){
                return "Closed";
            }
            else if(reg.total(cid) > change){
                console.log(change);
                return reg.display(change);
            }
    }
drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]])

drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]);
Jakob Dahl
@saadanerdetbare
Aug 04 2015 12:10
help wiki
CamperBot
@camperbot
Aug 04 2015 12:10

:pencil: how to contribute to this wiki [edit]

Contributing to our wiki is a great way to play an active role in helping others learn to code.

If you have a question about JavaScript or programming in general that you think our wiki should cover, ensure it is concisely written and feel free to add it directly.

You can also edit existing wiki articles if you see a mistake.

If you have questions about contributing to the Free Code Camp wiki message @danraley in Gitter.
:pencil: read more about how to contribute to this wiki on the FCC Wiki

Joris Labie
@labiej
Aug 04 2015 12:12
The same error as last night @davisec52
The reg.display method seems broken since the second test receives an array consisting of 15 elements
while there are only 9 bills/coins available
your for loop is made to access an array with indices 0, 2, 4, ... but the actual array has indices 100, 20, 10, ...
You also check if change >= denomMap[i] so you compare a number with a string which leads to nonsense, no?
amir
@Rimabo
Aug 04 2015 12:17
how do you copy and paste the code in here so that it has a dark background?
Evan Davis
@davisec52
Aug 04 2015 12:18
@labiej Ok, thank you. The solution appears to sort change from highest to lowest in correct amounts. The array includes string and number pairings for denominations and amounts.
@labiej The idea with the loops is that depending on the iteration, denomMap[i] will be a number.
amir
@Rimabo
Aug 04 2015 12:22
Can someone help me on the Arguments Optional Bonfire
Here is my code
function add() {
var total = 0;
  if (arguments.length > 2) {
    return undefined;
  } else if (typeof arguments[0] !== 'number' || typeof arguments[1] !== 'number') {
    return undefined;

  } else if (arguments === [0]) {
    return function(x) {
      return arguments[0] + "x"; 
    }; 

  }else {
    return arguments[0] + arguments[1];
  }
}

add(2,3);
Evan Davis
@davisec52
Aug 04 2015 12:23
@labiej There should be 18 elements in the denomMap array. Nine string elements and 9 number elements. Thank you for the observation about the second test. Any chance you could tell me what the outcome for the other test should be?
Tristanto
@rustyworks
Aug 04 2015 12:24
@Aubaroo Why you use arguments[0] + "x"; ?
Don't you should use + x instead + "x" ?
Why you use else if (arguments === [0]) instead use else if (arguments.length === 1) ?
amir
@Rimabo
Aug 04 2015 12:27
@rustyworks hmm.. thank you for the improvements but I still cant pass
Tristanto
@rustyworks
Aug 04 2015 12:27
Can you pass me the new code @Aubaroo
amir
@Rimabo
Aug 04 2015 12:27
ok
function add() {
var total = 0;
  if (arguments.length > 2) {
    return undefined;
  } else if (typeof arguments[0] !== 'number' || typeof arguments[1] !== 'number') {
    return undefined;

  } else if (arguments.length === 1) {
    return function(x) {
      return arguments[0] + x; 
    }; 

  }else {
    return arguments[0] + arguments[1];
  }
}

add(2,3);
I dont understand the checklist that is not marked correct... Do i need to consider brackets?
Tristanto
@rustyworks
Aug 04 2015 12:32
Here is the flaw in your code:
  1. You should swap first else if with second else if
So you should check if arguments.length first instead checking it's type
Or ...
You can check it one by one first
2 You should check the value of x by using typeof just like your code
David Hewitt
@davidmhewitt
Aug 04 2015 12:38
Is there anyone that's done the Pairwise bonfire? I'm not sure I understand the logic of what it's asking me to do.
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 12:41
bf pairwise
CamperBot
@camperbot
Aug 04 2015 12:41
:frown: Sorry, can't find a bonfire called pairwise. Check the map?
Tristanto
@rustyworks
Aug 04 2015 12:41
bf Pairwise
CamperBot
@camperbot
Aug 04 2015 12:41
:frown: Sorry, can't find a bonfire called pairwise. Check the map?
Tristanto
@rustyworks
Aug 04 2015 12:42
@Aubaroo If you still stuck, please feel free to ask
David Hewitt
@davidmhewitt
Aug 04 2015 12:42
I have code that's working for some of the test cases, but there's a couple it fails on and I can't see the logic behind how they get that answer.
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 12:43
@davidmhewitt oare you sure you're not reusing the same values?
David Hewitt
@davidmhewitt
Aug 04 2015 12:43
@vincepandolfo Once I've made a pair, do I have to start ignoring that pair?
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 12:44
@davidmhewitt yes
"Once an element has been used, it cannot be reused to pair with another."
amir
@Rimabo
Aug 04 2015 12:44
@rustyworks thanks, I think the new problem now (after adding your suggestion) is that the program is passing the argument eventhough its not a number...
heres my updated code
function add() {
var total = 0;
  if (arguments.length > 2) {
    return undefined;
  }  

  else if (arguments.length === 1) {
       return function(x) {
      if (typeof x !== 'number') {
        return undefined;
      } else {
      return arguments[0] + x; 
      }
    }; 

  }

  else if (typeof arguments[0] !== 'number' || typeof arguments[1] !== 'number') {
    return undefined;

  }

  else {
    return arguments[0] + arguments[1];
  }
}

add(2,3);
David Hewitt
@davidmhewitt
Aug 04 2015 12:44
Oh, sorry @vincepandolfo , I don't know how I missed that. I'll give it a try!
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 12:45
@davidmhewitt have fun!
David Hewitt
@davidmhewitt
Aug 04 2015 12:47
@vincepandolfo yep, that's solved it! That'll teach me to not read the question properly.
Tristanto
@rustyworks
Aug 04 2015 12:47
Do you have screen hero @Aubaroo ?
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 12:48
@davidmhewitt That's the first thing to do when you're stuck, re read!
Tristanto
@rustyworks
Aug 04 2015 12:49
Or maybe you want see my code (I will use comment)
Roy
@CruelCoin
Aug 04 2015 12:50
Hi all, not sure what is going wrong here: I am checking for a palindrome, and according to my console.log tests, this is working fine, but the tests do not pass.

function palindrome(str) {
// Good luck!
var lowerCaseStr = String.toLowerCase(str);
var lowercaseNoPuntuation = lowerCaseStr.replace(/[\W_]+/g,"");
var array = lowercaseNoPuntuation.split('');
console.log("lowercaseNoPuntuation: " + lowercaseNoPuntuation);
array.reverse();
var reversedString = array.join('');
console.log("reversed: " + reversedString);
if (str === reversedString)
{
return true;
}
return false;
}

palindrome("eye");

Grace
@dogbot101
Aug 04 2015 12:51
@CruelCoin When I run it, it says : TypeError: String.toLowerCase is not a function
amir
@Rimabo
Aug 04 2015 12:51
@rustyworks I dont have screen hero... its kinda late too... this is gonna be my last work before I go bed. Would you be kind enough to show me your code?
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 12:52
@dogbot101 you should use str.toLowerCase()
Tristanto
@rustyworks
Aug 04 2015 12:52
  function isNumber (arg) { // Use this to remove redundant code
    return typeof arg === "number";
  }

  function add() {
    // You should assign the first arguments to local variable,
    // because the "arguments" in the inner function, are different
    // with "arguments" in the outter function.
    var first = arguments[0];

    if (!isNumber(first)) {
      // Check! This is important step.
      return undefined;
    }

    if (arguments.length === 1) {
      // Use this when arguments are only 1
      return function (x) {
        // Check!
        if (!isNumber(x)) {
          return undefined;
        } else {
          return x + first;
        }
      }
    } else {
      if (!isNumber(arguments[1])) {
        return undefined;
      } else {
        return first + arguments[1];
      }
    }
  }
amir
@Rimabo
Aug 04 2015 12:53
@rustyworks thank you
Roy
@CruelCoin
Aug 04 2015 12:55

var code = "function palindrome(str) {
// Good luck!
var lowerCaseStr = String.toLowerCase(str);
var lowercaseNoPuntuation = lowerCaseStr.replace(/[\W_]+/g,"");
var array = lowercaseNoPuntuation.split('');
console.log("lowercaseNoPuntuation: " + lowercaseNoPuntuation);
array.reverse();
var reversedString = array.join('');
console.log("reversed: " + reversedString);
if (str === reversedString)
{
return true;
}
return false;
}

palindrome("eye");"

Can anyone help me understand ow to post formatted code?
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 12:55
Surround it with ```
```
code
```
Roy
@CruelCoin
Aug 04 2015 12:56

'''function palindrome(str) {
// Good luck!
var lowerCaseStr = String.toLowerCase(str);
var lowercaseNoPuntuation = lowerCaseStr.replace(/[\W_]+/g,"");
var array = lowercaseNoPuntuation.split('');
console.log("lowercaseNoPuntuation: " + lowercaseNoPuntuation);
array.reverse();
var reversedString = array.join('');
console.log("reversed: " + reversedString);
if (str === reversedString)
{
return true;
}
return false;
}

palindrome("eye");'''

Grace
@dogbot101
Aug 04 2015 12:56
I agree with @vincepandolfo... @CruelCoin after fixing str.toLowerCase , you still need to work on making a few tests pass
Ozy Design & Software
@OzySky
Aug 04 2015 12:56
the tlide key without shift
line before code and line after
Grace
@dogbot101
Aug 04 2015 12:56
assert.deepEqual(palindrome("race car"), true);expected false to deeply equal true
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 12:56
@ozydesign not everyone has the grave accent on his keyboard :P I don't
@CruelCoin use ``` not '''
Ozy Design & Software
@OzySky
Aug 04 2015 12:57
@vincepandolfo so what do you use then?
@dogbot101 maybe the space is the problem?
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 12:57
@ozydesign I copy paste it
Roy
@CruelCoin
Aug 04 2015 12:57
@dogbot101 My code for this test for example: "never odd or even" correctly reduces to: "neveroddoreven" so i don't know why that test is not passing
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 13:00
@CruelCoin you should compare lowerCaseNoPuntuation with reversedString, not str. You didn't change str at all
Ozy Design & Software
@OzySky
Aug 04 2015 13:00
@CruelCoin you are comparing the original string to the reversed string instead of the no spaces string
oops
@vincepandolfo you beat me to it by half a second
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 13:01
@ozydesign I write at 80 wpm :sunglasses:
Ozy Design & Software
@OzySky
Aug 04 2015 13:02
fasttt
Roy
@CruelCoin
Aug 04 2015 13:02
God dammit.....Simple error. Ashamed now. Thanks @vincepandolfo @ozydesign
Ozy Design & Software
@OzySky
Aug 04 2015 13:02
i'm only 60
wpm
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 13:02
@CruelCoin remember that strings are immutable!
Jakob Dahl
@saadanerdetbare
Aug 04 2015 13:03
update
CamperBot
@camperbot
Aug 04 2015 13:03
updating wiki...
...lone-the-FreeCodeCamp-website-on-a-Windows-pc.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 How-to-clone-the-FreeCodeCamp-website-on-a-Windows-pc.md
Updating f871fe9..eea7092 Fast-forward
done code: 0
:computer:
Roy
@CruelCoin
Aug 04 2015 13:03
@vincepandolfo Cheers. Will remember that
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 13:03
wiki strings
CamperBot
@camperbot
Aug 04 2015 13:03
no wiki entry for: strings
:pencil: click here to create one now!after creating your page type update to reload it here
Jorge Almeida
@Jorgixhallo
Aug 04 2015 13:03
wiki website on a
CamperBot
@camperbot
Aug 04 2015 13:03

:pencil: how to clone the freecodecamp website on a windows pc [edit]

How to clone and setup the FreeCodeCamp website on a Windows pc

This list works with the FreeCodeCamp site and have been tested on this Angular tutorial https://docs.angularjs.org/tutorial as well. Setting up the dev invironment on a Windows pc is easy although it will give a ton of errors first in the process. The important part is to correct theese errors.
:pencil: read more about how to clone the freecodecamp website on a windows pc on the FCC Wiki
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 13:03
wiki string
CamperBot
@camperbot
Aug 04 2015 13:03
no wiki entry for: string
:pencil: click here to create one now!after creating your page type update to reload it here
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 13:04
lol
Jorge Almeida
@Jorgixhallo
Aug 04 2015 13:04
@vincepandolfo just create it xD
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 13:04
@Jorgixhallo it was there! I remember it! lol
list js
Jorge Almeida
@Jorgixhallo
Aug 04 2015 13:04
i'm creating as i'm doing the challanges xD
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 13:04
I can't remember how it works...
Jorge Almeida
@Jorgixhallo
Aug 04 2015 13:04
find string
CamperBot
@camperbot
Aug 04 2015 13:04
find string
nothing found
Jorge Almeida
@Jorgixhallo
Aug 04 2015 13:04
find js string
CamperBot
@camperbot
Aug 04 2015 13:04
find js string
nothing found
Jorge Almeida
@Jorgixhallo
Aug 04 2015 13:05
nop. gess it's not there
Vincenzo Pandolfo
@vincepandolfo
Aug 04 2015 13:05
I might write something on the wiki too, if the heat doesn't kill me first
Jorge Almeida
@Jorgixhallo
Aug 04 2015 13:06
i wrote filter and latex
and for..on, going to write for..in now
wiki filter
CamperBot
@camperbot
Aug 04 2015 13:08

:pencil: js filter [edit]

The filter() method creates a new array with all elements that pass the test implemented by the provided function

arr.filter(callback[, thisArg])
Parameter
Required Arr
Required callback (function with max 3 args)
Optional thisArg

MDN link | MSDN link
:pencil: read more about js filter on the FCC Wiki

Chirag Patel
@CPatel217
Aug 04 2015 13:13
Watsup dudes and dudettes?
I wanna run something by you guys from Eloquent JavaScript
var input = "A string with 3 numbers in it... 42 and 88.";
var number = /\b(\d+)\b/g;
var match;
while (match = number.exec(input))
  console.log("Found", match[1], "at", match.index);
// → Found 3 at 14
//   Found 42 at 33
//   Found 88 at 40
This makes use of the fact that the value of an assignment expression (=) is the assigned value. So by using match = number.exec(input) as the condition in the while statement, we perform the match at the start of each iteration, save its result in a variable, and stop looping when no moe matches are found.
I dont get why this works
I thought the expression had to eval to true or false
Joseph Chananga Myalla
@sojelee
Aug 04 2015 13:17
@oab00 hi Omary, I have followed you explanation i am still not getting add(2)([3]) properly, arguments optinal
Jorge Almeida
@Jorgixhallo
Aug 04 2015 13:21
@CPatel217 you got one regex expression right? that looks for a digit
next, the variable, and in the while cicle, you start searching for a match in that regex.
If it's found, it logs, and then continues from the index you previously had. meaning it will not get the same numbers twice
Aniruddh Agarwal
@anrddh
Aug 04 2015 13:24
Can someone give me some hints regarding the Tic Tac Toe zipline?
Oliver
@Dadsaster
Aug 04 2015 13:25
@awesomeaniruddh what sort of hints?
Chirag Patel
@CPatel217
Aug 04 2015 13:25
ok so I kinda get that. im having trouble with how the regex is an object
but ill take taht
Aniruddh Agarwal
@anrddh
Aug 04 2015 13:25
@Dadsaster I dont really know how to starti
Chirag Patel
@CPatel217
Aug 04 2015 13:26
so if match has a value its true? and if no value its false?
Mateusz Szymański
@matszym
Aug 04 2015 13:26
@CPatel217 not quite
you should pass to while boolean value
Oliver
@Dadsaster
Aug 04 2015 13:27
@awesomeaniruddh have you done all the other ziplines? Did you look at the example? http://codepen.io/alex-dixon/full/JogOpQ/
Mateusz Szymański
@matszym
Aug 04 2015 13:27
if you pass to while something else than boolean value, javascript will try to make sens of that
Aniruddh Agarwal
@anrddh
Aug 04 2015 13:27
I did
Oliver
@Dadsaster
Aug 04 2015 13:27
@awesomeaniruddh you can start by building a board and having the computer randomly pick an empty square
Shaklin
@ShaklinSyed
Aug 04 2015 13:28
can any one suggest what might be wrong with this
function replace(str, before, after) {
     var arr = str.split(" ");
    var i;
    for(i=0;i<arr.length;i++){
        var match =  arr[i];
        if(match === before){
            arr.splice(i,1,after);
        }
    }
    var ret = arr.join(' ');
 return ret;
}
Oliver
@Dadsaster
Aug 04 2015 13:28
@awesomeaniruddh this might also help: http://neverstopbuilding.com/minimax
Shaklin
@ShaklinSyed
Aug 04 2015 13:28
the program works fine for a few cases
but show its incorrect for others
Chirag Patel
@CPatel217
Aug 04 2015 13:29
@mateush53 hmmm idk. book says its a pattern so I'll just go with it
Oliver
@Dadsaster
Aug 04 2015 13:30
@awesomeaniruddh Is that enough to get you started?
matejhegedus
@matejhegedus
Aug 04 2015 13:31
@ShaklinSyed I think you are replacing only one character of the original string.
@ShaklinSyed Which tests does it pass?
Shaklin
@ShaklinSyed
Aug 04 2015 13:32
expect(replace("Let us go to the store", "store", "mall")).to.equal("Let us go to the mall");
expect(replace("This has a spellngi error", "spellngi", "spelling")).to.equal("This has a spelling error");
these both work
Oliver
@Dadsaster
Aug 04 2015 13:32
This message was deleted
Shaklin
@ShaklinSyed
Aug 04 2015 13:32
and remaining fail
Mateusz Szymański
@matszym
Aug 04 2015 13:32
@CPatel217 When exec fails to find mach in provided string, it returns null. null is evaluated to false. But null is a value, there is always a value - its just falsy value
Shaklin
@ShaklinSyed
Aug 04 2015 13:34
@Dadsaster the first argument is the index where to start and second is the number of elements to remove and third are the elements to be added if i am right
Chirag Patel
@CPatel217
Aug 04 2015 13:34
ok got it, youve been a huge help. i was like f** it I'll just move on but of course I coudnt let it go
matejhegedus
@matejhegedus
Aug 04 2015 13:36
@ShaklinSyed I think the problem is that you're not preserving the case from the original string. When the replaced word is capitalised, the new word should be too.
Oliver
@Dadsaster
Aug 04 2015 13:36
@ShaklinSyed I know - your code works on my machine - which case fails?
Shaklin
@ShaklinSyed
Aug 04 2015 13:36
@matejhegedus that is what i thought
@Dadsaster replace("He is Sleeping on the couch", "Sleeping", "sitting")
matejhegedus
@matejhegedus
Aug 04 2015 13:37
@ShaklinSyed You need to check if the first character from the replaced word is capitalised.
Shaklin
@ShaklinSyed
Aug 04 2015 13:37
@matejhegedus have already started working on it Thanks all
Joseph Chananga Myalla
@sojelee
Aug 04 2015 13:39
fcc is really challenging, spent 2 days on one challenge with the help of fellows finally got it ok, bonfire arguments optional, thank you @oab00 for checking my code
CamperBot
@camperbot
Aug 04 2015 13:39
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Jason Wood
@catapixel
Aug 04 2015 13:46
Anyone working through or completed Bonfire: Symmetric Difference? I have a question.
flota113
@flota113
Aug 04 2015 13:54
@catapixel I've completed it, so will try to answer :D
Jason Wood
@catapixel
Aug 04 2015 13:55
@flota113 I've got it all passing except the last test. I don't get how providing a single array is a valid test when symmetric difference seems to require something to compare against...Can you explain?
flota113
@flota113
Aug 04 2015 13:56
give me a sec - opening the challenge to see the test ;)
actually You're right - I mean the description explicitly says that Your function should take two or more arrays
but for now You can easily fix it(as I did)
Jason Wood
@catapixel
Aug 04 2015 13:58
@flota113 That's what I read as well. I can "fake it" but wanted to know what was up.
flota113
@flota113
Aug 04 2015 13:59
if(arguments.length===1) callYourFunction(args , [])
You can check if the issue already exists or I will do it?
Jason Wood
@catapixel
Aug 04 2015 14:00
@flota113 Yeah, that's basically what I was planning on doing unless someone could explain why the test was valid. Appreciate it.
flota113
@flota113
Aug 04 2015 14:00
No problem ;)
Joris Labie
@labiej
Aug 04 2015 14:04
@davisec52 You here? Had to go in a hurry earlier.
L. Becker
@LCBecker
Aug 04 2015 14:07
Is anyone really good with Bootstrap's Grid system?
Kameron Robinson
@RobinsonKameron
Aug 04 2015 14:08
@LCBecker I'm fairly decent with it.
L. Becker
@LCBecker
Aug 04 2015 14:08
I'm having some trouble manipulating some columns. Here is my CodePen
I want that small circle at the bottom right of the big circle
I can't figure out how to put it there.
Liz Rezes
@queenlizo
Aug 04 2015 14:11
Hi, all! I'm doing the Chunky Monkey bonfire, and can't get this to work. It should break up the array into 2 subarrays with 2 numbers in each one.
function chunk(arr, size) {
  // Break it up. 
  var myArray = [];
  for (var i=0; i < arr.length; i++) {
    myArray.push(arr.slice(i, i+size));
  }

  if (arr.length) {
    myArray.push(arr);
  }
  return myArray;
}

chunk(['a', 'b', 'c', 'd'], 2);
Alexandro Perez
@AlexandroPerez
Aug 04 2015 14:11
@LCBecker: Let me try to look at your code, and see if I can help
L. Becker
@LCBecker
Aug 04 2015 14:13
@AlexandroPerez Thanks!
Jorge Almeida
@Jorgixhallo
Aug 04 2015 14:14
@queenlizo just to begin:
think about this cicle for (var i=0; i < arr.length; i++) {
if you have length 4, you want it to push 4 times?
also, why are you pushing twice to myArray? that if (arr.length) { will always evaluate true I gess
Liz Rezes
@queenlizo
Aug 04 2015 14:17
@Jorgixhallo I want the final result to be 2 sub arrays of 2 numbers. This code is the closest I've been to it
Moisés Man
@moigithub
Aug 04 2015 14:17
the question is correct but still missing something....
on the example.. it passing 2, as size.. to make groups of 2 elements
so... if u have ([1,2,3,4],2 )
the result should be [1,2], [3,4] (2 groups)
so u only need to iterate 2 times..
matejhegedus
@matejhegedus
Aug 04 2015 14:17
@queenlizo for (var i=0; i < arr.length; i++) should be for (var i=0; i < arr.length; i += size) I think
Paul Soper
@pdsoper
Aug 04 2015 14:17
@LCBecker It looks like you need to increase your col-sm-offset-2
L. Becker
@LCBecker
Aug 04 2015 14:18
@pdsoper For which div?
Liz Rezes
@queenlizo
Aug 04 2015 14:18
@matejhegedus That's closer! It spit out 2 sub arrays, and then the whole array again
@moigithub Thanks. Let me fiddle with it some more.
Paul Soper
@pdsoper
Aug 04 2015 14:19
@LCBecker For the ones containing F and C. Try col-ms-offset-9
Jorge Almeida
@Jorgixhallo
Aug 04 2015 14:19
@queenlizo with your code i'm getting 5 sub arrays if i'm not wrong. @matejhegedus Don't just give the answer like that xD
Moisés Man
@moigithub
Aug 04 2015 14:19
@queenlizo slice..copy part of an array.. but it DO NOT modify the original one...
matejhegedus
@matejhegedus
Aug 04 2015 14:20
@queenlizo Since you are not removing elements from the array, this part will push the whole array again into the result
if (arr.length) {
    myArray.push(arr);
  }
L. Becker
@LCBecker
Aug 04 2015 14:20
@pdsoper That offset is to put the F and C in the middle of the circle. It doesn't move the small circle to the right of the big circle.
Moisés Man
@moigithub
Aug 04 2015 14:20
so this..
if (arr.length) {
still checkign the full size origininal array
Paul Soper
@pdsoper
Aug 04 2015 14:21
@LCBecker Sorry. Try adding col-sm-offset-8 to the circle div around them
Liz Rezes
@queenlizo
Aug 04 2015 14:21
@matejhegedus if I take that out, it says that I have an illegal return statement
I got it! I changed the if statement to this:
 if (arr.length) {
    myArray.push();
Paul Soper
@pdsoper
Aug 04 2015 14:22
@LCBecker By the way, there are specific help groups for Ziplines (and Basejumps)
Moisés Man
@moigithub
Aug 04 2015 14:22
@queenlizo
if u have this [1,2,3,4,5], 2
ur groups (of 2 elements) should be....
[1,2]
[3,4]
[5] <-- include leftover
L. Becker
@LCBecker
Aug 04 2015 14:23
@pdsoper Really? I didn't know that! Thanks!
Paul Soper
@pdsoper
Aug 04 2015 14:24
@LCBecker They are HelpZiplines and HelpBasejumps
Jorge Almeida
@Jorgixhallo
Aug 04 2015 14:24
@LCBecker FreeCodeCamp/HelpBasejumps
FreeCodeCamp/HelpZiplines
just search them on the bar
Alexandro Perez
@AlexandroPerez
Aug 04 2015 14:26

@LCBecker I'm no expert in Bootstrap, so I had no idea you could use columns in such a way.

Anyway, what first come to mind with the approach you are trying to take is to use relative positioning to a parent element. That way no mater where the parent element is at, the child will be at a relative position of its parent.

Take a look at this stack-overflow question:
http://stackoverflow.com/questions/104953/position-an-html-element-relative-to-its-container-using-css

Jorge Almeida
@Jorgixhallo
Aug 04 2015 14:27
@queenlizo http://codeshare.io/ put your code here and share the link. I'll try to help you, not give you the answers, but try to show you the right way xD
Alexandro Perez
@AlexandroPerez
Aug 04 2015 14:28
To be honest I thought bootstrap layout system was more suited for layouts that don't require such complex positions, but I guess that's because I haven't try to do it myself.
Liz Rezes
@queenlizo
Aug 04 2015 14:28
@Jorgixhallo Thanks! I actually fixed the problem, and it's working now.
Evan Davis
@davisec52
Aug 04 2015 14:41
@Dadsaster 'morning! Are you still in the help chat?
Laura
@LauraNichols
Aug 04 2015 14:55
Does anyone know how to include a library with your code?
Kameron Robinson
@RobinsonKameron
Aug 04 2015 14:55
@LauraNichols in JS?
Oliver
@Dadsaster
Aug 04 2015 14:56
@davisec52 yes
Laura
@LauraNichols
Aug 04 2015 14:56
@RobinsonKameron Yes. I want to use an underscore function in the steamroller bonfire but I can't figure out how to include the underscore library
Kameron Robinson
@RobinsonKameron
Aug 04 2015 14:57
@LauraNichols I dont think you can do that, but here is some documentation http://www.w3schools.com/js/js_libraries.asp
Laura
@LauraNichols
Aug 04 2015 14:57
Thanks @RobinsonKameron
CamperBot
@camperbot
Aug 04 2015 14:57
lauranichols sends brownie points to @robinsonkameron :sparkles: :thumbsup: :sparkles:
:star: 2 | @robinsonkameron | http://www.freecodecamp.com/robinsonkameron
Evan Davis
@davisec52
Aug 04 2015 14:57
@Dadsaster If you have a few minutes, could I ask you to take a look at my solution for the Exact Change bonfire? It is failing two tests but nevertheless appears to produce the correct answers.
CamperBot
@camperbot
Aug 04 2015 14:57
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Nic Galluzzo
@ngalluzzo
Aug 04 2015 14:57
@LauraNichols that’d be cheating
!!
Kameron Robinson
@RobinsonKameron
Aug 04 2015 14:58
@ngalluzzo this is programming cheating'
@ngalluzzo Programming is cheating… lol
Laura
@LauraNichols
Aug 04 2015 14:58
@ngalluzzo Hahah well I don't want to cheat, but I just can't figure it out! I have gotten so close, but I have no idea what I should do to fix it.
Kameron Robinson
@RobinsonKameron
Aug 04 2015 14:58
@LauraNichols What bonfire is it?
Nic Galluzzo
@ngalluzzo
Aug 04 2015 14:58
feel free to post what yo uhave so far if you want some input :)
Oliver
@Dadsaster
Aug 04 2015 14:59
@davisec52 sure
Evan Davis
@davisec52
Aug 04 2015 15:00
@Dadsaster just a moment and I'll post a link to the model on repl.it
devwillpatterson
@devwillpatterson
Aug 04 2015 15:00
is there anyone here who i could private message a quick question too
Nic Galluzzo
@ngalluzzo
Aug 04 2015 15:00
go for it @devwillpatterson
Evan Davis
@davisec52
Aug 04 2015 15:00

@Dadsaster Here is a link at repl.it for the model: http://repl.it/BACR/2

Here are the tests that are failing:

assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['QUARTER', 0.50]], 'return correct change');return correct change: expected [ 'QUARTER', 0.5 ] to deeply equal [ [ 'QUARTER', 0.5 ] ]
assert.deepEqual(drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['TWENTY', 60.00], ['TEN', 20.00], ['FIVE', 15], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ], 'return correct change with multiple coins and bills');return correct change with multiple coins and bills: expected [ Array(7) ] to deeply equal [ Array(7) ]
Laura
@LauraNichols
Aug 04 2015 15:01
@RobinsonKameron It is the steamroller bonfire where you have to flatten nested arrays. @ngalluzzo Okay I will. I have to rewrite it though because I replaced it with the underscore function hahah
Evan Davis
@davisec52
Aug 04 2015 15:01
@Dadsaster Another FCCer suggested that the denomMap array is faulty, but I'm not seeing the problem.
Nic Galluzzo
@ngalluzzo
Aug 04 2015 15:01
lol OK :)
Kameron Robinson
@RobinsonKameron
Aug 04 2015 15:02
@LauraNichols Word, im on piglatin now.. Soo good luck lol
Nic Galluzzo
@ngalluzzo
Aug 04 2015 15:02
the exact change bonfire is really getting on my nerves lol
CamperBot
@camperbot
Aug 04 2015 15:02
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Laura
@LauraNichols
Aug 04 2015 15:02
@RobinsonKameron Nice. Thanks, you too
Jorge Almeida
@Jorgixhallo
Aug 04 2015 15:04
@davisec52 are you seeing what's wrong?
expected [ 'QUARTER', 0.5 ] to deeply equal [ [ 'QUARTER', 0.5 ] ]
your are calcullating it correctlly (I assume from the log)
Evan Davis
@davisec52
Aug 04 2015 15:06
@Jorgixhallo No--I'm really not getting what the problem is.
AJ Gibson
@gibsonio
Aug 04 2015 15:07
For the 'return largest number from an array' bonfire, can someone please tell me where i'm going wrong? the error message says that it can't read property '0' of undefined:
function largestOfFour(arr) {
  // You can do this!

 var max = arr[i][0];
  largestNumbers = [];

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

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



      if(arr[i][p] > max) {

        max = arr[i][p];

        largestNumbers.push(max);
      }
    }
  }

  return largestNumbers;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Jorge Almeida
@Jorgixhallo
Aug 04 2015 15:07
@davisec52 expected [ 'QUARTER', 0.5 ] to deeply equal [\huge[ [ 'QUARTER', 0.5 ] ]\huge]
Laura
@LauraNichols
Aug 04 2015 15:07
@ngalluzzo @RobinsonKameron Oh my goodness. I just retyped the whole thing with my though process from before and got it right the first time. I guess it was just a small mistake.
Oliver
@Dadsaster
Aug 04 2015 15:08
@davisec52 - yeah - your result is nested in an extra array
Kameron Robinson
@RobinsonKameron
Aug 04 2015 15:08
@LauraNichols Usually thats what happens..
Nic Galluzzo
@ngalluzzo
Aug 04 2015 15:08
@LauraNichols there you go :)
@Jorgixhallo looks like i t wants a nested array?
Laura
@LauraNichols
Aug 04 2015 15:09
@gibsonio First, you define max = arr[i][0] before you define i
Nic Galluzzo
@ngalluzzo
Aug 04 2015 15:09
[ 'QUARTER', 0.5 ] to deeply equal [ [ 'QUARTER', 0.5 ] ]
first is a single array, then they expect a nested array
Evan Davis
@davisec52
Aug 04 2015 15:09
@Jorgixhallo , @Dadsaster Ah, so it is simply a matter that I'm returning nested arrays.
AJ Gibson
@gibsonio
Aug 04 2015 15:09
thanks @LauraNichols ! i will give that a shot!
CamperBot
@camperbot
Aug 04 2015 15:09
gibsonio sends brownie points to @lauranichols :sparkles: :thumbsup: :sparkles:
:star: 1 | @lauranichols | http://www.freecodecamp.com/lauranichols
Laura
@LauraNichols
Aug 04 2015 15:10
@gibsonio You're welcome! (:
Oliver
@Dadsaster
Aug 04 2015 15:10
@davisec52 yes
Feners4
@Feners4
Aug 04 2015 15:12
how can I get my top text to center without it afecting everything below http://codepen.io/Feners4/pen/EjONEe ?
Evan Davis
@davisec52
Aug 04 2015 15:12
@Dadsaster and @Jorgixhallo Many thanks! Off to un-nest the arrays!
George Tsoukatos
@Gts0uk
Aug 04 2015 15:13
hello
Jorge Almeida
@Jorgixhallo
Aug 04 2015 15:13
@davisec52 You're welcome :)
George Tsoukatos
@Gts0uk
Aug 04 2015 15:13
any help with Find the Longest Word in a String bonfire ?
Jorge Almeida
@Jorgixhallo
Aug 04 2015 15:14
@Gts0uk what code have you made so far?
George Tsoukatos
@Gts0uk
Aug 04 2015 15:14
This message was deleted
Nic Galluzzo
@ngalluzzo
Aug 04 2015 15:14
your text align is matching the parent @Feners4
George Tsoukatos
@Gts0uk
Aug 04 2015 15:15
This message was deleted
Nic Galluzzo
@ngalluzzo
Aug 04 2015 15:15
give your li elements a specific text-align to override that
Laura
@LauraNichols
Aug 04 2015 15:15
@Gts0uk If you put three ticks "```" before and after your code, it will be formatted nicely
Jorge Almeida
@Jorgixhallo
Aug 04 2015 15:15
use code blocks next time: