These are chat archives for FreeCodeCamp/Help

21st
Aug 2015
Aliza
@alizagoldberg
Aug 21 2015 00:10
Thanks @dting and @kmiasko !
CamperBot
@camperbot
Aug 21 2015 00:10
alizagoldberg sends brownie points to @dting and @kmiasko :sparkles: :thumbsup: :sparkles:
:star: 198 | @kmiasko | http://www.freecodecamp.com/kmiasko
:star: 454 | @dting | http://www.freecodecamp.com/dting
Don C
@mysticsage
Aug 21 2015 00:14
This message was deleted
CamperBot
@camperbot
Aug 21 2015 00:14
Sorry, can't find a bonfire called reverse a string wiki. [ Check the map? ]
DTing
@dting
Aug 21 2015 00:20
bf reverse
CamperBot
@camperbot
Aug 21 2015 00:20

:fire:Bonfire: Reverse a String :link:

function reverseString(str) {
  return str;
}

reverseString('hello');

Reverse the provided string.

more info:  bf details | bf links | hint

Don C
@mysticsage
Aug 21 2015 00:23
bf links
Don C
@mysticsage
Aug 21 2015 00:23
This message was deleted
CamperBot
@camperbot
Aug 21 2015 00:23
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
viznev
@viznev
Aug 21 2015 00:23
@mysticsage do you need help?
Dan Stockham
@DanStockham
Aug 21 2015 00:56
bf arguments optional
CamperBot
@camperbot
Aug 21 2015 00:56

: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

Dan Stockham
@DanStockham
Aug 21 2015 00:57
hint
CamperBot
@camperbot
Aug 21 2015 00:57
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Todd Johnson
@TJohnson93
Aug 21 2015 00:58
@DanStockham Look into parameters or arguments
Dan Stockham
@DanStockham
Aug 21 2015 00:59
@TJohnson93 I already checked and I'm still pretty lost but I think I know what I did wrong.
function add(arg1, arg2) {
    if(typeof arg1 ==='number' && typeof arg2 === 'number') {
        return arg1 + arg2;

    } else if(typeof arg1 === 'number') {

         return function(val) {
            return val + arg1;
        };

    }         


}

add(2)(3);
There should be a separate function within a variable to test if the arguments are numbers.
Todd Johnson
@TJohnson93
Aug 21 2015 01:00
add(2)(3); This doesn’t look right?
Dan Stockham
@DanStockham
Aug 21 2015 01:01
Actually that is one of the test that runs.
DTing
@dting
Aug 21 2015 01:01
@DanStockham you need to return a function if yo dont have a second argument
@DanStockham oh you are lemme take another look
@DanStockham you need to check that val in the function you returned is also a number else return undefined
         return function(val) { // check this val is a number
            return val + arg1;
        };
Dan Stockham
@DanStockham
Aug 21 2015 01:05
@dting Right, and when you put conditional statements within it, it breaks the function. But I figured out that I should be creating another function that checks to see if the arguments are really numbers
var checkNum = function(val1, val2) {
    if(typeof val1 !== 'number' && typeof val2 !== 'number') {

      return undefined;
    }


  };
scratch that
DTing
@dting
Aug 21 2015 01:06
@DanStockham nah. you are close
function add(arg1, arg2) {
    if(typeof arg1 ==='number' && typeof arg2 === 'number') {
        return arg1 + arg2;

    } else if(typeof arg1 === 'number') {

         return function(val) {
            if (typeof val !== 'number') return undefined;
            return val + arg1;
        };

    }         
}
Dan Stockham
@DanStockham
Aug 21 2015 01:07
You can't have return statements can you?
DTing
@dting
Aug 21 2015 01:08
i just inlined the if-statement thats the same as:
function add(arg1, arg2) {
    if(typeof arg1 ==='number' && typeof arg2 === 'number') {
        return arg1 + arg2;

    } else if(typeof arg1 === 'number') {

         return function(val) {
            if (typeof val !== 'number') {
                 return undefined;
            }
            return val + arg1;
        };

    }         
}
Dan Stockham
@DanStockham
Aug 21 2015 01:10
Still getting just the raw function back when arg2 is a string.
Reese
@justoutherecoding
Aug 21 2015 01:12
Waypoint: Set The ID of an Element. Give your form element the id cat-photo-form. Can anyone tell me what's wrong with this: <form id="cat-photo-form">
DTing
@dting
Aug 21 2015 01:13
@DanStockham else if(typeof arg1 === 'number' && !arg2) {
@justoutherecoding did you remove the other part? i think it should look like <form id="cat-photo-form" action="/submit-cat-photo">
Dan Stockham
@DanStockham
Aug 21 2015 01:16
@dting It worked but I don't understand why we need to say that arg2 is false for it not to return the raw function
Reese
@justoutherecoding
Aug 21 2015 01:16
Thanks @dting I see where I went wrong. I didn't put the id and action in the same string. I had two separate lines of code.
CamperBot
@camperbot
Aug 21 2015 01:16
justoutherecoding sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 501 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Aug 21 2015 01:16
@DanStockham so you only want the if else statement to happen if you have both arg1 and arg2. when arg2 is a string the first statement isnt true. in your version the second is.
arg1 is still a number arg2 is a string. so the first if statement says... nope... checks the second one and see it only needs arg1 to be a number to return that function. sees that is true... so it returns the function. what you wanted is for it to skip past that one too and return undefined
Dan Stockham
@DanStockham
Aug 21 2015 01:18
Ohhhhhhhhhhhhhhhhhh
So just because arg2 was false, the conditional still checks arg1 as being true and runs the function passing arg2 in.
turning a blind eye to arg2 who is faking it.
I see what you did there arg2 >.>
sneaky b**...
ctcrnitv
@ctcrnitv
Aug 21 2015 01:25
issues w/ this drop-down, any tips?
DTing
@dting
Aug 21 2015 01:36
@skr5e you need to add the boostrap js to your page
ctcrnitv
@ctcrnitv
Aug 21 2015 01:37
Is the page not using bootstrap already?
I’ve used a lot of bootstrap classes and they work, doesn’t that mean it’s added properly?
Reggie
@Reggie01
Aug 21 2015 01:38

@skr5e add this to your external javascript setting in codepen @dting is right

//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js

Read this link http://getbootstrap.com/components/#navbar which leads to another link, which leads to another link. So TL;DR you were missing a dependency for navbar-collapse.

ctcrnitv
@ctcrnitv
Aug 21 2015 01:38
cool, thanks!
CamperBot
@camperbot
Aug 21 2015 01:38
if you want to thank someone, put an @ before their name!
DTing
@dting
Aug 21 2015 01:38
@skr5e you can click the sprocket and go to quick add and select boostrap
ctcrnitv
@ctcrnitv
Aug 21 2015 01:39
wait. are you sure I didn’t do that, can you verify that on my codepen dting?
DTing
@dting
Aug 21 2015 01:39
ya
ctcrnitv
@ctcrnitv
Aug 21 2015 01:39
to me it shows up on the list
Reggie
@Reggie01
Aug 21 2015 01:39
yeah i verifed when i followed your link
DTing
@dting
Aug 21 2015 01:39
it's not there
GFrozoni
@GFrozoni
Aug 21 2015 01:39
Hello guys, I am having trouble with the Bonfire: Factorialize a Number. Could someone try and help me find the expected answer? I actually found a code which works, but the system wont accept it.... If need be, I can post my work here.
DTing
@dting
Aug 21 2015 01:39
Screen Shot 2015-08-20 at 6.37.13 PM.png
Screen Shot 2015-08-20 at 6.37.27 PM.png
Reggie
@Reggie01
Aug 21 2015 01:40
@skr5e under the javascript tab
DTing
@dting
Aug 21 2015 01:40
@GFrozoni
function factorialize(num) {
  return num < 3 ? num : num * factorialize(num-1);
}
factorialize(5);
GFrozoni
@GFrozoni
Aug 21 2015 01:40
why wont this work?
Screen Shot 2015-08-20 at 10.35.30 PM.png
Greg Smith
@PortableStick
Aug 21 2015 01:40
anybody able to give a tip on the final learnyounode exercise?
ctcrnitv
@ctcrnitv
Aug 21 2015 01:41
you guys are totally right, I was looking at the CSS portion
thanks again
CamperBot
@camperbot
Aug 21 2015 01:41
if you want to thank someone, put an @ before their name!
GFrozoni
@GFrozoni
Aug 21 2015 01:42
@dting , do you have any ideia why it wont work?
DTing
@dting
Aug 21 2015 01:45
@GFrozoni move your var x = 2; inside the function
@GFrozoni
function factorialize(num) {
  var x = 2;
  var y = num;
  while (x < y) {
    num = num * x;
    x = x + 1;
  }
  return num;
}
x is undefined when you call your function and it just returns num. the while loop never runs
Andrés Cifuentes
@dinga99
Aug 21 2015 01:52
@PortableStick where part?
Greg Smith
@PortableStick
Aug 21 2015 01:53
@dinga99 I'm having a brain-fart trying to output my JSON on exercise 13
const http = require("http"),
        url = require("url");

function doubleZeros(i){
    if(i < 10){
        return "0" + i.toString();
    } else{
        return i;
    }
}

function createJServer(port){
    http.createServer(function(request, response){
        response.writeHead(200, {"Content Type":"application/json"});
        if(request.method === "GET"){

            var queryStr = url.parse(request.url, true).query
            if(url.parse(request.url).pathname === '/api/parsetime'){

                var date = new Date(queryStr.iso),
                    output = {
                        'hour'   : doubleZeros(date.getHours()),
                        'minutes': doubleZeros(date.getMinutes()),
                        'seconds': doubleZeros(date.getSeconds())
                        };

            } else if(url.parse(request.url).pathname === '/api/unixtime'){
                    output = {"date" : Date.now()};
            }

            //need to console.log(output) when request is done

        }
    }).listen(port);
}

createJServer(process.argv[2]);
Andrés Cifuentes
@dinga99
Aug 21 2015 01:55
@PortableStick when you try to verify, the output its blank?
well... the comparsion with the solution
Greg Smith
@PortableStick
Aug 21 2015 01:56
if I do console.log( ), I get the output i want, but it doesn't terminate
if I try something like request.on('end', function(){...}), it gives me an error
Andrés Cifuentes
@dinga99
Aug 21 2015 01:57
try with response.end(JSON.stringify(output));
Greg Smith
@PortableStick
Aug 21 2015 01:58
fantastic, thanks @dinga99
CamperBot
@camperbot
Aug 21 2015 01:58
portablestick sends brownie points to @dinga99 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for dinga99
Greg Smith
@PortableStick
Aug 21 2015 01:58
it didn't pass, but at least I'm getting the data out
Andrés Cifuentes
@dinga99
Aug 21 2015 01:58
cool!!
IllusionElements
@IllusionElements
Aug 21 2015 01:59
in js how do you get the content in between html tags?
for instance
<h1> This is Cool</h1>
some JS code, return "This is Cool"
Andrés Cifuentes
@dinga99
Aug 21 2015 01:59
that a great step forward haha
Greg Smith
@PortableStick
Aug 21 2015 01:59
oh, and I just need to fix some typos, so YAY I'M DONE WITH THIS NODE STUFF
Donavin Northrup
@dnorthrupva
Aug 21 2015 02:02
Can anyone tell me why scrollspy isn't working http://codepen.io/dnorthrupva/pen/gpNoOJ
AKA Why the tab's aren't being marked 'active' as I scroll?
Juan Martínez
@jbmartinez
Aug 21 2015 02:10
hey everyone!
@dnorthrupva I can't see any code for that
Marie Pelletier
@Marie000
Aug 21 2015 02:15
HI! I am working on the first zipline (build portfolio page) and I am having a hard time with bootstrap and general layout. It looks fine in full screen, but as soon as you make it narrower, the heading ("marie's portfolio") starts sticking out of its box. Also, the social media links all get on top of one another as soon as you narrow just a little.
(still trying to figure out how to share a codepen project here)
Bill
@kirah1314
Aug 21 2015 02:21
@Marie000 click Editor on the right side and you'll see a "Get URL"
viznev
@viznev
Aug 21 2015 02:26
This message was deleted
SojournerOctocat
@SojournerOctocat
Aug 21 2015 02:29
@viznev Sure.
viznev
@viznev
Aug 21 2015 02:31
oops, sorry haha, just posted it in the main chat, but here. it works, but I'm wondering if there's perhaps a better way or more recommended way
function mutation(arr) {
  for (var i = 0; i < arr[1].length; i++) {
    if (arr[0].toLowerCase().indexOf(arr[1][i].toLowerCase()) === -1) {
      return false;
    }
  }
  return true;
}

mutation(['hello', 'hey']);
Donavin Northrup
@dnorthrupva
Aug 21 2015 02:33
I'ma punch CodePen in the face if when I get home and try this in TextMate my code works.
RIGHT in the face.
@jbmartinez Yea, sorry. My jQ wasn't in that CodePen I posted for some reason. I fixed it, haha.
Chris
@Bloodmail
Aug 21 2015 02:39
Any help ? :D It sounds logical to me
blob
viznev
@viznev
Aug 21 2015 02:41
@Bloodmail you can post the code directly in chat, makes it easier to see :)
help formatting
CamperBot
@camperbot
Aug 21 2015 02:41

: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

Donavin Northrup
@dnorthrupva
Aug 21 2015 02:45
One more time for good measure http://codepen.io/dnorthrupva/pen/gpNoOJ can anyone tell why my scrollspy isn't working? Last time I'll ask then I'll just bug test it in TextMate once I get home.
Chris
@Bloodmail
Aug 21 2015 02:45

function repeat(str, num) {

var repeatString = str.repeat(num);
var negativeNum = str.replace(str, "");
// repeat after me
if (num > 0){
return repeatString;
}
else
{return negativeNum;
}
}

repeat('abc', 3);

Haha it doesnt seem pretty
Donavin Northrup
@dnorthrupva
Aug 21 2015 02:46
Place the code within three backtick (key to the left of 1). CamperBot said so.
Chris
@Bloodmail
Aug 21 2015 02:47

