These are chat archives for FreeCodeCamp/Help

11th
Aug 2015
Godfrey Chiu
@ggwc82
Aug 11 2015 00:00
anyone here that doesn't mind helping me with the node.js waypoint - Make it Modular? I'm passing all the tests bar the first one, I suspect its to do with how my program.js main file is handling the callback data
MatiKid
@MatiKid
Aug 11 2015 00:06
Can someone give a clue about how to start the Binary Agents Bonfire? I’m lost..
Moisés Man
@moigithub
Aug 11 2015 00:07
bf binary agent
CamperBot
@camperbot
Aug 11 2015 00:07

:fire:Bonfire: Binary Agents :link:

function binaryAgent(str) {
  return str;
}

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

Return an English translated sentence of the passed binary string.

more info:  bf details | bf links | hint

Moisés Man
@moigithub
Aug 11 2015 00:07
bf details
CamperBot
@camperbot
Aug 11 2015 00:07

:fire:Bonfire: Binary Agents :link:

function binaryAgent(str) {
  return str;
}

binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111');
Return an English translated sentence of the passed binary string.
The binary string will be space separated.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
MatiKid
@MatiKid
Aug 11 2015 00:08
hint
CamperBot
@camperbot
Aug 11 2015 00:08
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Moisés Man
@moigithub
Aug 11 2015 00:10
@MatiKid those 0001010 (8 digits) is a binary number (base2)
u need to convert to base10 (0123456789)
the number u get is an ascii code which represent a character like
A = code 65 (pressing alt + 65, will show u an A)
so u need to "decode" transform all those binary nums into a character using those functions
@MatiKid u can google for.. how to convert base2 to base10 algorithm.. or check parseInt javascript function
MatiKid
@MatiKid
Aug 11 2015 00:16
thanks @moigithub , I’ll take a look at it
CamperBot
@camperbot
Aug 11 2015 00:16
matikid sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
hey @matikid if you found this info helpful :point_right: consider adding a wiki article!
Sacha DeAngeli
@jazzhands
Aug 11 2015 00:53
hi guys, is there anyone who can help me with an algorithm question? This one is kicking my butt.
(I’m trying to do a recursive solution)
Alejandro Tejada
@wannabecoding
Aug 11 2015 00:54
I have a question on the palindromes, just to see if I'm headed in the right direction.
I need to check various strings to see if they are palindromes. So i need to break that string down into an array, reverse it and then join. Then compare original string versus the reversed string, correct?
Sacha DeAngeli
@jazzhands
Aug 11 2015 00:56
This message was deleted
Marie Pelletier
@Marie000
Aug 11 2015 00:56
Having trouble with a regular expression. I am trying to select ' when used as quotation (in the beginning and and of a string) but not when used as an apostrophe.
I have: /^'|'$/g
It's not working.What am I doing wrong?
Sacha DeAngeli
@jazzhands
Aug 11 2015 00:56
This message was deleted
This message was deleted
var permute = function(input){
    var permutation = function (arr, position){
        if(position >= arr.length-1){
            console.log(arr);
            return results.push(arr);
        }else
        {
            var tempSwap="";
            for(i=position;i<arr.length;i++){
                //console.log(arr, position, i);
                tempSwap = arr[position];
                arr.splice(position,1,arr[i]);
                //console.log(arr, position, i, tempSwap);
                arr.splice(i,1,tempSwap);
                console.log(arr, position, i, tempSwap);
                permutation(arr,(position+1));
            }
            return position;
        }
    };

    permutation(input,0);
};

var results=[];
permute(['a','b','c']);
console.log(results);
whoo! finally got that markdown to work - anyone know why this recursion isn’t working right? I get really wierd results:
[ [ 'a', 'c', 'b' ], [ 'a', 'c', 'b' ] ]
Marie Pelletier
@Marie000
Aug 11 2015 01:00
@wannabecoding correct. Just be careful to make a copy of your array before reversing it.
Ingrid
@voodoobettie
Aug 11 2015 01:06
@luishendrix92 Thanks so much for the help. Very much appreciated!
Marie Pelletier
@Marie000
Aug 11 2015 01:06

I am on Convert HTML Entities and getting strange results. Here's my code:

function convert(str) {
  // &colon;&rpar;
  str = str.replace(/^'|'$/g,'&apos;').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
  return str;
}

convert('Dolce & Gabbana');

It works for all cases, except 'Schindler's List' which gives me this error: expected 'Shindler\'s List' to equal 'Shindler's List'
where is that \ coming from???

Ash Roulston
@AshRoulston
Aug 11 2015 01:15
where's the missing ) or extra (
$(document).ready(function(){
$('#button').click(funtion(){
var toAdd = $('input[name=checkListItem]').val();
$('.list').append('item');
});
});
Cristián Berríos
@crisberrios
Aug 11 2015 01:17
@Marie000 the 2nd replace will mess everything as it replaces &apos; with &amp;pos;
wiki format
CamperBot
@camperbot
Aug 11 2015 01:18
no wiki entry for: format
:pencil: click here to create one now!after creating your page type update to reload it here
Cristián Berríos
@crisberrios
Aug 11 2015 01:18
help format
CamperBot
@camperbot
Aug 11 2015 01:18

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Cristián Berríos
@crisberrios
Aug 11 2015 01:18
@AshRoulston paste the formatted code so it's easier to check
Moisés Man
@moigithub
Aug 11 2015 01:21
@AshRoulston try to refresh the page ?
u storing something on toAdd and u not using that.. but i dont see any missing or extra ) (
Jeff Garrett
@jeffjg
Aug 11 2015 01:22
Hey all. I have a probably easy responsive design question.
Marie Pelletier
@Marie000
Aug 11 2015 01:22
thanks @crisberrios any ideas how I could work around that?
CamperBot
@camperbot
Aug 11 2015 01:22
marie000 sends brownie points to @crisberrios :sparkles: :thumbsup: :sparkles:
hey @marie000 if you found this info helpful :point_right: consider adding a wiki article!
:star: 110 | @crisberrios | http://www.freecodecamp.com/crisberrios
Ash Roulston
@AshRoulston
Aug 11 2015 01:23
@crisberrios @moigithub I figured it out... I had a mispelled function
Jeff Garrett
@jeffjg
Aug 11 2015 01:23

I have a simple responsive column layout here: http://codepen.io/cafebandito/pen/VLRGbe

It looks good when it's full screen, however, when it's shrunken down to mobile view and the columns adjust to 100%, I want the red box to be on top of the blue one. Any ideas?

Moisés Man
@moigithub
Aug 11 2015 01:25
"mobile first" ?
put red before blue
Juan Martínez
@jbmartinez
Aug 11 2015 01:26
@jeffjg that ^^
Moisés Man
@moigithub
Aug 11 2015 01:26
and.. when desktop full screen.. float red to right.. blue to left .. probably
Jeff Garrett
@jeffjg
Aug 11 2015 01:27
Omg I feel so dumb lol
OK, thanks. Naptime
Vince
@Vince33
Aug 11 2015 01:30
Anyone good with angular
Cristián Berríos
@crisberrios
Aug 11 2015 01:30
@Marie000 move the replace down the chain until the end
Vince
@Vince33
Aug 11 2015 01:30
?
Cristián Berríos
@crisberrios
Aug 11 2015 01:31
not me Vince :(
Vince
@Vince33
Aug 11 2015 01:31
hey @crisberrios !
Cristián Berríos
@crisberrios
Aug 11 2015 01:32
hey :D
Vince
@Vince33
Aug 11 2015 01:32
been a while
Cristián Berríos
@crisberrios
Aug 11 2015 01:33
yes, though I've been entering fairly often for the last month
and almost everyday for the last weeks
Vince
@Vince33
Aug 11 2015 01:33
yeah I have been commuting so i have not had much time
:worried:
Brett Guillory
@kurzninja
Aug 11 2015 01:40
This message was deleted
Vince
@Vince33
Aug 11 2015 01:40
So if anyone is good with $resource, $httpBackend, and abstract states let me know I am in a serious death metal debugging session
Russell Westberry
@russbus
Aug 11 2015 02:27
Having a weird time with this where art thou bonfire. Not 100% sure if I'm doing what's being asked and I have no idea if Object.hasOwnProperty() is necessary or useful to complete (doesn't appear to me that it is).
Robert
@rc242
Aug 11 2015 02:30
heyo
Logan Tegman
@ltegman
Aug 11 2015 02:31
@russbus Don’t know if it’s required, but I did use it in my solution.
Russell Westberry
@russbus
Aug 11 2015 02:32
Welp. Here's what I have (haven't yet submitted). Been working all day on a Python final so my brain isn't exactly behaving.
function where(collection, source) {
  var arr = [];
  // What's in a name?
  var sourceProps = Object.keys(source);
  for (var i = 0; i < sourceProps.length; i++) {
    for ( var j = 0; j < collection.length; j++) {
      if (collection[j][sourceProps[i]] == source[sourceProps[i]]) {
        arr.push(collection[j]);
      }
    }
  }
  return arr;
}

console.log(where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }));
Logan Tegman
@ltegman
Aug 11 2015 02:36
@russbus It’s not quite the solution I had, but it’s really close, and it produces the same output :)
Russell Westberry
@russbus
Aug 11 2015 02:37
@ltegman I initially used Object.hasOwnProperty() as the first half of an && for that if, but it didn't seem to matter.
AJ Gibson
@gibsonio
Aug 11 2015 02:39
question, i solved the seek and destroy bonfire without using the filter method which was suggested in the bonfire. am i missing something by not solving that problem by using filter?
Robert
@rc242
Aug 11 2015 02:40
@gibsonio other than getting some experience using the filter function? probably not.
Logan Tegman
@ltegman
Aug 11 2015 02:41
@russbus Yeah, after you mentioned that I played around with my own code and don’t see any benefit from having that check there.
AJ Gibson
@gibsonio
Aug 11 2015 02:42
@rc242 :+1:
Russell Westberry
@russbus
Aug 11 2015 02:43
@ltegman Yup. Just thought maybe there was something I was missing in not using it. I'll assume for now there's not.
Brett Guillory
@kurzninja
Aug 11 2015 02:46
can someone help me understand how to properly use jQuery.getJSON to fetch a JSON list using jsonP? I just don't seem to be getting the syntax correct here
Logan Tegman
@ltegman
Aug 11 2015 02:49
@kurzninja You should just be able to add ?callback=? to the end of the URL you’re contacting. I’ve hit a couple APIs that complained when I did that and I had to manually make the JSON request with JQuery.Ajax but most have responded well to adding the callback.
Brett Guillory
@kurzninja
Aug 11 2015 02:50
I guess I just don't really understand exactly how that works
let's say I have a function in codepen I want to execute when the JSON is fetched, and pass it the data that was fetched
what does adding ?callback=? to the URL do exactly?
Logan Tegman
@ltegman
Aug 11 2015 02:56
@kurzninja When you add it in JQuery it’s essentially just telling the server that you want a jsonp response, and JQuery does some magic to make it act like a normal request, so you can just pass in your callbacks like normal. If you check out this stack overflow thread you can get an idea of how it would be used if JQuery wasn’t doing the magic for you. http://stackoverflow.com/questions/6132796/how-to-make-a-jsonp-request-from-javascript-without-jquery
Brett Guillory
@kurzninja
Aug 11 2015 02:58
so I'd add jsonp?callback=myFunctionNameHere and it would just pass the data into that function that's waiting for it?
I feel like the rest of the FCC curriculum didn't really prepare me for even this first zipline
but I'm figuring it out slowly but Shirley
Logan Tegman
@ltegman
Aug 11 2015 03:02
Sort of, but the weird part about jsonp is that you actually execute it by appending a script tag referencing that API endpoint onto your page. It’s kind of clunky and I honestly don’t think anyone would bother with it if it weren’t for the fact that it lets you get around CORS. I do feel like the ziplines kind of just throw you in the deep end. I personally like that style, but it does mean you end up spending a lot of time googling to find your own answers.
Which is honesly pretty good practice for the real work XD
Brett Guillory
@kurzninja
Aug 11 2015 03:03
gotcha, I guess I'm just trying to understand the syntax of the jQuery.getJSON function then. Not sure where to put my function name to be called, in the URL itself or as a parameter of the getJSON() function?
Logan Tegman
@ltegman
Aug 11 2015 03:05
@kurzninja Oh, yeah, you can just pass in your callback as the second parameter for the getJSON call. When you’re using JQuery the jsonp thing doesn’t really have an impact besides the addition or ?callback=? to the URL.
chuah48263
@chuah48263
Aug 11 2015 03:07
Hi guys, have anyone has any experience on godaddy?
Brett Guillory
@kurzninja
Aug 11 2015 03:07
ok, so let me show you what my request looks like
 $('.getquote').click(function(){
    $.getJSON('http://quotesondesign.com/wp-json/posts?callback=&filter[orderby]=rand&filter[posts_per_page]=25', null, fillQuotesArray);  
  }); // .getquote .click