```function repeat(str, num) {

var repeatString = str.repeat(num);
var negativeNum = str.replace(str, "");
// repeat after me
if (num > 0){
return repeatString;
}
else
{return negativeNum;
}
}

repeat('abc', 3);

Donavin Northrup
@dnorthrupva
Aug 21 2015 02:47
Above and below.
SojournerOctocat
@SojournerOctocat
Aug 21 2015 02:47
help format
CamperBot
@camperbot
Aug 21 2015 02:47

: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

Jesse
@jctm30
Aug 21 2015 02:51

hello all! I have a question:

str = str.replace(/\s/g, '')

does this basically mean replace all whitespace(spaces, tabs) with nothing( which is '')?

viznev
@viznev
Aug 21 2015 02:51
@jctm30 yep!
Jesse
@jctm30
Aug 21 2015 02:52
@viznev thanks!!
CamperBot
@camperbot
Aug 21 2015 02:52
jctm30 sends brownie points to @viznev :sparkles: :thumbsup: :sparkles:
:star: 213 | @viznev | http://www.freecodecamp.com/viznev
viznev
@viznev
Aug 21 2015 02:52
@jctm30 np!
Chris
@Bloodmail
Aug 21 2015 02:54
function repeat(str, num) {

  var repeatString = str.repeat(num);
  var negativeNum = str.replace(str, "");
  // repeat after me
  if (num > 0){
  return repeatString;
  }
  else 
      {return negativeNum;
       }
  }


repeat('abc', 3);
Reggie
@Reggie01
Aug 21 2015 02:59
@dnorthrupva If you click on the tabs in your codepen they do scroll. What behavior are you expecting?
Jesse
@jctm30
Aug 21 2015 03:03

Hello!

str.replace(regexp|substr, newSubStr|function[, flags])

what is the " | " symbol mean in this formula?

SojournerOctocat
@SojournerOctocat
Aug 21 2015 03:03
@jctm30 newSubString or function
| = or
Jesse
@jctm30
Aug 21 2015 03:04
oh i see
is it because

regexp|substr

can either be for example, /the+/gi or "example string"

SojournerOctocat
@SojournerOctocat
Aug 21 2015 03:04
@jctm30 Yes.
IllusionElements
@IllusionElements
Aug 21 2015 03:04
$('#temp').click(function() {
        if (n===celsius + "&#8451") {
          $('#temp').html(farenheit + "&#8457");
        } else  {
          $('#temp').html(celsius + "&#8451");
        }
how do I make it so that you can toggle between these values on click? it seems that right now it's just running it all on the first click, but I want the code to run per click
Jesse
@jctm30
Aug 21 2015 03:05
@SojournerOctocat thanks makes sense!!!
CamperBot
@camperbot
Aug 21 2015 03:05
jctm30 sends brownie points to @sojourneroctocat :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for sojourneroctocat
Jesse
@jctm30
Aug 21 2015 03:07

str.replace(regexp|substr, newSubStr|function[, flags])

can someone help me understand what "function[, flags]" means here?

IllusionElements
@IllusionElements
Aug 21 2015 03:08
@jctm30 3function (replacement)
A function to be invoked to create the new substring (to put in place of the substring received from parameter #1). The arguments supplied to this function are described in the "Specifying a function as a parameter" section below.
flags
Note: The flags argument does not work in v8 Core (Chrome and Node.js). A string specifying a combination of regular expression flags. The use of the flags parameter in the String.prototype.replace() method is non-standard and deprecated. Instead of using this parameter, use a RegExp object with the corresponding flags. The value of this parameter if it is used should be a string consisting of one or more of the following characters to affect the operation as described:
Jesse
@jctm30
Aug 21 2015 03:10
@IllusionElements thank you... i was reading it but honestly was hard to comprehend.. the diction is still very unfamiliar
CamperBot
@camperbot
Aug 21 2015 03:10
jctm30 sends brownie points to @illusionelements :sparkles: :thumbsup: :sparkles:
:star: 229 | @illusionelements | http://www.freecodecamp.com/illusionelements
IllusionElements
@IllusionElements
Aug 21 2015 03:12
@jctm30 basically its saying that the function value there is what you're replacing the string with
viznev
@viznev
Aug 21 2015 03:12
@Bloodmail are you still needing help with the repeat?
SojournerOctocat
@SojournerOctocat
Aug 21 2015 03:14
@jctm30 It is hard to decipher. Sometimes it feels like those explanations aren't written in English.
IllusionElements
@IllusionElements
Aug 21 2015 03:15
can anyone help me figure out why my switch/case doesn't seem to want to run here : http://codepen.io/illusionelements/pen/aOrqEv ?
Chris
@Bloodmail
Aug 21 2015 03:19
@viznev yes:C
Aaron Judell
@aaronjudell
Aug 21 2015 03:23
Hey guys. So I'm a little stuck on the Bonfire Seek and Destroy. I thought I had a function that would work, but it doesn't seem to be completing two of the tasks required.

Basically here's my current code. function destroyer(arr) {

for(var i = 1; i < arguments.length; i++) {
for(var j = 0; j < arr.length; j++) {
if(arr[j] === arguments[i]) {
arr.splice(j, 1);
}
}
}

return arr;
}

i realize that i could try to do it using filter() instead. is that what i'm going to have to do?
JessicaEx
@JessicaEx
Aug 21 2015 03:32
@aaronjudell try using http://pythontutor.com/visualize.html#mode=edit to see what your code is actually doing
select javascript at the top if it isn't already selected
Do you see the problem?
Aaron Judell
@aaronjudell
Aug 21 2015 03:34
@JessicaEx Thanks. Although unfortunately that website doesn't seem to be doing anything when I enter my code and click "visualize execution"
CamperBot
@camperbot
Aug 21 2015 03:34
aaronjudell sends brownie points to @jessicaex :sparkles: :thumbsup: :sparkles:
:star: 215 | @jessicaex | http://www.freecodecamp.com/jessicaex
JessicaEx
@JessicaEx
Aug 21 2015 03:36
Did you include this bit: destroyer([3, 5, 1, 2, 2], 2, 3, 5);? I think this call to destroyer has some problems
Aaron Judell
@aaronjudell
Aug 21 2015 03:37
@JessicaEx yep i added it in. but it still just freezes. is a window supposed to pop up?
JessicaEx
@JessicaEx
Aug 21 2015 03:37
If you can't see it, the problem starts when you try to remove, splice, or add anything to an array while you are looping through it. You change the length and the index
Try adding the numbers that match the arguments to a new array or cloning the array and removing the numbers from that array while looping over the original array
Aaron Judell
@aaronjudell
Aug 21 2015 03:40
@JessicaEx Ohh of course. I see. Thanks a lot.
CamperBot
@camperbot
Aug 21 2015 03:40
aaronjudell sends brownie points to @jessicaex :sparkles: :thumbsup: :sparkles:
:warning: aaronjudell already gave jessicaex points
JessicaEx
@JessicaEx
Aug 21 2015 03:40
*I'm sorry that didn't make much sense. Let me restate that first bit. You can try creating a new array, and then add the numbers that match the arguments to that array. Remove those numbers from the array before you return a value.
Aaron Judell
@aaronjudell
Aug 21 2015 03:43
i just added a "j--;" and the whole thing works lol
because i made up for the splicing
@JessicaEx so thanks a lot. that was exactly what i needed to know
CamperBot
@camperbot
Aug 21 2015 03:44
aaronjudell sends brownie points to @jessicaex :sparkles: :thumbsup: :sparkles:
:warning: aaronjudell already gave jessicaex points
JessicaEx
@JessicaEx
Aug 21 2015 03:45
Nice solution!
Patrick McWilliams
@patrickmac110
Aug 21 2015 03:46
I'm having a slight issue under waypoints: javascript objects
*manipulate javascript objects
I have this in the code as shown by example:
// Let's add the property bark to myDog
myDog.bark("ruff");
I'm getting this error though:
// Let's add the property bark to myDog
myDog.bark("ruff");
sorry, I mean:
myDog.bark is not a function
Patrick McWilliams
@patrickmac110
Aug 21 2015 03:52
any thoughts??
JessicaEx
@JessicaEx
Aug 21 2015 03:54
myDog.bark = "ruff";
@patrickmac110
Patrick McWilliams
@patrickmac110
Aug 21 2015 03:55
@JessicaEx Thank you!!
CamperBot
@camperbot
Aug 21 2015 03:55
patrickmac110 sends brownie points to @jessicaex :sparkles: :thumbsup: :sparkles:
:star: 216 | @jessicaex | http://www.freecodecamp.com/jessicaex
Max Althoff
@tifantaworld
Aug 21 2015 04:08
The REPL is incurably bugged out for me in Basic Javascript Waypoint 39. I think it's stuck in an infinite loop and won't stop executing. The page freezes and I can't even reset the code.
JessicaEx
@JessicaEx
Aug 21 2015 04:13
Is it the code or the webpage?
Max Althoff
@tifantaworld
Aug 21 2015 04:15
I think it's the code. I was in the middle of typing a line, and suddenly it just decided that it wanted to loop forever and ever. I'm guessing the REPL didn't like what it was trying to incrementally execute.
I've reloaded the page several times, and the page is just frozen. Can't interact with anything on it and it's just endlessly loading.
IllusionElements
@IllusionElements
Aug 21 2015 04:17
how do you set an if statement between two times?
Patrick McWilliams
@patrickmac110
Aug 21 2015 04:19
@tifantaworld have you tried hard resetting the website? ctrl+shift+r I believe
viznev
@viznev
Aug 21 2015 04:20
@tifantaworld if you're in chrome you can clear the local storage for the page that has the bad code
otherwise you can just clear the cache in general
Justin Ceballos
@reliable-justin
Aug 21 2015 04:20

Hey everyone, I’m having a bit of trouble with the "Use Conditional Logic with IfElse Statements” challenge

`
function myFunction(){
var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;
}

// Create an if-else statement here to return "heads" if flip is 0. Otherwise return "tails".

// Only change code below this line.

if (flip === 0) {
  return(heads);
}

else {
  return(tails);
}

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return(myFunction());})();
`

Could someone help please?

Patrick McWilliams
@patrickmac110
Aug 21 2015 04:20
@IllusionElements please elaborate. I'm not understannding your query
@reliable-justin put the "heads" and "tails in quotation marks
Max Althoff
@tifantaworld
Aug 21 2015 04:21
@patrickmac110 @viznev The code is saved in the waypoint editor, I don't think clearing local storage or the cache is going to work. The instant it runs that saved code, the page freezes. I don't even have time to click the reset button to set the code back to the default.
Billy Goodson
@B-Goodson
Aug 21 2015 04:22
What's the easiest way to merge two arrays into one?
Justin Ceballos
@reliable-justin
Aug 21 2015 04:22
@patrickmac110 I tried that and it didn’t work
viznev
@viznev
Aug 21 2015 04:23
@tifantaworld it might not hurt to try clearing that particular key/storage if you've haven't already
Max Althoff
@tifantaworld
Aug 21 2015 04:23
@reliable-justin heads and tails shouldn't be in parentheses. Just type return "heads" and return "tails"
@viznev how do I clear the local storage for a particular page?
Justin Ceballos
@reliable-justin
Aug 21 2015 04:25

@tifantaworld

`function myFunction(){
var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;
}

// Create an if-else statement here to return "heads" if flip is 0. Otherwise return "tails".

// Only change code below this line.

if (flip === 0) {
  return "heads";
}

else {
  return "tails";
}

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return(myFunction());})();`

That doesn’t seem to be working either :(

Billy Goodson
@B-Goodson
Aug 21 2015 04:25
awesome, thanks @Reggie01
CamperBot
@camperbot
Aug 21 2015 04:25
b-goodson sends brownie points to @reggie01 :sparkles: :thumbsup: :sparkles:
:star: 147 | @reggie01 | http://www.freecodecamp.com/reggie01
Max Althoff
@tifantaworld
Aug 21 2015 04:25
@reliable-justin What exactly is not working about it? Which test is failing?
viznev
@viznev
Aug 21 2015 04:26
@tifantaworld are you using chrome?
Max Althoff
@tifantaworld
Aug 21 2015 04:26
@viznev yes
Justin Ceballos
@reliable-justin
Aug 21 2015 04:26
@tifantaworld It returns “Illegal return statement”
Max Althoff
@tifantaworld
Aug 21 2015 04:27
@reliable-justin paste in the exact code using three backticks so we can see the proper formatting
Justin Ceballos
@reliable-justin
Aug 21 2015 04:28
@tifantaworld
function myFunction(){
  var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;
}

// Create an if-else statement here to return "heads" if flip is 0. Otherwise return "tails".

// Only change code below this line.

if (flip === 0) {
  return "heads";
}

else {
  return "tails";
}

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return(myFunction());})();
viznev
@viznev
Aug 21 2015 04:28
@tifantaworld make sure you're on a tab with freecodecamp.com up, hit f12 (dev console)->Resources->Local Storage, you should see all the keys there by waypoint name
@tifantaworld just delete the key for the offending waypoint
Patrick McWilliams
@patrickmac110
Aug 21 2015 04:30
@reliable-justin delete the closing curly bracket after "var flip" line
Max Althoff
@tifantaworld
Aug 21 2015 04:31
@reliable-justin The problem is that curly bracket on line 3. Not sure how that got there, but your if statement should be inside it
Patrick McWilliams
@patrickmac110
Aug 21 2015 04:31
and add it after your else statement
what @tifantaworld said haha
Natch Khongpasuk
@knatch
Aug 21 2015 04:32
yo
viznev
@viznev
Aug 21 2015 04:32
@knatch howdy!
Max Althoff
@tifantaworld
Aug 21 2015 04:32
@viznev Thanks for the help, deleting the local storage worked
CamperBot
@camperbot
Aug 21 2015 04:32
tifantaworld sends brownie points to @viznev :sparkles: :thumbsup: :sparkles:
:star: 215 | @viznev | http://www.freecodecamp.com/viznev
viznev
@viznev
Aug 21 2015 04:32
@tifantaworld no problem, glad it worked!
Justin Ceballos
@reliable-justin
Aug 21 2015 04:33
@patrickmac110 @tifantaworld Oh…. Thank you so much! I feel kinda dumb :shipit:
CamperBot
@camperbot
Aug 21 2015 04:33
:star: 243 | @tifantaworld | http://www.freecodecamp.com/tifantaworld
:star: 181 | @patrickmac110 | http://www.freecodecamp.com/patrickmac110
reliable-justin sends brownie points to @patrickmac110 and @tifantaworld :sparkles: :thumbsup: :sparkles:
Patrick McWilliams
@patrickmac110
Aug 21 2015 04:34
@reliable-justin glad we could help!
goodnight all!
Natch Khongpasuk
@knatch
Aug 21 2015 04:34
i'm struggling with the Bonfire: Return Largest Numbers in Arrays. The result returns just like the tasks but it is not deeply equal.. or something I don't know.
Max Althoff
@tifantaworld
Aug 21 2015 04:34
@patrickmac110 night
viznev
@viznev
Aug 21 2015 04:35
@knatch can you post your code?
Natch Khongpasuk
@knatch
Aug 21 2015 04:37
@viznev how do we post our code here?
viznev
@viznev
Aug 21 2015 04:37
help formatting
CamperBot
@camperbot
Aug 21 2015 04:37

: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

viznev
@viznev
Aug 21 2015 04:37
@knatch ^ there you go :)
Max Althoff
@tifantaworld
Aug 21 2015 04:37
@camperbot FTW
Natch Khongpasuk
@knatch
Aug 21 2015 04:38
function largestOfFour(arr) {
  // You can do this!
  for (var i = 0; i < 4 ; i++){
    for (var j = 0; j< 4 ;j++){
      if(largest < arr[i][j]){
        largest = arr[i][j];
      }
    }
    result.push(largest);

    largest = 0;
  }
  return result
}

var largest = 0;
var result = [];
Ahh there you go
chantilly lovelace
@chantillylace
Aug 21 2015 04:39
When it comes to Bonfire challenges, do I ask for help here or go to bonfire-arguments-optional?
CamperBot
@camperbot
Aug 21 2015 04:39
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Natch Khongpasuk
@knatch
Aug 21 2015 04:40
Oh really I didn't know that there's bonfire-arguments-optional
Apology
Matt Everson
@matteverson
Aug 21 2015 04:40
@knatch This is a fine place to ask for help @chantillylace
Max Althoff
@tifantaworld
Aug 21 2015 04:42
@knatch what error are you getting? what do the tests say?
Natch Khongpasuk
@knatch
Aug 21 2015 04:43
'expected [ 27, 5, 39, 1001, 27, 5, 39, 1001 ] to deeply equal [ 27, 5, 39, 1001 ]'
Apparently, I don't know why it's not deeply equal.
Matt Everson
@matteverson
Aug 21 2015 04:43
@knatch In this case it means they just aren't equal. The numbers are there twice in your output.
Max Althoff
@tifantaworld
Aug 21 2015 04:43
@knatch I think you're adding things to the array twice
chantilly lovelace
@chantillylace
Aug 21 2015 04:44
I'm confused as to how to write out the code for bonfire 2, reverse a string---I know what to do and in what order, I'm stymied by how to write it out.
Evan Aubry
@evanAubry
Aug 21 2015 04:46
@chantillylace you want the function to return the given string reversed
Natch Khongpasuk
@knatch
Aug 21 2015 04:47
Yeah but it returns exactly the 'correct' output in the left black pane
by correct I mean it looks the same
viznev
@viznev
Aug 21 2015 04:48
@knatch I believe the reason is because you set the result var in a global scope, so each time the test is run, the old values are still in the result array
Natch Khongpasuk
@knatch
Aug 21 2015 04:49
ahh I got it!
I couldn't understand the first time you guys said i am adding thing twice
That's something
viznev
@viznev
Aug 21 2015 04:50
the only reason we knew that was because the test results said that haha, that was kinda the clue :)
Natch Khongpasuk
@knatch
Aug 21 2015 04:51
Yeah, thanks @viznev , @matteverson and @tifantaworld
CamperBot
@camperbot
Aug 21 2015 04:51
knatch sends brownie points to @viznev and @matteverson and @tifantaworld :sparkles: :thumbsup: :sparkles:
:star: 247 | @tifantaworld | http://www.freecodecamp.com/tifantaworld
:star: 257 | @matteverson | http://www.freecodecamp.com/matteverson
:star: 216 | @viznev | http://www.freecodecamp.com/viznev
Max Althoff
@tifantaworld
Aug 21 2015 04:51
@knatch I couldn't figure it out at first, but I just got it. It has nothing to do with your program's logic. You're polluting the global object by putting result outside the function. result is hanging around and you're adding to it again...
@knatch put result (and probably, for the sake of consistency, largest) inside the function
viznev
@viznev
Aug 21 2015 04:52
@knatch no problem!
JessicaEx
@JessicaEx
Aug 21 2015 04:53
Has anyone done the MongoDB exercises?
chantilly lovelace
@chantillylace
Aug 21 2015 04:53

Here's my code for bonfire 2. where have I gone wrong? function reverseString(str) {
return string; String.split('');Array.reverse('');Array.join('');
}

reverseString('hello');

JessicaEx
@JessicaEx
Aug 21 2015 04:53
I'm one the third one, and I have no idea what I am doing
Natch Khongpasuk
@knatch
Aug 21 2015 04:54
@tifantaworld yeah I moved those 2 in and it worked! Cheers
JessicaEx
@JessicaEx
Aug 21 2015 04:54
@chantillylace anything after the return line will not be executed
Max Althoff
@tifantaworld
Aug 21 2015 04:54
@knatch No problem ... I was definitely stumped, because your logic looked (and was) correct.
JessicaEx
@JessicaEx
Aug 21 2015 04:55
@chantillylace I'm pretty sure you only need to reverse the string. The split() and join() aren't necessary
Max Althoff
@tifantaworld
Aug 21 2015 04:57
Later everyone!
Natch Khongpasuk
@knatch
Aug 21 2015 04:57
See you!
viznev
@viznev
Aug 21 2015 04:57
@tifantaworld take care!
@JessicaEx I don't think the string object has a reverse method, thus the reason for converting to an array and reversing and then rejoining to a string
@chantillylace can you post your code again using the correct formatting?
help formatting
CamperBot
@camperbot
Aug 21 2015 05:00

: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

viznev
@viznev
Aug 21 2015 05:00
@chantillylace ^that should help :)
chantilly lovelace
@chantillylace
Aug 21 2015 05:02

function reverseString(str) {
String.split(''); Array.reverse('');Array.join('');
return str;
}

reverseString('hello');
This is what I have so far and I get the error message: String.split is not a f unction.

JessicaEx
@JessicaEx
Aug 21 2015 05:03
@viznev Yeah, I forgot about that.
thanks
CamperBot
@camperbot
Aug 21 2015 05:03
if you want to thank someone, put an @ before their name!
Chad Kreutzer
@ChadKreutzer
Aug 21 2015 05:04
@chantillylace for one thing, .reverse() does not take any arguments. and also, you join them with a "." not a semicolon.
viznev
@viznev
Aug 21 2015 05:05
@JessicaEx no problem by any means haha, I forget stuff too :)
Chad Kreutzer
@ChadKreutzer
Aug 21 2015 05:06
oh yeah, and you want it to read:
```
str.split('').reverse().join('');
the "Array" that is being referred to in the MDN is your str
Donavin Northrup
@dnorthrupva
Aug 21 2015 05:15
http://codepen.io/dnorthrupva/pen/gpNoOJ Anyone able to notice why my scrollspy won’t work? (IE once you scroll past an anchor, the nav should become “active”.
chantilly lovelace
@chantillylace
Aug 21 2015 05:23