if I put fillQuotesArray(data) as my 3rd parameter, it tells me data is not defined
and if I just put fillQuotesArray without the (), then it gives me an error elsewhere where it's trying to access something undefined
like the data never really got passed to my function
Logan Tegman
@ltegman
Aug 11 2015 03:12
@kurzninja Have you tried omitting the null second parameter and just using fillQuotesArray. You shouldn’t need to add the (data) onto the end of your fillQuotesArray call. I’d also add a ? to your ?callback=.
Brett Guillory
@kurzninja
Aug 11 2015 03:12
I just tried that before you posted
doesn't seem to work
William Wagner
@wcwagner
Aug 11 2015 03:12
Hey @ltegman was the API you used for the Random Quote zipline easy to use, because I'm kind of lost.
I applied for http://www.quotes.net/quotes_api.php but I'm still waiting
Brett Guillory
@kurzninja
Aug 11 2015 03:13
that didn't work @ltegman, now it's giving me a "Refused to execute script from" error
Logan Tegman
@ltegman
Aug 11 2015 03:16
@Stfyou I personally went with this API: http://gophergala.github.io/wisdom/
@Stfyou I didn’t love the whole startup quote thing, but I liked how easy it was to use.
@kurzninja Hmm, I’m gonna play around with it real quick.
Brett Guillory
@kurzninja
Aug 11 2015 03:17
wait, I think I got it
I was only using the jsonP method because I was having cross site request errors before
I got rid of the whole ?callback= thing all together and now it's retrieving the data and passing it to my function no problem
William Wagner
@wcwagner
Aug 11 2015 03:18
@ltegman Did I miss a FCC module on working with jQuery and APIS, because I feel kind of lost right now. Thanks for the suggestion though, I'll look into it.
Brett Guillory
@kurzninja
Aug 11 2015 03:18
I guess maybe this API server is configured to allow any origin
Logan Tegman
@ltegman
Aug 11 2015 03:21
@kurzninja Oh, haha, well that makes it easy!
Brett Guillory
@kurzninja
Aug 11 2015 03:22
I think my problem was the original API I was trying to use has a problem on their side and it was just screwing me up completely
Logan Tegman
@ltegman
Aug 11 2015 03:23
@Stfyou The JQuery stuff is really light and doesn’t cover an API stuff. I definitely don’t think FCC does much in the current curriculum to set you up for the ziplines.
Brett Guillory
@kurzninja
Aug 11 2015 03:24
I think the FCC curriculum should definitely go through in more detail a choice selection of really important jQuery functions like the getJSON() and similiar things that would be really useful to know and not as simple as things like .addClass() or something like that
William Wagner
@wcwagner
Aug 11 2015 03:25
@kurzninja I agree. jQuery plays such a pivotal role, and the code Academy track is not sufficient at all.
Brett Guillory
@kurzninja
Aug 11 2015 03:26
maybe we should write those lessons and submit for pull requests :P
Brett Guillory
@kurzninja
Aug 11 2015 03:33
w00t, finally got this working the way I wanted it :D
now I just need to refactor it to work in the right order lol
Logan Tegman
@ltegman
Aug 11 2015 03:34
I think the new FCC curriculum that’s supposed to be getting deployed soon has a completely revamped and much more in-depth jquery path. It’s an in-house developed course in the new version
Brett Guillory
@kurzninja
Aug 11 2015 03:38
I just went through the beta jQuery path, I didn't find it that much more expanded really
it was still really basic, just DOM manipulation
gazzer82
@gazzer82
Aug 11 2015 03:40
Howdy all, anyone have any spare time to help me understand the code i used to make Bonfire: No Repeats work, it's super short but i'm not really sure how it works. I gave in after 2 days of trying to get it to work myself :(
CamperBot
@camperbot
Aug 11 2015 03:40
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
gazzer82
@gazzer82
Aug 11 2015 03:40
function permAlone(str){
    var inputArray = str.split("")
    return inputArray.reduce(function permute(res, item, key, arr) {
        return res.concat(arr.length > 1 && arr.slice(0, key)
        .concat(arr.slice(key + 1))
        .reduce(permute, [])
        .map(function(perm) {
            console.log(perm);
            return [item].concat(perm); }) || item);
    }, [])
    .map(function(itemToStringify){
        return itemToStringify.join('');
    })
    .reduce(function(count,string){
        var patt = new RegExp(/(\w)(\1+)/);
        if(patt.test(string)){
            return count;
        }else{
            return count + 1;
        }
    },0);
}
It's everything contained within the first return statement, all the rest of the easy bits are all me . .
Brett Guillory
@kurzninja
Aug 11 2015 03:52
what is this all about?
return [item].concat(perm); }) || item);
gazzer82
@gazzer82
Aug 11 2015 03:54
@kurzninja i have no idea, which is why i was asking, but it works.
Logan Tegman
@ltegman
Aug 11 2015 03:54
@gazzer82 You chose an incredibly complex functional example to work from! It’s good code, but without some comments it’s really hard to read.
Brett Guillory
@kurzninja
Aug 11 2015 03:54
I don't understand what function that || item is part of
gazzer82
@gazzer82
Aug 11 2015 03:55
@kurzninja it seemed the closest to what i was actually trying to achieve with my car crash of code.
Logan Tegman
@ltegman
Aug 11 2015 03:55
@kurzninja You can use || in return statement or assignment. Basically if the thing in front is falsey it will fall through and use the thing after the || instead
gazzer82
@gazzer82
Aug 11 2015 03:56
So in this context is it the map that's falling through?
Brett Guillory
@kurzninja
Aug 11 2015 03:56
yeah, I can't parse that at all lol
gazzer82
@gazzer82
Aug 11 2015 03:57
Also not sure what's gong on with
(function permute(res, item, key, arr) {
what's permute, where does that come from?
It's part of the later reduce function.
I think i need to come back to this when my brain is fresh and see if i can work out what's going on.
Brett Guillory
@kurzninja
Aug 11 2015 03:59
yeah, it looks like the inner reduce function is calling the function from earlier, recursively
does this not create an infinite loop when you run it?
Mahtab
@RoadToCode822
Aug 11 2015 03:59
What’s the — > stand for in the while loop argument?
    while (num-- > 2) {
        tmp *= num;
Logan Tegman
@ltegman
Aug 11 2015 04:00
@RoadToCode822 It’s just a greater than symbol, but the num value is being decremented.
Mahtab
@RoadToCode822
Aug 11 2015 04:00
ahh i see
Brett Guillory
@kurzninja
Aug 11 2015 04:00
that's a really weird place to mutate the num variable
Mahtab
@RoadToCode822
Aug 11 2015 04:01
im doing factorial bonfire
msdn gives me this explanation:
function factorial(num)
{
    // If the number is less than 0, reject it.
    if (num < 0) {
        return -1;
    }
    // If the number is 0, its factorial is 1.
    else if (num == 0) {
        return 1;
    }
    var tmp = num;
    while (num-- > 2) {
        tmp *= num;
    }
    return tmp;
}

var result = factorial(8);
document.write(result);
i’m having trouble synthesizing num— >
Robert Richey
@0x0936
Aug 11 2015 04:02
@kurzninja it's a way of not using a for loop
gazzer82
@gazzer82
Aug 11 2015 04:02
@kurzninja no, it runs perfectly and really fast, even with a really big input string.
Brett Guillory
@kurzninja
Aug 11 2015 04:03
I would just put
while (num > 2) {
tmp *= num;
num--;
}
gazzer82
@gazzer82
Aug 11 2015 04:03
I think i might try splitting it out into separate functions, might help make more sense . .
Brett Guillory
@kurzninja
Aug 11 2015 04:03
unless you specifically need to reduce num before the first iteration
gazzer82
@gazzer82
Aug 11 2015 04:04
i thought recursion was supposed to be simpler to read then loops :)
Robert Richey
@0x0936
Aug 11 2015 04:05
the more I code, the more I hate loops. I'll take those higher-order functions as much as I can.
gazzer82
@gazzer82
Aug 11 2015 04:08
@0x0936 i agree, but man i can't make head nor tail of the code above. It's voodoo i tell you, voodoos!
Mahtab
@RoadToCode822
Aug 11 2015 04:11
@kurzninja
For num = 5, the part of your code would look like this:
//while statement is true, therefore the code inside the while loop will run
while (5 > 2) {
//tmp = 5?
tmp = 5 * 5;
num = 5 - 1;
}
shouldn’t it be while (n > 1) ?
for the while loop’s argument
Brett Guillory
@kurzninja
Aug 11 2015 04:12
well it'd be (num > 2), because num is changing
the literal value 5 doesn't change
Mahtab
@RoadToCode822
Aug 11 2015 04:13
i think it should be num > 1
because 5! = 5 4 3 2 1 and since 2 is not included in (n>2), you don’t end up multiply the 2 in the 5!
Kavita Sachdeva
@kavitasa
Aug 11 2015 04:19
Anyone see why the number 4 gets logged to the console here?
var languages = {
    english: "Hello!",
    french: "Bonjour!",
    notALanguage: 4,
    spanish: "Hola!"
};

// print hello in the 3 different languages
for(var prop in languages) {
    if (typeof prop === "string") {
        console.log(languages[prop]);
    }
}
Danny Fritz
@dannyfritz
Aug 11 2015 04:20
@kavitasa because "notALanguage" is a string
Logan Tegman
@ltegman
Aug 11 2015 04:20
@kavitasa prop refers to the key, not the value paired with that key
Kavita Sachdeva
@kavitasa
Aug 11 2015 04:20
ah, yes, got it. thx
Harvey
@harvey56
Aug 11 2015 04:21
@dannyfritz :+1:
Kavita Sachdeva
@kavitasa
Aug 11 2015 04:22
sigh… productivity decines in correlation with the number of hours spent staring at the computer :worried:
Harvey
@harvey56
Aug 11 2015 04:22
@kavitasa yep, have to take a break from time to time
Danny Fritz
@dannyfritz
Aug 11 2015 04:22
The ebb and flow of focus and productivity can be quite fleeting.
Harvey
@harvey56
Aug 11 2015 04:24
can anyone help me understand the following :
var myFalse = new Boolean(false);   // initial value of false
var x = new Boolean(false);
if (x) {
  // this code is executed
}
in the first case, it's said it is false, whereas the 2nd case suggests that x would be true
Kameron Robinson
@RobinsonKameron
Aug 11 2015 04:25
@kavitasa Did you fix it ?
Kavita Sachdeva
@kavitasa
Aug 11 2015 04:26
@RobinsonKameron yes, thank you :-)
Kameron Robinson
@RobinsonKameron
Aug 11 2015 04:26
Howd you do it?
Logan Tegman
@ltegman
Aug 11 2015 04:27
@harvey56 Boolean can’t be used as a constructor. You’d have to do x = Boolean(false)
Danny Fritz
@dannyfritz
Aug 11 2015 04:27
@harvey56 doesn't new Boolean(false) create an Object and not a Boolean?
try Boolean(false) instead of new Boolean(false)
Kavita Sachdeva
@kavitasa
Aug 11 2015 04:27
@RobinsonKameron .. changed the condition in the if statement to (typeof languages[prop] === “string”)
Harvey
@harvey56
Aug 11 2015 04:29
@dannyfritz agreed. my understanding is that myFalse would be true as it is an object. (those 2 examples are from MDN btw). MDN says it has an initial value of false; i don't understand why
Danny Fritz
@dannyfritz
Aug 11 2015 04:30
oh, i don't think you typed your first case correctly. :P
Danny Fritz
@dannyfritz
Aug 11 2015 04:30
An object evaluates to true in JS when it is coerced to a Boolean.
Harvey
@harvey56
Aug 11 2015 04:35
i think i got it : myFalse is true, but has a value of false. Is that right ?
Danny Fritz
@dannyfritz
Aug 11 2015 04:36
!!myFalse is true
Harvey
@harvey56
Aug 11 2015 04:38
@dannyfritz :)
Mahtab
@RoadToCode822
Aug 11 2015 04:51
why isn’t my code working for factorial?
function factorialize(num) {
  if(num<0) {
    return -1;
  }
  else if(num <= 1){
    num = 1;
  }
  var tmp = num;

    while(num > 2){
      tmp *= num;
      num--;
    }
    return tmp;
}

factorialize(5);
Robert
@rc242
Aug 11 2015 04:53
@RoadToCode822 Look at your tmp assignment outside your loop and your tmp assignment in your while loop.
Mistereo
@Mistereo
Aug 11 2015 04:54
@RoadToCode822 also look at your while loop condition :)
Mahtab
@RoadToCode822
Aug 11 2015 04:55
so I should have var tmp = num; inside the while loop? @rc242
@Mistereo , whats wrong with the condition?
Mistereo
@Mistereo
Aug 11 2015 04:55
@RoadToCode822 nope.
I’m using this as a guide, my code looks similar to theirs, minus the num— from the while condition
Mistereo
@Mistereo
Aug 11 2015 04:56
@RoadToCode822 it's bad guide...
Mahtab
@RoadToCode822
Aug 11 2015 04:57
i tried using factorial, which seems to be the easiest way, but isn’t working on freecodecamp either
works on jsfiddle though
Mistereo
@Mistereo
Aug 11 2015 04:58
@RoadToCode822 ok, try to interpret you code for num = 3 for example.
step by step.
Mathew Kurian
@currymanswag
Aug 11 2015 05:00
Hey guys I'm doing Basic HTML and CSS number 17. My code looks done, and I feel like it should be working. But the text is still blue instead of red i.e; the !important declaration isn't working. Does anyone have an idea of what I'm doing wrong?
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>



<style>
  .red-text {
    color: red;
  }
  !important: .urgently-red {
    color:red !important;
  }
  .blue-text {
    color: blue;
  }
  h2 {
    font-family: Lobster, Monospace;
  }
  p {
    font-size: 16px;
    font-family: Monospace;
  }
</style>

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

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

<p class='red-text'>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
Ingrid
@voodoobettie
Aug 11 2015 05:02
@currymanswag The important declaration needs to go at the end of the line
Mahtab
@RoadToCode822
Aug 11 2015 05:02
@Mistereo for num = 3, i’m getting 9 :S
Mathew Kurian
@currymanswag
Aug 11 2015 05:02
@voodoobettie Isn't it already at the end of the line? O.o
Mistereo
@Mistereo
Aug 11 2015 05:03
@RoadToCode822 did you find the problem?
Mathew Kurian
@currymanswag
Aug 11 2015 05:03
You mean after the closing curly brace?
Mistereo
@Mistereo
Aug 11 2015 05:04
@RoadToCode822 you should check you code step by step for num = 3, then it should be clear.
Ingrid
@voodoobettie
Aug 11 2015 05:04
@currymanswag It needs to go at the other end. :)
Mistereo
@Mistereo
Aug 11 2015 05:04
@RoadToCode822 also, do you know the definition of factorial?
Mahtab
@RoadToCode822
Aug 11 2015 05:06
yes i do obviously
Mistereo
@Mistereo
Aug 11 2015 05:06
@RoadToCode822 factorial(n) = 1 2 ... n;
So factorial(3) = 1
2 * 3 which is 6.
@RoadToCode822 ok.
Mahtab
@RoadToCode822
Aug 11 2015 05:06
5 ! = 5 4 3 2 1
Mistereo
@Mistereo
Aug 11 2015 05:07
@RoadToCode822 yes, then if you do what I suggest, it should be clear to you what's wrong with your code.
Mahtab
@RoadToCode822
Aug 11 2015 05:07
i’m having difficulty finding the problem because i set tmp = num = 3 at first
then set while (3 > 2) which is true, therefore i go ahead and do tmp = tmp * num , which gives me 9
then num decrements and the while loop ends, so my result becomes 9
Mistereo
@Mistereo
Aug 11 2015 05:08
yes. So you multiply your result by 3 two times.
which is wrong
It's a first problem. There are one more.
@RoadToCode822 fix that and paste your new code here :)
Mahtab
@RoadToCode822
Aug 11 2015 05:09
the return tmp; is the other mistake?
Mistereo
@Mistereo
Aug 11 2015 05:10
nope.
paste your fixed code here.
maybe you already fix the second issue :)
when dealing with first one.
Ingrid
@voodoobettie
Aug 11 2015 05:12
bf confirm the ending
How can I get the match on the array to change it to have a funny array with inputs etc instead of an array containing the words in the sentence, as I was trying to. It somehow ends up with 'undefined' when I check on the last item in the array.
    function end(str, target) {
        var result = (str.match(/\s/) || false);
        console.log(result);
        if (result === true) {
            var newString = str.pop().split(" ");
            console.log(newString.length);
            console.log(newString);
             if (newString[-1] === target) {
                console.log("updated to " + newString);
                return true;
            }  
        }
          else { 
              // This part is working
              if (str.substr(-1) === target) {
            return true;
              }
        }
        console.log("updated to " + newString);
        return false;
    }

    end('Bastian is a man', 'man');
CamperBot
@camperbot
Aug 11 2015 05:12
Sorry, can't find a bonfire called confirm the ending how can i get the match on the array to change it to have a funny array with inputs etc instead of an array containing the words in the sentence as i was trying to it somehow ends up with undefined when i check on the last item in the array function endstr target var result strmatchs false consolelogresult if result true var newstring strpopsplit consolelognewstringlength consolelognewstring if newstring-1 target consolelogupdated to newstring return true else this part is working if strsubstr-1 target return true consolelogupdated to newstring return false endbastian is a man man. [ Check the map? ]
Ingrid
@voodoobettie
Aug 11 2015 05:12
bf confirm the ending
CamperBot
@camperbot
Aug 11 2015 05:12

:fire:Bonfire: Confirm the Ending :link:

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

end('Bastian', 'n');

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

more info:  bf details | bf links | hint

Mahtab
@RoadToCode822
Aug 11 2015 05:13
ok let me try, @Mistereo , thanks btw
Ingrid
@voodoobettie
Aug 11 2015 05:13
It works to match the last letter but not words
Mistereo
@Mistereo
Aug 11 2015 05:16
@voodoobettie look at your working part. Why don't use the same approach everywhere?
Mahtab
@RoadToCode822
Aug 11 2015 05:17
my new code, but not working :(
function factorialize(num) {
  if(num<0) {
    return -1;
  }
  else if(num <= 1){
    num = 1;
  }
    for(j=num-1; j>0; j--){
       while(num > 2){
      num = num * (num - j);
      num--;
       }
    }
    return num;
}

factorialize(5);
Mistereo
@Mistereo
Aug 11 2015 05:18
@RoadToCode822 hmm, all you need to fix your previous code is to change tmp initial value :)
*to fix first issue...
for(j=num-1; j>0; j--){
       while(num > 2){
      num = num * (num - j);
      num--;
       }
    }
This part is really strange to me.
pwdd
@pwdd
Aug 11 2015 05:20
@voodoobettie , have you tried comparing a substring that has the same length as the target?
Robert
@rc242
Aug 11 2015 05:20
hi.
pwdd
@pwdd
Aug 11 2015 05:21
@rc242 ! :D
Mahtab
@RoadToCode822
Aug 11 2015 05:21
hello @rc242
@Mistereo I was trying to loop the numbers preceeding the factorial digit
and have those numbers multiply each other then multiply that by num
Mistereo
@Mistereo
Aug 11 2015 05:22
@RoadToCode822 then what a nested while loop for?
Mahtab
@RoadToCode822
Aug 11 2015 05:22
right, that shouldn’t be there now that i think about it
Mistereo
@Mistereo
Aug 11 2015 05:22
@RoadToCode822 also why you change you num variable?
Mahtab
@RoadToCode822
Aug 11 2015 05:23
wha t do you mean
num is num
Mistereo
@Mistereo
Aug 11 2015 05:23
ok, it may be fine with your for-loop.
@RoadToCode822 I mean that it's better to collect answer in another variable.
Mahtab
@RoadToCode822
Aug 11 2015 05:24
This is my current code and it’s not looking good
function factorialize(num) {
  if(num<0) {
    return -1;
  }
  else if(num <= 1){
    num = 1;
  }

    for(j=num-1; j>0; j--){

      num = num * (j * (j-1));
      num--;

    }
    return num;
}

factorialize(5);
Mistereo
@Mistereo
Aug 11 2015 05:25
@RoadToCode822 like in your first code you used 'tmp' there.
Wrong. Thing about what are you doing here.
num = num * (j * (j-1));
num--;
pwdd
@pwdd
Aug 11 2015 05:26

I need some help to understand a thing (bf where do I belong).
As part of the solution, I was trying this:

function where(arr, num) {
  var toSort = arr.push(num);
  var sorted = toSort.sort(function(a, b) {
    return a - b;
  });
  // here goes the answer
}

However, I get a 'sort is not a function'
When I try:

function where(arr, num) {
  arr.push(num);
  arr.sort(function(a, b) {
    return a - b;
  });
  // here goes the answer
}

it works perfectly.
So, what is the difference between doing the arr.sort and toSort.sort?

Mistereo
@Mistereo
Aug 11 2015 05:26
@RoadToCode822 there should be just: num = num * j;
Mahtab
@RoadToCode822
Aug 11 2015 05:27
hmm i see
function factorialize(num) {
  if(num<0) {
    return -1;
  }
  else if(num <= 1){
    num = 1;
  }

    for(j=num-1; j>0; j--){

      num = num * j;
      num--;

    }
    return num;
}

factorialize(5);
like this?
Mistereo
@Mistereo
Aug 11 2015 05:27
This message was deleted
without num--; for what?
Bret Reynoso
@breyn407
Aug 11 2015 05:28

This is driving me crazy. Maybe I’m tired and missing something:

// create your Animal class here
function Animal(name,numlegs) {
    this.name = name;
    this.numlegs = numlegs;
}


// create the sayName method for Animal
Animal.prototype.sayName = function() {
    console.log("Hi my name is " + this.name);
};



// provided code to test above constructor and method
var penguin = new Animal("Captain Cook", 2);
penguin.sayName();

codecademy is giving me an error. but it works in repl.it. any ideas?

Mistereo
@Mistereo
Aug 11 2015 05:29
@breyn407 please give us a link to the statements.
Mahtab
@RoadToCode822
Aug 11 2015 05:29
right
got it :)
thanks man!
Mistereo
@Mistereo
Aug 11 2015 05:30
@RoadToCode822 i'll send you my solution in pm :)
Mahtab
@RoadToCode822
Aug 11 2015 05:30
ok :)
i got two solutions as well. I used factorial
function factorialize(num) {
  if(num==1)
    return 1;
  else
    return num*factorialize(num-1);
}

console.log(factorialize(5));
recursion
Mistereo
@Mistereo
Aug 11 2015 05:31
@RoadToCode822 this one looks cleaner :)
Bret Reynoso
@breyn407
Aug 11 2015 05:31

This is the error:

Oops, try again. It looks like your Animal constructor does not take in two arguments and save them as 'this.name' and 'this.numLegs' respectively.

Ingrid
@voodoobettie
Aug 11 2015 05:32
@Mistereo Should I be matching the value backwards using regex? I'm trying to figure out how I can extract the last element of the string. I was trying to put it into an array and extract the last value but it's not really working out.
Mathew Kurian
@currymanswag
Aug 11 2015 05:32
Hey guys I'm doing Basic HTML and CSS number 17. My code looks done, and I feel like it should be working. But the text is still blue instead of red i.e; the !important declaration isn't working. Does anyone have an idea of what I'm doing wrong?
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>



<style>
  .red-text {
    color: red;
  }
  !important: .urgently-red {
    color:red !important;
  }
  .blue-text {
    color: blue;
  }
  h2 {
    font-family: Lobster, Monospace;
  }
  p {
    font-size: 16px;
    font-family: Monospace;
  }
</style>

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

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

<p class='red-text'>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
Robert
@rc242
Aug 11 2015 05:32
well, hell.
Mistereo
@Mistereo
Aug 11 2015 05:33
@voodoobettie use the same .substr as in you working part...
Mathew Kurian
@currymanswag
Aug 11 2015 05:33
Do I need to make a separate style tag and put the !important and .urgently-red in there?
Mistereo
@Mistereo
Aug 11 2015 05:33
@voodoobettie this task can be solved with one line of code.
Mathew Kurian
@currymanswag
Aug 11 2015 05:33
No matter what I try, the <h2> text always stays blue instead of red.
wontoan
@wontoan
Aug 11 2015 05:34
if you're trying to change the <h2> tag then why are you trying to change the <p> tag?
Mistereo
@Mistereo
Aug 11 2015 05:35
@breyn407 numLegs is not the same as numlegs check your constructor.
@breyn407 js is case sensitive.
Mathew Kurian
@currymanswag
Aug 11 2015 05:35
@wontoan Oh sorry, I didn't explain. The exercise wants the h2 text to be red. The <p> text is from the previous exercise. The current exercise doesn't care about the paragraph.
Robert
@rc242
Aug 11 2015 05:35
Agghh, can't get this selector to work correctly :(
wontoan
@wontoan
Aug 11 2015 05:35
1s let me pull this exercise u
up
Bret Reynoso
@breyn407
Aug 11 2015 05:36
@Mistereo, oh crud. it was a stupid error. thx
Mathew Kurian
@currymanswag
Aug 11 2015 05:36
Okay thanks for helping!
@wontoan We're basically trying to have the h2 text be red instead of blue, even though the blue text function is the one that was defined last, and therefor has higher priority.
wontoan
@wontoan
Aug 11 2015 05:37
worked fine for me
Bill
@kirah1314
Aug 11 2015 05:37
@voodoobettie you can find the length of target then substr the length backwards with a negative value
wontoan
@wontoan
Aug 11 2015 05:38
<style>
  .red-text {
    color: red;
  }

  .urgently-red {
    color: red !important;
  }

  .blue-text {
    color: blue;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

  p {
    font-size: 16px;
    font-family: Monospace;
  }
</style>

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

<p class='red-text'>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class='red-text'>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
Ah, I see your syntax problem now
!important: .urgently-red {
    color:red !important;
  }
Mathew Kurian
@currymanswag
Aug 11 2015 05:39
@wontoan Was I not supposed to enter it twice?
That's how it was written in the explanations.
pwdd
@pwdd
Aug 11 2015 05:39
@voodoobettie I believe you do not need regex for this problem. It is simpler than that. ;) the secret is getting a substring that has same length as the target, from end to start.
wontoan
@wontoan
Aug 11 2015 05:39
It's not your fault, FCC meant
Bret Reynoso
@breyn407
Aug 11 2015 05:39

@Mistereo, that’s why it worked in repl.it. Because the code was fine. However, it didn’t follow the instructions exactly and use “numLegs” so the error correction failed my code.

Thanks for your help!

wontoan
@wontoan
Aug 11 2015 05:39
"this is how you use !important: "
notice the opening and closing <style> </style> tags? The code in between is what you want. .urgently-blue { color: blue !important; }
Mathew Kurian
@currymanswag
Aug 11 2015 05:41
Ah. So I just need to write it once?
wontoan
@wontoan
Aug 11 2015 05:41
yeah remove !important:
Mathew Kurian
@currymanswag
Aug 11 2015 05:41
Okay. Thanks man!
wontoan
@wontoan
Aug 11 2015 05:42
:+1: :
Mahtab
@RoadToCode822
Aug 11 2015 05:50
I was able to log the # of letters in each word of a given string, but not sure how to pick the max # and choose that respective word and convert it back to str
function longestWordIn(str){
    var newStr = str.split(' ');
        for (i=0; i<newStr.length; i++){
            console.log(newStr[i].length);
        }    
    return str.length;
}

console.log(longestWordIn("The quick brown fox jumped over the lazy dog"));
Ingrid
@voodoobettie
Aug 11 2015 05:51
@kirah1314 Thanks!
Ozy Design & Software
@OzySky
Aug 11 2015 06:07
@RoadToCode822 inside the for loop compare newStr[i].length to an initial value, then if it is higher, make that value equal newStr[i].length
Matthew Barber
@Honno
Aug 11 2015 06:36
Hey guys, what does "member value" exactly mean?
Regarding js objects at least
Mahtab
@RoadToCode822
Aug 11 2015 06:45
This code works in jsfiddle but not in FCC:
function longestWordIn(str){
    var newStr = str.split(' ');
    var longest = 0;
        for (i=0; i<newStr.length; i++){
            if(longest < newStr[i].length){
            longest = newStr[i].length;
            str = newStr[i];
            }
        }    
    return str.length;
}

console.log(longestWordIn("The quick brown fox jumped over the lazy dog"));
Luis Felipe López G.
@luishendrix92
Aug 11 2015 06:50
@RoadToCode822 WHy don't you just return longest instead of changing the value of str.
Also, your code in FCC should have the function execution as it was in the original code provided by the bonfire, not a console.log.
Mahtab
@RoadToCode822
Aug 11 2015 06:51
hmm good point.
I got it now, it’s fixed. Had to change the function name to the origional as well
ahmeddin
@ahmeddin
Aug 11 2015 06:54
anyone wanting to pair up
Mahtab
@RoadToCode822
Aug 11 2015 06:54
what you on ahmeddin
@ahmeddin
Jeremy Gorniak
@Gornstats
Aug 11 2015 06:56
hey guys on the Make a Person bonfire I've created my class no problem, but the checks don't allow me to pass because I have 9 keys and they apparently want only 6... expect(Object.keys(bob).length).to.eql(6);expected 9 to deeply equal 6
Anyone have any ideas? I need 6 keys to create the necessary methods, and 3 more to set the initial properties...not sure how to do it in just 6
ahmeddin
@ahmeddin
Aug 11 2015 06:57
dna pairing problem...
i have only skype
nobodyyyyyyyyyyyyyy
great...
wontoan
@wontoan
Aug 11 2015 07:01
thanks @ozydesign
CamperBot
@camperbot
Aug 11 2015 07:01
wontoan sends brownie points to @ozydesign :sparkles: :thumbsup: :sparkles:
hey @wontoan if you found this info helpful :point_right: consider adding a wiki article!
:star: 3 | @ozydesign | http://www.freecodecamp.com/ozydesign
Jeremy Gorniak
@Gornstats
Aug 11 2015 07:02
nvm, used prototypes to solve the problem
Matthew Barber
@Honno
Aug 11 2015 07:05
@ozydesign where you at on functional programming? :p
every question I need to go back to the prototype declarations to understand what the code actually does
Woolwit
@Woolwit
Aug 11 2015 07:14
@ahmeddin I solved it with a series of else if. Is that the direction you're headed in?
ahmeddin
@ahmeddin
Aug 11 2015 07:15
was it a short code......something ingenious or .......... or a long winded else-ifs
Woolwit
@Woolwit
Aug 11 2015 07:16
Yes, long-winded. As is my way.
ahmeddin
@ahmeddin
Aug 11 2015 07:16
:D
good.......u are smart...
Woolwit
@Woolwit
Aug 11 2015 07:17
Are you working on something ingenious? If you'd like to see mine, there's another pairing site you could see it on.
ahmeddin
@ahmeddin
Aug 11 2015 07:17
well......i have jumped on to the next prorblem, and i have realized i am very weak when it comes to string problems...
but i would like to see your code still..
Woolwit
@Woolwit
Aug 11 2015 07:18
Click the link and I will show you around. There's only text chat, but it's pretty cool. http://pythontutor.com/visualize.html#togetherjs=IRNFKnAHe3
ahmeddin
@ahmeddin
Aug 11 2015 07:23
thanx man...gonna look at the code..
i think i did not understand the problem....
what should string CGC evaluate to.........CGCG, but with this code is it going to be CGGCCG,...
Woolwit
@Woolwit
Aug 11 2015 07:25
Let's try it
ahmeddin
@ahmeddin
Aug 11 2015 07:26
ok...
Woolwit
@Woolwit
Aug 11 2015 07:30
PS You could chat back to me in there.
Juan Martínez
@justinian336
Aug 11 2015 07:30
Hey guys, can someone help me with my Wikipedia viewer code?
ahmeddin
@ahmeddin
Aug 11 2015 07:39
thanx @Woolwit , i misunderstood the problem, it was straight forward and had to be done the way u did it,
Matthew Barber
@Honno
Aug 11 2015 07:50

I don't understand...

Array.zip = function(left, right, combinerFunction) {
    var counter,
        results = [];

    for(counter = 0; counter < Math.min(left.length, right.length); counter++) {
        results
    }

    return results;
};

so does counter and results get declared as an array?

Ozy Design & Software
@OzySky
Aug 11 2015 07:51
counter is not an array. results is empty array
Matthew Barber
@Honno
Aug 11 2015 07:52
thanks @ozydesign
CamperBot
@camperbot
Aug 11 2015 07:52
honno sends brownie points to @ozydesign :sparkles: :thumbsup: :sparkles:
hey @honno if you found this info helpful :point_right: consider adding a wiki article!
:star: 4 | @ozydesign | http://www.freecodecamp.com/ozydesign
Mistereo
@Mistereo
Aug 11 2015 07:52
counter is not an array...
Matthew Barber
@Honno
Aug 11 2015 07:52
so its counter declared as underfined?
ahh
Ozy Design & Software
@OzySky
Aug 11 2015 07:52
thanks @Mistereo
CamperBot
@camperbot
Aug 11 2015 07:52
ozydesign sends brownie points to @mistereo :sparkles: :thumbsup: :sparkles:
hey @ozydesign if you found this info helpful :point_right: consider adding a wiki article!
Matthew Barber
@Honno
Aug 11 2015 07:52
it's like
var counter;
var results = [];
right?
Ozy Design & Software
@OzySky
Aug 11 2015 07:52
yeah
Mistereo
@Mistereo
Aug 11 2015 07:52
yes
Matthew Barber
@Honno
Aug 11 2015 07:52
untahnks @ozydesign
thanks @Mistereo
CamperBot
@camperbot
Aug 11 2015 07:53
honno sends brownie points to @mistereo :sparkles: :thumbsup: :sparkles:
hey @honno if you found this info helpful :point_right: consider adding a wiki article!
Matthew Barber
@Honno
Aug 11 2015 07:53
my hero

So do folk prefer

var counter = 0,
results = [],
name = "bob";

or

var counter = 0;
var results = [];
var name = "bob";

more?