function reverseString(str) {
str.split('').reverse().join('');
return str;
}

reverseString('hello');

It's not reversing "hello". I'm feeling really stupid not getting this :(
viznev
@viznev
Aug 21 2015 05:24
@chantillylace don't worry, we all have our ups and downs! I still make mistakes with the simplest of things haha
Donavin Northrup
@dnorthrupva
Aug 21 2015 05:25
@chantillylace So you’re actually VERY close.
However, you’re telling to manipulate string, THEN you’re telling it to return the str. But it’s going to return the ORIGINAL str.
So try putting those modifications ONTO the ‘return str'
And see what happens.
viznev
@viznev
Aug 21 2015 05:25
@chantillylace remember, calling those functions on str actually returns a new string, they don't modify the original
Donavin Northrup
@dnorthrupva
Aug 21 2015 05:26
So
return str.split(‘’).reverse().join(‘’);
viznev
@viznev
Aug 21 2015 05:27
or as a slight alternative
str = str.split('').reverse().join('');
return str;
just to make the point clear about manipulating vs returning a new string :)
Donavin Northrup
@dnorthrupva
Aug 21 2015 05:28
Hey @viznev if you’re in a helpful mood.
You should figure out why the EFF my scrollyspy doesn’t work!
I’m 99% sure it’s Codepen, though.
viznev
@viznev
Aug 21 2015 05:28
haha, okay, okay, I know you've been trying to find an answer for that, so I'll take a look, just a sec :)
Donavin Northrup
@dnorthrupva
Aug 21 2015 05:29
I keep saying “I’ll back burner it” but everytime I see it not working I get distracted.
Reggie
@Reggie01
Aug 21 2015 05:31
@dnorthrupva I think you are missing some code. You don't have a scroll event in your code. Your events are based off clicks.
Woolwit
@Woolwit
Aug 21 2015 05:31
Anyone here familiar with sumFibs? The expected answers to the tests seem strange to me. I think I'm missing something basic in the wording of the problem. For example, if you're summing all the odd fibs from 1-1000 wouldn't you expect it to be more than... expect(sumFibs(1000)).to.equal(1785);
Logan Tegman
@ltegman
Aug 21 2015 05:31
@dnorthrupva I know this isn’t super helpful as far as solving your problem, but just so you know a good way to check if a problem is codepen’s fault is to change it to debug view (you can do this by changing the pen part of the url to debug. That view has no iFrame, so if you still have the problem it is no fault of codepen
Donavin Northrup
@dnorthrupva
Aug 21 2015 05:32
@Reggie01 So it’s a bit confusing because the “scrollspy” is built into the navbar of bootstrap, and the <body> which you can find under “HTML Settings”. However, I don’t think CodePen is even reading my custom <body> tag - Appending it via JS doesn’t help either.
chantilly lovelace
@chantillylace
Aug 21 2015 05:35
Thank you @dnorthrupva, @ChadKreutzer, and @viznev. I knew what I wanted, and sorta the format from the .pop, .push waypoints., but just couldn't figure out where the string went. I got it to work. I can go to bed now.
CamperBot
@camperbot
Aug 21 2015 05:35
chantillylace sends brownie points to @dnorthrupva and @chadkreutzer and @viznev :sparkles: :thumbsup: :sparkles:
:star: 291 | @chadkreutzer | http://www.freecodecamp.com/chadkreutzer
:star: 239 | @dnorthrupva | http://www.freecodecamp.com/dnorthrupva
:star: 218 | @viznev | http://www.freecodecamp.com/viznev
Logan Tegman
@ltegman
Aug 21 2015 05:35
@dnorthrupva You need to add the bootstrap js to your codepen
Donavin Northrup
@dnorthrupva
Aug 21 2015 05:36
@ltegman Think that might be it? I’ll try. I just checked page source, and yea <body tag> is just <body> .
Logan Tegman
@ltegman
Aug 21 2015 05:36
I just added the bootstrap js on my end and it started working, so that should do it
Donavin Northrup
@dnorthrupva
Aug 21 2015 05:36
@ltegman omfg that was it. THAT was what I’d wasted 3 hours on.
Hahaha
Thanks @ltegman
CamperBot
@camperbot
Aug 21 2015 05:36
dnorthrupva sends brownie points to @ltegman :sparkles: :thumbsup: :sparkles:
:star: 175 | @ltegman | http://www.freecodecamp.com/ltegman
Donavin Northrup
@dnorthrupva
Aug 21 2015 05:37
Now to fix the resolution, then slap it together.
Logan Tegman
@ltegman
Aug 21 2015 05:37
haha, glad to help! happens to all of us. I spent 4 hours trying to figure out why some buttons weren’t working before realizing I had put the wrong bootstrap attribute on them and it was taking over the click event XD
viznev
@viznev
Aug 21 2015 05:38
@chantillylace that's great! have a great night! :)
Donavin Northrup
@dnorthrupva
Aug 21 2015 05:40
@ltegman I actually have no experience with Bootstrap, so I decided to re-do all the ziplines with the ‘suggested’ methods to become more well versed. I’m also trying to go ‘over the top’ but it’s pushing meh buttons.
Woolwit
@Woolwit
Aug 21 2015 05:41
@chantillylace This online IDE really helps me see what's going on. You can step through your code and see the result for each step. For example: http://pythontutor.com/visualize.html#togetherjs=swRGGOq62r
Logan Tegman
@ltegman
Aug 21 2015 05:42
@dnorthrupva I can sympathize with that. I only used bootstrap on one of my ziplines so far and I felt like it caused me far more pain and frustration than it would have to just style from scratch. Not to mention it was an overkill filesize for what I really needed from it.
Woolwit
@Woolwit
Aug 21 2015 05:45
sumFibs... anyone?
Donavin Northrup
@dnorthrupva
Aug 21 2015 05:45
I’m unsure if Bootstrap has a way to fix this, or no. So http://codepen.io/dnorthrupva/pen/gpNoOJ as you can see, my second picture is effed if I don’t have it repeat. Am I supposed to just find a specific 1900x1200+ photo, or am I missing something simple?
Rex Schrader
@SaintPeter
Aug 21 2015 05:46
@dnorthrupva Try this:
background-size: cover;
Donavin Northrup
@dnorthrupva
Aug 21 2015 05:47
@SaintPeter Oh snap, I didn’t even know about cover.
Rex Schrader
@SaintPeter
Aug 21 2015 05:47
@dnorthrupva :D
@Woolwit I can help
@Woolwit Re-Read the instructions. Look very carefully at the description of the end conditions.
bf fib
CamperBot
@camperbot
Aug 21 2015 05:48

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

function sumFibs(num) {
  return num;
}

sumFibs(4);

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

more info:  bf details | bf links | hint

Donavin Northrup
@dnorthrupva
Aug 21 2015 05:49
Thanks @SaintPeter
CamperBot
@camperbot
Aug 21 2015 05:49
dnorthrupva sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 249 | @saintpeter | http://www.freecodecamp.com/saintpeter
Woolwit
@Woolwit
Aug 21 2015 05:49
bf details
CamperBot
@camperbot
Aug 21 2015 05:49

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

function sumFibs(num) {
  return num;
}

sumFibs(4);
Return the sum of all odd Fibonacci numbers up to and including the passed number if it is a Fibonacci number.
The first few numbers of the Fibonacci sequence are 1, 1, 2, 3, 5 and 8, and each subsequent number is the sum of the previous two numbers.
As an example, passing 4 to the function should return 5 because all the odd Fibonacci numbers under 4 are 1, 1, and 3.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
Rex Schrader
@SaintPeter
Aug 21 2015 05:50
@Woolwit Read the first sentance VERY carefully.
Woolwit
@Woolwit
Aug 21 2015 05:51
... scratches head.
My code works for 4...
Rex Schrader
@SaintPeter
Aug 21 2015 05:52
@Woolwit What is the end condition? Is it the quantity of Fibonacci numbers?
Woolwit
@Woolwit
Aug 21 2015 05:52
It's the sum of all the Fibs up to the given number, isn't it?
Odd ones, that is
Rex Schrader
@SaintPeter
Aug 21 2015 05:53
What does "up to the given number" mean in this case?
Woolwit
@Woolwit
Aug 21 2015 05:53
I'm thinking of a long array of every fibonacci up to and including the given number?
Rex Schrader
@SaintPeter
Aug 21 2015 05:53
As you pointed out, is it reasonable to expect that the first 1000 numbers would give you a result in the thousands?
Woolwit
@Woolwit
Aug 21 2015 05:54
Yes my result for sumFibs(1000) is 11708364174233842
Significantly different from the expected outcome ;-)
Rex Schrader
@SaintPeter
Aug 21 2015 05:55
So there is no way that that is what is being asked for, then.
Woolwit
@Woolwit
Aug 21 2015 05:55
They don't call me Woolwit for naught
Rex Schrader
@SaintPeter
Aug 21 2015 05:56
One last try: Why did they include the provisio "including the passed number if it is a Fibonacci number"?
If it was the index of the Fibonacci number, wouldn't ALL passed numbers be Fibonacci numbers?
So what is another way we can read the end condition?
Woolwit
@Woolwit
Aug 21 2015 05:57
Yes I guess I assumed the passed numbers would fall somewhere in the Fibonacci sequence.
I'll think about that some more and try to understand how the expected results derive from the passed number.
Rex Schrader
@SaintPeter
Aug 21 2015 05:58
The key is that you end condition is relative to the Fibonacci number, not the index. You not getting the first N numbers, you're getting the numbers until the next Fibonacci number is greater than "num"
So keep generating Fib nums until you're greater than 'num'
Woolwit
@Woolwit
Aug 21 2015 05:58
Oh wow. Thanks @SaintPeter
Rex Schrader
@SaintPeter
Aug 21 2015 05:59
If it's any consolation, I did a false start on that one as well.
botstatus
CamperBot
@camperbot
Aug 21 2015 05:59
All bot systems are go!
botVersion: 0.0.11
env: prod
botname: camperbot
chicachicamji
@chicachicamji
Aug 21 2015 06:00
can anyone help me understand why this code isn't working?
function end(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  if(target.length == 1) {
    if(str.substr(str[str.length - target.length], 1) == target) {
      return true;
    } else {
      return false;
    }
  } else {
    if(str.substr(str[str.length - target.length], target.length) == target) {
    return true;
  } else {
    return false;
  }
  }
}

end('Bastian', 'n');
Woolwit
@Woolwit
Aug 21 2015 06:00
Not quite a trick question but... thanks again!
CamperBot
@camperbot
Aug 21 2015 06:00
if you want to thank someone, put an @ before their name!
Rex Schrader
@SaintPeter
Aug 21 2015 06:00
@chicachicamji Sure, let me take a look
@chicachicamji Your math is wrong on this line:
str.substr(str[str.length - target.length], 1)
@chicachicamji From the MDN Article
If indexStart is greater than indexEnd, then the effect of substring() is as if the two arguments were swapped; for example, str.substring(1, 0) == str.substring(0, 1).
@chicachicamji remember that indexes are zero based, but .length is not.
chicachicamji
@chicachicamji
Aug 21 2015 06:07
@SaintPeter yes i know, but shouldn't it work? in the case of Bastian for example, if target.length ==1, which it is, then go to the next line of code, if Bastian.substr(Bastian[7-1], 1) == target, which it is, return true, else return false, I'm not understanding what's wrong with it
DTing
@dting
Aug 21 2015 06:09
@chicachicamji you dont need a special case for target.length == 1.
Rex Schrader
@SaintPeter
Aug 21 2015 06:09

@chicachicamji Oh, it's not math, sorry, it's this:

str[str.length - target.length]

Why are you passing the CONTENTS of str into your substr function?

DTing
@dting
Aug 21 2015 06:09
@chicachicamji str[<somenumberhere>] gives you a simple character
@chicachicamji all you need to do is call str.substr with a number. that number should be the index at where to start comparing the str to the target.
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:12
Does Padding follow the clockwise reasoning, or do I have to do Padding-top: 20 padding-bottom 20? I’m 99% sure it follows clockwise but I forget.
viznev
@viznev
Aug 21 2015 06:12
@dnorthrupva yes, it does
chicachicamji
@chicachicamji
Aug 21 2015 06:12
@dting @SaintPeter thanks, that was stupid of me this worked for me:
function end(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  if(target.length == 1) {
    if(str.substr(str.length - 1, 1) == target) {
      return true;
    } else {
      return false;
    }
  } else {
    if(str.substr(str.length - target.length, target.length) == target) {
    return true;
  } else {
    return false;
  }
  }
}