Mistereo
@Mistereo
Aug 11 2015 07:57
@Honno I prefer the second: one 'var' for each variable :)
Matthew Barber
@Honno
Aug 11 2015 07:58
Also, why does http://jhusain.github.io/learnrx/ declare concatAll, map, filter, reduce and concatMap functions on the Array.prototype, but zip on just Array?
wait on that, it's because...
you modify two values
so you can't... ahah
Roy
@CruelCoin
Aug 11 2015 08:29
@Honno I prefer the second.
var counter = 0;
var results = [];
var name = "bob";
Easier to read
darklove2501
@darklove2501
Aug 11 2015 08:47
I want Screenhero app on Windows. anyone please send me the invite code to ntvinh.it@gmail.com
Roy
@CruelCoin
Aug 11 2015 09:06
Hi all, can i get some advse with this please?
Bonfire: Title Case a Sentence
CamperBot
@camperbot
Aug 11 2015 09:06

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

more info:  bf details | bf links | hint

Roy
@CruelCoin
Aug 11 2015 09:07
function titleCase(str)
{
  var wordArray = str.split(' ');

  for (var i = 0; i < wordArray.length; i++)
    {
      wordArray[i].charAt(0).toUpperCase();
    }

  var returnString = wordArray.join(' ');

  return returnString;
}

titleCase("I'm a little tea pot");
Pascal
@pfilippi24
Aug 11 2015 09:18
@CruelCoin toUpperCase() does not modify the string it is called on, but returns a new one with the desired case
Roy
@CruelCoin
Aug 11 2015 09:21
@pfilippi24 aha. One sec
@pfilippi24 My finished code.
function titleCase(str)
{
  var wordArray = str.split(' ');

  for (var i = 0; i < wordArray.length; i++)
    {
      var tempWord = wordArray[i];
      var firstLetter = tempWord.charAt(0).toUpperCase();
      var restOfWord = tempWord.substring(1).toLowerCase();
      var newWord = firstLetter.concat(restOfWord); 
      wordArray[i] = newWord;
    }

  var returnString = wordArray.join(' ');

  return returnString;
}

titleCase("I'm a little tea pot");
@pfilippi24 Thanks for the help
How do i send brownie points?
rahisarm
@rahisarm
Aug 11 2015 09:30
Helllo is there anyone?
Roy
@CruelCoin
Aug 11 2015 09:31
Yup, @rahisarm Whats up?
rahisarm
@rahisarm
Aug 11 2015 09:32
I was starting to do a hello world app in node.js at cloud 9
I just cannot start my own app running
Im a newbie Here...So please help
@CruelCoin ???
Roy
@CruelCoin
Aug 11 2015 09:34
Node.js is not something i'm familiar with, sorry
Not at that point yet
thanks @pfilippi24
CamperBot
@camperbot
Aug 11 2015 09:36
cruelcoin sends brownie points to @pfilippi24 :sparkles: :thumbsup: :sparkles:
hey @cruelcoin if you found this info helpful :point_right: consider adding a wiki article!
Pascal
@pfilippi24
Aug 11 2015 09:51
@CruelCoin You're welcome and thanks for the brownies :)
MD MOJIBUL HOQUE
@Mojibul
Aug 11 2015 09:53
I am stuck . Please any one help me . Here is my code
function search(lastName){
    var contactsLength = contacts.length;
    for (i=0; i < contactsLength ; i++){
        if (contacts[i].lastName == lastName){
            printPerson(contact[i]);
            }
        }
    }
search("jones");
It's a Building an Address Book 5/6
Pascal
@pfilippi24
Aug 11 2015 09:56
@Mojibul shouldn't printPerson(contact[i]); be printPerson(contacts[i]);?
MD MOJIBUL HOQUE
@Mojibul
Aug 11 2015 09:57
@pfilippi24 I change it but not working !!! I request to you please help me.
Pascal
@pfilippi24
Aug 11 2015 10:00
@Mojibul The string comparison is case sensitive, so search("jones"); can not work
@Mojibul because the bob object is defined like
var bob = {
    firstName: "Bob",
    lastName: "Jones",
    phoneNumber: "(650) 777-7777",
    email: "bob.jones@example.com"
};
MD MOJIBUL HOQUE
@Mojibul
Aug 11 2015 10:02
@pfilippi24 actually i get this message "
Oops, try again. It looks like your search function didn't log "Bob Jones" to the console. Did you remember to call search after you defined it?
"
Pascal
@pfilippi24
Aug 11 2015 10:02
@Mojibul exactly and I told you how to solve it :)
@Mojibul you search for "jones", but there is no "jones" in the address-book. Case is important!
MD MOJIBUL HOQUE
@Mojibul
Aug 11 2015 10:06
Thanks @pfilippi24
CamperBot
@camperbot
Aug 11 2015 10:06
mojibul sends brownie points to @pfilippi24 :sparkles: :thumbsup: :sparkles:
hey @mojibul if you found this info helpful :point_right: consider adding a wiki article!
Pascal
@pfilippi24
Aug 11 2015 10:06
@Mojibul You're welcome
Huseyin O.
@husamp
Aug 11 2015 10:08
Hello!
I have a question regarding a bonfire, but not sure if this is the correct chat room :)
Shouvik Roy
@royshouvik
Aug 11 2015 10:12
@husamp ask away!
What problem are you facing?
Huseyin O.
@husamp
Aug 11 2015 10:13
I've asked in HelpBonfires chat @royshouvik :)
CamperBot
@camperbot
Aug 11 2015 10:13
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
CamperBot
@camperbot
Aug 11 2015 10:14
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Migh_T_Reuben
@treuben
Aug 11 2015 10:42
Hello. I need a little help on this challenge please - http://www.freecodecamp.com/challenges/waypoint-use-the-bootstrap-grid-to-put-elements-side-by-side
I got 3 out of the 4. I don't understand the correct way to wrap each of the buttons within a <div class="col-xs-4"> element. When I placed this in front of each button it was not deemed correct. I would appreciate some advisement. Thank you.
<div class='row'
<button class='btn btn-block btn-primary'>Like</button>
<button class='btn btn-block btn-info'>Info</button>
<button class='btn btn-block btn-danger'>Delete</button>
</div>
ahmeddin
@ahmeddin
Aug 11 2015 10:47
anyone did the bonfire sorted union using array.reduce()
want to see how reduce can help u select elements from an array instead of doing a computation......(i might not know what i am saying :worried: )
Pascal
@pfilippi24
Aug 11 2015 10:52
@ahmeddin filter is more suitable to this bonfire, but you can simulate filter using reduce. I'll post if you are interested
ahmeddin
@ahmeddin
Aug 11 2015 10:53
i did using filter...
just wondered what it would be to use reduce..
Matthew Barber
@Honno
Aug 11 2015 10:53

@ahmeddin Basically

array.reduce(function(accumulator, current) {
  return <value to become the accumulator>;
});

So, if you wanted to add all items in an array

array.reduce(function(accumulator, current) {
  return accumulator + current;
});
Because, the accumulator stores a value, and you can do whatever you want to it, like add the current value in the array
ahmeddin
@ahmeddin
Aug 11 2015 10:54
my code

function unite(arr1, arr2, arr3) {
var arr=[];
var f = function(x){ if (arr.indexOf(x)===-1) arr.push(x); };

for (var i=0; i<arguments.length; i++)
{
arguments[i].filter(f);

}
return arr;

}

Matthew Barber
@Honno
Aug 11 2015 10:55
Wanna find the biggest number?
array.reduce(function(accumulator, current) {
  if(current > accumulator) {
    return current;
  } else {
    return accumulator;
  }
});
Pascal
@pfilippi24
Aug 11 2015 10:55
@ahmeddin I see, something like this would work using reduce:
function unite(arr1, arr2, arr3) {
  return arr1.concat(arr2,arr3).reduce(function(res, item, index, arr){
    if(arr.indexOf(item) ===  index) res.push(item);
    return res;
  }, []);  
}
ahmeddin
@ahmeddin
Aug 11 2015 10:55
wait.......this seems interesting
ok... @pfilippi24 @Honno lemme try
Migh_T_Reuben
@treuben
Aug 11 2015 10:56
sigh. Guess noone can help me.
Matthew Barber
@Honno
Aug 11 2015 10:58
@treuben close your first div?
also it's not class row, it's...
Pascal
@pfilippi24
Aug 11 2015 10:58
@treuben 1. your opening div tag misses a '>'
  1. the task of this waypoint is to additionally wrap all button elements with their own diffs
Matthew Barber
@Honno
Aug 11 2015 10:59
whoops it is class row haha
Migh_T_Reuben
@treuben
Aug 11 2015 11:02
@pfilippi24 - I'm aware of that. How? And when I put the other div tag on it rendered one of green checks incorrect.
I don't get it. Can someone advise? The way I did it below is not working.
<div class='row'
<div class="col-xs-4"><button class='btn btn-block btn-primary'>Like</button></div>
<div class="col-xs-4"><button class='btn btn-block btn-info'>Info</button></div>
<div class="col-xs-4"><button class='btn btn-block btn-danger'>Delete</button></div>
</div>
Migh_T_Reuben
@treuben
Aug 11 2015 11:08
@pfilippi24 - Thank you
Pascal
@pfilippi24
Aug 11 2015 11:15
@treuben there is still the closing '>' missing on the outer div
Migh_T_Reuben
@treuben
Aug 11 2015 11:21
@pfilippi24 - Yeah. It took me a moment to figure what you meant. At first I thought I needed to do it like this: <div> , but after staring at it some more I then moved it to the end and got it correct. So that is why I thanked you because you were right. I didnt understand where exactly I was supposed to put the div tag. I got it now. Thanks again for your help. I appreciate it.
Sydney Ekpo
@rejreign
Aug 11 2015 11:21
Hi All.
In building my resume http://codeacademy.com, I find that my paragraphs/text spill out of my div(text is quite much). Do I just increase the div height or is there a source code I can use?
Joris Labie
@labiej
Aug 11 2015 11:26
Don't set a fixed height ?
Sydney Ekpo
@rejreign
Aug 11 2015 11:30
@labiej My div height is currently 450px. I'm sure if I increased it, it would then contain. However, isn't there a way to make the div intuitively wrap all the text?
Joris Labie
@labiej
Aug 11 2015 11:30
Don't set a height explicitly
It stretches with the contents
Sydney Ekpo
@rejreign
Aug 11 2015 11:31
@labiej Ok I'll try that now
Pascal
@pfilippi24
Aug 11 2015 11:39
@treuben great!
Sydney Ekpo
@rejreign
Aug 11 2015 11:41
@labiej You were right. Thank you.
fares red
@fareshnd
Aug 11 2015 11:41
can you help me ?
Joris Labie
@labiej
Aug 11 2015 11:41
@fareshnd don't know, what's the problem?
fares red
@fareshnd
Aug 11 2015 11:42

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

p.sansserif{
font-family: sans-serif;
}
</style>

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

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

<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
the problem is Your p elements should use the font "Monospace".???

Joris Labie
@labiej
Aug 11 2015 11:43
help format
CamperBot
@camperbot
Aug 11 2015 11:43

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Joris Labie
@labiej
Aug 11 2015 11:43
font-family should be changed in your CSS
fares red
@fareshnd
Aug 11 2015 11:44
oui but i try all things .but nothing
zcrnivec
@zcrnivec
Aug 11 2015 11:45
function convert(str) {
  // &colon;&rpar;
  return str.replace(/[&<>\'\"]/gi, function(i) {
    return '&#' + i.charCodeAt(0) + ";";
  });
}

convert('Dolce & Gabbana');
help me pls
CamperBot
@camperbot
Aug 11 2015 11:45
no wiki entry for: me pls
:pencil: click here to create one now!after creating your page type update to reload it here
zcrnivec
@zcrnivec
Aug 11 2015 11:45
why it doesnt work ? Bonfire: Convert HTML Entities
fares red
@fareshnd
Aug 11 2015 11:47
i didn't understund
Joris Labie
@labiej
Aug 11 2015 11:52
@fareshnd font-family: Monospace instead of font-family: sans-serif
Nepherius
@Nepherius
Aug 11 2015 11:53
@zcrnivec & should be converted to &
amp;
zcrnivec
@zcrnivec
Aug 11 2015 11:54
well the site that was provided from freecodecamp there is more html entities than just &
Nepherius
@Nepherius
Aug 11 2015 11:54
but sill cool solution :)
fares red
@fareshnd
Aug 11 2015 11:54
yes think you vey much
Nepherius
@Nepherius
Aug 11 2015 11:55
they just want the other code not the one with number
numbers*
zcrnivec
@zcrnivec
Aug 11 2015 11:55
oh ok :)
Nepherius
@Nepherius
Aug 11 2015 11:56
'&' '>' and so on
meh ..cant write the code lol
zcrnivec
@zcrnivec
Aug 11 2015 11:56
yeah me neither
is there any solution than brute force?
except*
Nepherius
@Nepherius
Aug 11 2015 11:57
'>'  would be '&gt;'
zcrnivec
@zcrnivec
Aug 11 2015 11:58
yes I could achieve that if make an array of html entities but is there any other solution except this brute force ? :)
Nepherius
@Nepherius
Aug 11 2015 11:59
idk, only ones I seen were keys or switch
zcrnivec
@zcrnivec
Aug 11 2015 11:59
kk
Migh_T_Reuben
@treuben
Aug 11 2015 12:03

Hello. I would appreciate some advisement on this challenge: http://www.freecodecamp.com/challenges/waypoint-add-font-awesome-icons-to-our-buttons

I don't understand how to "wrap my i element". This is my code:

<div class='row'>

<i class='fa fa-thumbs-up'>
  <div class='col-xs-4'>
    <button class='btn btn-block btn-primary'>Like</button>
  </div></i>

  <div class='col-xs-4'>
    <button class='btn btn-block btn-info'>Info</button>
  </div>

  <div class='col-xs-4'>
    <button class='btn btn-block btn-danger'>Delete</button>
  </div>

</div>
zcrnivec
@zcrnivec
Aug 11 2015 12:04
okaj got it :)
function convert(str) {
  // &colon;&rpar;
  var chars = {
    "&": "&amp;",
    "<": "&lt;",
    ">": "&gt;",
    "\"": "&quot;",
    "\'": "&apos;"
  };

  return str.replace(/[&<>\'\"]/gi, function(ch) {
    return chars[ch];
  });

  /*return str.replace(/[&<>\'\"]/gi, function(i) {
    return '&#' + i.charCodeAt(0) + ";";
  });*/
}

convert('Dolce & Gabbana');
Nepherius
@Nepherius
Aug 11 2015 12:06
nice gz
Ozy Design & Software
@OzySky
Aug 11 2015 12:06
@treuben put the <i> element inside the div
gjoko1
@gjoko1
Aug 11 2015 12:08
I need some help with the "Bonfire: Falsey Bouncer" challenge. The goal is "Remove all falsey values from an array. Falsey values in javascript are false, null, 0, "", undefined, and NaN."
CamperBot
@camperbot
Aug 11 2015 12:08
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Migh_T_Reuben
@treuben
Aug 11 2015 12:09
@ozydesign - Like this? I'm still getting it wrong.
<div class='row'>

  <div class='col-xs-4'><i class='fa fa-thumbs-up'>
    <button class='btn btn-block btn-primary'>Like</button>
  </div></i>

  <div class='col-xs-4'>
    <button class='btn btn-block btn-info'>Info</button>
  </div>

  <div class='col-xs-4'>
    <button class='btn btn-block btn-danger'>Delete</button>
  </div>

</div>
Ozy Design & Software
@OzySky
Aug 11 2015 12:11
I think it's supposed to be like this
<div class='row'>

  <div class='col-xs-4'>
    <button class='btn btn-block btn-primary'><i class='fa fa-thumbs-up'>Like</i></button>
  </div>

  <div class='col-xs-4'>
    <button class='btn btn-block btn-info'>Info</button>
  </div>

  <div class='col-xs-4'>
    <button class='btn btn-block btn-danger'>Delete</button>
  </div>

</div>
zcrnivec
@zcrnivec
Aug 11 2015 12:13
anyone good with Regular expressions?
Migh_T_Reuben
@treuben
Aug 11 2015 12:13
@ozydesign - I lost one of my green checks because I need to "Make sure your i element has a closing tag."
Ozy Design & Software
@OzySky
Aug 11 2015 12:13
@treuben check my edit
@zcrnivec a bit
ahmeddin
@ahmeddin
Aug 11 2015 12:14
@treuben the opposite :(
Migh_T_Reuben
@treuben
Aug 11 2015 12:14
@ozydesign - lol. oh there it is. My bad
@ozydesign - Let me try that.
Ozy Design & Software
@OzySky
Aug 11 2015 12:15
@zcrnivec what do you need help with?
zcrnivec
@zcrnivec
Aug 11 2015 12:15
spinal tap case
function spinalCase(str) {
  // "It's such a fine line between stupid, and clever."
  // --David St. Hubbins
  return str.replace(/\s/g, "-").toLowerCase();
}

spinalCase('This Is Spinal Tap');
but it only works for spaces
have to do it for underscores and i have to somehow seperate the words
Tristanto
@rustyworks
Aug 11 2015 12:17
find home
CamperBot
@camperbot
Aug 11 2015 12:17

find home

[0] home

Tristanto
@rustyworks
Aug 11 2015 12:17
Ah finally, home ...
Migh_T_Reuben
@treuben
Aug 11 2015 12:17
@ozydesign - Thank you very much sir. I see what you did there and all my checks are green. Thank you very much. I appreciate your help.
Ozy Design & Software
@OzySky
Aug 11 2015 12:17
@treuben no problems
@zcrnivec one sec
zcrnivec
@zcrnivec
Aug 11 2015 12:21
function spinalCase(str) {
  // "It's such a fine line between stupid, and clever."
  // --David St. Hubbins
  return str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
  }
and now i need for white space and underscore :D
i mean it could be done using double str.replace but I am wondering if I can do it in single regular expression
Pascal
@pfilippi24
Aug 11 2015 12:29
@zcrnivec I solved this with a single regex, but I used String.match(regex) with a join() after that
Nepherius
@Nepherius
Aug 11 2015 12:31
function spinalCase(str) {
  // "It's such a fine line between stupid, and clever."
  // --David St. Hubbins
  return str.replace(/\s|_|([a-z](?=[A-Z]))/gm, '$1-').toLowerCase();
}

spinalCase('This Is Spinal Tap');
some crazy regex
zcrnivec
@zcrnivec
Aug 11 2015 12:32
indeed crazy regex
Pascal
@pfilippi24
Aug 11 2015 12:32
@Nepherius nice one
@Nepherius what does the 'm' after the 'g' mean at the end of the regex?
zcrnivec
@zcrnivec
Aug 11 2015 12:34
and ?=
Nepherius
@Nepherius
Aug 11 2015 12:36
multiline .. but not really needed
positive lookahead and capture
https://regex101.com/ best site ever, just input the regex in there
Pascal
@pfilippi24
Aug 11 2015 12:42
Thanks @Nepherius
Lookahead/-behinds were new for me. Looks very useful
CamperBot
@camperbot
Aug 11 2015 12:42
pfilippi24 sends brownie points to @nepherius :sparkles: :thumbsup: :sparkles:
hey @pfilippi24 if you found this info helpful :point_right: consider adding a wiki article!
Nepherius
@Nepherius
Aug 11 2015 12:44
heh it took me like 30 mins to write that 1 line :))
Pascal
@pfilippi24
Aug 11 2015 12:50
looks like that, great job :)
the best I came up with is:
function spinalCase(str) {
  return str.match(/([A-Z]?[a-z]+)/g).join("-").toLowerCase();
}
Harvey
@harvey56
Aug 11 2015 13:01
The IDE warned me : "don't make functions within a loop". why ?
Nepherius
@Nepherius
Aug 11 2015 13:02
maybe because you are redefining the function every time
Harvey
@harvey56
Aug 11 2015 13:08
@Nepherius my index is not inside the function. i do something like : arr1.filter()
arr[i].filter()
Pascal
@pfilippi24
Aug 11 2015 13:10
@harvey56 do you do something like arr[i].filter(function(e{...});?
@harvey56 if so, you most likely define a function inside a loop (if i is a loop variable)
Harvey
@harvey56
Aug 11 2015 13:47
@pfilippi24 oops, yes you're right that is what i am doing
Matthew Barber
@Honno
Aug 11 2015 14:07
@ozydesign did you know subArray.forEach() is not a function?
cries
"eh it basically works show answers and move on!"
"hahaha noooope!"
Ozy Design & Software
@OzySky
Aug 11 2015 14:07
lol
@Honno
Matthew Barber
@Honno
Aug 11 2015 14:08
@ozydesign fuck this lol, it's so mind bending to learn, and then it's like a thousand codecademies in how buggy it is
Henry Erickson
@henryed86
Aug 11 2015 14:17
Hello
Im stuck at the beta Zipline on the personal Portfolio Webpage, It looks too small on mobile http://codepen.io/henryed86/full/MwxPJW/
its fine on here but too small on mobile
Ozy Design & Software
@OzySky
Aug 11 2015 14:25
@henryed86 you didn't really set to be responsive, only to scale down to screen size...
Matthew Barber
@Honno
Aug 11 2015 14:30
What is an 'event' in js exactly?
Javier
@jalonso087
Aug 11 2015 14:32
bonfire mutations
CamperBot
@camperbot
Aug 11 2015 14:32

:fire:Bonfire: Mutations :link:

function mutation(arr) {
  return arr;
}

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

Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.

more info:  bf details | bf links | hint

Ozy Design & Software
@OzySky
Aug 11 2015 14:38
@Honno maybe a click....
Matthew Barber
@Honno
Aug 11 2015 14:39
@ozydesign yeah facepalming now
Ozy Design & Software
@OzySky
Aug 11 2015 14:40
@Honno btw check out http://pythontutor.com/ which can run JS as well, then it actually visualizes how the script runs. total awesomeness :smile:
Henry Erickson
@henryed86
Aug 11 2015 14:40
@ozydesign are you referring to this <meta name="viewport" content="width=device-width, initial-scale=1"> ?
Matthew Barber
@Honno
Aug 11 2015 14:41
@ozydesign thats sweet
Ozy Design & Software
@OzySky
Aug 11 2015 14:43
@henryed86 more like
@media (max-width: 320px) {
.element {
      width: 90%;   
     }
}
Harvey
@harvey56
Aug 11 2015 14:45
@Honno you may want to start with a nerd test to check how nerdy you are. Passing the FCC tests requires a certain level of nerdiness :)
http://www.nerdtests.com/ft_nq.php
Matthew Barber
@Honno
Aug 11 2015 14:46
uh ok
Roy
@CruelCoin
Aug 11 2015 14:48
thanks @ozydesign
CamperBot
@camperbot
Aug 11 2015 14:48
cruelcoin sends brownie points to @ozydesign :sparkles: :thumbsup: :sparkles:
hey @cruelcoin if you found this info helpful :point_right: consider adding a wiki article!
:star: 5 | @ozydesign | http://www.freecodecamp.com/ozydesign
Roy
@CruelCoin
Aug 11 2015 14:48
@ozydesign Thats possibly the coolest site i have seen in years. This will stop me having to use console test statements to test!
Ozy Design & Software
@OzySky
Aug 11 2015 14:49
@CruelCoin no problems mate!
Henry Erickson
@henryed86
Aug 11 2015 14:49
@ozydesign :S I'm having the same problem
Ozy Design & Software
@OzySky
Aug 11 2015 14:51
@harvey56 the test's a bit old. " How much RAM do you have? 3Gb?! wow!" I mean come on :stuck_out_tongue:
@henryed86 what do you mean?
Henry Erickson
@henryed86
Aug 11 2015 14:52
I've tried that
Harvey
@harvey56
Aug 11 2015 14:53
@ozydesign lol yeah i agree
Henry Erickson
@henryed86
Aug 11 2015 14:57
@ozydesign or it could be a bug
Ozy Design & Software
@OzySky
Aug 11 2015 14:57
@henryed86 could be. try on js fiddle then
@henryed86 nice design btw
Henry Erickson
@henryed86
Aug 11 2015 15:00
Thanks! @ozydesign
CamperBot
@camperbot
Aug 11 2015 15:00
henryed86 sends brownie points to @ozydesign :sparkles: :thumbsup: :sparkles:
hey @henryed86 if you found this info helpful :point_right: consider adding a wiki article!
:star: 6 | @ozydesign | http://www.freecodecamp.com/ozydesign
Nick Rameau
@R4meau
Aug 11 2015 15:10
Hmm, who created @camperbot ???
Lightwaves
@Lightwaves
Aug 11 2015 15:10
@R4meau dcsan
Nick Rameau
@R4meau
Aug 11 2015 15:11
@Lightwaves Thanks, did he make it open source?
Lightwaves
@Lightwaves
Aug 11 2015 15:12
Nick Rameau
@R4meau
Aug 11 2015 15:12
@Lightwaves Found it :)
Lightwaves
@Lightwaves
Aug 11 2015 15:12
haha beat me too it :P
Nick Rameau
@R4meau
Aug 11 2015 15:13
@Lightwaves Thanks.
Lightwaves
@Lightwaves
Aug 11 2015 15:13
Here's the associated chatroom is
https://gitter.im/dcsan/gitterbot
No problem
Nick Rameau
@R4meau
Aug 11 2015 15:14
@Lightwaves Lol, looks like he beats me to creating that bot. I was stupid thinking I was the only one who wanted to create one for this room.
Lightwaves
@Lightwaves
Aug 11 2015 15:14
haha he could sure use the help so contribute!
I missed having a bot, RIP Slackbot
Nick Rameau
@R4meau
Aug 11 2015 15:15
@Lightwaves Lol, maybe someday.
AJ Gibson
@gibsonio
Aug 11 2015 15:20

question about the push method. why is it when i have an array like arr = [10, 20, 30] and i push a number to it like:
num = 40;
var newArr = arr.push(num);

the newArr only hold the length of the array and not the new array itself?

Moisés Man
@moigithub
Aug 11 2015 15:22
@gibsonio yes, push modify the original array, and return the new array length
so after push ... arr will be [10,20,30,40]
and newArr = 4 <-- length
Sydney Ekpo
@rejreign
Aug 11 2015 15:23
Whoa!.. just finished HTML and CSS. Off to jquery.. Quickly updated my Skill set on Linkedin. It's been interesting so far. So happy. Thank you to @QuincyLarson and everyone behind http://freecodecamp.com
Moisés Man
@moigithub
Aug 11 2015 15:24
@gibsonio if u no need/or dont gonna use the array length value.. u can just arr.push(num); without storing the returning result on a variable
AJ Gibson
@gibsonio
Aug 11 2015 15:26
@moigithub i dont understand why we get the length back and not [10,20,30,40]. does it have something to do with the new variable only being able to store the 'reference' to the array?
rayner-villalba-coderoad-com
@rayner-villalba-coderoad-com
Aug 11 2015 15:26
Hello guys can anyone can help me?
Juan Martínez
@jbmartinez
Aug 11 2015 15:27
hello everyone!
I have some questions about CSS
rayner-villalba-coderoad-com
@rayner-villalba-coderoad-com
Aug 11 2015 15:27
Hello @jbmartinez
Vaghawan Ojha
@vaghawan
Aug 11 2015 15:28
return result.reduce(function(x,y)
{
return x.concat(y).filter(function(value,first,second)
{
return second.indexOf(value) === second.lastIndexOf(value);
});
});
can anyone help me with these line?
Nick Rameau
@R4meau
Aug 11 2015 15:29
@gibsonio If you are trying to copy the arr variable, you can just do
var newArr = arr.slice()
Because push doesn't copy an array to a variable.
Vaghawan Ojha
@vaghawan
Aug 11 2015 15:29
I want to understand what does it actually mean, I know the reduce and concat but I need an elaboration of the above line
Juan Martínez
@jbmartinez
Aug 11 2015 15:30
why my calculator background doesn't stretch to full height? http://s.codepen.io/jbmartinez/debug/rVPJLM?
Nick Rameau
@R4meau
Aug 11 2015 15:31
@gibsonio push adds an element to an array and logs its current length.
AJ Gibson
@gibsonio
Aug 11 2015 15:32
@R4meau ok thx
Vaghawan Ojha
@vaghawan
Aug 11 2015 15:38
though sounds vague, I really want to understand.
Nick Rameau
@R4meau
Aug 11 2015 15:39
@vaghawan Maybe if you showed the full code I could try to help.
Logan Tegman
@ltegman
Aug 11 2015 15:41
@vaghawan Reduce is an accumulator, so for every new value of y it is concatenating onto the accumulated array of x. Then after it does the concatenation it is filtering the accumulated array to make sure there are no duplicate values.
Edian Ibarrola
@edianibarrola
Aug 11 2015 15:41
Anyone on that doesnt mind helping me out a bit? Im trying to link a bootstrap.css to my index.html (on brackets program) but it doesnt seem to link. I tried the .css file in the same folder, and i tried linking to an external href
Vaghawan Ojha
@vaghawan
Aug 11 2015 15:43
@Itegman , Ok I understand a little bit.
@R4meau here's the full code, I almost couldn't been able to solve this symmetric difference so I'm trying to understand other solution
@R4meau function sym(args) {
var result = [].map.call(arguments, function(value)
{
return value.filter(function(value, first, second)
{
return first === second.lastIndexOf(value);
});
});
return result.reduce(function(x,y)
{
return x.concat(y).filter(function(value,first,second)
{
return second.indexOf(value) === second.lastIndexOf(value);
});
});
}
Logan Tegman
@ltegman
Aug 11 2015 15:44
@vaghawan Next time you paste code please format it with markdown, this guide will show you how: https://gist.github.com/ArielLeslie/e2cdb70956fe399deccf
Nick Rameau
@R4meau
Aug 11 2015 15:44
@vaghawan And the filter callback arguments are not value,first,second, they are value, index, array just so this doesn't confuse you. See the doc there
Vaghawan Ojha
@vaghawan
Aug 11 2015 15:46
@ok
@ I'm new here although completed all the others algo problems beside advance. I don't know but I'm feeling hard
devwillpatterson
@devwillpatterson
Aug 11 2015 15:55
is there anyone here who i can private message to ask a quick question?
Shaklin
@ShaklinSyed
Aug 11 2015 15:59
@devwillpatterson yes
Edian Ibarrola
@edianibarrola
Aug 11 2015 16:08
Does anyone here work with the program Brackets? I am having trouble getting bootstrap to work with it. tried a couple of tutorials but doesnt seem to link.
Imanuel Gittens
@imanuelgittens
Aug 11 2015 16:30
Hi guys i'm trying to do the make a Person challenge however i'm getting trouble with the 'setters'. Can anyone point me in the right direction? Thank you
var Person = function(firstAndLast) {

    var first = firstAndLast.split(' ')[0];

    this.getFullName = function(){
        return firstAndLast;
    };

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

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

    this.setFirstName = function(first){

    };

    this.setLastName = function(last){

    };

    this.setFullName = function(firstAndLast){

    };

};

var bob = new Person('Bob Ross');
bob.getFullName();
Nepherius
@Nepherius
Aug 11 2015 16:36
@zcrnivec | means or so /a|b/ would match a OR b
Logan Tegman
@ltegman
Aug 11 2015 16:42
@imanuelgittens Well, you'll want to add a variable to store the last name just like you did with the first name, your get functions will need to access those and not the variable being passed into your constructor, and you'll need to modify those variables in your set functions.
Imanuel Gittens
@imanuelgittens
Aug 11 2015 16:53
@ltegman thanks man! you're awesome!
var Person = function(firstAndLast) {

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

    this.getFullName = function(){     
        return fullName;
    };

    this.getFirstName = function(){

      return firstName;
    };

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

    this.setFirstName = function(first){
         firstName = first;
    };

    this.setLastName = function(last){
         lastName = last;
    };

    this.setFullName = function(firstAndLast){
         fullName = firstAndLast;
    };

};