end('Bastian', 'n');
CamperBot
@camperbot
Aug 21 2015 06:12
chicachicamji sends brownie points to @dting and @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 250 | @saintpeter | http://www.freecodecamp.com/saintpeter
:star: 505 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Aug 21 2015 06:13
@dnorthrupva ya clockwise starting from the top
Rex Schrader
@SaintPeter
Aug 21 2015 06:13
@chicachicamji Awesome :D
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:13
So 20% 0% 20% 0% for top/bottom 20%?
Rex Schrader
@SaintPeter
Aug 21 2015 06:13
@dting Don't you sleep? I thought you were on all day helping :D
viznev
@viznev
Aug 21 2015 06:14
@dnorthrupva yes
DTing
@dting
Aug 21 2015 06:14
haha
Rex Schrader
@SaintPeter
Aug 21 2015 06:15
Speaking of which, I think it's time for ME to get some sleep :D
viznev
@viznev
Aug 21 2015 06:15
@dnorthrupva though I believe you can also do a shorthand of padding: 20px 0px;, not sure if that's a recommended way though
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:16
Thanks @viznev @dting
CamperBot
@camperbot
Aug 21 2015 06:16
dnorthrupva sends brownie points to @viznev and @dting :sparkles: :thumbsup: :sparkles:
:star: 507 | @dting | http://www.freecodecamp.com/dting
:star: 220 | @viznev | http://www.freecodecamp.com/viznev
viznev
@viznev
Aug 21 2015 06:16
@dnorthrupva np
DTing
@dting
Aug 21 2015 06:16
@SaintPeter have a good one
Timothy Kim
@tea-kay
Aug 21 2015 06:35
hey guys anyone finish the "check for palindromes" challenge under algorithm scripting?
I'm having some trouble with the
DTing
@dting
Aug 21 2015 06:35
@gzatrader ya whats up?
Timothy Kim
@tea-kay
Aug 21 2015 06:35
.replace() function
Mounika Reddy
@mounikagv
Aug 21 2015 06:35
can anyone tell me the actual use of "lorem ipsum text" in HTML5??
DTing
@dting
Aug 21 2015 06:35
lets see what you got
Timothy Kim
@tea-kay
Aug 21 2015 06:36
@dting hey have a min to help me out?
DTing
@dting
Aug 21 2015 06:36
@mounikagv lorem ipsum is just used as place holder text to see how stuff would look
sure paste your code here
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:38
I’m trying to use '<i class="fa fa-github fa-fw"></i>’ for the first time, but the Github icon isn’t showing. Anyone know why?
DTing
@dting
Aug 21 2015 06:39
did you load font awesome on your page?
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:39
Is that not built into Bootstrap? Haha
Logan Tegman
@ltegman
Aug 21 2015 06:39
Bootstrap has its own icon codes, different from the font awesome ones.
DTing
@dting
Aug 21 2015 06:40
nah it's separate
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:40
Haha, I’m sooooo clever. Thanks, again.
CamperBot
@camperbot
Aug 21 2015 06:40
if you want to thank someone, put an @ before their name!
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:40
THANKS @camperbot You’re just gonna tell me ‘I Already thanked ‘em"
CamperBot
@camperbot
Aug 21 2015 06:40
dnorthrupva sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star: 67 | @camperbot | http://www.freecodecamp.com/camperbot
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:41
http://codepen.io/dnorthrupva/pen/gpNoOJ/ It’s coming together, guys.
It’s getting beeeaaauuutiiiiful
viznev
@viznev
Aug 21 2015 06:42
@dnorthrupva cool!
Timothy Kim
@tea-kay
Aug 21 2015 06:42

@dting cool thanks

function palindrome(str) {
var x = str.split('').toLowerCase().replace().join('');
var palin = str.split('').toLowerCase().replace().reverse().join('');
if (x === palin) {
return true;
} else {
return false;
}
}