var bob = new Person('Bob Ross');
bob.getFullName();
Logan Tegman
@ltegman
Aug 11 2015 17:07
@imanuelgittens Glad to help. Only further advice I'd give is that you never want to hold duplicate copies of the same data in different variables. So I'd pick either a fullname variable or separate first and last and do functions on them to get or set whichever you aren't directly holding in a variable.
AJ Gibson
@gibsonio
Aug 11 2015 17:09
for the 'Sum All Numbers In A Range' Bonfire, is there a shorter, more precise way than this:
function sumAll(arr) {

var max = Math.max.apply(null, arr);

var min = Math.min.apply(null, arr);  

var myArray = [];


    while(min < max) {

        myArray.push(min);        
        min += 1;
    }

    myArray.push(max);

    var result = myArray.reduce(function(a, b) {
        return a + b;
    });

    return result;
}


sumAll([1, 4]);
Luis Felipe López G.
@luishendrix92
Aug 11 2015 17:12
@gibsonio Mine is but sometimes I see it after a while and I don't remember what I did haha, I have to read step by step to re-understand:
function sumAll(arr) {
  var sum = 0;
  for (var i = Math.min.apply(null, arr); i <= Math.max.apply(null, arr); i++)
    sum += i;
  return sum;
}

sumAll([1, 4]);
According to myself, it starts looping from the minimum number in the array (1) up to the maximum number (4)
So it sums 1 to 0 = 1, then 2 to 1 = 3, then 3 to 3 = 6, then 4 to 6 = 10 and it stops, returns 10
Mahtab
@RoadToCode822
Aug 11 2015 17:16
Can someone explain the return statement
function toTitleCase(str)
{
    return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
}
what does the regex stand for? Any alphanumeric and white spaces? g means repeat preceeding expression?
Luis Felipe López G.
@luishendrix92
Aug 11 2015 17:18
@RoadToCode822 It will return the original string but after the words (including their following whitespaces) were capitalized by uppercasing the first character and adding the rest of it as lowercase.
it really wasn't necessary to include the whitespaces in the regex
Mahtab
@RoadToCode822
Aug 11 2015 17:18
So it doesn’t "Return the provided string with the first letter of each word capitalized.”?
Luis Felipe López G.
@luishendrix92
Aug 11 2015 17:19
@RoadToCode822 It is exactly what it does.
Using a function in the replace() method allows to do some work with each of the matches that the regexp returned.
@RoadToCode822 My solution was very similar, except I lowercased everything at the beginning:
function titleCase(str) {
  return str.toLowerCase().replace(/\w+'?[\w-]*/g, function(word){return word.replace(word[0], word[0].toUpperCase());});
}

titleCase("I'm a little tea pot");
AJ Gibson
@gibsonio
Aug 11 2015 17:20
@luishendrix92 wow that is impressive. you didn't even have to use .reduce() lol
Mahtab
@RoadToCode822
Aug 11 2015 17:21
i’m really struggling with regexp. The regex provided as a parameter, what is it’s function?
Luis Felipe López G.
@luishendrix92
Aug 11 2015 17:21
@gibsonio That's because it wasn't necessary, in other bonfires it is tho.
Mahtab
@RoadToCode822
Aug 11 2015 17:21
as in, what is it supposed to do
to the string
Luis Felipe López G.
@luishendrix92
Aug 11 2015 17:21
@RoadToCode822 Match and/or validate (using test) a pattern
Off I go, school!
Mahtab
@RoadToCode822
Aug 11 2015 17:22
thanks @luishendrix92 have fun
CamperBot
@camperbot
Aug 11 2015 17:22
roadtocode822 sends brownie points to @luishendrix92 :sparkles: :thumbsup: :sparkles:
hey @roadtocode822 if you found this info helpful :point_right: consider adding a wiki article!
:star: 5 | @luishendrix92 | http://www.freecodecamp.com/luishendrix92
Danny Lewis
@silverwedding
Aug 11 2015 17:31
Can anyone hel with 'Bonfire: Arguments Optional' cannot understand the question.. Thanks
Rani Jaiswal
@ranijaiswal
Aug 11 2015 17:31
Hi, I just joined this and am working on the challenges! I'm a little confused about why one of my code snippets won't work. Can someone help?
Thanks in advance!
Raul Tomescu
@RaulTsc
Aug 11 2015 17:35
Hey. Post your code between ``` and maybe someone can help :)
Rani Jaiswal
@ranijaiswal
Aug 11 2015 17:39
Thanks Raul! But wait... what do you mean between ```?
<p> click here for <a href= 'http://catphotoapp.com'> cat photos </a> </p>
oops. that didn't show up all beautifully.
<p> click here for <a href= 'http://catphotoapp.com'> cat photos </a> </p>
Mahtab
@RoadToCode822
Aug 11 2015 17:39
``` <code>
then ``` again
Rani Jaiswal
@ranijaiswal
Aug 11 2015 17:39
<p> click here for <a href= 'http://catphotoapp.com'> cat photos </a> </p>
Mahtab
@RoadToCode822
Aug 11 2015 17:39
to end code snippet
Rani Jaiswal
@ranijaiswal
Aug 11 2015 17:39
like that?
Mahtab
@RoadToCode822
Aug 11 2015 17:39
like ```
then you put your p tag
then end with ``` for multi line code
Rani Jaiswal
@ranijaiswal
Aug 11 2015 17:40
ok, it's just one line!
I'm doing what you're saying and it's showing up like this:
<p> click here for <a href= 'http://catphotoapp.com'> cat photos </a> </p>
Mahtab
@RoadToCode822
Aug 11 2015 17:40
yep thats fine
that code isnt working?
Rani Jaiswal
@ranijaiswal
Aug 11 2015 17:41
awesome, thank you!
no, it's passing everything except "Your a element should be wrapped within your new p element."
Mahtab
@RoadToCode822
Aug 11 2015 17:42
whats the name of the challenge
Rani Jaiswal
@ranijaiswal
Aug 11 2015 17:42
it's Basic HTML5 and CSS #24, about wrapping an anchor element within a paragraph.
Mahtab
@RoadToCode822
Aug 11 2015 17:43
that’s weird haha it seems like i didnt’ finish that one after the same errors
Rani Jaiswal
@ranijaiswal
Aug 11 2015 17:43
wait!
weird.
does it matter what line you put that on?
Mahtab
@RoadToCode822
Aug 11 2015 17:43
ok now i got it
Rani Jaiswal
@ranijaiswal
Aug 11 2015 17:43
because i just got it to work on an earlier line
Mahtab
@RoadToCode822
Aug 11 2015 17:43
This message was deleted
replace the <for></for> with for
Rani Jaiswal
@ranijaiswal
Aug 11 2015 17:45
okay.
hm.
Mahtab
@RoadToCode822
Aug 11 2015 17:45
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

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

  .thick-green-border {
    border-color: green;
    border-width: 10px;
    border-style: solid;
    border-radius: 50%;
  }

  .smaller-image {
    width: 100px;
  }
</style>

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

<p>Click here for <a href='http://www.catphotoapp.com'>cat photos</a></p>

<img class='smaller-image thick-green-border' src='https://bit.ly/fcc-kittens'/>

<p class='red-text'>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class='red-text'>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
Rani Jaiswal
@ranijaiswal
Aug 11 2015 17:45
why does it matter if the code is on that line or on the very bottom?
Mahtab
@RoadToCode822
Aug 11 2015 17:45
because it needs to be before the photo
In this case, FCC wants that paragraph to appear before the photo
Rani Jaiswal
@ranijaiswal
Aug 11 2015 17:46
Ohh, I see!
Okay! Thank you so much!!
Mahtab
@RoadToCode822
Aug 11 2015 17:46
no problem, good luck
Cory Johnson
@CygnusSW
Aug 11 2015 17:47
blob
blob
I could use some help with this bonfire: Seek and Destroy. I think I'm having issues with how to return the values that are contained in "args", and I've tried several ways, but never found anything that worked well :(. Any suggestions?
CamperBot
@camperbot
Aug 11 2015 17:47
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Shaklin
@ShaklinSyed
Aug 11 2015 17:49
@Cory2911 it would be readable if you could paste the code than screenshot of it
use 3` before and after the code
Cory Johnson
@CygnusSW
Aug 11 2015 17:50

3'function destroyer(arr) {
//1,2,3,1,2,3
var args = Array.prototype.slice.call(arguments, 1); //2, 3

var filtered = arr.filter(function(args){
for (i=0; i<args.length;i++){
return (typeof args === 'number');
}
});
return filtered;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);

3'
lol
is there a help guide somewhere for that?
Bill
@kirah1314
Aug 11 2015 17:50
help format
CamperBot
@camperbot
Aug 11 2015 17:50

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Cory Johnson
@CygnusSW
Aug 11 2015 17:50
thanks

'''
function destroyer(arr) {
//1,2,3,1,2,3
var args = Array.prototype.slice.call(arguments, 1); //2, 3

var filtered = arr.filter(function(args){
for (i=0; i<args.length;i++){

  return (typeof args === 'number');
}

});

return filtered;
}

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

CamperBot
@camperbot
Aug 11 2015 17:51
:bulb: to format code use backticks! ``` more info
Bill
@kirah1314
Aug 11 2015 17:51
` is left of the 1 (one) :)
Cory Johnson
@CygnusSW
Aug 11 2015 17:53
Hopefully this is it
function destroyer(arr) {
  //1,2,3,1,2,3
  var args = Array.prototype.slice.call(arguments, 1); //2, 3

  var filtered = arr.filter(function(args){
    for (i=0; i<args.length;i++){
    return (typeof args === 'number');
    }
  }); 
return filtered;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Cool! lol
gingerkitty
@gingerkitty
Aug 11 2015 17:55
greeetings code buddies, I have some design feedback I'd like to share about the beta site. How does one do that? Is their method set up for this or should I contact Quincy directly?
sadiyah
@sadiyah
Aug 11 2015 17:59
So the beta website, do you need to create a new account there? My login doesn't seem to work on it.
Shaklin
@ShaklinSyed
Aug 11 2015 18:04
@Cory2911 have you fixed it
Christine
@orangelines
Aug 11 2015 18:09
This message was deleted
Hey guys, sorry in advance, this is going to be a long message. I'm having a real hard time with for loops and arrays :worried: I need help understanding this program before I try to replicate it. If someone would rather chat privately, that would be great too! Here's the link to the lesson: https://www.codecademy.com/courses/javascript-beginner-en-XEDZA/0/1
Below is the program that codeacademy wrote.
Below that is my break down of it and questions.
/*jshint multistr:true */

text = "Blah blah blah blah blah blah Eric \
blah blah blah Eric blah blah Eric blah blah \
blah blah blah blah blah Eric";

var myName = "Eric";
var hits = [];

// Look for "E" in the text
for(var i = 0; i < text.length; i++) {
    if (text[i] === "E") {
        // If we find it, add characters up to
        // the length of my name to the array
        for(var j = i; j < (myName.length + i); j++) {
            hits.push(text[j]);
        }
    }
}

if (hits.length === 0) {
    console.log("Your name wasn't found!");
} else {
    console.log(hits);
}
//BREAKDOWN 
1. i = 0           //0 = "Eric"
2. i is less than text.length          //text.length is 13
3. run if statement: if "Eric" = "E" 
4. then, run for loop
5. j = i          //i = "Eric" //what does the j represent? 
6. j is less than myName.length + i            //does 'i' resemble a number or a word or a letter?
7. run hits.push(text[j]);           //what does this code mean? //when does this nested for loop increment again?

8. then increment i, i = 1         // i = "Blah"
9. i is less than text.length
10. run if statement: if "Blah" = "E"
11. false, than what?
Brett Guillory
@kurzninja
Aug 11 2015 18:42
Can someone look at my JS code here and tell me why my quoteArray array is empty when I try to access it in my $('getquote').click() function?
http://codepen.io/kurzninja/pen/qdLYwX?editors=001
Matthew Senko
@mpskierbg
Aug 11 2015 18:44
Can anyone tell me what output the computer is looking for in covernt HTML?
George
@sushiyea
Aug 11 2015 18:45
Can i get help with Responsive Design with Bootstrap #15
Brett Guillory
@kurzninja
Aug 11 2015 18:45
bot convert html
Brett Guillory
@kurzninja
Aug 11 2015 18:46
This message was deleted
bot waypoint responsive design
CamperBot
@camperbot
Aug 11 2015 18:46
no wiki entry for: waypoint responsive design
:pencil: click here to create one now!after creating your page type update to reload it here
Brett Guillory
@kurzninja
Aug 11 2015 18:46
This message was deleted
CamperBot
@camperbot
Aug 11 2015 18:46

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

Basic commands:

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

:speech_balloon: meet camperbot in this room!

:pencil: read more about camperbot on the FCC Wiki

Dayne Wright
@daynewright
Aug 11 2015 18:46
Ok…quick question here… Is there a reason why concatAll() and concatMap() are not native prototypes of an Array in Javascript?
Brett Guillory
@kurzninja
Aug 11 2015 18:46
This message was deleted
CamperBot
@camperbot
Aug 11 2015 18:46
Sorry, can't find a bonfire called responsive design with bootstrap. [ Check the map? ]
George
@sushiyea
Aug 11 2015 18:48
oh ok so I am confused on "Give the submit button in your form the classes "btn btn-primary" , and the "form control"
Brett Guillory
@kurzninja
Aug 11 2015 18:48
@Daynewr good question. I think it's probably because they're such specific situations that depend on having your data in particular formats
they assume you have an array of Objects that are nested
that's not really pure "Array" function
Dayne Wright
@daynewright
Aug 11 2015 18:50
@kurzninja Ok..I see. But it seems that they are specific enough that you would only use them for that purpose, although I am still new to this so I could be wrong.
just curious
Brett Guillory
@kurzninja
Aug 11 2015 18:50
no worries, that's a really tough waypoint :)
Tristanto
@rustyworks
Aug 11 2015 18:50
@kurzninja It seems your problem is: async when getting quote
Brett Guillory
@kurzninja
Aug 11 2015 18:51
@rustyworks yeah, I'm still not really sure how I should implement the callback
Tristanto
@rustyworks
Aug 11 2015 18:51
@kurzninja I already check using console log, the click event is triggered before quoteArray is running
Matthew Barber
@Honno
Aug 11 2015 18:51
function sym() {
  var differences = [];
  var checkDiff = function(item) {
      return arguments[i + 1].indexOf(item) === -1;
    };
  for(var i = 0; i < arguments.length - 1; i++) {
    differences.push(arguments[i].filter(checkDiff));
  }
  return differences;
}
Why does arguments[i + 1].indexOf is not a function come up?
Brett Guillory
@kurzninja
Aug 11 2015 18:51
how can that be? The quoteArray is declared at the very top of the page
what if I move them inside the document.ready function?
Tristanto
@rustyworks
Aug 11 2015 18:52
Hmmm... oh 2x click for running, sorry2
I only click once <- here is a bug I think
Brett Guillory
@kurzninja
Aug 11 2015 18:54
if I uncomment any of the console.log sanity tests there, the data prints to the console
so i'm definitely getting the data
William
@minimalistStig
Aug 11 2015 18:54
for the validating US telephone numbers, why is "(6505552368)" supposed to be false?
Brett Guillory
@kurzninja
Aug 11 2015 18:54
it's just not getting to the quotesArray for some reason
Nepherius
@Nepherius
Aug 11 2015 18:54
@minimalistStig bad format
Joris Labie
@labiej
Aug 11 2015 18:54
@honno you are accessing the arguments of the function checkDiff read about scope
William
@minimalistStig
Aug 11 2015 18:55
@Nepherius so is it because there is a ")" at the end?
Kelsey B
@kelseybcoding
Aug 11 2015 18:55
This message was deleted
Brett Guillory
@kurzninja
Aug 11 2015 18:55
Click on your profile picture in the top right @kelseybcoding
Nepherius
@Nepherius
Aug 11 2015 18:55
@minimalistStig yes, phone numbers are like (xxx) xxx xxxx or +x (xxx)xxx xxxx
Dayne Wright
@daynewright
Aug 11 2015 18:56
@Honno It returns that TypeError: arguments[i].filter is not a function
William
@minimalistStig
Aug 11 2015 18:56
@Nepherius Thanks!
Nepherius
@Nepherius
Aug 11 2015 18:56
and ofc no () is valid too
Matthew Barber
@Honno
Aug 11 2015 18:56
@labiej It did the same thing when in the for loop
@labiej Should be fine as it's a definition not actually ran out of scope
Joris Labie
@labiej
Aug 11 2015 18:57
arguments is not what you think it is
Tristanto
@rustyworks
Aug 11 2015 18:57
@kurzninja Ah finally
I change $('#quote').html(quote.body);
And it works :|
Brett Guillory
@kurzninja
Aug 11 2015 18:58
not innerHTML?
Tristanto
@rustyworks
Aug 11 2015 18:58
No :|
Maybe it's obsolete I don't know
Nepherius
@Nepherius
Aug 11 2015 18:58
it's not
Brett Guillory
@kurzninja
Aug 11 2015 18:58
according to the devdocs, .html() takes no arguments, it's only a getter function
oh
wait
Tristanto
@rustyworks
Aug 11 2015 18:59
Wait
Brett Guillory
@kurzninja
Aug 11 2015 18:59
crap, there is a setter function
i missed it lol
Tristanto
@rustyworks
Aug 11 2015 18:59
InnerHtml is javascript maybe :|
Not JQuery
Brett Guillory
@kurzninja
Aug 11 2015 18:59
with no arguments, .html returns the HTML contents
Tristanto
@rustyworks
Aug 11 2015 18:59
So you should change it into javascript first
Brett Guillory
@kurzninja
Aug 11 2015 18:59
but with arguments, it sets it to the argument
d'oh
Tristanto
@rustyworks
Aug 11 2015 18:59
so, you should do this $('#quote')[0].innerHTML = quote.body;
Maybe .... I don't know
I'll try first
Brett Guillory
@kurzninja
Aug 11 2015 19:00
that doesn't work
I'm still getting an undefined error in my .click() function
Tristanto
@rustyworks
Aug 11 2015 19:00
It works
Try 2x
2x click
Brett Guillory
@kurzninja
Aug 11 2015 19:01
wtf, it doesn't work for me lol
Tristanto
@rustyworks
Aug 11 2015 19:01
$('#quote')[0].innerHTML = quote.body;
How about this ?
Brett Guillory
@kurzninja
Aug 11 2015 19:01
holy crap
wtf
all of a sudden it just works
what the hell
Tristanto
@rustyworks
Aug 11 2015 19:01
:|
Brett Guillory
@kurzninja
Aug 11 2015 19:01
I didn't even change anything
Tristanto
@rustyworks
Aug 11 2015 19:01
Do you see your code changing ? I don't know because I don't fork your source :D
Brett Guillory
@kurzninja
Aug 11 2015 19:01
that's weird
Tristanto
@rustyworks
Aug 11 2015 19:02
$('#quote')[0].innerHTML = quote.body; ?
That's mine :D, If in your code has that line, that's probably mine :D
Joris Labie
@labiej
Aug 11 2015 19:03
@Honno try putting console.log(arguments.callee + " has " + arguments.length + " arguments!"); in strategic places
Matthew Barber
@Honno
Aug 11 2015 19:04
@labiej .callee?
Matthew Barber
@Honno
Aug 11 2015 19:04
thanks @labiej, I don't know shit :p
CamperBot
@camperbot
Aug 11 2015 19:04
honno sends brownie points to @labiej :sparkles: :thumbsup: :sparkles:
hey @honno if you found this info helpful :point_right: consider adding a wiki article!
Joris Labie
@labiej
Aug 11 2015 19:05
I only found out about this today myself
Matthew Barber
@Honno
Aug 11 2015 19:05
helpful for learners
Tristanto
@rustyworks
Aug 11 2015 19:06
find girlfriend
CamperBot
@camperbot
Aug 11 2015 19:06
find girlfriend
nothing found
Tristanto
@rustyworks
Aug 11 2015 19:06
Aw :(
So sad :(
Matthew Barber
@Honno
Aug 11 2015 19:06
lolwut
Brett Guillory
@kurzninja
Aug 11 2015 19:08
@rustyworks I dont' think you can alter my codepen yourself
Tristanto
@rustyworks
Aug 11 2015 19:08
@kurzninja Oh, okay :D
Brett Guillory
@kurzninja
Aug 11 2015 19:08
I have to refactor this a bit to make it work a little better
Tristanto
@rustyworks
Aug 11 2015 19:09
And, kurz, I think its better to ajax while document on load :|
So your first click will works
Matthew Senko
@mpskierbg
Aug 11 2015 19:11
hey i need help on the convert HTML bonfire anyone available?
CamperBot
@camperbot
Aug 11 2015 19:11
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Abhisek Pattnaik
@abhisekp
Aug 11 2015 19:18
help find enlightenment
CamperBot
@camperbot
Aug 11 2015 19:18
no wiki entry for: find enlightenment
:pencil: click here to create one now!after creating your page type update to reload it here
Abhisek Pattnaik
@abhisekp
Aug 11 2015 19:18
find enlightenment
CamperBot
@camperbot
Aug 11 2015 19:18
find enlightenment
nothing found
Brett Guillory
@kurzninja
Aug 11 2015 19:18
@rustyworks well everything is inside the $('document').ready() function so the first click should work just fine, right?
Tristanto
@rustyworks
Aug 11 2015 19:22
Yup
Well gtg, it's 2:22 AM here bye
Alejandro Tejada
@wannabecoding
Aug 11 2015 19:23
Anybody have a solution for the factorialize bonfire with a while loop?
Abhisek Pattnaik
@abhisekp
Aug 11 2015 19:26
@wannabecoding what's your soln?
Alejandro Tejada
@wannabecoding
Aug 11 2015 19:26
I have two so far, one with a recursive function and another with a for loop
Curious if it's possible with a while loop
Abhisek Pattnaik
@abhisekp
Aug 11 2015 19:28
@wannabecoding if it's possible with for loop, it's possible with while loop too. :P
Alejandro Tejada
@wannabecoding
Aug 11 2015 19:28
@abhisekp lol I imagined
Abhisek Pattnaik
@abhisekp
Aug 11 2015 19:35
@wannabecoding also you might wanna look into other's code to see if they might have more efficient or elegant way of writing it.
Just go to http://freecodecamp.com/username (replace username with an actual username e.g. wannabecoding)
Alejandro Tejada
@wannabecoding
Aug 11 2015 19:40
@abhisekp Thanks. I will look into that :)
RC Maples
@rcmaples
Aug 11 2015 19:48
Howdy all,
Anyone here good with Array.forEach()?
Matthew Barber
@Honno
Aug 11 2015 19:50
@rcmaples
arr.forEach(function(itemInArray) {
  doSomethingTo(itemInArray);
});
e.g.
arrNames.forEach(function(name) {
  console.log(name);
});
RC Maples
@rcmaples
Aug 11 2015 19:51
@Honno Well I've finished the missing letter bonfire, and I was looking over someone elses code that used a forEach and I didn't understand it completely. ... Code:
// Mine 2 - 21
function fearNotLetter(str) {
    var numArr =[];
    var ans = '';

    for (var i = 0; i<str.length; i++){
        numArr.push(str.charCodeAt(i));
    }

   var j = numArr[0];

   for (var i = 0; i<numArr.length; i++){
       console.log("i = " + i)
       if (j === numArr[i]){
           j++;
       } else {
           return ans = String.fromCharCode(j);
       }
   }

}

// The other (25-46)

function fearNotLetter( str ) {
  var result = '';
  var charCodes = [];

  str.split( '' ).forEach( function( letter ) {
      charCodes.push( letter.charCodeAt() );
    });

  charCodes.forEach( function( code, index, array ) {
      var helper = array[ index - 1 ] || array[ 0 ];

      if ( code - helper > 1 ) {
        result += String.fromCharCode( helper + 1 );
      }
    });

  if ( result === '' ) {
    return undefined;
  }

  return result;
}
I understand the forEach on the string, but the one on the charCodes array is confusing.
Matthew Barber
@Honno
Aug 11 2015 19:52
oooh
@rcmaples He turns the string into an array of characters, then converts it to the char code, then pushes that to a new array
wait
you know that xD
ahhh
so
I don't know and need to go, sorry :p
RC Maples
@rcmaples
Aug 11 2015 19:54
lol no sweat. thanks @Honno
Josh Ghent
@joshghent
Aug 11 2015 20:01
Hi guys, not sure exactly what this bonfire is actually asking...
Abhisek Pattnaik
@abhisekp
Aug 11 2015 20:01
find array
CamperBot
@camperbot
Aug 11 2015 20:02
Abhisek Pattnaik
@abhisekp
Aug 11 2015 20:02
find foreach
CamperBot
@camperbot
Aug 11 2015 20:02
find foreach
nothing found
Logan Tegman
@ltegman
Aug 11 2015 20:03
@joshghent What part of it are you confused by?
Abhisek Pattnaik
@abhisekp
Aug 11 2015 20:06
@joshghent you just have to make a person. :P
A person can be called a person if they possess qualities of a human being.
Josh Ghent
@joshghent
Aug 11 2015 20:09
@abhisekp @ltegman So do you need to make seperate getFirstName, getLastName functions within the variable person?
Just the starting code confuses me. Am I supposed to be making var person into an object and define the functions in that way?
Logan Tegman
@ltegman
Aug 11 2015 20:10
@joshghent Yes. The starting codes gives you an Object Constructor (which in JS looks like a function). You put your methods in their and then every person that gets created has those methods as a property of themselves.
Josh Ghent
@joshghent
Aug 11 2015 20:14
var Person = function(firstAndLast) {
    return firstAndLast;
    function setFullName(firstAndLast){

    }
    function setFirstName(first){

    }
    function setLastName(last){

    }
};

var bob = new Person('Bob Ross');
bob.getFullName();
Like this? @ltegman
Shaklin
@ShaklinSyed
Aug 11 2015 20:15
@joshghent yes
Josh Ghent
@joshghent
Aug 11 2015 20:15
got it
Logan Tegman
@ltegman
Aug 11 2015 20:15
@joshghent Close, but you'll need your functions to be defined on this
Josh Ghent
@joshghent
Aug 11 2015 20:15
How so? @ltegman
Logan Tegman
@ltegman
Aug 11 2015 20:16
@joshghent
var Person = function(firstAndLast) {
  this.getFirstName = function() {

  };
};
Josh Ghent
@joshghent
Aug 11 2015 20:17
@ltegman Ah I see, then I just need to call bob.setFirstName(‘bob’) and then inside the set function just make the input of that equal to this.getFirstName?
Logan Tegman
@ltegman
Aug 11 2015 20:18
@joshghent If you didn't define it on this it would only be accessible from within the Person object, but not by anything trying to use the Person object, which is great for things you want to keep hidden (like variables) but not so good for your object methods.
@joshghent You'll want your set function to modify some variable of the Person that stores the name and the get function to access that variable and return it.
Josh Ghent
@joshghent
Aug 11 2015 20:20
@ltegman Huh I see, ok let me give this a go. So I am keeping my original code for the set functions? or using this.setFirstName = function(){}; etc.
Logan Tegman
@ltegman
Aug 11 2015 20:21
@joshghent You need to use this.functionName to define any functions you want to use outside of that object. So all your getters and setters will need to be defined on this.
Javier
@jalonso087
Aug 11 2015 20:32
I need some help figuring out why this isn't iterating through my second argument
function destroyer(arr, num1, num2) {
  // Remove all the values
  for (i = 0; i < arr.length; i++) {
    if (arr[i] === num1 || arr[i] === num2){
      arr.splice(i,1);
    }
  }   return arr;

}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
It doesn't seem to be taking num2 into account and I can't figure out why
That declaration returns [1,3,1,3] but it's supposed to return [1,1]
Logan Tegman
@ltegman
Aug 11 2015 20:36
@jalonso087 The problem is that when you remove the 2's you shift the elements of the array. So when you remove the first 2 the index is at 1 and then you move the 3 into the 1 index spot by splicing and then you increment the index to 2, so you skip over the 3 that you had moved into the 1 index.
Javier
@jalonso087
Aug 11 2015 20:36
Oh wow, alright
thanks @ltegman
CamperBot
@camperbot
Aug 11 2015 20:36
jalonso087 sends brownie points to @ltegman :sparkles: :thumbsup: :sparkles:
hey @jalonso087 if you found this info helpful :point_right: consider adding a wiki article!
:star: 161 | @ltegman | http://www.freecodecamp.com/ltegman
Logan Tegman
@ltegman
Aug 11 2015 20:36
@jalonso087 Glad to help :smile:
Ramses
@ram535
Aug 11 2015 20:37
no more Screen Hero ???
what do you use to pair programming???
Josh Ghent
@joshghent
Aug 11 2015 20:37
@ltegman So I have this so far...
var Person = function(firstAndLast) {
    this.getFirstName = function(){
      return this.firstName;
    };
    this.getLastName = function(){
      return this.lastName;
    };
    this.getFullName = function(){
      return this.fullName;
    };
    this.setFirstName = function(first){
      this.firstName = first;
    };
    this.setLastName = function(last){
      this.lastName = last;
    };
    this.setFullName = function(firstAndLast){
      this.fullName = firstAndLast;
    };
};

var bob = new Person('Bob Ross');
bob.getFullName();
I guess I need to take firstAndLast and then split it to get ‘first’ and ‘last’ right?
Logan Tegman
@ltegman
Aug 11 2015 20:39
@joshghent Yup. The other issue though is that to complete the challenge you can't be storing your name variables on this. Those you want to keep hidden by declaring them in a var in the Person function.
Josh Ghent
@joshghent
Aug 11 2015 20:42
How do you mean declare them in var in the person function?
Logan Tegman
@ltegman
Aug 11 2015 20:43
@joshghent Something like
var Person = function(firstAndLast) {

    var fullName = "";

    this.getFirstName = function(){
      return this.firstName;
    };
    this.getLastName = function(){
      return this.lastName;
    };
    this.getFullName = function(){
      return this.fullName;
    };
    this.setFirstName = function(first){
      this.firstName = first;
    };
    this.setLastName = function(last){
      this.lastName = last;
    };
    this.setFullName = function(firstAndLast){
      this.fullName = firstAndLast;
    };
};
@joshghent Then access that variable with your getters and setters.
Daniel Nora
@DanielNora
Aug 11 2015 20:44
In this example, this.fullName refers to that variable?
Logan Tegman
@ltegman
Aug 11 2015 20:46
@danielnora No, this.fullName is refers to a completely different variable that is a property of the Person object instance. That is the incorrect way to store variable on an object (if you want to keep them private, which this challenge asks for).
Daniel Nora
@DanielNora
Aug 11 2015 20:46
Hmm, okay. Thanks.
Logan Tegman
@ltegman
Aug 11 2015 20:47
@joshghent I would highly recommend you read the articles linked on that bonfire about Closures and Details of the Object Model. It goes over these concepts, which are super important to javascript, especially later when you start getting into frameworks like Angular and React that require very specific scopes to make certain functionality work.
Arya
@beingmojo
Aug 11 2015 20:51
Hi all
Josh Ghent
@joshghent
Aug 11 2015 20:51
@ltegman Ill give them another read. Had a read but didn’t quite understand how to implement them here practically. Thank you. Ill work on this later :)
Logan Tegman
@ltegman
Aug 11 2015 20:52
@joshghent Good luck! The scoping and object stuff takes a while to wrap your head around (atleast it did for me)
Arya
@beingmojo
Aug 11 2015 20:54

I created this program:

function reverseString(str){
    var arr=[];
    for(var i=0; i<str.length; i++) {
        arr[i] = str[i];
        console.log(arr[i]);
    }

    for(var j=arr.length-1; j>=0; j--){
        str[j]=arr[j];
        console.log(str[j]);
    }
    return str;
}              
console.log(reverseString('hello'));

This program is supposed to reverse a string, it works on my browser however doesn't work on Bonfire, can someone help, Thanks

Logan Tegman
@ltegman
Aug 11 2015 20:59
@aryasingh78666 You're logging the string as you reverse it, but you're not assigning it anywhere. Strings are immutable, so you can't assign to an index of the string, you have to create an entirely new string and assign it to that variable.
@aryasingh78666 I would look into the helper methods String.Split, Array.Reverse, and Array.Join -- they'll make your life a lot easier both on that challenge and down the line.
Arya
@beingmojo
Aug 11 2015 21:11
@ltegman thanks for help
Logan Tegman
@ltegman
Aug 11 2015 21:11
@aryasingh78666 Glad to help :smile:
Lightwaves
@Lightwaves
Aug 11 2015 21:11
@aryasingh78666
Your second for loop isn't actually two far off from a potential solution
@aryasingh78666
If you do want to continue down this path
Arya
@beingmojo
Aug 11 2015 21:11
Sure
I know I am kind of close with this approach as well, however unable to figure out whats the mistake with loop
@Lightwaves Sure, I know I am kind of close with this approach as well, however unable to figure out whats the mistake with loop
Lightwaves
@Lightwaves
Aug 11 2015 21:13
the loop itself is correct from the console.log you are are probably getting
o l l e h
get rid of the first loop and just focus on the second one.
Arya
@beingmojo
Aug 11 2015 21:14
@Lightwaves Yes it reverses the string, work well in Webstorm, it doesn't run in Bonfire
Lightwaves
@Lightwaves
Aug 11 2015 21:15
Well you have that arr array up there what you could do is push each letter into that array
then join the array
Arya
@beingmojo
Aug 11 2015 21:16
@Lightwaves Thanks for help, I'll give a try that way. :smile:
Lightwaves
@Lightwaves
Aug 11 2015 21:17
@aryasingh78666 NP tell me if you get. I also recommend learning how to do it the other way @ltegman detailed you will be using those methods a lot in other bonfires.
Chocobowings
@chocobowings
Aug 11 2015 21:28
Just finished Bonfire: Inventory Update :smile: can someone check my code to show me a more efficient way of doing it ? or if my approach is anywhere close to be production ready. Thanks :smile:
Logan Tegman
@ltegman
Aug 11 2015 21:43
@chocobowings Don't know if I can tell you if it's production ready, but I'm happy to take a look at it
Chocobowings
@chocobowings
Aug 11 2015 21:44
@ltegman Thanks :)
Andreia Melo
@andreiamlm
Aug 11 2015 21:52
Hi! Is there a section on FCC about the alumni that already got a job? Did anyone got a remote job? thanks
Cristián Berríos
@crisberrios
Aug 11 2015 21:57
There's not @andreiamlm. Some of us (who already got a job) still come back though :)
Moisés Man
@moigithub
Aug 11 2015 21:59
if u have a object1 ={id:0, aaaa:100}
and object2 = {id:0, bbbb:111}
there are any command/instruction/function/method to join em ?
so it becomes {id:0, aaaa:100, bbbb:111}
Andreia Melo
@andreiamlm
Aug 11 2015 22:01
It would be so nice to read about all your testimonies to motivate us :)
Cristián Berríos
@crisberrios
Aug 11 2015 22:03
as long as you love to code, are intelligent and most important, very constant, you will get a job before you know it. Of course there are factors that make it easier or harder, but still :)
Logan Tegman
@ltegman
Aug 11 2015 22:04
@moigithub I don't think there is any built in JS function for this. You'd have to iterate through all the properties and add them individually. If you're working on a project where to can add Lodash though the _.merge function should do what you're looking for.
Jonathan Clermont
@clermontster
Aug 11 2015 22:04
The last three tests on Make a Person Bonfire are bizarre...what do I need to test for?
Cristián Berríos
@crisberrios
Aug 11 2015 22:07
@moigithub you can't "join them" but you can set the prototype of one to be the other, it would achieve the same on this particular case.
Andreia Melo
@andreiamlm
Aug 11 2015 22:10
thanks @crisberrios :D
CamperBot
@camperbot
Aug 11 2015 22:10
andreiamlm sends brownie points to @crisberrios :sparkles: :thumbsup: :sparkles:
hey @andreiamlm if you found this info helpful :point_right: consider adding a wiki article!
:star: 111 | @crisberrios | http://www.freecodecamp.com/crisberrios
Russell Westberry
@russbus
Aug 11 2015 22:10
This Seek and Destroy bonfire is weirding me.
Logan Tegman
@ltegman
Aug 11 2015 22:11
@russbus What about it?
Russell Westberry
@russbus
Aug 11 2015 22:13
Well, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments has a big red warning stating "Important: You should not slice on arguments because it prevents optimizations in JavaScript engines (V8 for example). Instead, try constructing a new array by iterating through the arguments object."
...And then all their examples use var args = Array.prototype.slice.call(arguments);
Cristián Berríos
@crisberrios
Aug 11 2015 22:14
@russbus it's very scenario-dependant
If you are loading it, let's say when you get data from an api call
then it's ok
but if you're using it for streaming real time data
and calling the function several times each second
MatiKid
@MatiKid
Aug 11 2015 22:15
function binaryAgent(str) {

  var binArray = str.split(" ");
  var translation = "";

  for(i = 0; i < binArray.length; i++) {
    aux = String.fromCharCode(parseInt(binArray[i], 2));
    translation.concat(aux);
  }

  console.log(translation);
  return translation;
}

binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111');
Cristián Berríos
@crisberrios
Aug 11 2015 22:15
for example, when following the movement of a mouse
then it's a bad idea
MatiKid
@MatiKid
Aug 11 2015 22:16
The fist statement inside the for is returning a string
But the concat method is not add anything to the translation var
Russell Westberry
@russbus
Aug 11 2015 22:16
@crisberrios Makes sense. It just seemed REALLY WEIRD/confusing that that page would make such a big deal out of not doing it and then do it exclusively.
DTing
@dting
Aug 11 2015 22:17
@MatiKid concat doesnt mutate
MatiKid
@MatiKid
Aug 11 2015 22:19
@dting so concat is returning a new string?
here's an example of how Babel does a polyfill for this scenario
DTing
@dting
Aug 11 2015 22:20
@MatiKid ya
var a = "a";
a.concat("b");
// "ab"
a
// "a"
Cristián Berríos
@crisberrios
Aug 11 2015 22:21
@russbus also, bear in mind that nested arrays and objects still get passed as reference when slicing the arguments, so in that case it's best to used an immutable data structure or do a deep cloning (which is slow by definition)
MatiKid
@MatiKid
Aug 11 2015 22:22
@dting ohh got it
DTing
@dting
Aug 11 2015 22:27
@MatiKid consider using translation += aux; over concat
Russell Westberry
@russbus
Aug 11 2015 22:27
@crisberrios Yeah, that link you sent me was very similar to my solution - declaring the array in the for loop.
Liz Rezes
@queenlizo
Aug 11 2015 22:27
This message was deleted
Hi! Can anyone tell me why this isn't working?
function convert(str) {
  // &colon;&rpar;
  var regex = str.indexOf(/[&<>"']/) ;

  switch (str) {
    case "&": 
        str.replace("&", "&amp");
        return  str;
       // break;
    case "<": 
        str.replace("<", "&lt");
        return  str;
       // break;
    case ">": 
        str.replace(">", "&gt");
        return  str;
        //break;
    case '"': 
        str.replace('"', "&quot");
        return  str;
       // break;
    case "''": 
        return str.replace("'", "&apos");
       // break;

    default:
        return  str
    }
}

convert('Dolce & Gabbana');
DTing
@dting
Aug 11 2015 22:28
@queenlizo you cant use regex in an indexOf
Liz Rezes
@queenlizo
Aug 11 2015 22:29
Ooh. lol- i knew that. ;)
Qstreet
@Qstreet
Aug 11 2015 22:41
bonfire sorted union
CamperBot
@camperbot
Aug 11 2015 22:41

:fire:Bonfire: Sorted Union :link:

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

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

Write a function that takes two or more arrays and returns a new array of unique values in the order of the original provided arrays.

more info:  bf details | bf links | hint

Moisés Man
@moigithub
Aug 11 2015 22:41
@queenlizo also missing semicolon on ur html entities &amp;
Liz Rezes
@queenlizo
Aug 11 2015 22:42
@moigithub Ah. I see. Thanks!
MatiKid
@MatiKid
Aug 11 2015 22:46
bonfire arguments optional
CamperBot
@camperbot
Aug 11 2015 22:46

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

more info:  bf details | bf links | hint

MatiKid
@MatiKid
Aug 11 2015 22:47
Should add arguments to add() ??
Moisés Man
@moigithub
Aug 11 2015 22:55
This message was deleted
bf details
CamperBot
@camperbot
Aug 11 2015 22:55

: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:
Moisés Man
@moigithub
Aug 11 2015 22:55
check those links
and no.. u no need to add arguments to the function
SV19
@SV19
Aug 11 2015 22:59
Hi guys, new recruit here, be gentle :)
SojournerOctocat
@SojournerOctocat
Aug 11 2015 22:59
@SV19, Welcome to FCC!
SV19
@SV19
Aug 11 2015 23:00
@SojournerOctocat Thank you! Hoping I can bug the community a bit with some simple (probably) questions. And repay the favor down the road as I get more knowledgable!
I'm having trouble early in the course, at "Waypoint: Override Styles with Important". I have been doing pretty well on the lessons up until I reached this one. I don't even know where to begin.
rbunz
@rbunz08
Aug 11 2015 23:03
I cant find someone to pair on a bonfire and my code is giving me an empty array..anyone have time to just check my code to see where I am going wrong??
@SV19 I was just in your position and felt the same way...maybe its my turn to repay the favor a little!! Im still a beginner myself but I can try!!
SojournerOctocat
@SojournerOctocat
Aug 11 2015 23:06
@SV19 What's the URL/link?
Melissa Eaton
@meaton3
Aug 11 2015 23:06
Can anyone possibly explain to me what Cloud 9 is vs. Heroku vs. Github? I'm having a hard time understanding what they all do.
SojournerOctocat
@SojournerOctocat
Aug 11 2015 23:07
@SV19 What code do you have so far?
@rbunz08 I might be able to help. Paste your code.
help format
CamperBot
@camperbot
Aug 11 2015 23:08

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Jacques de Reynal
@jdr972
Aug 11 2015 23:10
Could anyone help me with this code i can't figure out why it doesn't pass the challenge
var i;
var endArray = [];

function compare(x, y) {
    return y - x;
}

var largestOfFour = function(arr){
 //Sorting 
  for(i = 0; i < 4; i++){
     arr[i].sort(compare);
     endArray.push(arr[i][0]);
  }
   return endArray;
};

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 2, 37, 39], [1000, 1001, 857, 1]]);
alt Here are the messages
Ozy Design & Software
@OzySky
Aug 11 2015 23:17
@jdr972 each time the function runs it adds to the global variable "endArray" so each run adds another 4 numbers
you need to set the empty array inside the largestOfFour function
Jacques de Reynal
@jdr972
Aug 11 2015 23:18
@ozydesign Thank you very much
I had it like that because for some reason it wouldn't work on codepen without it being outside the function
rbunz
@rbunz08
Aug 11 2015 23:25
`
function destroyer(arr) {
  // create empty array
  var array = [];

  // Check all values in the second arguments   
  for (i = 1; i < arguments.length; i++){
     var unwantedValues = arguments[i];
     console.log("unwantedvalues are " + unwantedValues);

     // check all the values in the first argument
    for (j = 0; j <arr.length; j++){
      var values = arr[j];
      console.log("values are " + values);

      //check to see if the values is not the same as the unwanted
      if (unwantedValues != values) {

         // push the unmatched into the new array
         array.push(values);
    } 
    }
   } 
  return array;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
"You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments."
Its only checking each of the first array values against one of the arguments.. instead of against them both. So it is printing the first array twice including 3 the first time and 2 the second time
Keenan Diaz
@GhostBoy138
Aug 11 2015 23:31
I'm totally stumped on this waypoint, can someone give me a hand?
rbunz
@rbunz08
Aug 11 2015 23:34
which one?? @GhostBoy138
Moisés Man
@moigithub
Aug 11 2015 23:36
@rbunz08 for that exercise i did this...
pick 2 and 3 values destroyer([1, 2, 3, 1, 2, 3], 2, 3); put in an array so u have [2,3]
then check if each and every values of [1, 2, 3, 1, 2, 3] was on [2,3]
using indexOf function
Keenan Diaz
@GhostBoy138
Aug 11 2015 23:39
@rbunz08 Waypoint: Use a CSS Class to Style an Element
Moisés Man
@moigithub
Aug 11 2015 23:40
<element class="class1 class2 classN"> ....... </element >
and u should have defined ur class previously on <style> section (on top)
<style>
.classN {
    // attributes
}
<style>
Tom Pyszczuk
@Ne0nite
Aug 11 2015 23:44
Hey gang I need help :/ .. Trying to do the capitalize each word in sentence bonefire and its beating me every round :/ ... any tips would be welcome :)
function titleCase(str) {
    var array = str.split(/\s/g);
    for (var i=0; i < array.length; i++) { 
       var stringUpper =  array[i].charAt(0).toUpperCase();
       array[i].replace(array[i].charAt(0),stringUpper);
       console.log(array);
 //      console.log(stringUpper);
     }
//    var stringUpper = array.join(" ");
//    console.log(stringUpper);

}

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

//var capitalized = capitalizeMe.charAt(0).toUpperCase() + capitalizeMe.substring(1);
//str.replace(regexp|substr, newSubStr|function[, flags])  <--- best idea for now is to use replace. Replace every first letter in word with either var stringupper or just use RegEx to replace first letter with a capital (if possible with RegEx)
don't mind the commented out code below, its just some of my notes :)
The above code is my latest attempt, unsuccessful as always :/
Rafael Neubauer
@Scyles
Aug 11 2015 23:49
@rbunz08 You are cycling through your first array for every destroyer number, the problem is whatever values you didn't add the first time around (when unwanted = 2, you are adding 1,3,1,3 - note not adding 2's) gets added the second time around (when unwanted = 3, you are going through the array again this time adding 1,2,1,2 - not not adding 3's)
Tom Pyszczuk
@Ne0nite
Aug 11 2015 23:49
The code properly splits string into array and it even lets me capitalize the letters. But thats it, I dont know how to add the capital letters to the array elements later on . For some reason I am braindead about this :/
Keenan Diaz
@GhostBoy138
Aug 11 2015 23:49
I just do not get it at all
Rafael Neubauer
@Scyles
Aug 11 2015 23:51
@rbunz08 You should look into the Array.Filter() and Array.indexOf() functions
Rafael Neubauer
@Scyles
Aug 11 2015 23:57
@Ne0nite String.replace() doesn't alter the actual string it returns a new string, so you will need to add the changed string into a new array via Array.push() then return that array
Moisés Man
@moigithub
Aug 11 2015 23:58
@Ne0nite problem is strings on Javascript are immutable, means u cant change a single character like that... u need to REBUILT a new string