CamperBot
@camperbot
Aug 21 2015 06:42
gzatrader sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 511 | @dting | http://www.freecodecamp.com/dting
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:43
Something is wrong with it, I’m missing the fourth page/pic entirely. Weird.
DTing
@dting
Aug 21 2015 06:43
@gzatrader replace takes two arguments. you aren't calling it with any. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
Evan Aubry
@evanAubry
Aug 21 2015 06:43
@gzatrader instead of using for else, use return x === palin;
DTing
@dting
Aug 21 2015 06:43
@gzatrader for example:
'hello'.replace(/h/, '');
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:44
Hmm, what did I break...
viznev
@viznev
Aug 21 2015 06:44
@gzatrader here's the doc for replace: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
Edit:my bad, @dting already linked it
Justin Crawford
@JCrawford1122
Aug 21 2015 06:44
Does anyone use the Microsoft Edge browswer?
browser
DTing
@dting
Aug 21 2015 06:44
that would return ello because i replaced the "h" with an empty string.
Timothy Kim
@tea-kay
Aug 21 2015 06:44
@viznev @dting @evanAubry thanks everyone let me look through it and retry it
CamperBot
@camperbot
Aug 21 2015 06:44
gzatrader sends brownie points to @viznev and @dting and @evanaubry :sparkles: :thumbsup: :sparkles:
:warning: gzatrader already gave dting points
:star: 215 | @evanaubry | http://www.freecodecamp.com/evanaubry
:star: 222 | @viznev | http://www.freecodecamp.com/viznev
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:45
@dting cries I broke it somehow!
Nnxoxo
@Nnxoxo
Aug 21 2015 06:45
@JCrawford1122 I have it on my Win 10 machine, but I don't use it...
Timothy Kim
@tea-kay
Aug 21 2015 06:45
@dting " /x/, '' " <--- would replace x with a space?
Bogdan Uifalean
@bogdanuifalean
Aug 21 2015 06:46
Hello :) Maybe somebody can help me on this, I did the weather zipline some time ago and it worked fine. I was using code based on this http://jsfiddle.net/LEBz8/1/ for the twitter button. Now when I try to use it, it sometimes creates more twitter buttons and sometimes it doesn't. Anybody have an idea why this happens?
Timothy Kim
@tea-kay
Aug 21 2015 06:46
@dt what if I want to replace spaces would it be "/ /"
Justin Crawford
@JCrawford1122
Aug 21 2015 06:46
The JavaScript waypoints don't seem to work for me with Edge is why I was asking.
DTing
@dting
Aug 21 2015 06:46
@gzatrader ya you can use regex as the first argument
Nnxoxo
@Nnxoxo
Aug 21 2015 06:47
@JCrawford1122 stay, I'll test
DTing
@dting
Aug 21 2015 06:47
@JCrawford1122 i believe quincy said that the test lib isn't compatible with edge or safari but im not sure if they fixed it
viznev
@viznev
Aug 21 2015 06:47
@gzatrader you might need to add the g modifier to replace all instances instead of the first
manasshukla
@manasshukla
Aug 21 2015 06:47
can someone help me with arguments object in java script
?
davellolz
@davellolz
Aug 21 2015 06:47
hello guys
Nnxoxo
@Nnxoxo
Aug 21 2015 06:47
@manasshukla type here waht u need
Ryan Malm
@Rybar
Aug 21 2015 06:47
post your code and be more specific with your problem @manasshukla
viznev
@viznev
Aug 21 2015 06:47
@davellolz howdy
Justin Crawford
@JCrawford1122
Aug 21 2015 06:48
@Nnutthowze @dting Thanks
CamperBot
@camperbot
Aug 21 2015 06:48
:star: 265 | @nnutthowze | http://www.freecodecamp.com/nnutthowze
:star: 512 | @dting | http://www.freecodecamp.com/dting
jcrawford1122 sends brownie points to @nnutthowze and @dting :sparkles: :thumbsup: :sparkles:
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:48
Ugh I fixed it. I commented out a section once and forgot to uncomment it.
DTing
@dting
Aug 21 2015 06:48
@dnorthrupva seems like your home button doesnt work either
@dnorthrupva that is if it is supposed to bring you to the top
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:49
@dting Yea, I accidentally commented out the ‘home’ section, so it pushed everything up.
I’m noticing frequently when I “Full View” the site, the font awesome icons aren’t showing (Website is loading before the <link> - How would I fix that? async the link?
DTing
@dting
Aug 21 2015 06:50
@manasshukla the arguments object is an array like object that contains all the arguments a function is called with
Nnxoxo
@Nnxoxo
Aug 21 2015 06:50
@JCrawford1122 I tested first waypoint in Edge and all works fine
DTing
@dting
Aug 21 2015 06:50
@manasshukla for example:
function fn() {
   console.log(arguments[0]);
   console.log(arguments[1]);
   console.log(arguments[2]);
}
fn(1, "2");
// 1
// "2"
// undefined
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:50
@dting Try now when you can - http://codepen.io/dnorthrupva/full/gpNoOJ/ Should work
davellolz
@davellolz
Aug 21 2015 06:51
hello guys I have question about " $('.target:even').addClass("animated shake") " ... Im being confused becase Im targetting even numbers but the one shaking is odd numbers.. ITs weird. Can anyone please help me?
Justin Crawford
@JCrawford1122
Aug 21 2015 06:52
@Nnutthowze Thanks for checking. Just to clarify you did one of the JavaScript waypoints?
CamperBot
@camperbot
Aug 21 2015 06:52
jcrawford1122 sends brownie points to @nnutthowze :sparkles: :thumbsup: :sparkles:
:warning: jcrawford1122 already gave nnutthowze points
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:52
So the thing to remember is arrays start at 0 @davellolz
DTing
@dting
Aug 21 2015 06:52
@davellolz the targeting is index 0 starting. even if you label them 1,2,3 they are really indexed 0,1,2
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:52
So if you’re shaking the “even” ones. (0, 2, 4, 6)
You’re shaking the 1st, 3rd, and 5th icons, aren’t you?
DTing
@dting
Aug 21 2015 06:52
@dnorthrupva working again
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:52
NICE! I will quit for the night. I’ve made good progress, I think.
davellolz
@davellolz
Aug 21 2015 06:53
Aw ok thanks @dnorthrupva @dting @dnorthrupva for answering!
CamperBot
@camperbot
Aug 21 2015 06:53
davellolz sends brownie points to @dnorthrupva and @dting and @dnorthrupva :sparkles: :thumbsup: :sparkles:
:star: 240 | @dnorthrupva | http://www.freecodecamp.com/dnorthrupva
:star: 240 | @dnorthrupva | http://www.freecodecamp.com/dnorthrupva
:star: 513 | @dting | http://www.freecodecamp.com/dting
Donavin Northrup
@dnorthrupva
Aug 21 2015 06:53
I have one more ‘fancy’ thing to put, then I’ll just slap the info on there.
Nnxoxo
@Nnxoxo
Aug 21 2015 06:53
@JCrawford1122 I'll try the JS one
chicachicamji
@chicachicamji
Aug 21 2015 06:54
hi guys, I'm stuck on the chunky monkey bonfire and was wondering if you could help me. I'm not sure how you can make a multidimensional array here's my code so far.
function chunk(arr, size) {
  // Break it up.
  var firstArray = [];
  var secondArray = [];
  for(var x = 0; x < size; x++) {
    firstArray.push(arr[x]);
  }
  return secondArray.push(firstArray);
}

chunk(['a', 'b', 'c', 'd'], 2);
davellolz
@davellolz
Aug 21 2015 06:54
its working now thank you guys!!!
CamperBot
@camperbot
Aug 21 2015 06:54
if you want to thank someone, put an @ before their name!
davellolz
@davellolz
Aug 21 2015 06:55
@camperbot sorry newbie here
will continue now...
Nnxoxo
@Nnxoxo
Aug 21 2015 06:56
@JCrawford1122 so the JS waypoints aren't working in Edge
Justin Crawford
@JCrawford1122
Aug 21 2015 06:57
@Nnutthowze Sweet. Thank you for your time!
CamperBot
@camperbot
Aug 21 2015 06:57
jcrawford1122 sends brownie points to @nnutthowze :sparkles: :thumbsup: :sparkles:
:warning: jcrawford1122 already gave nnutthowze points
ShortWaveLengthSubset
@ShortWaveLengthSubset
Aug 21 2015 06:58
Someone feel up to helping me with some stubborn CSS?
chicachicamji
@chicachicamji
Aug 21 2015 06:58
sur
e
ShortWaveLengthSubset
@ShortWaveLengthSubset
Aug 21 2015 06:58
http://i.imgur.com/QwShTUQ.png
can anyone give me an idea of why my the second line of this is not being affected by { margin : } in CSS?
<jade>
div(class="lastlist")
            nl(ng-repeat="chal in latest")        
                nm
                    a(href="/{{ chal.instance }}" target="_self") {{ chal.challenge }}
                    br
                nc
                    {{ chal.movie1 }} vs {{ chal.movie2 }}
</jade>

// using stylus as a preprocessor here, dont mind the syntax
<style>
.lastlist nc, .lastlist nm
  margin-left 60px
</style>
so the situation I'm in, it won't indent the second line
DTing
@dting
Aug 21 2015 07:00
is this on codepen
ShortWaveLengthSubset
@ShortWaveLengthSubset
Aug 21 2015 07:00
I could rip the angular out of it and put it on codepen
or at least my controller and just have it display static
CamperBot
@camperbot
Aug 21 2015 07:01
:trollface: troll problems? notify admins here
ShortWaveLengthSubset
@ShortWaveLengthSubset
Aug 21 2015 07:05
close enough?
manasshukla
@manasshukla
Aug 21 2015 07:06

'''function destroyer(arr) {
// Remove all the values

var filter_arr=arr.filter(function (value){
  for (var i=1;i<arguments.length;i++){
    if (value != arguments[i])
      return value;
  }
});

}

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

CamperBot
@camperbot
Aug 21 2015 07:06
:bulb: to format code use backticks! ``` more info
manasshukla
@manasshukla
Aug 21 2015 07:06
this is what I have coded for the seek and destroy bonfire
can some tell me why this is not working
?
DTing
@dting
Aug 21 2015 07:07
@drscogin what's the compiled html look like @drscogin haha ya that doesnt really help
@manasshukla you want to use the opposite logic
@manasshukla only return false if the value is equal.
manasshukla
@manasshukla
Aug 21 2015 07:09
the filter method is still a little ambigous
DTing
@dting
Aug 21 2015 07:09
@manasshukla then after you check all the arguments return true. right now you check the first argument if it isnt equal it returns.
you just need to return true or false from the filter callback function. if it is true the "value" will be kept. if false. it wont.
var filter_arr=arr.filter(function (value){
  for (var i=1;i<arguments.length;i++){
    if (value === arguments[i]) return false;
  }
  return true;
});
ShortWaveLengthSubset
@ShortWaveLengthSubset
Aug 21 2015 07:12
@dting yeah importing it to codepen is just a total mess
manasshukla
@manasshukla
Aug 21 2015 07:13
@dting tried the code snippet send by you. This is returning the whole array
DTing
@dting
Aug 21 2015 07:14
@manasshukla you need to alias the arguments object for the callback
@manasshukla the callback function has it's own arguments object
manasshukla
@manasshukla
Aug 21 2015 07:15
@dting that is an awesome catch
DTing
@dting
Aug 21 2015 07:17
haha hope it works.
ShortWaveLengthSubset
@ShortWaveLengthSubset
Aug 21 2015 07:21
well, i guess im just going to have to live with it being broken, putting even a portion of this app into codepen or jsfiddle is a nightmare
Timothy Kim
@tea-kay
Aug 21 2015 07:23

@dting I was trying to combine string functions with array functions in the wrong order so I ended up with:

function palindrome(str) {
var rev = str.split('').reverse().join();
var x = function() {
str.replace(/ /g,'').toLowerCase();
};

if (x(str) === x(rev)) {
  return true;

} else {
return false;
}
}

palindrome("eye");

@dting it's still completing the challenge what did I miss?
@dting not**
DTing
@dting
Aug 21 2015 07:26
@gzatrader your x function doen't return anything so the conditional is always true
you need to take an argument for your str in the x function and call the .replace on that otherwise you just are calling replace on the str your palindrome function was called with
ShortWaveLengthSubset
@ShortWaveLengthSubset
Aug 21 2015 07:32
i figured it out at least

display: block

to the rescue

DTing
@dting
Aug 21 2015 07:34
nice, I thought it might be an list-style-position:outside thing but wasn't sure.
ShortWaveLengthSubset
@ShortWaveLengthSubset
Aug 21 2015 07:34
yeah not sure if its the best solution but
manasshukla
@manasshukla
Aug 21 2015 07:35
@dting Thanks for your suggestions
was finally able to solve the bonfire
CamperBot
@camperbot
Aug 21 2015 07:35
manasshukla sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 514 | @dting | http://www.freecodecamp.com/dting
ShortWaveLengthSubset
@ShortWaveLengthSubset
Aug 21 2015 07:35
now I have to stop the server from crashing when I violate some Mongoose Schema rules
but I think I'll leave that til tomorrow
Nnxoxo
@Nnxoxo
Aug 21 2015 07:41
This message was deleted
Timothy Kim
@tea-kay
Aug 21 2015 08:04

@dting

okay, this is how far I've gotten now... However it doesn't work for 1 of the tests which is "A man, a plan, a canal. Panama

I checked the console with dev tools and it's the period that's not being removed should I add another .replace() function? or is there a simpler way?

function palindrome(str) {
var x = str.replace(/ /g,'').toLowerCase();
var rev = x.split('').reverse().join();
var y = x.split('').join();
if (y === rev ) {
return true;
} else {
console.log(y);
console.log(rev);
return false;
}
}

Owen
@owencampbell
Aug 21 2015 08:12
@gzatrader can you wrap your code in 3 ticks?
Timothy Kim
@tea-kay
Aug 21 2015 08:14
@owencampbell hey lol sorry I'm noob at this what does wrapping it in "3 ticks" mean?
jojacino
@jojacino
Aug 21 2015 08:14
I am having trouble on the last advanced bf
bf friendly date ranges
CamperBot
@camperbot
Aug 21 2015 08:14
Sorry, can't find a bonfire called friendly date changes. [ Check the map? ]
jojacino
@jojacino
Aug 21 2015 08:15
bf friendly date ranges
CamperBot
@camperbot
Aug 21 2015 08:15

:fire:Bonfire: Friendly Date Ranges :link:

function friendly(str) {
  return str;
}

friendly(['2015-07-01', '2015-07-04']);

Implement a way of converting two dates into a more friendly date range that could be presented to a user.

more info:  bf details | bf links | hint

Owen
@owencampbell
Aug 21 2015 08:16
@gzatrader Ha I only learnt what it meant yesterday too.. 3 ticks before and after your code is {code}
dammit, 3 x `
jojacino
@jojacino
Aug 21 2015 08:16
my code only doesn't pass two tests and the comparison only says expected to === Array(2);
tjstinso
@tjstinso
Aug 21 2015 08:19
@jojacino I think you should have access to the test case. Try testing it in and actually looking at the result
Owen
@owencampbell
Aug 21 2015 08:19
@gzatrader If you're using the web client there is a button in the bottom right of the text box that looks like an M with a down arrow... It details out all the markdown you can use with examples
jojacino
@jojacino
Aug 21 2015 08:20
@tjstinso thank you, god I am sleepy. Maybe I should go to bed. lol
CamperBot
@camperbot
Aug 21 2015 08:20
jojacino sends brownie points to @tjstinso :sparkles: :thumbsup: :sparkles:
:star: 169 | @tjstinso | http://www.freecodecamp.com/tjstinso
jojacino
@jojacino
Aug 21 2015 08:21
Oh no, that's right, it's the comparison one that says Arrray(2) not mine
Timothy Kim
@tea-kay
Aug 21 2015 08:21
@owencampbell
function palindrome(str) {
  var x = str.replace(',','').replace('.','').replace(/ /g,'').toLowerCase();
  var rev = x.split('').reverse().join().replace(',','').replace('.','');
  var y = x.split('').join().replace(',','').replace('.','');
    if (y === rev && y.length === rev.length) {
      return true;
} else {
    console.log(y);
    console.log(rev);
    return false;
  }
}
jojacino
@jojacino
Aug 21 2015 08:22
eh, going to bed anyway, gnight coders, =D
Timothy Kim
@tea-kay
Aug 21 2015 08:22
@owencampbell
function palindrome(str) {
  var x = str.replace(/ /g,'').toLowerCase();
  var rev = x.split('').reverse().join();
  var y = x.split('').join();
    if (y === rev && y.length === rev.length) {
      return true;
} else {
    console.log(y);
    console.log(rev);
    return false;
  }
}
@owencampbell the one before was me trying to get rid of spaces and commas after the join because the last test for whatever reason kept joining with the spaces and period
Owen
@owencampbell
Aug 21 2015 08:25
@gzatrader And what's it failing on?
Chad Kreutzer
@ChadKreutzer
Aug 21 2015 08:28
@gzatrader at first glance, i can see that your regexp isn't going to do the job in every case: it only looks for spaces, not punctuation. I like playing on www.regexer.com to find a regexp that'll work.
Timothy Kim
@tea-kay
Aug 21 2015 08:29
@owencampbell assert.deepEqual(palindrome("A man, a plan, a canal. Panama"), true);expected false to deeply equal true
Chad Kreutzer
@ChadKreutzer
Aug 21 2015 08:39
@gzatrader sorry. I meant regexr.com
Tim Millar
@tim-millar
Aug 21 2015 08:47
@Noblelynx @michaelmenace You want to transform every object (i.e., array) in your array into another value. A classic way to approach this is to map a projection function over the elements of the array. (This is more or less the purpose of map.) For the largestOfFour problem, obviously the projection function would take the maximum element of the sub-array. Hence, you can easily write a simple solution in one line (as a bonus, the solution is good for arbitrary-sized jagged arrays).
davellolz
@davellolz
Aug 21 2015 08:47
Hi guys I have a question why is it that lastName[lastName.length - 1]; return the last value of a string?
got it nevermind my question above XD
manasshukla
@manasshukla
Aug 21 2015 09:01
Hey Guys, for the zipline do we not have challenges ? Meaning completing the zipline is the only challenge. There are no incremental challenges that would lead us to the finishing point of zipline
?
Tim Millar
@tim-millar
Aug 21 2015 09:02
@manasshukla I think you're supposed to break them into user stories.
Sophanarith Sok
@sok213
Aug 21 2015 09:03
@manasshukla You have to make it on your own, if you get stuck, use google.
Natch Khongpasuk
@knatch
Aug 21 2015 09:03
Hey guys
manasshukla
@manasshukla
Aug 21 2015 09:04
@sok213 seems daunting
Sophanarith Sok
@sok213
Aug 21 2015 09:04
@manasshukla I know, but you'll learn so much by doing that
Natch Khongpasuk
@knatch
Aug 21 2015 09:04

What's this suppose to mean?

should return empty array if all elements are falsey: expected [ null ] to deeply equal []

Sophanarith Sok
@sok213
Aug 21 2015 09:04
it's similar to someone pushing you into a pool of water without you actually knowing how to swim @manasshukla
manasshukla
@manasshukla
Aug 21 2015 09:05
@sok213 so true
:)
Sophanarith Sok
@sok213
Aug 21 2015 09:09
@manasshukla If you REALLY get stuck, which you will because everyone does, you can always ask for help on the HelpZiplines channel. Good luck!
manasshukla
@manasshukla
Aug 21 2015 09:12
@sok213 : Where can I find these channels
Sophanarith Sok
@sok213
Aug 21 2015 09:14
it should be on the left side-bar
@manasshukla
Chad Kreutzer
@ChadKreutzer
Aug 21 2015 09:20
@sok213 thanks for the link to that channel, even though I'm not @manasshukla :D I'm not ready to ask for help yet, but I'm sure I will be needing some soon.
CamperBot
@camperbot
Aug 21 2015 09:20
chadkreutzer sends brownie points to @sok213 and @manasshukla :sparkles: :thumbsup: :sparkles:
:star: 268 | @sok213 | http://www.freecodecamp.com/sok213
:star: 197 | @manasshukla | http://www.freecodecamp.com/manasshukla
Sophanarith Sok
@sok213
Aug 21 2015 09:21
@ChadKreutzer No problem :)
manasshukla
@manasshukla
Aug 21 2015 09:24
@ChadKreutzer I think we might also get some help from the bootstrap waypoints
just a suggestion
Chad Kreutzer
@ChadKreutzer
Aug 21 2015 09:26
@manasshukla I did them, but I did them over a month ago. so I actually just started to redo the HTML/CSS/Bootstrap waypoints and I plan on redoing the AirBnB section of Codeacademy.
Thapz123
@Thapz123
Aug 21 2015 09:28
Anyone willing to pair program the Quote Machine Zipline with me
?
Josh A
@ai3gtmc
Aug 21 2015 10:23
Hi
Cristi Rusu
@CristiInfo
Aug 21 2015 10:24
hello
Giacomo
@Jack1618
Aug 21 2015 10:26
hi @ai3gtmc , I'll help you
Josh A
@ai3gtmc
Aug 21 2015 10:26
@Jack1618 thanks, I have no idea where to start
CamperBot
@camperbot
Aug 21 2015 10:26
ai3gtmc sends brownie points to @jack1618 :sparkles: :thumbsup: :sparkles:
:star: 193 | @jack1618 | http://www.freecodecamp.com/jack1618
Giacomo
@Jack1618
Aug 21 2015 10:27
@ai3gtmc you have to match cases like "race Car" or "RACEcar". They're both palindromes.
Josh A
@ai3gtmc
Aug 21 2015 10:28
yeah I get that but I don't know how to match them
Rabin Shrestha
@jyapujuju
Aug 21 2015 10:28
Waypoint: Manipulate Arrays With shift .... need help in .
Giacomo
@Jack1618
Aug 21 2015 10:29
@ai3gtmc for this purpose you have to make a sentence flat, e.g. both sentences above we want make them "racecar". For uppercase chars you can use the toUpperCase() function, while for delete all non-words characters from a string you can use replace()
Josh A
@ai3gtmc
Aug 21 2015 10:31
I think I'm stuck after that.
Giacomo
@Jack1618
Aug 21 2015 10:32
@ai3gtmc to replace a non-word char with an empty string, you have to use a regEx. 'str.replace(/\W+/g,'');' is what we need for
Josh A
@ai3gtmc
Aug 21 2015 10:33
I replaced them with ''
I think that part is right.
Michael Bomholt
@bomholtm
Aug 21 2015 10:34
hey guys. is it possible to make a page relate to the size of the browser "display"? even if some websites are responsive it is shown differently for example if the bookmark toolbar is enabled/displayed.. you can see more or less of the website. i basicly want to do a scrolling down page where no matter what ... the entering screen is equal on every browser
Giacomo
@Jack1618
Aug 21 2015 10:35
now you have to compare this string with its reverse. the reverse function that I think you've done before
don't forget to uppercase your string first
Josh A
@ai3gtmc
Aug 21 2015 10:36
hmm I see, I think I know what to do. thanks!
CamperBot
@camperbot
Aug 21 2015 10:36
if you want to thank someone, put an @ before their name!
Giacomo
@Jack1618
Aug 21 2015 10:37
np :smile:
Giacomo
@Jack1618
Aug 21 2015 10:51

guys, simply what's wrong with this code?
`function findLongestWord(str) {

var array = str.split('');

maxLength = array[0].length;

for(var i = 0; i < array.length; i++){
if(array[i].length > maxLength)
maxLength = array[i].length;
}

return maxLength;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
`
I don't know why it doesn't work. I think it should work! Any help? Thanks!

CamperBot
@camperbot
Aug 21 2015 10:51
if you want to thank someone, put an @ before their name!
Nnxoxo
@Nnxoxo
Aug 21 2015 10:58
This message was deleted
@Jack1618 u have var array = str.split('');
u need to put a space
Todd Johnson
@TJohnson93
Aug 21 2015 10:59
@Jack1618 What @Nnutthowze said
Nnxoxo
@Nnxoxo
Aug 21 2015 11:00
@Jack1618 and will work
Giacomo
@Jack1618
Aug 21 2015 11:02
Oh, @Nnutthowze thanks!! it escaped from my debugging!
CamperBot
@camperbot
Aug 21 2015 11:02
jack1618 sends brownie points to @nnutthowze :sparkles: :thumbsup: :sparkles:
:star: 267 | @nnutthowze | http://www.freecodecamp.com/nnutthowze
Josh A
@ai3gtmc
Aug 21 2015 11:05
ahhh I'm stuck. :(
I'm at the Bonfire: Check for Palindromes, everything that is true works fine but everything that should be false returns invalid. :(
This message was deleted
CamperBot
@camperbot
Aug 21 2015 11:09
:bulb: to format code use backticks! ``` more info
Josh A
@ai3gtmc
Aug 21 2015 11:10
function palindrome(str) {
  // Good luck!
  var lower = str.toLowerCase();
  var hold = lower.split('').reverse().join('');
  if (hold) {
    return true;
  }
  else {
    return false;
  }

}
not sure what I'm doing wrong :(
CatNipples98
@CatNipples98
Aug 21 2015 11:14
can someone help me?
Nnxoxo
@Nnxoxo
Aug 21 2015 11:15
@ai3gtmc ur code always gives true
Todd Johnson
@TJohnson93
Aug 21 2015 11:15
@CatNipples98 What’s up?
Josh A
@ai3gtmc
Aug 21 2015 11:15
@Nnutthowze that's what I'm stuck with
CatNipples98
@CatNipples98
Aug 21 2015 11:16
so i am stuck at Manipulate Arrays With pop and i don't know what i need to write after i write myArray.pop()
Nnxoxo
@Nnxoxo
Aug 21 2015 11:16
@ai3gtmc u need to check ur base string with new one
@CatNipples98 myArray.pop();
Todd Johnson
@TJohnson93
Aug 21 2015 11:17
This message was deleted
CamperBot
@camperbot
Aug 21 2015 11:17
Sorry, can't find a bonfire called manipulate arrays with pop. [ Check the map? ]
CatNipples98
@CatNipples98
Aug 21 2015 11:17
i alreadyw rote that but i need to add something else
Todd Johnson
@TJohnson93
Aug 21 2015 11:17
var removed = myArray.pop();
FCC wants it assigned to a variable removed
CatNipples98
@CatNipples98
Aug 21 2015 11:18
ooohhh i understand now thanks
CamperBot
@camperbot
Aug 21 2015 11:18
if you want to thank someone, put an @ before their name!
Todd Johnson
@TJohnson93
Aug 21 2015 11:18
@CatNipples98 You’re welcome
CatNipples98
@CatNipples98
Aug 21 2015 11:18
@thanks @TJohnson93
CamperBot
@camperbot
Aug 21 2015 11:18
catnipples98 sends brownie points to @thanks and @tjohnson93 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for thanks
:star: 247 | @tjohnson93 | http://www.freecodecamp.com/tjohnson93
Todd Johnson
@TJohnson93
Aug 21 2015 11:19
@CatNipples98 don’t need to put @ in front of thanks :)
CamperBot
@camperbot
Aug 21 2015 11:19
tjohnson93 sends brownie points to @catnipples98 :sparkles: :thumbsup: :sparkles:
:star: 139 | @catnipples98 | http://www.freecodecamp.com/catnipples98
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:32
hey everyone
I have a small problem in Zipline 3
I need to use an API in my code
but I never learnt how to use an API
and I searched everywhere with no luck...
how do I implement this API in my code... help... please?
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:34
not very good...
I tried it but..
Todd Johnson
@TJohnson93
Aug 21 2015 11:35
@mobesa You can use Ajax
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:35
how? @TJohnson93
Todd Johnson
@TJohnson93
Aug 21 2015 11:35
I’ll do a proof of concept… hang on...
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:35
:smile:
by the way, thanks @Nnutthowze
CamperBot
@camperbot
Aug 21 2015 11:36
mobesa sends brownie points to @nnutthowze :sparkles: :thumbsup: :sparkles:
:star: 268 | @nnutthowze | http://www.freecodecamp.com/nnutthowze
Todd Johnson
@TJohnson93
Aug 21 2015 11:37
@mobesa jQuery AJAX Documentation
function getQuote(){
    $.ajax({
        url: 'https://andruxnet-random-famous-quotes.p.mashape.com/cat=movies',
        type: 'POST',
        datatype: 'json',
        beforeSend: function(xhr){
            // Send Header for API Request 
            xhr.setRequestHeader("X-Mashape-Key", "SECRET-KEY");

            // Display AJAX Loader
        }
        success: function(data){
            data = JSON.parse(data);
            // Display Data to HTML
        },
        error: function(err){
            // Display Error
        }
    });
}
mobesa @mobesa is scanning @TJohnson93 's answer... please hold
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:38
thanks mate @TJohnson93
CamperBot
@camperbot
Aug 21 2015 11:38
mobesa sends brownie points to @tjohnson93 :sparkles: :thumbsup: :sparkles:
:star: 248 | @tjohnson93 | http://www.freecodecamp.com/tjohnson93
Todd Johnson
@TJohnson93
Aug 21 2015 11:38
@mobesa Anytime
Jordan Shackelford
@JordanShackelford
Aug 21 2015 11:40
isn't this script correct? $("#left-well:nth-child(2)").addClass("animated bounce");
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:40
is there some docs about this that I can build on?
@TJohnson93
Jordan Shackelford
@JordanShackelford
Aug 21 2015 11:40
It's supposed to make the second child element bounce but it doesn't work
Todd Johnson
@TJohnson93
Aug 21 2015 11:40
@mobesa Yeah see link to jQuery Ajax docs in previous post
Nnxoxo
@Nnxoxo
Aug 21 2015 11:40
@JordanShackelford link the code
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:41
@JordanShackelford it's weird but you should change left-well to target
@TJohnson93 :+1:
@TJohnson93 so what is AJAX? (dumb and obvious question)
Jordan Shackelford
@JordanShackelford
Aug 21 2015 11:42
oh it tells me to do it to each well element
what is target?
Todd Johnson
@TJohnson93
Aug 21 2015 11:42
@JordanShackelford I think @mobesa means your class named target
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:43
@JordanShackelford I tried that waypoint and it worked only if I changed .left-wellto .target
Jordan Shackelford
@JordanShackelford
Aug 21 2015 11:43
oh ok I understand now. thanks
CamperBot
@camperbot
Aug 21 2015 11:43
if you want to thank someone, put an @ before their name!
Todd Johnson
@TJohnson93
Aug 21 2015 11:43

@mobesa

Ajax (also AJAX; /ˈeɪdʒæks/; short for asynchronous JavaScript and XML)[1][2][3] is a group of interrelated Web development techniques used on the client-side to create asynchronous Web applications. With Ajax, web applications can send data to and retrieve from a server asynchronously (in the background) without interfering with the display and behavior of the existing page. Data can be retrieved using the XMLHttpRequest object. Despite the name, the use of XML is not required (JSON is often used in the AJAJ variant), and the requests do not need to be asynchronous.[4]

Ajax is not a single technology, but a group of technologies. HTML and CSS can be used in combination to mark up and style information. The DOM is accessed with JavaScript to dynamically display – and allow the user to interact with – the information presented. JavaScript and the XMLHttpRequest object provide a method for exchanging data asynchronously between browser and server to avoid full page reloads.
Wikipedia Description

Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:44
:+1: :+1: :+1:
Jordan Shackelford
@JordanShackelford
Aug 21 2015 11:44
:thumbsup:
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:45
should be suggested to be put in the curriculum, before the ziplines, right?
Todd Johnson
@TJohnson93
Aug 21 2015 11:45
@mobesa Yeah I think so… Not sure where to offer input on that matter though except maybe tweet them or something
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:46
I think there's a Gitter room for it... hold on
Todd Johnson
@TJohnson93
Aug 21 2015 11:46
@mobesa Ahh right
but I think for real important stuff like this it's better to tweet Quincy or something... thanks again @TJohnson93
CamperBot
@camperbot
Aug 21 2015 11:48
mobesa sends brownie points to @tjohnson93 :sparkles: :thumbsup: :sparkles:
:warning: mobesa already gave tjohnson93 points
Todd Johnson
@TJohnson93
Aug 21 2015 11:48
@mobesa no problem
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:49
oh... there seems to be an error in the ajax code you gave me @TJohnson93
data = JSON.parse(data); seems to not work... help... again? :confused:
Todd Johnson
@TJohnson93
Aug 21 2015 11:50
Is the API returning a JSON object?
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:50
nothing at all.. just an error
Uncaught SyntaxError: Unexpected identifier
    at Object.InjectedScript._evaluateOn (<anonymous>:905:140)
    at Object.InjectedScript._evaluateAndWrap (<anonymous>:838:34)
    at Object.InjectedScript.evaluate (<anonymous>:694:21)
Todd Johnson
@TJohnson93
Aug 21 2015 11:51
That snippet is derived from my Quote Generator
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:51
wow...
i don't know.. maybe i'll try again..
Todd Johnson
@TJohnson93
Aug 21 2015 11:52
@mobesa Just comment it out untill to you find an API you like and the developer should have documentation on what to API returns… Is usually XML or JSON
Da Cheezy Mobsta
@mobesa
Aug 21 2015 11:52
sure thing @TJohnson93
bye everyone!!
zcrnivec
@zcrnivec
Aug 21 2015 11:52
Is there a way to do this in pure js?
var req = new XMLHttpRequest();
req.open("GET", "http://api.forismatic.com/api/1.0/method=getQuote&format=json&lang=en", false);
req.send(null);
console.log(JSON.parse(req.responseText));
I dont quite understand this api http://forismatic.com/en/api/
Rabin Shrestha
@jyapujuju
Aug 21 2015 11:55
var ourArray = ["Stimpson", "J", ["cat"]];
ourRemoved = ourArray.shift();
// ourArray now equals ["J", ["cat"]]

var myArray = ["John", 23, ["dog", 3]];
// Only change code below this line.
myArray.pop();
var myRemoved = myArray; // This should be ["John"] and myArray should now be [23, ["dog", 3]]
myRemoved.pop();
// Only change code above this line.

// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & myRemoved = ' + JSON.stringify(z));})(myArray, myRemoved);
Waypoint: Manipulate Arrays With shift
Todd Johnson
@TJohnson93
Aug 21 2015 11:56
@zcrnivec Try via POST
@jyapujuju
var myRemoved = myArray.shift();
@jyapujuju So .pop() will remove the last value out of the Array while .shift() removes the first value in Array
Rabin Shrestha
@jyapujuju
Aug 21 2015 11:59
@TJohnson93 not working
var ourArray = ["Stimpson", "J", ["cat"]];
ourRemoved = ourArray.shift();
// ourArray now equals ["J", ["cat"]]

var myArray = ["John", 23, ["dog", 3]];
// Only change code below this line.
myArray.pop();
var myRemoved = myArray; // This should be ["John"] and myArray should now be [23, ["dog", 3]]
var myRemoved = myArray.shift();// Only change code above this line.

// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & myRemoved = ' + JSON.stringify(z));})(myArray, myRemoved);
var ourArray = ["Stimpson", "J", ["cat"]];
ourRemoved = ourArray.shift();
// ourArray now equals ["J", ["cat"]]

var myArray = ["John", 23, ["dog", 3]];
// Only change code below this line.
myArray.pop();
var myRemoved = myArray; // This should be ["John"] and myArray should now be [23, ["dog", 3]]
myRemoved = myArray.shift();// Only change code above this line.

// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & myRemoved = ' + JSON.stringify(z));})(myArray, myRemoved);
this also
Todd Johnson
@TJohnson93
Aug 21 2015 12:00
@jyapujuju You are now declaring myRemoved variable twice
Remove the myArray.pop()
Your code will be like so:
var ourArray = ["Stimpson", "J", ["cat"]];
ourRemoved = ourArray.shift();
// ourArray now equals ["J", ["cat"]]

var myArray = ["John", 23, ["dog", 3]];
// Only change code below this line.

var myRemoved = myArray.shift(); // This should be ["John"] and myArray should now be [23, ["dog", 3]]

// Only change code above this line.

// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & myRemoved = ' + JSON.stringify(z));})(myArray, myRemoved);
or via two lines of code, like you have:
var myRemoved = myArray; // This should be ["John"] and myArray should now be [23, ["dog", 3]]
myRemoved = myArray.shift();// Only change code above this line.
Rabin Shrestha
@jyapujuju
Aug 21 2015 12:06
thanks @TJohnson93 <3
CamperBot
@camperbot
Aug 21 2015 12:06
jyapujuju sends brownie points to @tjohnson93 :sparkles: :thumbsup: :sparkles:
:star: 249 | @tjohnson93 | http://www.freecodecamp.com/tjohnson93
Todd Johnson
@TJohnson93
Aug 21 2015 12:11
@jyapujuju You're Welcome
zcrnivec
@zcrnivec
Aug 21 2015 12:17
@TJohnson93 I did this with the help of eloquent javascript book, but it still doesnt work
function get(url) {
    return new Promise(function(succeed, fail) {
       var req = new XMLHttpRequest();
       req.open("POST", url, true);
       req.addEventListener("load", function() {
           if(req.status < 400)
               succeed(req.responseText);
           else
               fail(new Error("Request failed: " + req.statusText));
       });
    req.addEventListener("error", function() {
        fail(new Error("Network error"));
    });
    req.send(null);
    });
}
get("http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=json&lang=en");
This message was deleted
Vitalii Danylov
@vitaliidanylov
Aug 21 2015 12:19
Hi everyone! There is enybody who knows how to compare two dates?
var date1 = new Date('2015-11-11');
var date2 = new Date('2015-11-11');
date1 === date2 ----> false...why? It's comparing link to objects?
Todd Johnson
@TJohnson93
Aug 21 2015 12:20
@zcrnivec Sorry, I have never used Vanilla JS to do that before but I’ll give it a shot
zcrnivec
@zcrnivec
Aug 21 2015 12:22
@TJohnson93 Didn't know it is VanillaJS the book didnt mention it, but i would like to do it with pure JS but the problem is No 'Access-Control-Allow-Origin'
Bianca Mihai
@biancamihai
Aug 21 2015 12:23
@vitaliidanylov because are objects
try:
var date1 = new Date('2015-11-11');
var date2 = new Date('2015-11-11');
date1.getTime() === date2.getTime()
and you will get true
Todd Johnson
@TJohnson93
Aug 21 2015 12:26
@zcrnivec well your url works on their API Tester
When I copy your code into the console I get your Promise object
I don’t fully understand what you are trying to do on this line
return new Promise(function(succeed, fail) {
Nnxoxo
@Nnxoxo
Aug 21 2015 12:28
@zcrnivec try to read this and all will work at the end there is a solution
https://developer.mozilla.org/en-US/docs/AJAX/Getting_Started
zcrnivec
@zcrnivec
Aug 21 2015 12:30
I retyped it from the book
Bianca Mihai
@biancamihai
Aug 21 2015 12:30
@vitaliidanylov edited the answer :) my bad but yes it gives you false because they are objects
zcrnivec
@zcrnivec
Aug 21 2015 12:30
eloquent javascript is there a way to do this with simple XMLHttpRequest();
Vitalii Danylov
@vitaliidanylov
Aug 21 2015 12:32
@biancamihai thanks, I wrote the function which cheks each parameter of date(like: year,month and date for equality)
CamperBot
@camperbot
Aug 21 2015 12:32
vitaliidanylov sends brownie points to @biancamihai :sparkles: :thumbsup: :sparkles:
:star: 236 | @biancamihai | http://www.freecodecamp.com/biancamihai
David Petrey
@davidpetrey
Aug 21 2015 12:34
What do I do if the lesson page isn't loading right?
Todd Johnson
@TJohnson93
Aug 21 2015 12:35

@zcrnivec Perhaps this may help with your No Access-Control-Allow-Origin error

Note that if you want to POST data, you may have to set the MIME type of the request. For example, use the following line before calling send() for form data sent as a query string:

httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded’);
zcrnivec
@zcrnivec
Aug 21 2015 12:35

@TJohnson93

var req = new XMLHttpRequest();
req.open("POST", "http://api.forismatic.com/api/1.0/", true);
req.send("method=getQuote&key=457653&format=json&lang=en");
console.log(req.responseText);

After this i get No 'Access-Control-Allow-Origin' what should i do next?

David Petrey
@davidpetrey
Aug 21 2015 12:37
I'll just skip the lesson for now. But should I report it somewhere?
minakasiin
@minakasiin
Aug 21 2015 12:37
Isn't there a "Bug" button on the left side of the screen?
David Petrey
@davidpetrey
Aug 21 2015 12:38
nevermind I guess i should click on the Bug button
Todd Johnson
@TJohnson93
Aug 21 2015 12:38
This message was deleted
David Petrey
@davidpetrey
Aug 21 2015 12:38
This message was deleted
This message was deleted
This message was deleted
minakasiin
@minakasiin
Aug 21 2015 12:38
=P
David Petrey
@davidpetrey
Aug 21 2015 12:38
I'm new and I can't type
thanks
CamperBot
@camperbot
Aug 21 2015 12:38
if you want to thank someone, put an @ before their name!
Todd Johnson
@TJohnson93
Aug 21 2015 12:58
This message was deleted
Thapz123
@Thapz123
Aug 21 2015 13:11
Struggling with my Quote Machine. Can anyone help :
http://codepen.io/Thapz123/full/XbLBVj
J Player
@Heyjp
Aug 21 2015 13:17
function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  function oneFilter (value) {
    if (value != Boolean(false)) {

      return true;

    } else {     
      return false;
    }
  }
  return arr.filter(oneFilter);
}
bouncer([false, null, 0]);
What can I do to remove the null?
minakasiin
@minakasiin
Aug 21 2015 13:17
In CSS and HTML, does the "!important" have to be in the CSS or the HTML element? ///Nevermind, fixed it. I had ; before the !important keyword.
Lovelyn Tijesunimi-israel
@andela-ltijesunimi-israel
Aug 21 2015 13:23
Hello
minakasiin
@minakasiin
Aug 21 2015 13:23
'ello
Lovelyn Tijesunimi-israel
@andela-ltijesunimi-israel
Aug 21 2015 13:23
pls I'm having issues with Bonfire: Find longest word in a string
Here's my code

``` function findLongestWord(str) {
var splitString = str.split(" ");
var longest = 0;
for(var i=0; i<= splitString.length; i++){
if(longest < splitString[i].length){
longest = splitString[i].length;
}
}
return longest;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
```

How do i use the preformatted text on here
Todd Johnson
@TJohnson93
Aug 21 2015 13:25
the ``` needs to be on its own line
@Amoralyn You could always sort the array and output the largest that way I believe
Omar
@oab00
Aug 21 2015 13:25
@Thapz123 change jsonp: "this.success",
to jsonp: "jsonp",
Lovelyn Tijesunimi-israel
@andela-ltijesunimi-israel
Aug 21 2015 13:26
Thanks @TJohnson93
CamperBot
@camperbot
Aug 21 2015 13:26
amoralyn sends brownie points to @tjohnson93 :sparkles: :thumbsup: :sparkles:
:star: 250 | @tjohnson93 | http://www.freecodecamp.com/tjohnson93
Lovelyn Tijesunimi-israel
@andela-ltijesunimi-israel
Aug 21 2015 13:26
function findLongestWord(str) {
var splitString = str.split(" ");
var longest = 0;
for(var i=0; i<= splitString.length; i++){
  if(longest < splitString[i].length){
    longest = splitString[i].length; 
  }
}
  return longest;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
Todd Johnson
@TJohnson93
Aug 21 2015 13:27
That works?
I just looked up my solution which is:
function findLongestWord(str) {
  myarray = str.split(' ');
  myarray.sort(function(a, b){
    return b.length - a.length; // ASC -> a - b; DESC -> b - a
  });
  return myarray[0].length;
}

findLongestWord('The quick brown fox jumped over the lazy dog’);
Lovelyn Tijesunimi-israel
@andela-ltijesunimi-israel
Aug 21 2015 13:28
Okay
Thapz123
@Thapz123
Aug 21 2015 13:29
@oab00 Just tried that and it seems to have worked. Why though?
@oab00 Thanks too!
CamperBot
@camperbot
Aug 21 2015 13:29
thapz123 sends brownie points to @oab00 :sparkles: :thumbsup: :sparkles:
:star: 197 | @oab00 | http://www.freecodecamp.com/oab00
Omar
@oab00
Aug 21 2015 13:29
no idea honestly xD
probably replacing the callback function but dunno how it works..
DanieleBergesio
@DanieleBergesio
Aug 21 2015 13:39

hi everyone, hope u're doing good!
So, i'm trying to solve the following code:

function destroyer(arr) {
// Remove all the values
var arr2 = [];
for (i=1;i<=arguments.length-1;i++) {
arr2 = arr2.concat(arguments[i]);
}

function filt (arr,arr2) {

if (arr!==arr2) {
  return true;
} else {
  return false;
}

}

return arr.filter(filt);
}

destroyer(['tree', 'hamburger', 53], 'tree', 53);

in the exercise 16 of Basic Algorithm, but I got stuck. Why in ex 14 I was able to filter the array (without even going through all the elements) and not this time? I should get the string 'hamburger' back, but instead I get the full initial array...

for instance, if I add arr!==53 in the if case, it does take it off the array; so it goes through all the elements without any loops; but still...
Young Lee
@young92117
Aug 21 2015 13:51
@DanieleBergesio I think fliter method won’t update array itself but return the NEW filtered array. If you want the new fitlered array, you need to save the return array from filter() or you need to reaasinge back to itself.
Moisés Man
@moigithub
Aug 21 2015 13:53

@DanieleBergesio if u have this
destroyer(['tree', 'hamburger', 53], 'tree', 53);
what this part of code does ??

var arr2 = [];
for (i=1;i<=arguments.length-1;i++) {
arr2 = arr2.concat(arguments[i]);
}

what arr2 value or values will have??

DanieleBergesio
@DanieleBergesio
Aug 21 2015 13:54
@moigithub since the arr is just the first part of the argument, so '['tree', 'hamburger', 53]' I needed to tell the function the second argument to use
so arr2 gives back "['tree', 53]"
and the following if looks for them
Moisés Man
@moigithub
Aug 21 2015 13:56
ok.. so.. in ur filter call back u checking
if (arr!==arr2) {
if we replacing the values.. it will be
This message was deleted
DanieleBergesio
@DanieleBergesio
Aug 21 2015 13:57
@young92117 thanks! But I was trying something similar to what I wrote above in ex 14 and it worked (there though I had just booleans)
CamperBot
@camperbot
Aug 21 2015 13:57
danielebergesio sends brownie points to @young92117 :sparkles: :thumbsup: :sparkles:
:star: 110 | @young92117 | http://www.freecodecamp.com/young92117
DanieleBergesio
@DanieleBergesio
Aug 21 2015 13:57
(what's that?)
@moigithub yes
indeed, if I add if (arr!==arr2 && arr !==53) { it gives back just ["tree, "hamburger"]
CamperBot
@camperbot
Aug 21 2015 13:58
:bulb: to format code use backticks! ``` more info
Moisés Man
@moigithub
Aug 21 2015 14:01
no sry.. im wrong :)
Lovelyn Tijesunimi-israel
@andela-ltijesunimi-israel
Aug 21 2015 14:01
@TJohnson93 I solved the issue. it was in the for loop
function findLongestWord(str) {
var splitString = str.split(" ");
var longest = 0;
for(var i=0; i< splitString.length; i++){
  if(longest < splitString[i].length){
    longest = splitString[i].length; 
  }
}
  return longest;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
Moisés Man
@moigithub
Aug 21 2015 14:03
function filt (arr,arr2) {
if (arr!==arr2) {
  return true;
} else {
  return false;
}
}
return arr.filter(filt);
(ok with this code.. IF replacing values )
return ['tree', 'hamburger', 53].filter(filt);
filter will pick each values of (left side) array
and check on ur filter callback (so the correct check will be )
if ( 'tree' !== ['tree', 53] ) {
then next check will be (filter iterate on each elements)
if ( 'hamburger' !== ['tree', 53] ) {
and
if ( 53 !== ['tree', 53] ) {
@DanieleBergesio
since all those are differents (!==) ur callback return true (including the element on the last result), so the last result u get back is ['tree', 'hamburger', 53]
DanieleBergesio
@DanieleBergesio
Aug 21 2015 14:07
uhm... u're totally right @moigithub
Andreia Melo
@andreiamlm
Aug 21 2015 14:07
hi do you know where I can check the last modifications on the curriculum from the last update?
Moisés Man
@moigithub
Aug 21 2015 14:07
to fix ur code.. u need to change ur callback checking.... for something like...
if arr IS ON arr2 then decide if u wanna keep (returning true) or discard (false)
so ur callback checks will be like...
if ( 53 IsOn ['tree', 53] ) {
if ( 'tree' IsOn ['tree', 53] ) {
if ( 'hamburger' IsOn ['tree', 53] ) {
on each iteration
for the "Is On" check.. u could use Array indexOf function
DanieleBergesio
@DanieleBergesio
Aug 21 2015 14:10
so there's not an easy compact way to avoid if iterations, isn't it?
CrunchyTacos
@CrunchyTacos
Aug 21 2015 14:13
Is anyone on that can help with getJSON problems on the Twitch API for the Zipline?
Moisés Man
@moigithub
Aug 21 2015 14:14
@DanieleBergesio the If checks i wrote are an example HOW filter works.. (filter have a internal iterator)
DanieleBergesio
@DanieleBergesio
Aug 21 2015 14:14
@moigithub thanks!
for your help
CamperBot
@camperbot
Aug 21 2015 14:14
danielebergesio sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star: 5 | @moigithub | http://www.freecodecamp.com/moigithub
Joey Orlando
@joeyorlando
Aug 21 2015 14:16

Hi there.. I'm on the Arguments Optional Intermediate algorithm challenge and I am getting hung up on one specific aspect of the challenge

The challenge is as follows:

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 var sum2And = add(2); return sum2And(3); // 5

If either argument isn't a valid number, return undefined.

I am able to catch if the number of arguments is less than 2 and also check the type of the arguments provided. Where I am getting hung up is 'returning a function that is waiting for an argument'.

This is what I have so far

function sumFirstNumAnd(a,b) {
 return a + b;
}

function add() {

  var args = Array.prototype.slice.call(arguments);

  var allNumbers = args.every(function(elem){
    return !isNaN(parseFloat(elem)) && typeof elem == 'number';
  });

  if (!allNumbers){
    return undefined;
  } else if (args.length < 2) {
    return sumFirstNumAnd(args);
  } else {
    return args[0] + args[1];
  }

}

add(2,3);

These are some of the provided test cases:

expect(add(2, 3)).to.equal(5);
expect(add(2)(3)).to.equal(5);add(...) is not a function
expect(add('http://bit.ly/IqT6zt')).to.be.undefined;
expect(add(2, '3')).to.be.undefined;
expect(add(2)([3])).to.be.undefined;
RC Maples
@rcmaples
Aug 21 2015 14:19

Hey folks, was curious if someone could help me with a json parsing issue...

var testData = {a giant json string};
var testSon = JSON.parse(testData);
testSon.getOwnPropertyNames().forEach(function(val, idx, arrary){
    console.log(val);
});

Right now I'm just trying to spit out the values of prop names in the json so I can begin pulling info out and storing it.
However, my console spits out:

undefined:1                                                                                                                                                                                                                                      
[object Object]                                                                                                                                                                                                                                  
 ^                                                                                                                                                                                                                                               
SyntaxError: Unexpected token o                                                                                                                                                                                                                  
    at Object.parse (native)                                                                                                                                                                                                                     
    at Object.<anonymous> (/home/ubuntu/workspace/scratch.js:5:20)                                                                                                                                                                               
    at Module._compile (module.js:456:26)                                                                                                                                                                                                        
    at Object.Module._extensions..js (module.js:474:10)                                                                                                                                                                                          
    at Module.load (module.js:356:32)                                                                                                                                                                                                            
    at Function.Module._load (module.js:312:12)                                                                                                                                                                                                  
    at Module.runMain [as _onTimeout] (module.js:497:10)                                                                                                                                                                                         
    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)

Code is available @ codepen: http://codepen.io/rcmaples/pen/vOqzLb.js
Be warned the testData json string is exceedingly large.

rolanjose7
@rolanjose7
Aug 21 2015 14:19
guys i feel like a loser, i cant do any of the bonfires by myself
RC Maples
@rcmaples
Aug 21 2015 14:20
@rolanjose7 That doesn't mean you're a loser at all! Besides we're supposed to pair up on the bonfires and read and ask. I asked for a lot of help during the bonfires. :)
CamperBot
@camperbot
Aug 21 2015 14:20
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Owen
@owencampbell
Aug 21 2015 14:21
@rcmaples It's already a JSON object and doesn't need parsing. You'd normally use parse if you got that JSON object over as a string
rolanjose7
@rolanjose7
Aug 21 2015 14:22
@rcmaples i'm only at Bonfire: Title Case a Sentence and this and those before it i did them with somebody else's code.
RC Maples
@rcmaples
Aug 21 2015 14:23
Thank you @owencampbell and @moigithub Now I get to sift through a bazillion json props.
CamperBot
@camperbot
Aug 21 2015 14:23
rcmaples sends brownie points to @owencampbell and @moigithub :sparkles: :thumbsup: :sparkles:
:star: 130 | @owencampbell | http://www.freecodecamp.com/owencampbell
:star: 6 | @moigithub | http://www.freecodecamp.com/moigithub
RC Maples
@rcmaples
Aug 21 2015 14:23
@rolanjose7 Does their code make sense to you, can you read through it and understand what it's doing?
Moisés Man
@moigithub
Aug 21 2015 14:25
testSon.getOwnPropertyNames().forEach
Object.getOwnPropertyNames(testSon).foreach
rolanjose7
@rolanjose7
Aug 21 2015 14:25
@rcmaples yes and then i think "its so simple and i couldn't figure it out" and then i get frustrated at myself
RC Maples
@rcmaples
Aug 21 2015 14:26
@rolanjose7 I had a few bonfires that I just couldn't wrap my head around, and after hours of beating out wrong code I would go look at somones solution and do the same. But then I would study it and try to understand their thought process and the steps they took to get to their answer.
@moigithub That awkward moment when the console shows you that you called the wrong api and brought in a bunch of irrelevant data. d'oh.
rolanjose7
@rolanjose7
Aug 21 2015 14:28
@rcmaples so i shouldn't beat myself for it?
RC Maples
@rcmaples
Aug 21 2015 14:29
@rolanjose7 Not too much. ;) esp if you're studying it and taking away good principles and being able to recall something you saw earlier and make your own code with it later.
@rolanjose7 You can do it!
rolanjose7
@rolanjose7
Aug 21 2015 14:31
@rcmaples thanks for the support man. I think im gonna chill out for a little, bit listening to music and come back to coding a little later
CamperBot
@camperbot
Aug 21 2015 14:31
rolanjose7 sends brownie points to @rcmaples :sparkles: :thumbsup: :sparkles:
:star: 263 | @rcmaples | http://www.freecodecamp.com/rcmaples
Juliano Rafael
@thefrontendwizard
Aug 21 2015 14:40

Guys, I need some help here

I don't know how to make calls to an API and use the response data on a website

tinako97
@tinako97
Aug 21 2015 14:41
@julianorafael I felt your pain. I don't think freeCodeCamp prepares us for APIs. At least I didn't see it.
Juliano Rafael
@thefrontendwizard
Aug 21 2015 14:42
Yeah, I'm really suffering here
tinako97
@tinako97
Aug 21 2015 14:42
I was very frustrated too. Which one are you working on?
Juliano Rafael
@thefrontendwizard
Aug 21 2015 14:42
on the random quote machine
tinako97
@tinako97
Aug 21 2015 14:42
Have you decided on what site to work with?
Juliano Rafael
@thefrontendwizard
Aug 21 2015 14:43
the forismatic.com api
tinako97
@tinako97
Aug 21 2015 14:43
OK, I know someone who did that site. I could look at their call. Getting the call right is the hardest part.
Juliano Rafael
@thefrontendwizard
Aug 21 2015 14:44
yeah, definitely
tinako97
@tinako97
Aug 21 2015 14:44
Let me look. How much of the call do you want? The whole thing or I try to make hints out of it?
Do you want to show me what you have? @julianorafael
Juliano Rafael
@thefrontendwizard
Aug 21 2015 14:46
Ahm, I just need help with the call and how to parse to an object to use it in the page
Juliano Rafael
@thefrontendwizard
Aug 21 2015 14:47
is it really that simple? @moigithub
I just watched a tutorial a guy from HelpZiplines indicated me
the $.getJSON realy do exacly what I want it
thanks @moigithub and @tinako97
CamperBot
@camperbot
Aug 21 2015 14:49
julianorafael sends brownie points to @moigithub and @tinako97 :sparkles: :thumbsup: :sparkles:
:star: 201 | @tinako97 | http://www.freecodecamp.com/tinako97
:star: 7 | @moigithub | http://www.freecodecamp.com/moigithub
Juliano Rafael
@thefrontendwizard
Aug 21 2015 14:49
I'll try it here
tinako97
@tinako97
Aug 21 2015 14:50
I had trouble even with the documentation. Some of it was not clear to me. @julianorafael Good luck.
Donavin Northrup
@dnorthrupva
Aug 21 2015 15:05
Gooood morning.
Chris
@Shifthawke
Aug 21 2015 15:37
I've been gone for two weeks, did they release the beta as the new norm? Or is the beta site still up and running?
Logan Tegman
@ltegman
Aug 21 2015 15:39
@Shifthawke Beta site got deployed to prod and the beta site was taken down.
Chris
@Shifthawke
Aug 21 2015 15:40
Thank you for the answer. My comp is being a..... special... today. I wasn't sure if it was just being mean again. Earlier it told me yahoo.com didn't exist lol.
CamperBot
@camperbot
Aug 21 2015 15:40
if you want to thank someone, put an @ before their name!
Chris
@Shifthawke
Aug 21 2015 15:40
Yes, master bot.
fullstackquest
@fullstackquest
Aug 21 2015 15:43
Need some help with the Basic Javascript - Use Bracket Notation to Find the First Character in a String. Here my code. firstLetterOfLastName = lastName [0]; This is the message I get - Program Execution Failure
No user tests were run.
Logan Tegman
@ltegman
Aug 21 2015 15:45
@fullstackquest It looks like you put a space between the lastName variable and the [0], that could be the source of the problem.
George Tsoukatos
@Gts0uk
Aug 21 2015 15:46
how can I make the background color of a text
not to be extended
and just include the text ?
thanks
CamperBot
@camperbot
Aug 21 2015 15:46
if you want to thank someone, put an @ before their name!
fullstackquest
@fullstackquest
Aug 21 2015 15:47
@ltegman That was it! Thanks for the assist!
CamperBot
@camperbot
Aug 21 2015 15:47
fullstackquest sends brownie points to @ltegman :sparkles: :thumbsup: :sparkles:
:star: 177 | @ltegman | http://www.freecodecamp.com/ltegman
Logan Tegman
@ltegman
Aug 21 2015 15:48
@Gts0uk You’ll want to style the element the text is in. Many elements default to having padding that extends beyond the text area and this will also get colored in with the background color. You’ll want to remove any of this.
@fullstackquest Glad to hear it worked!
Donavin Northrup
@dnorthrupva
Aug 21 2015 15:52
If I uncomment the “<div class=“row”>” I’m getting a weird new “side scroll” area. I’m unfamiliar with how the grid system complete works. Any insight http://codepen.io/dnorthrupva/pen/gpNoOJ/ ?
Tod
@thermobee
Aug 21 2015 15:55
I have a question about bonfire seek and destroy. Can somebody help me out?
Calandra Zellner
@calandraz
Aug 21 2015 15:55
Is anyone having any trouble with waypoints 39 and or 40 in JavaScript? Whenever I try and work them they just seem to freeze/crash
Tod
@thermobee
Aug 21 2015 15:56
@dnorthrupva you might wanna change the color of your about section, its extremely hard to read
Logan Tegman
@ltegman
Aug 21 2015 15:56
@thermobee What do you need help with?
Donavin Northrup
@dnorthrupva
Aug 21 2015 15:56
@thermobee Yea, haha. I’m trying to just fix the placement right now, then I’ll fix the colors. I’m having bootstrap grid issues.
viznev
@viznev
Aug 21 2015 15:57
This message was deleted
Tod
@thermobee
Aug 21 2015 15:57
@ltegman the destroyer function is only receiving the arr argument so how do I call the arguments that i need to search the arr with?
viznev
@viznev
Aug 21 2015 15:57
@calandraz if the code is stuck, you'll need to clear your browser cache, else if using chrome you can just delete the local storage key
Calandra Zellner
@calandraz
Aug 21 2015 15:58
Thanks @viznev !
CamperBot
@camperbot
Aug 21 2015 15:58
calandraz sends brownie points to @viznev :sparkles: :thumbsup: :sparkles:
:star: 226 | @viznev | http://www.freecodecamp.com/viznev
viznev
@viznev
Aug 21 2015 15:58
@calandraz np!
Logan Tegman
@ltegman
Aug 21 2015 15:58
@thermobee That challenge links for the documentation for the arguments variable, which should solve that problem: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments
Tod
@thermobee
Aug 21 2015 16:01
I dont get it, but i'll read through and try to figure it out
Logan Tegman
@ltegman
Aug 21 2015 16:06
@thermobee The cliff-notes version of it is that all your arguments are availiable in the order that they were passed in as a part of the arguments array, so if you were passed the arguments [1, 2, 3, 1, 2, 3], 2, 3 then arguments[0] would be [1, 2, 3, 1, 2, 3], arguments[1] is 2 and arguments[2] is 3
Donavin Northrup
@dnorthrupva
Aug 21 2015 16:09
Anyone Bootstrap familiar? I read all the grid information but still confused about something.
Never mind, I figured it out, I’m stupid. Haha
The Container div isn’t optional.
I’m soooo good at this, haha
ulmas
@ulmas
Aug 21 2015 16:13
Hello... can someone give me a hint with Waypoint: Target a Specific Child of an Element Using jQuery

Here's my script:

<script>
$(document).ready(function() {
$(".well:nth-child(2)").addClass("animated bounce")
});
</script>

Instead of the child elements bouncing, the 2 parent ".well" DIVs are bouncing
what's the problem? Can't figure out
<script>
  $(document).ready(function() {
    $(".well:nth-child(2)").addClass("animated bounce")
  });
</script>
Here's the formatted code
J Player
@Heyjp
Aug 21 2015 16:17
I remember having the exact same issue, hopefully someone will chime in with an answer. I removed the "well" class and it worked for me.
ulmas
@ulmas
Aug 21 2015 16:17
Ok, I actually figured it out
viznev
@viznev
Aug 21 2015 16:17
This message was deleted
ulmas
@ulmas
Aug 21 2015 16:18
Apparently, ":nth-child(x)" needs to be applied to the child element class itself
Julian Fernandes
@Noblelynx
Aug 21 2015 16:20
bf mutations
CamperBot
@camperbot
Aug 21 2015 16:20

: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

Julian Fernandes
@Noblelynx
Aug 21 2015 16:20
hint
CamperBot
@camperbot
Aug 21 2015 16:20
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
ulmas
@ulmas
Aug 21 2015 16:20
i.e. the "target" is not a parent element to the n'th child of which should a class be added, but rather the "nth child with a class of 'target'"
@Heyjp I just checked, and removing ".well" actually accepts the task as completed, but that' actually a bug, i.e. it shouldn't be accepted. I will post a but to GitHub
AaronOoooo
@AaronOoooo
Aug 21 2015 16:24
Could someone help me. Not sure if I'm the right track with Bonfire: Return Largest Numbers in Arrays
function largestOfFour(arr) {
  // You can do this!
  var temp = 0;
  newArr = [];

  for (var x = 0; x < largestOfFour.length; x++)
    {
      for (var y = 0; y < largestOfFour.length; y++)
        {
          if (temp < largestOfFour[x][y])
            {
              temp = largestOfFour[x][y];
            }
        }
      newArr = newArr.push(temp);
    }
    return newArr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
CamperBot
@camperbot
Aug 21 2015 16:24
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Julian Fernandes
@Noblelynx
Aug 21 2015 16:24
no hints on mutations :( lame
largestOfFour is a function, you won't be able to check it's length with the '.length' @AaronOoooo
AaronOoooo
@AaronOoooo
Aug 21 2015 16:26
@Noblelynx Thank you! What was I thinking!
CamperBot
@camperbot
Aug 21 2015 16:26
aaronooooo sends brownie points to @noblelynx :sparkles: :thumbsup: :sparkles:
:star: 194 | @noblelynx | http://www.freecodecamp.com/noblelynx
Julian Fernandes
@Noblelynx
Aug 21 2015 16:26
use the argument as the variable to check the length
AaronOoooo
@AaronOoooo
Aug 21 2015 16:26
@Noblelynx OK, I will.
ulmas
@ulmas
Aug 21 2015 16:28
bonfire name
CamperBot
@camperbot
Aug 21 2015 16:28
no, type part of the name of the bonfire! eg bonfire roman
ulmas
@ulmas
Aug 21 2015 16:28
bonfire child
CamperBot
@camperbot
Aug 21 2015 16:28
Sorry, can't find a bonfire called child. [ Check the map? ]
ulmas
@ulmas
Aug 21 2015 16:28
waypoint child
hmm...
Julian Fernandes
@Noblelynx
Aug 21 2015 16:29
need help with a waypoint? @ulmas
@ulmas you almost have it right, try using the class for target instead of well. Remember that you added the target class to the children in the well?
@ulmas the parents are bouncing because you targeted them with the .well class (which is the parents class)
ulmas
@ulmas
Aug 21 2015 16:32
@Noblelynx yep, figured that out, thanks!
CamperBot
@camperbot
Aug 21 2015 16:32
ulmas sends brownie points to @noblelynx :sparkles: :thumbsup: :sparkles:
:star: 195 | @noblelynx | http://www.freecodecamp.com/noblelynx
Meher Chandan
@meherchandan
Aug 21 2015 16:32
hi .. need help with Waypoint: Create Bootstrap Wells?
Julian Fernandes
@Noblelynx
Aug 21 2015 16:33
:clap: @ulmas
whats the issue @meherchandan ?
Meher Chandan
@meherchandan
Aug 21 2015 16:33
let me write all condition
Joey Orlando
@joeyorlando
Aug 21 2015 16:33
bonfire Map the Debris
CamperBot
@camperbot
Aug 21 2015 16:33

:fire:Bonfire: Map the Debris :link:

function orbitalPeriod(arr) {
  var GM = 398600.4418;
  var earthRadius = 6367.4447;
  return arr;
}

orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]);

Return a new array that transforms the element's average altitude into their orbital periods.

more info:  bf details | bf links | hint

Joey Orlando
@joeyorlando
Aug 21 2015 16:34
hint
CamperBot
@camperbot
Aug 21 2015 16:34
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Meher Chandan
@meherchandan
Aug 21 2015 16:34
These are condition Add two div elements inside your div class="well"> element both with the class col-xs-6
Nest both of your div class="col-xs-6" elements within your div class="row" element.
Make sure all your div elements have closing tags.

i have wriiten <div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="well">
<div class="col-xs-6">

</div> </div>
<div class="col-xs-6"></div>

</div>
</div>

it says Nest both of your div class="col-xs-6" elements within your div class="row" element. is not correct
ulmas
@ulmas
Aug 21 2015 16:35
@meherchandan when you did this:
</div> </div>
Meher Chandan
@meherchandan
Aug 21 2015 16:36

ok ,..now made this : <div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="well">
<div class="col-xs-6">

</div> 
<div class="col-xs-6"></div></div>

</div>
</div>

but still incorrect
not sure what is wrong..:(
ulmas
@ulmas
Aug 21 2015 16:38
@meherchandan your "structure" should go like this: ".row" > ".col-xs-6" > ".well"
Julian Fernandes
@Noblelynx
Aug 21 2015 16:38
you want something to look like this :
<div row>
  <div with col-xs-6>
    <div well>
    </div> //close the well div
  </div> //close the col div
  <div with col-xs-6>
    <div well>
    </div> //close the well div
  </div>  //close the col div
</div row> //close div row
ulmas
@ulmas
Aug 21 2015 16:39
and you need to have two of thise
Julian Fernandes
@Noblelynx
Aug 21 2015 16:39
the code i wrote out is just so you get an idea of how it's nested
Meher Chandan
@meherchandan
Aug 21 2015 16:39
ok let me try again..Thanks a lot..:)
CamperBot
@camperbot
Aug 21 2015 16:39
if you want to thank someone, put an @ before their name!
ulmas
@ulmas
Aug 21 2015 16:40
@meherchandan the task says "Nest one div element with the class well within each of your col-xs-6 div elements."
so all you really need to do is, from your previous code (if you Reset it)
under the two ".col-xs-6" div's you have...
Meher Chandan
@meherchandan
Aug 21 2015 16:40
yes ..i am writing it again ..will get back if not resolved
ulmas
@ulmas
Aug 21 2015 16:41
...you need to add one new div under each, with a class "well"
Julian Fernandes
@Noblelynx
Aug 21 2015 16:41
good luck @meherchandan
Meher Chandan
@meherchandan
Aug 21 2015 16:41
thanks @ulmas @Noblelynx
CamperBot
@camperbot
Aug 21 2015 16:41
meherchandan sends brownie points to @ulmas and @noblelynx :sparkles: :thumbsup: :sparkles:
:star: 138 | @ulmas | http://www.freecodecamp.com/ulmas
:star: 196 | @noblelynx | http://www.freecodecamp.com/noblelynx
ulmas
@ulmas
Aug 21 2015 16:43
@meherchandan Try to focus on the task. Actually, when I read the individual "checkmark" descriptions, I find that that it's either confusing or misleading completely. That is probably the reason you were confused too and went the wrong path.
The 1st checkmark says "Add two div elements inside your div class="well"> element both with the class col-xs-6", and that's actually not what you need to do to accomplish the task.
I will open a bug to change the description of that checkmark to something more meaningful.
Meher Chandan
@meherchandan
Aug 21 2015 16:45
yes..still not able to clear this..

<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="col-xs-6">

</div>
<div class="col-xs-6">

</div></div>

<div class="well">
  <div class="row">
 <div class="col-xs-6">

</div>
<div class="col-xs-6">

    </div></div>

</div>
</div>

written this..
I still don't understand what it want me to do..:(
ulmas
@ulmas
Aug 21 2015 16:47
@meherchandan You are on the wrong path, don't read the checkmark descriptions, they are misleading
Meher Chandan
@meherchandan
Aug 21 2015 16:47
ok
ulmas
@ulmas
Aug 21 2015 16:47
@meherchandan Click the "Reset" button to start over
Meher Chandan
@meherchandan
Aug 21 2015 16:47
yes done..
what are the checkmark that I need to complete.?
ulmas
@ulmas
Aug 21 2015 16:48
don't worry about the checkmarks for now
@meherchandan so... all you need to do is, per the task: "Nest one div element with the class well within each of your col-xs-6 div elements."
that means, under each of your <div class="col-xs-6"> that you have, you need to add one <div> with a class "well". That's it!
Meher Chandan
@meherchandan
Aug 21 2015 16:49
oh man..done....Thanks @ulmas a lot..This exercise is too confusing and checkmark are wrong..
CamperBot
@camperbot
Aug 21 2015 16:49
meherchandan sends brownie points to @ulmas :sparkles: :thumbsup: :sparkles:
:warning: meherchandan already gave ulmas points
ulmas
@ulmas
Aug 21 2015 16:51
@meherchandan indeed it is! I've just logged a bug to fix it: #2430
...actually, here's the proper bug link: FreeCodeCamp/FreeCodeCamp#2430
Meher Chandan
@meherchandan
Aug 21 2015 16:52
ok great..
I am new here....don't know know that much processes here.
ulmas
@ulmas
Aug 21 2015 16:54
Don't worry, you are not far off. And logging bugs is not "set in stone" process. It's more like a goodwill activity to help out the project! Just like sitting in this chat :smile:
Will Moody
@willmoody
Aug 21 2015 16:54
Morning folks!
Meher Chandan
@meherchandan
Aug 21 2015 16:55
yeah ..it is..
Will Moody
@willmoody
Aug 21 2015 16:56
I'm having some difficulty with Bonfire: Truncate a string, I don't understand why this isn't correct:
function truncate(str, num) {
  // Clear out that junk in your trunk
  if (str.length >= 11) {
  var short = str.substr(0, num - 3);
  return short + "...";}
else return str;
}

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

two of the checkmarks pass, but two read
assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length) === 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is = length');should not truncate if string is = length

assert.strictEqual(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2), 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is < length');should not truncate if string is < length: expected 'A-tisket a-tasket A green and yellow baske...' to equal 'A-tisket a-tasket A green and yellow basket'

Logan Tegman
@ltegman
Aug 21 2015 17:03
@fractal-mind You hard coded the value 11 into your if condition. You should be using the num variable.
Will Moody
@willmoody
Aug 21 2015 17:03
I just realized that as you sent the message haha, d'oh
Thanks all the same, @ltegman !
CamperBot
@camperbot
Aug 21 2015 17:03
fractal-mind sends brownie points to @ltegman :sparkles: :thumbsup: :sparkles:
:star: 179 | @ltegman | http://www.freecodecamp.com/ltegman
Matt Bishop
@cmbishop
Aug 21 2015 17:11
blob
Not quite sure what the next step is here. Any suggestions?
Rex Schrader
@SaintPeter
Aug 21 2015 17:15
@cmbishop Step one: Post your code rather than a screenshot.
wiki format
CamperBot
@camperbot
Aug 21 2015 17:15

: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

Rex Schrader
@SaintPeter
Aug 21 2015 17:17
@cmbishop The problem is that you reference the same slot every time:
$('.slot')[0]  --->   $('.slot')[1] and $('.slot')[2]
Meher Chandan
@meherchandan
Aug 21 2015 17:17
@SaintPeter I think you have entered the same slot everytime
Rex Schrader
@SaintPeter
Aug 21 2015 17:18
@meherchandan It's not my code, it's @cmbishop's code.
Meher Chandan
@meherchandan
Aug 21 2015 17:18
yeah..sorry :(
Matt Bishop
@cmbishop
Aug 21 2015 17:19

'$($('.slot')[0].html('<img src = "' + images[slotOne-1] + '">');
$($('.slot')1.html('<img src = "' + images[slotTwo-1] + '">');
$($('.slot')2.html('<img src = "' + images[slotThree-1] + '">');'

I've tried this and nothing.

Meher Chandan
@meherchandan
Aug 21 2015 17:19
just realized after enterinh
Rex Schrader
@SaintPeter
Aug 21 2015 17:20
@cmbishop Prefix your code with a ```, press shift enter for a new line, paste code, shift enter, and 3 more backticks. That does look correct, though.
Meher Chandan
@meherchandan
Aug 21 2015 17:20
$($('.slot')[1].html('<img src = "' + images[slotTwo-1] + '">');
$($('.slot')[2].html('<img src = "' + images[slotThree-1] + '">');
viznev
@viznev
Aug 21 2015 17:21
@meherchandan you can edit your post if you click the ... to the right of your post (it's just to the right of the timestamp)
Meher Chandan
@meherchandan
Aug 21 2015 17:22
thanks @viznev ..I am new here so don't know conventions here
CamperBot
@camperbot
Aug 21 2015 17:22
meherchandan sends brownie points to @viznev :sparkles: :thumbsup: :sparkles:
:star: 231 | @viznev | http://www.freecodecamp.com/viznev
viznev
@viznev
Aug 21 2015 17:22
@meherchandan no problem! don't worry, I learned about it my self not too long ago :)
Meher Chandan
@meherchandan
Aug 21 2015 17:22
:D
Matt Bishop
@cmbishop
Aug 21 2015 17:23
    $($('.slot')[1].html('<img src = "' + images[slotOne-1] + '">');
    $($('.slot')[2].html('<img src = "' + images[slotTwo-1] + '">');
    $($('.slot')[3].html('<img src = "' + images[slotThree-1] + '">');
Yeah, I tried that and still nothing.
CamperBot
@camperbot
Aug 21 2015 17:23
:bulb: to format code use backticks! ``` more info
Matt Bishop
@cmbishop
Aug 21 2015 17:26
And thanks for giving me the rundown on formatting, by the way.
CamperBot
@camperbot
Aug 21 2015 17:26
if you want to thank someone, put an @ before their name!
Meher Chandan
@meherchandan
Aug 21 2015 17:26
@cmbishop I have just tried same exercise with same code ..and its working
Matt Bishop
@cmbishop
Aug 21 2015 17:27
Hmmm... I haven't changed anything else with the rest of the code.
I was having issues with the Waypoint before this one as well.
Rex Schrader
@SaintPeter
Aug 21 2015 17:27
@cmbishop Arrays are zero based indexs
@cmbishop You are going 1, 2, 3 - it needs to be 0, 1, 2
Meher Chandan
@meherchandan
Aug 21 2015 17:28
This is the code that I used ```
$($('.slot')[0]).html('<img src = "' + images[slotOne-1] + '">');
$($('.slot')[1]).html('<img src = "' + images[slotTwo-1] + '">');
$($('.slot')[2]).html('<img src = "' + images[slotThree-1] + '">');
``` 
grets311
@emh1010
Aug 21 2015 17:28
@cmbishop try starting at 0 instead of 1
Matt Bishop
@cmbishop
Aug 21 2015 17:32
    $($('.slot')[0].html('<img src = "' + images[slotOne-1] + '">');
    $($('.slot')[1].html('<img src = "' + images[slotTwo-1] + '">');
    $($('.slot')[2].html('<img src = "' + images[slotThree-1] + '">');
I've tried that as well... still nothing.
Rex Schrader
@SaintPeter
Aug 21 2015 17:34
@cmbishop Try refreshing your page.
@cmbishop because I just did a byte for byte comparison and that exactly matches my code.
Meher Chandan
@meherchandan
Aug 21 2015 17:34
yes..because its working on my machine ..
Matt Bishop
@cmbishop
Aug 21 2015 17:35
Nope - it just doesn't like it. I guess it's a skip, then?
DTing
@dting
Aug 21 2015 17:38
@cmbishop you took out a )

@cmbishop

$($('.slot')[0].html(

should be

$($('.slot')[0]).html(
for each of them
Matt Bishop
@cmbishop
Aug 21 2015 17:39
Wow. Alright then - thanks for your help @dting and everyone else!
CamperBot
@camperbot
Aug 21 2015 17:39
:star: 516 | @dting | http://www.freecodecamp.com/dting
cmbishop sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
Will Moody
@willmoody
Aug 21 2015 17:39

I can't seem to get .slice() to work in Bonfire: Chunky Monkey?

function chunk(arr, size) {
  // Break it up.
  arr.slice(1, 3);
  return arr;

}

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

returns
["a","b","c","d"]

I've sliced a thousand things already, I feel like I'm missing something that's keeping this from working as intended?

DTing
@dting
Aug 21 2015 17:40
@fractal-mind you need to iterate over the original array to return chunks of size argument[1];
Will Moody
@willmoody
Aug 21 2015 17:41
@dting Ahhh, gotcha, don't know how I didn't think of that, haha. Thanks!
CamperBot
@camperbot
Aug 21 2015 17:41
fractal-mind sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 517 | @dting | http://www.freecodecamp.com/dting
Pranav Doshi
@pranavdoshi
Aug 21 2015 17:48
Hey guys I am facing a serious issue the javascript challenges when I press run the code on my laptop nothing happens even after severaltimes of pressing whereas if I access on my mobile device then it works this I tested in ie and chrome both are having same prob.
Sandeep Lakka
@asandyz
Aug 21 2015 17:49
which browser are you using?
Pranav Doshi
@pranavdoshi
Aug 21 2015 17:49
image.png
this is problem
@asandyz chrome
and ie
Sandeep Lakka
@asandyz
Aug 21 2015 17:50
can u post link of that waypoint here please
Pranav Doshi
@pranavdoshi
Aug 21 2015 17:50
k
hey this was with all js challenges
until now I completed my challenges through the mobile device