These are chat archives for FreeCodeCamp/Help

25th
Sep 2015
Rex Schrader
@SaintPeter
Sep 25 2015 00:00
@EmotionlessRock Ask for help, ask for support, just don't give up. You can do it!
EmotionlessRock
@EmotionlessRock
Sep 25 2015 00:01
Got it! Thanks
CamperBot
@camperbot
Sep 25 2015 00:01
if you want to thank someone, put an @ before their name!
Tyler Moeller
@TylerMoeller
Sep 25 2015 00:27
Can anyone help me understand how to better to escape this question mark before text= in this url? This is working now, but I have no idea why the \tt before it helps. I'm guessing there's a better way...
var tweetQuote = "<a target=\"_blank\" href=\"https://twitter.com/intent/twee\tt" + "?text=" + shareUrl + "\"><img class=\"shareQuote\" src=\"http://i.imgur.com/Mq6wXgJ.png\"></a>";
finished url would be:
<a target="_blank" href="https://twitter.com/intent/tweet/?text=shareUrl><img class="shareQuote" src="http://i.imgur.com/Mq6wXgJ.png"></a>
where shareUrl is the text content I'm sending in the tweet.
Rex Schrader
@SaintPeter
Sep 25 2015 00:42
@TylerMoeller I don't understand this: twee\tt" + "?text= Why do you have that extra backslash in there? It should just be:
tweet?text=
Tyler Moeller
@TylerMoeller
Sep 25 2015 00:43
without the \tt I get an error because the ? isn't escaped
No idea why that works though...just playing around and got it to work by putting the backslash there
Rex Schrader
@SaintPeter
Sep 25 2015 00:44
@TylerMoeller As far as I know, there is no reason to have ? escaped at all.
@TylerMoeller What might be easier would be to use single quotes for the overall string, so you don't have to escape your double-quotes.
@TylerMoeller
var tweetQuote = '<a target="_blank" href="https://twitter.com/intent/tweet?text=' + shareUrl + '"><img class="shareQuote" src="http://i.imgur.com/Mq6wXgJ.png"></a>';
Tyler Moeller
@TylerMoeller
Sep 25 2015 00:46
That gives me all sorts of errors if I don't escape the double quotes
Rex Schrader
@SaintPeter
Sep 25 2015 00:47
@TylerMoeller Are you sure you don't have an open quote from a prior line?
Tyler Moeller
@TylerMoeller
Sep 25 2015 00:47
Let me try it on a clean pen, brb
Rex Schrader
@SaintPeter
Sep 25 2015 00:48
@TylerMoeller https://repl.it/BKmQ
Works for me
Tyler Moeller
@TylerMoeller
Sep 25 2015 00:48
Yeah, works on a clean pen. Maybe something to do with the ajax ??
function getQuote() {
  $.ajax({
    url: "http://api.forismatic.com/api/1.0/",
    jsonp: "jsonp",
    dataType: "jsonp",
    data: {
      method: "getQuote",
      lang: "en",
      format: "jsonp"
    },
    success: function(data) {
      // only accept quotes of 115 chars or less so tweets don't get truncated
      // max = 140 - 22chars for url - 2 spaces and a tilde = 115
      if ((data.quoteText.length + data.quoteAuthor.length) > 115) {
        getQuote();
        return;
      }
      //format URLs
      var authorWiki = "<a target=\"_blank\" href=\"https://wikipedia.org/wiki/" + data.quoteAuthor + "\"><i class=\"authorWiki fa fa-2x fa-wikipedia-w fa-inverse\"></i></a>";
      var shareUrl = encodeURIComponent(data.quoteText + "~" + data.quoteAuthor) + " http://s.codepen.io/TylerMoeller/debug/WQGjvO";
      var shareQuote = "<a target=\"_blank\" href=\"https://twitter.com/intent/tweet" + "?text=" + shareUrl + "\"><img class=\"shareQuote\" src=\"http://i.imgur.com/Mq6wXgJ.png\"></a>";

      //populate html
      document.getElementById("quote").innerHTML = data.quoteText;
      document.getElementById("shareQuote").innerHTML = shareQuote;
      //handle null authors
      if (data.quoteAuthor.length === 0) {
        document.getElementById("author").innerHTML = "~ Anyonymous";
        document.getElementById("authorWiki").innerHTML = "<a href=\"http://wikipedia.org/wiki/anonymous\"><i class=\"authorWiki fa fa-2x fa-wikipedia-w fa-inverse\"></i></a>";
      } else {
        document.getElementById("author").innerHTML = "~ " + data.quoteAuthor;
        document.getElementById("authorWiki").innerHTML = authorWiki;
      }

    }
  });
}
I got rid of the \t and it's working now. Adding the twitter widget code helped. Still need to escape the quotes though.
Rex Schrader
@SaintPeter
Sep 25 2015 00:51
@TylerMoeller More likely an open quote or semicolon
Tyler Moeller
@TylerMoeller
Sep 25 2015 00:51
Okay, I'll keep trying to hunt it down. Thanks @SaintPeter
CamperBot
@camperbot
Sep 25 2015 00:51
tylermoeller sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 723 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Sep 25 2015 00:53
@TylerMoeller I strongly advise AGAINST using the twitter widget code. The problem with it is that it generates an iframe and CANNOT be altered once produced. That means your get quote button is going not going to be able to work. Just roll your own button (like with a Font Awesome twitter icon) and use the Twitter Intent Tweet URL.
Tyler Moeller
@TylerMoeller
Sep 25 2015 00:54
I'm just using their js code for a modal - using a twitter icon for the link. http://codepen.io/TylerMoeller/pen/WQGjvO
The FontAwesome icon gets blocked by AdBlock, so I had to use one of the logos and rename it so it didn't include the word "twitter"
Rex Schrader
@SaintPeter
Sep 25 2015 00:56
@TylerMoeller Nice - that seems to work well. I like the growing animation on mouseover.
Star Cherrix
@Sparklepaws
Sep 25 2015 00:57
Hey friends! So, as apart of the portfolio zipline I've written a JS code to help with a certain specific feature I noticed on the example page. I'm a little scared it might be too memory intensive, so I'm looking for feedback:
window.addEventListener("resize", function(e){
    if(window.innerWidth < 1000){
        $("#txtprim").css({"font-size": "40px"})
    } else if(window.innerWidth > 1000){
        $("#txtprim").css({"font-size": "70px"})
    }
});
Tyler Moeller
@TylerMoeller
Sep 25 2015 00:57
Thanks again. :)
CamperBot
@camperbot
Sep 25 2015 00:57
if you want to thank someone, put an @ before their name!
Rex Schrader
@SaintPeter
Sep 25 2015 00:57
@TylerMoeller Looks like you fixed it? Anyway, I really dig the Wikipedia link for the author, although I don't know that it's readily obvious what that is. Maybe use the "puzzle globe" image instead?
@Sparklepaws You know you can do the same thing with @media queries in CSS, no javascript required?
Tyler Moeller
@TylerMoeller
Sep 25 2015 00:58
@SaintPeter The globe looked really ugly :) I tried it out. Will have to think about these - maybe put them in a semi-transparent jumbotron to show that they are clickable
Rex Schrader
@SaintPeter
Sep 25 2015 00:58
@TylerMoeller Haha - I just don't know that the W is widely recognized. Maybe better to make the author a clickable link?
Star Cherrix
@Sparklepaws
Sep 25 2015 00:59
@SaintPeter Would that be a better option?
Rex Schrader
@SaintPeter
Sep 25 2015 00:59
@Sparklepaws As for that specific code, that'll be fine and not take too much memory or whatever.
Tyler Moeller
@TylerMoeller
Sep 25 2015 00:59
@SaintPeter That's a good idea too.
Rex Schrader
@SaintPeter
Sep 25 2015 01:00
@Sparklepaws Yes. Doing it in CSS is almost always preferable. CSS3 is designed to work at multiple sizes and solve this exact problem.
Star Cherrix
@Sparklepaws
Sep 25 2015 01:00
@SaintPeter Jeeze so much has changed since I last picked up a CSS book years ago, that's some nifty power. I'll look into the media queries, thanks a ton!
CamperBot
@camperbot
Sep 25 2015 01:00
sparklepaws sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 724 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Sep 25 2015 01:01
@Sparklepaws You bettcha!
Tyler Moeller
@TylerMoeller
Sep 25 2015 01:01
@Sparklepaws If you want font sizes to scale across screens, try using em units instead. font-size: 1.4em
may not need any css in that case
okay - back to work. givepizza @Sparklepaws
lol
Rex Schrader
@SaintPeter
Sep 25 2015 01:02
@Sparklepaws http://www.w3schools.com/cssref/css_units.asp - rem, vh or vw may be helpful units as well.
Star Cherrix
@Sparklepaws
Sep 25 2015 01:02
@TylerMoeller Actually I was using VH and VW, but EMs worked as well. The thing is, I'm not looking to scale based on percentages, I'm looking to switch the text size abruptly when it goes below a certain screen width =3
Rex Schrader
@SaintPeter
Sep 25 2015 01:03
@Sparklepaws Then media queries are absolutely the way to go.
Star Cherrix
@Sparklepaws
Sep 25 2015 01:03
@SaintPeter Perfect, I'll go see if I can dig up info and write something up.
Rex Schrader
@SaintPeter
Sep 25 2015 01:04
I just to say :sparkles: @Sparklepaws :sparkles:
Star Cherrix
@Sparklepaws
Sep 25 2015 01:05
Haha
Star Cherrix
@Sparklepaws
Sep 25 2015 01:17
The working result using media queries:
@media (max-width: 1000px){
    #txtprim {
    font-size: 40px;
    }
}
@media (min-width: 1001px){
    #txtprim {
    font-size: 70px;
    }
}
Rex Schrader
@SaintPeter
Sep 25 2015 01:26
@Sparklepaws Sweet!
Derrick
@Derricksr
Sep 25 2015 01:32
js if
find js
CamperBot
@camperbot
Sep 25 2015 01:34

find js

:zero: js fundamental
:one: js resources
:two: zipline use the twitchtv json api
:three: js arguments
:four: js closures
:five: js falsey
:six: js filter
:seven: js for in
:eight: js for of
:nine: js for
:one::zero: js immutable
:one::one: js indexof
:one::two: js loops
:one::three: js map
:one::four: js regex
:one::five: js slice
:one::six: js ternary
:one::seven: js truthy
:one::eight: js undefined
:one::nine: jsonp

limited to first 20 entries.
type find js again for more enteries.

Derrick
@Derricksr
Sep 25 2015 01:35
find js
CamperBot
@camperbot
Sep 25 2015 01:35

find js

more enteries:

:two::zero: testingjson
:two::one: wiki js template

Mark Puetz
@Funkybunch2006
Sep 25 2015 01:47
Beginner trying to change color of h2 text with style tag. Copied the example exactly (but with the specified color) and I'm getting nothing
google no help
<h2style="color:red">CatPhotoApp</h2>
Tyler Moeller
@TylerMoeller
Sep 25 2015 01:48
You need a space after h2
Mark Puetz
@Funkybunch2006
Sep 25 2015 01:48
Jezzus. Couldn't see it cuz it split onto a new line
thanks
CamperBot
@camperbot
Sep 25 2015 01:48
if you want to thank someone, put an @ before their name!
Tyler Moeller
@TylerMoeller
Sep 25 2015 01:49
np
Mark Puetz
@Funkybunch2006
Sep 25 2015 01:49
CamperBot
@camperbot
Sep 25 2015 01:49
if you want to thank someone, put an @ before their name!
Tyler Moeller
@TylerMoeller
Sep 25 2015 01:49
:smile:
x34passenger
@x34passenger
Sep 25 2015 02:01
My code for Bonfire: Sorted Union is causing the page to freeze or lock up, is it a bug I should report?
DJ
@qualitymanifest
Sep 25 2015 02:03
@x34passenger idk man sounds like you have an infinite loop
i.e. not a bug
you wanna copy & paste it?
Aaron Markle
@aaronmarkle
Sep 25 2015 02:04
a lot of activity here tonight
x34passenger
@x34passenger
Sep 25 2015 02:04
@qualitymanifest
function unite(arr1, arr2, arr3) 
{
  var combinedArr = arr1.concat(arr2);
  combinedArr = combinedArr.concat(arr3);
  var endVal = combinedArr.length - 1;
  var endItem = combinedArr[endVal];

  //console.log(endVal);
  var counter = 0;
  var totalIteration = combinedArr.length * (combinedArr.length - 1);
  var totalIterator = 0;
  while(totalIterator != totalIteration)
  {
      if( endItem == combinedArr[counter] )
      {
        combinedArr.splice(endVal, 1);
        counter = 0;
        endVal = combinedArr.length - 1;
        endItem = combinedArr[combinedArr.length - 1];
        totalIteration = combinedArr.length * (combinedArr.length - 1);
        totalIterator++;
      }
      else
      {
        counter++;
        if( counter == endVal )
        {
          endVal = counter - 1;
          counter = 0;

          endItem = combinedArr[endVal];
          totalIteration = ( combinedArr.length - 1 )* ( combinedArr.length - 2 );
        }
        totalIterator++;
      }
  }
  return combinedArr;
}
DJ
@qualitymanifest
Sep 25 2015 02:06
@x34passenger hmm.. i ran it in repl.it and it did went fine..
x34passenger
@x34passenger
Sep 25 2015 02:06
@qualitymanifest Yes it does fine for me as well outside of the free code camp webpage
Mateja Trifunovski
@Matko95
Sep 25 2015 02:07
bf sorted union
CamperBot
@camperbot
Sep 25 2015 02:07

:fire:Bonfire: Sorted Union :link:

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

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

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

more info:  bf details | bf links | hint

x34passenger
@x34passenger
Sep 25 2015 02:07
@qualitymanifest can you try submitting in your free code camp page for sorted union, does it freeze or lock up the page?
Mateja Trifunovski
@Matko95
Sep 25 2015 02:08
@x34passenger the result is bad though
Leonardo Ernesto
@leercampusano
Sep 25 2015 02:08
Hi, can someone help me with this bonfire: Bonfire: Check for Palindromes
x34passenger
@x34passenger
Sep 25 2015 02:08
@Matko95 I ran the code in my personal code editor, but when I try to run the tests on the free code camp webpage, it causes the to lock up
DJ
@qualitymanifest
Sep 25 2015 02:08
@x34passenger wait, no. it locks up on test unite([1, 2, 3], [5, 2, 1]), [1, 2, 3, 5]
x34passenger
@x34passenger
Sep 25 2015 02:09
@qualitymanifest I will try to run that test
DJ
@qualitymanifest
Sep 25 2015 02:09
i tried them individually on repl.it and it was fine until that one
so sounds like totalIterator != totalIteration is never happening on that one for some reason. aside from that i haven't gotten to that bonfire yet so i can't really help
Mateja Trifunovski
@Matko95
Sep 25 2015 02:10
why does that test contain a ")" after the second array?
x34passenger
@x34passenger
Sep 25 2015 02:10
@qualitymanifest good information though
thanks @qualitymanifest
CamperBot
@camperbot
Sep 25 2015 02:10
x34passenger sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 228 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
DJ
@qualitymanifest
Sep 25 2015 02:11
@Matko95 they're all like that. here's another unite([1, 3, 2], [1, [5]], [2, [4]]), [1, 3, 2, [5], [4]]
i think the ones inside the parens are the inputs and the last one outside the parens is the expected output
Don Price
@KingHippo
Sep 25 2015 02:14
I'm working on Bonfire: Chunky Monkey and wondering if my logic headed in the right direction.
function chunk(arr, size) {
  // Break it up.
  var groupArray = [[],[]];
  for(i in arr) {
    while(i < size) {
      groupArray.push([[i],[]]);
    } if (i > size) {
      groupArray.push([[],[i]]);
    }
  }
  return groupArray;

}

chunk(["a", "b", "c", "d"], 2, "");
x34passenger
@x34passenger
Sep 25 2015 02:22
What is the difference between == comparison and === in javascript?
Mandeep Singh
@MandeepMann
Sep 25 2015 02:22
<style>
.red-text {
color: red;
}

p {
font-size: 16px;
font-family: Monospace;
}
h2{font-family:lobster} href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">;
</style>
is this the right way of doing it ? i am a beginner p
Andrés Del Carpio
@AndrsDC
Sep 25 2015 02:24

@x34passenger == tests for value only.

"3" == 3 // true

=== test for value and type

"3" === 3 // false

Mateja Trifunovski
@Matko95
Sep 25 2015 02:25
@MandeepMann you mean adding the lobster font?
Mandeep Singh
@MandeepMann
Sep 25 2015 02:26
yes , I mean am i adding it right ?
Mateja Trifunovski
@Matko95
Sep 25 2015 02:26
@MandeepMann nope, It doesn't go in the style tag, well it could, but not like that, you are supposed to use a <link> element
@MandeepMann <link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"> something like this
put it below your style tag
Mandeep Singh
@MandeepMann
Sep 25 2015 02:27
ok but does it need to be in between any tag or just like that ?
Mateja Trifunovski
@Matko95
Sep 25 2015 02:28
it usually stays in the <head></head> which you don't have
but just put it under the </style>
Mandeep Singh
@MandeepMann
Sep 25 2015 02:29
@Matko95 Got it, Thank you very much
CamperBot
@camperbot
Sep 25 2015 02:29
mandeepmann sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 370 | @matko95 | http://www.freecodecamp.com/matko95
Andrés Del Carpio
@AndrsDC
Sep 25 2015 02:31
I'm a bit stuck on Bonfire: Falsy Bouncer
My code:
function bouncer(arr) {
  function value(val) {
      return val !== false && val !== null && val !== 0 && val !== "" && val !== undefined && isNaN(arr) !== false;
  }
  arr = arr.filter(value);

  return arr;
}

bouncer([7, "ate", "", false, 9]);    // [7, "ate", 9]
bouncer(["a", "b", "c"]);            // ["a", "b", "c"]
bouncer([false, null, 0]);            // []
Trevor Old
@Frogz1
Sep 25 2015 02:32
Hey can anyone take a look at this and help me debug the white spot that occurs at the top on different browser sizes and also why my "About" and "Portfolio" nav buttons dont jump to that section after i've scrolled to the bottom http://s.codepen.io/Frogz1/debug/ZbYywP?
x34passenger
@x34passenger
Sep 25 2015 02:32
thanks @adc39
CamperBot
@camperbot
Sep 25 2015 02:32
x34passenger sends brownie points to @adc39 :sparkles: :thumbsup: :sparkles:
:star: 185 | @adc39 | http://www.freecodecamp.com/adc39
Andrés Del Carpio
@AndrsDC
Sep 25 2015 02:32
but the notification tells me "[false, null, 0] should return [].: expected [ NaN ] to deeply equal []
"
x34passenger
@x34passenger
Sep 25 2015 02:33
thanks @adc39
CamperBot
@camperbot
Sep 25 2015 02:33
x34passenger sends brownie points to @adc39 :sparkles: :thumbsup: :sparkles:
:warning: x34passenger already gave adc39 points
Andrés Del Carpio
@AndrsDC
Sep 25 2015 02:33
sure no prob! don't need to say it again
Mateja Trifunovski
@Matko95
Sep 25 2015 02:34
@Frogz1 could you post the full page pen, so we could look at the code?
Trevor Old
@Frogz1
Sep 25 2015 02:34
I believe I did
Mateja Trifunovski
@Matko95
Sep 25 2015 02:34
you sent the debug version
oh you sent both, sorry :)
Trevor Old
@Frogz1
Sep 25 2015 02:35
All good , looks like there is an auto margin-bottom from bootstrap nav bar i may have to override from main channel ppl are looking at it there as well
Mateja Trifunovski
@Matko95
Sep 25 2015 02:38
@Frogz1 i think it won't scroll back , since it stays in the same position
they are overlapping each other
Trevor Old
@Frogz1
Sep 25 2015 02:38
@Matko95 bu tyou can do it with home
@Matko95 you can go back to home , and it should be moving the scrollbar
Mateja Trifunovski
@Matko95
Sep 25 2015 02:39
@Frogz1 home is above them
Trevor Old
@Frogz1
Sep 25 2015 02:39
@Matko95 yes and so are portfolio and about?
@Matko95 the only one that works after scrolling to bottom is home
Mateja Trifunovski
@Matko95
Sep 25 2015 02:40
@Frogz1 I'm not sure how your scroll works though, where did you define it?
Trevor Old
@Frogz1
Sep 25 2015 02:40
@Matko95 I'm using scrollmagic api
@Matko95 I'm using a global triggerhook set at 0.09
Jacob
@ILoveEngineering
Sep 25 2015 02:47
I need help
Mateja Trifunovski
@Matko95
Sep 25 2015 02:47
hmmm guess you'll have to look at some scrollmagic link @Frogz1 it doesn't even scroll with jquery
Jacob
@ILoveEngineering
Sep 25 2015 02:47
I am begginning html, and I don't understand what the first few words of "kitty ispum text" are.
Trevor Old
@Frogz1
Sep 25 2015 02:47
@ILoveEngineering placeholder text
Jacob
@ILoveEngineering
Sep 25 2015 02:48
I understand that, but what am i supposed to put in my p element?
Mateja Trifunovski
@Matko95
Sep 25 2015 02:48
just copy everthing
Jacob
@ILoveEngineering
Sep 25 2015 02:48
ok
Mateja Trifunovski
@Matko95
Sep 25 2015 02:48
or a first few words
Jacob
@ILoveEngineering
Sep 25 2015 02:48
THANKS
CamperBot
@camperbot
Sep 25 2015 02:48
if you want to thank someone, put an @ before their name!
Jacob
@ILoveEngineering
Sep 25 2015 02:48
@Matko95 THANKS
CamperBot
@camperbot
Sep 25 2015 02:48
iloveengineering sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 372 | @matko95 | http://www.freecodecamp.com/matko95
John Oksasoglu
@oksas
Sep 25 2015 02:58
I'm having some trouble with bonfire: symmetric difference
assert.sameMembers(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]), [1, 4, 5])
Mateja Trifunovski
@Matko95
Sep 25 2015 02:59
@oksas what is it?
John Oksasoglu
@oksas
Sep 25 2015 02:59
this is one of the tests in the bonfire, and clearly 5 is in all 3 arrays that are passed in to the function. but it's saying that 5 should be part of the solution array???
Rory Smith
@alanbuchanan
Sep 25 2015 03:00
@oksas did you watch the video they provide? because that explains it
John Oksasoglu
@oksas
Sep 25 2015 03:00
I wikipedia'd it instead haha. oops. alright I'll check that out
Rory Smith
@alanbuchanan
Sep 25 2015 03:00
@oksas after the first two youre left with [1, 3]
then test [1,3] to [3, 4, 5]
Mateja Trifunovski
@Matko95
Sep 25 2015 03:01
@oksas So.. when we have 3 or more arrays, first we do symDiff for [1,2,5] and [2,3,5] which gives us [1,3] then we do symDiff for [1,3] and [3,4,5] which gives us [1,4,5]
x34passenger
@x34passenger
Sep 25 2015 03:01
In Bonfire: Sorted Union, how do you handle higher number of arguments if the given arguments are already preset to handle only 3 arguments?
Mateja Trifunovski
@Matko95
Sep 25 2015 03:01
bf sorted union
CamperBot
@camperbot
Sep 25 2015 03:01

:fire:Bonfire: Sorted Union :link:

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

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

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

more info:  bf details | bf links | hint

John Oksasoglu
@oksas
Sep 25 2015 03:01
ahhh. ok, didn't realize that. so test it sort of two at a time, rather than all at once? many thanks @Matko95 @alanbuchanan
CamperBot
@camperbot
Sep 25 2015 03:01
oksas sends brownie points to @matko95 and @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 377 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
:star: 373 | @matko95 | http://www.freecodecamp.com/matko95
Mateja Trifunovski
@Matko95
Sep 25 2015 03:02
@oksas yep, 1 by 1
navicyclical
@navicyclical
Sep 25 2015 03:05
@abhisekp what is a general solution?
Rory Smith
@alanbuchanan
Sep 25 2015 03:05
@oksas it's not really that youre testing two at a time, more like, if there are more than 2 args, do extra stuff :D
John Oksasoglu
@oksas
Sep 25 2015 03:07
ah. ok. perhaps that would be a better way to approach modifying my algorithm, then. thank ye kindly
CamperBot
@camperbot
Sep 25 2015 03:07
if you want to thank someone, put an @ before their name!
Andrés Del Carpio
@AndrsDC
Sep 25 2015 03:32
bf falsy bouncer
CamperBot
@camperbot
Sep 25 2015 03:32
Sorry, can't find a bonfire called falsy bouncer. [ Check the map? ]
jjvanhan
@jjvanhan
Sep 25 2015 03:42
I wrote a function that doesn't work as expected. Basically, I want the function to do the following:
function displayEventsInGroups(numGroups) {
var obj = new Object();
var count = 0
for (var i = 0; i < 1000; i++) {
var x = Math.floor(Math.random() 1000);
for (var j = 0; j < numGroups; j++) {
if ((x >= j
1000/numGroups) && (x < (j*1000/numGroups + 1000/numGroups))) {
obj[j] = {group: count = count + 1};
}
}
}
console.log(obj);
}
displayEventsInGroups(10);
Athul Ganesh
@athul777
Sep 25 2015 03:44
hi, can anyone help me with this waypoint - Waypoint: Make Object Properties Private
I don't understand what the question is asking

We can also create private properties and private methods, which aren't accessible from outside the object.

To do this, we omit the word this from the property or method declaration.

See if you can keep myBike.speed and myBike.addUnit private, while making myBike.getSpeed publicly accessible.

this is what the instructions said
but i'm not sure how to make something in an object accessible publicly
//Let's create an object with a two functions. One attached as a property and one not.
var Car = function() {
  this.gear = 1;
  function addStyle(styleMe){
    return 'The Current Gear Is: ' + styleMe;
  }
  this.getGear = function() {
    return addStyle(this.gear);
  };
};

var Bike = function() {
  // Only change code below this line.
  speed = 100;
  function addUnit(value) {
    return value + "KM/H";
  }

  getSpeed = function () {
    return addUnit(speed);
  };

};

// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();

if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};
this is the code
Risle
@Risle
Sep 25 2015 03:49
@athul777 It's just the opposite: place 'this.' before a property to make it accessible outside the object.
Athul Ganesh
@athul777
Sep 25 2015 03:50
ah, ok, thanks @Risle . But why is that? Why is it that if you add a this, it becomes accessible outside the object?
CamperBot
@camperbot
Sep 25 2015 03:50
athul777 sends brownie points to @risle :sparkles: :thumbsup: :sparkles:
:star: 204 | @risle | http://www.freecodecamp.com/risle
Risle
@Risle
Sep 25 2015 03:54
@athul777 'this.' acts as a sort of variable. If you don't add it, 'this' automatically is defined as the object that the property is a member of. By adding 'this.' before a property, it's like declaring a variable for an object.
Athul Ganesh
@athul777
Sep 25 2015 03:57
but why is it that if you don't add 'this' and declare a new object and try to get the property, it displays undefined? Shouldn't it still return speed anyway?
jjvanhan
@jjvanhan
Sep 25 2015 04:07

function displayEventsInGroups(numGroups) {
    var obj = new Object();
    var count = 0
    for (var i = 0; i < 1000; i++) {
        var x = Math.floor(Math.random() * 1000);
        for (var j = 0; j < numGroups; j++) {
            if ((x >= j*1000/numGroups) && (x < (j*1000/numGroups + 1000/numGroups))) {
                obj[j] = {group: count = count + 1};
            }
        }    
    }
    console.log(obj);
}
displayEventsInGroups(10);
Any idea why my function fails? I want the function to generate a random number from 0 to 1000, and depending on whether that number is in the range 0-100, 100-200, 200-300, ..., or 900-1000, update a counter variable stored as an object property value (each range has its corresponding object property). I want this to happen a total of 1000 times. I expect that the result would be a count value of around 100 for each group range, but I get 10X this amount...
Risle
@Risle
Sep 25 2015 04:08
@athul777 Sure, you can access the value of the property (in this case, object's speed --> 'return object.speed') but you can't construct a new property with new values.
Athul Ganesh
@athul777
Sep 25 2015 04:09
ah, ok, I think I get it now. Thanks @Risle
CamperBot
@camperbot
Sep 25 2015 04:09
athul777 sends brownie points to @risle :sparkles: :thumbsup: :sparkles:
:warning: athul777 already gave risle points
OverTheNeptune
@OverTheNeptune
Sep 25 2015 04:20
@jjvanhan It looks like your count variable is being incremented on every iteration of your 'for' loop and each time, the incremented value is being assigned to which ever group the current random number is assigned to.
Abhisek Pattnaik
@abhisekp
Sep 25 2015 04:42
@navicyclical a general soln. regex would look like this /[^A-Za-z0-9]/gi or /[\W_]/gi
Matt Anderson
@MDAWebDev
Sep 25 2015 04:45
For those of you who have applied for and/or gotten the front end dev certificate, how long did it take between filling out the form and hearing anything back?
jjvanhan
@jjvanhan
Sep 25 2015 04:53
@OverTheNeptune Yeah I think you're right, thanks!
CamperBot
@camperbot
Sep 25 2015 04:53
jjvanhan sends brownie points to @overtheneptune :sparkles: :thumbsup: :sparkles:
:star: 204 | @overtheneptune | http://www.freecodecamp.com/overtheneptune
navicyclical
@navicyclical
Sep 25 2015 05:03
@abhisekp dude, that worked!
thanks @abhisekp
CamperBot
@camperbot
Sep 25 2015 05:03
navicyclical sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 469 | @abhisekp | http://www.freecodecamp.com/abhisekp
aeroldb
@aeroldb
Sep 25 2015 05:03
chunky monkey :(
function chunk(arr, size) {

  var splittedArray = [];

  for(var i=0; i<arr.length; i+=size)
  {
    return splittedArray.push(arr.slice(i, i + size));
  }
}

chunk(["a", "b", "c", "d"], 2, "");
Abhisek Pattnaik
@abhisekp
Sep 25 2015 05:04
@navicyclical i shouldn't have done that. :(
You should've found the answer after reading about RegEx
explain regex
CamperBot
@camperbot
Sep 25 2015 05:04

:point_right: js regex [wiki]

Links to useful RegEx resources.

See also: :clipboard: Tutorials | :syringe: Testing | :soccer: Games | :newspaper: Blogs | :package: Software

:pencil: read more about js regex on the FCC Wiki

Abhisek Pattnaik
@abhisekp
Sep 25 2015 05:04
@navicyclical :point_up: September 25, 2015 10:34 AM
lonirose
@lonirose
Sep 25 2015 05:05
Can I get a hint on Bonfire: Reverse a String
This is my code:
function reverseString(str) {
  return str;

}

reverseString("hello", "");
var strReverse = str.split('').reverse('').join('');
aeroldb
@aeroldb
Sep 25 2015 05:05
yeah
@lonirose you need to put your code inside the function...
@lonirose you're code is outside of the function scope...
lonirose
@lonirose
Sep 25 2015 05:06
@aerb199 Okay I just did that but still not working
aeroldb
@aeroldb
Sep 25 2015 05:06
your code?
@lonirose dont forget to return the variable you just made =)
lonirose
@lonirose
Sep 25 2015 05:07
@aerb199 Okay let me try, be back
aeroldb
@aeroldb
Sep 25 2015 05:09
@lonirose , you got it right your error is here.
str.split('').reverse('').join('');
lonirose
@lonirose
Sep 25 2015 05:16
@aerb199 did I write my methods right?
aeroldb
@aeroldb
Sep 25 2015 05:17
@lonirose , you did except for reverse. should be an empty method
lonirose
@lonirose
Sep 25 2015 05:24
@aerb199
sorry still confused by this
function reverseString(str) {
  return str;
var strReverse = str.split('').reverse().join('');
}

reverseString("hello", "");
reverseString(strReverse);
@ aerb199 I really don't know why I just went through the waypoint lessons and I've been looking at the articles in this bonfire lesson
navicyclical
@navicyclical
Sep 25 2015 05:29
@abhisekp I admit, I also looked it up on MDN's JS documentation
\W takes care of non-word characters
SojournerOctocat
@SojournerOctocat
Sep 25 2015 05:33
This message was deleted
Jose E. Pimentel
@jedpimentel
Sep 25 2015 05:33
@lonirose you're returning the same input value. You will also have to move the return statement under where 'str' is processed into strReverse (that line doesn't really run since there's a return before it)
also, the line "reverseString(strReverse); " will cause an error/issue, since strReverse is not defined outside the reverseString function
reverseString("hello", ""); is the same as reverseString("hello");, since the function was defined with a single input, it will just ignore the second input instead of causing an issue (mostly since JS supports optional arguments)
lonirose
@lonirose
Sep 25 2015 05:41
@jedpimentel Thank you for your help! Thumbsup!
CamperBot
@camperbot
Sep 25 2015 05:41
lonirose sends brownie points to @jedpimentel :sparkles: :thumbsup: :sparkles:
:star: 316 | @jedpimentel | http://www.freecodecamp.com/jedpimentel
Kimmo Hintikka
@HintikkaKimmo
Sep 25 2015 07:25
Hi, just running trough the git session to refresh as I normally have to use SVN. Am I doing something stupid or is the a bug?

immohintikka@git-it:~/workspace/patchwork (HintikkaKimmo) $ git-it verify
Verifying "BRANCHES AREN'T JUST FOR BIRDS"...

ACTUAL EXPECTED


"Branch name expected: add-HintikkaKimmo" != "Found branch as expected!"
"{ [Error: Command failed: fatal: ambiguous argument 'origin/HintikkaKimmo': unknown revision or path not in the working tree." != "Changes have been pushed!"
"Use '--' to separate paths from revisions, like this:" != "File in contributors folder!"
"'git <command> [<revision>...] -- [<file>...]'" != ""
"] killed: false, code: 128, signal: null }" != null
"" != null

FAIL

Your solution to BRANCHES AREN'T JUST FOR BIRDS didn't match the expected output.

Try again!

kimmohintikka@git-it:~/workspace/patchwork (HintikkaKimmo) $ git status
On branch HintikkaKimmo
nothing to commit, working directory clean

Why it expects branch name add-HintikkaKimmo rather than HintikkaKimmo?
Kimmo Hintikka
@HintikkaKimmo
Sep 25 2015 07:32
Ok changed the name
kimmohintikka@git-it:~/workspace/patchwork (add-HintikkaKimmo) $ git status
On branch add-HintikkaKimmo
nothing to commit, working directory clean
Takes one error away but still does not work

kimmohintikka@git-it:~/workspace/patchwork (add-HintikkaKimmo) $ git-it verify
Verifying "BRANCHES AREN'T JUST FOR BIRDS"...

ACTUAL EXPECTED


"Found branch as expected!" "Found branch as expected!"
"{ [Error: Command failed: fatal: ambiguous argument 'origin/add-HintikkaKimmo': unknown revision or path not in the working tree." != "Changes have been pushed!"
"Use '--' to separate paths from revisions, like this:" != "File in contributors folder!"
"'git <command> [<revision>...] -- [<file>...]'" != ""
"] killed: false, code: 128, signal: null }" != null
"" != null

FAIL

Your solution to BRANCHES AREN'T JUST FOR BIRDS didn't match the expected output.

Try again!

DTing
@dting
Sep 25 2015 07:56
@HintikkaKimmo did you push to origin?
Andi
@p3rand0r
Sep 25 2015 07:59

Hi all , im trying to complete the Bonfire: Where do I belong challenge but when run this code

function where(arr, num) {
var arraj=arr;
  arraj=arraj.concat(num);
var a= arraj.sort();
 return a;
}
where([5, 3, 20, 3], 3) ;

i get this as an return : [20, 3, 3, 3, 5]
can someone explain to me why they didnt sort in order? :/

DTing
@dting
Sep 25 2015 08:02
you need to pass a compareFunction to sort
or else it sorts it lexigraphically
bf where
CamperBot
@camperbot
Sep 25 2015 08:02

:fire:Bonfire: Where art thou :link:

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

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

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

more info:  bf details | bf links | hint

DTing
@dting
Sep 25 2015 08:02
bf links
DTing
@dting
Sep 25 2015 08:02
bf where do
CamperBot
@camperbot
Sep 25 2015 08:02

:fire:Bonfire: Where do I belong :link:

function where(arr, num) {
  // Find my place in this sorted array.
  return num;
}

where([40, 60], 50);

Return the lowest index at which a value (second argument) should be inserted into a sorted array (first argument).

more info:  bf details | bf links | hint

DTing
@dting
Sep 25 2015 08:02
bf links
CamperBot
@camperbot
Sep 25 2015 08:02
links:
DTing
@dting
Sep 25 2015 08:03
see the documentation (Description)
Andi
@p3rand0r
Sep 25 2015 08:03
sorry whats an compareFunction?
DTing
@dting
Sep 25 2015 08:03
see the documentation
Andi
@p3rand0r
Sep 25 2015 08:04
shouldnt the numbers have the uperhand over the string one?
DTing
@dting
Sep 25 2015 08:04
compareFunction
Optional. Specifies a function that defines the sort order. If omitted, the array is sorted according to each character's Unicode code point value, according to the string conversion of each element.
Andi
@p3rand0r
Sep 25 2015 08:05
oh i see, so its the unicode first (aka string) then the number :/ , its kinda strange but yeah i guess thats how it is :P thanks @dting
CamperBot
@camperbot
Sep 25 2015 08:05
p3rand0r sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1246 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Sep 25 2015 08:05
the number is never used if you omit the compareFunction
it will call .toString on the elements
and sort them by the string conversion
Andi
@p3rand0r
Sep 25 2015 08:09
i see, well thats a great explanation, i guess not having to type the type of the variable has its own downsides :/
DTing
@dting
Sep 25 2015 08:09
i have some notes on that bf here if you are interested in taking a look https://github.com/dting/fccbonfires/blob/master/basic/Basic%2016%20-%20Where%20do%20I%20belong.ipynb
Andi
@p3rand0r
Sep 25 2015 08:46

@dting thanks i was looking at them after finishing , but i cant still understand why the

function compareNumbers(a, b) {
  return a - b;
}

will sort the array by numbers :/

CamperBot
@camperbot
Sep 25 2015 08:46
p3rand0r sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:warning: p3rand0r already gave dting points
DTing
@dting
Sep 25 2015 08:46
if a is smaller than b then a - b will be negative
if a is larger than b then a - b will be positive
if a is equal to b then the function will return 0

If compareFunction(a, b) is less than 0, sort a to a lower index than b, i.e. a comes first.

If compareFunction(a, b) returns 0, leave a and b unchanged with respect to each other, but sorted with respect to all different elements. Note: the ECMAscript standard does not guarantee this behaviour, and thus not all browsers (e.g. Mozilla versions dating back to at least 2003) respect this.

If compareFunction(a, b) is greater than 0, sort b to a lower index than a.
compareFunction(a, b) must always return the same value when given a specific pair of elements a and b as its two arguments. If inconsistent results are returned then the sort order is undefined.

Andi
@p3rand0r
Sep 25 2015 08:51
oh i see so they compare array[i] with array[i+1] and then sort the things by the number now i understand ..well thanks again , if for you is ok ill add you as a "pairing companion" to the exercise :)
CamperBot
@camperbot
Sep 25 2015 08:51
if you want to thank someone, put an @ before their name!
Oleg Avgustinov
@oleg-am
Sep 25 2015 09:05
Who solved the problem of "Bonfire: DNA Pairing", please tell me the rules of conversion. For example pair ("TTGAG") in [['T', 'A'], ['T', 'A'], ['G', 'C'], ['A', 'T'], ['G', 'C']]
DTing
@dting
Sep 25 2015 09:06
bf DNA
CamperBot
@camperbot
Sep 25 2015 09:06

:fire:Bonfire: DNA Pairing :link:

function pair(str) {
 return str;
}

pair("GCG");

The DNA strand is missing the pairing element. Match each character with the missing element and return the results as a 2d array.

more info:  bf details | bf links | hint

DTing
@dting
Sep 25 2015 09:06
bf details
CamperBot
@camperbot
Sep 25 2015 09:06

:fire:Bonfire: DNA Pairing :link:

function pair(str) {
 return str;
}

pair("GCG");
The DNA strand is missing the pairing element. Match each character with the missing element and return the results as a 2d array.
<a href="http://en.wikipedia.org/wiki/Base_pair">Base pairs</a> are a pair of AT and CG. Match the missing element to the provided character.
Return the provided character as the first element in each array.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
DTing
@dting
Sep 25 2015 09:08
@oleg-am thats the way the base pairs are paired AT TA GC CG
Oleg Avgustinov
@oleg-am
Sep 25 2015 09:11
@dting Thank you, now try
CamperBot
@camperbot
Sep 25 2015 09:11
oleg-am sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1247 | @dting | http://www.freecodecamp.com/dting
kuhan
@nkuhan
Sep 25 2015 09:16

function titleCase(str) {
var str = str.toLowerCase();
var arr = str.split(' ');

for (var i = 0; i < 5; i++){
arr[i][0] = arr[i][0].toUpperCase();

}

str = arr.join(' ');
return arr;
}
titleCase("I'm a little tea pot", "");

what is the wrong with this code
?
it didn't return Title Case a Sentence
DTing
@dting
Sep 25 2015 09:21
@nkuhan strings are immutable you cant assign a value to a character in a string. what you need to do is replace the entire string in arr[i] with a new string that has the correct capitalization
wiki immutable
CamperBot
@camperbot
Sep 25 2015 09:21

:point_right: js immutable [wiki]

Immutable means unchangeable i.e. you can't change.

Javascript has lots of immutable types e.g. string primitive type. Try this in your console.

s = "red";
console.log(s[1]); //→ "e"
s[1] = "x";
console.log(s) //→ "red"

the s didn't change! WAT!

:pencil: read more about js immutable on the FCC Wiki

kuhan
@nkuhan
Sep 25 2015 09:39
yes that's correct @dting , How to replace the entire string in arr[i] with a new string that has the correct capitalization
what is declare java variables i dont undertsand
Michał F
@mflisiuk
Sep 25 2015 10:09
Hi, I am facing the "Twich TV API" challenge, but I am quite confused. I noticed that an example is build on angular framework, but I don't know angular yet. Do you think that should I pratice angular first? Or try solution in vanilla JS?
Fábio Paraíso Oliveira
@FabioParaiso
Sep 25 2015 10:24
@mflisiuk The idea (I think) is to use the tools you have until that moment.
So no Agular
It will make it more difficult its true but well lol
On the other side if you want to train angular i don't see a strong reason not to use it
Harsh Kumar
@hkumar1993
Sep 25 2015 10:37
Hi everyone, I was wondering if someone could help me understand the solution for Bonfire: Seek and Destroy
function destroyer(arr) {
  var args = Array.prototype.slice.call(arguments);
  args.splice(0, 1);
  return arr.filter(function(element) {
    return args.indexOf(element) === -1;
  });
}
so I understood the arguments part (after a lot of head scratching)
but I don't understand what in the world is this "elements" that is being passed int he function
could someone explain ?
Coira Ellison
@Coira
Sep 25 2015 10:44
hi @hkumar1993 filter goes through each element in arr, like a for loop would do, except you don't have to explicitly state it.
so if you have arr = [a, b, c], then element will be a the first time through filter, then b, then c
Harsh Kumar
@hkumar1993
Sep 25 2015 10:50
@Coira so the input to the function does not need to be explicitly stated ? "element" just automatically does the work ?
Coira Ellison
@Coira
Sep 25 2015 10:55
yep
i mean, it doesn't have to be called element
Harsh Kumar
@hkumar1993
Sep 25 2015 11:05
ah really ? ok i'll try doing that and see what happens
thanks @Coira
CamperBot
@camperbot
Sep 25 2015 11:05
hkumar1993 sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:star: 237 | @coira | http://www.freecodecamp.com/coira
Abhisek Pattnaik
@abhisekp
Sep 25 2015 11:46
@hkumar1993 the filter function is internally implemented something like this http://eloquentjavascript.net/05_higher_order.html#h_1BJbwiI0gI
@hkumar1993 And for explanations head here http://watchandcode.com/courses/eloquent-javascript-the-annotated-version/lectures/206821
and search Filtering
Harsh Kumar
@hkumar1993
Sep 25 2015 11:56
thanks @abhisekp
CamperBot
@camperbot
Sep 25 2015 11:56
hkumar1993 sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 472 | @abhisekp | http://www.freecodecamp.com/abhisekp
JBGuthrie
@JBGuthrie
Sep 25 2015 12:22

hi!

I'd like to have someone critique my bonfire code if that's okay.
It works I just don't think its as efficient as it probably should be.


function factorialize(num , counter, output) {

 var counter= 0;
 var output= 1;

  while (counter != (num +1)) {
     counter += 1;


     if (counter <= num && counter > 1){  
       var output = counter * output;
      }
  }
   return output;
}


factorialize(5, '');
Triboulet
@ray-triboulet
Sep 25 2015 12:24
What's up guys, I found a bug, I think, and wanted to pass it through Gitter
I'm on the Waypoint: Link to External Pages with Anchor Elements, and have laid out my anchor code and it keeps erring out.
<a href="http://freecatphotoapp.com> cat photos</a> acts like it isn't closing, but whats more the "cat photos" isn't generating as text
JBGuthrie
@JBGuthrie
Sep 25 2015 12:25
its not closing
you missed a "
at the end of your url
Triboulet
@ray-triboulet
Sep 25 2015 12:26
oh dang... wow, rookie error. Thanks @JBGuthrie
CamperBot
@camperbot
Sep 25 2015 12:26
ariovistust sends brownie points to @jbguthrie :sparkles: :thumbsup: :sparkles:
:star: 170 | @jbguthrie | http://www.freecodecamp.com/jbguthrie
Coira Ellison
@Coira
Sep 25 2015 12:28
hey @JBGuthrie perhaps a for-loop instead of while would make it shorter?
JBGuthrie
@JBGuthrie
Sep 25 2015 12:31
@Coira Gonna give this a whirl. thanks.
CamperBot
@camperbot
Sep 25 2015 12:31
jbguthrie sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:star: 238 | @coira | http://www.freecodecamp.com/coira
Coira Ellison
@Coira
Sep 25 2015 12:31
np :)
Kouty
@koouty
Sep 25 2015 12:34
number 148 (in Javascript Basics)
Bill Zerega
@dedicatedfuture
Sep 25 2015 12:41
good morning
can anyone help me with Zipline: Build a Tic Tac Toe Game?
i can not figure out why my site is so jacked up
Kouty
@koouty
Sep 25 2015 12:43
This message was deleted
Abhisek Pattnaik
@abhisekp
Sep 25 2015 12:49
@JBGuthrie for code critics, head over to https://gitter.im/FreeCodeCamp/CodeReview

@JBGuthrie
Soln. 1:

function factorialize(num) {
  if(num == 0) {
    return 1;
  } else {
    return (num * factorialize(num - 1));
  }
}

Soln. 2:

function factorialize(num) {
  var fact = 1;
  while(num) { fact *= num--; }
  return fact;
}
Sam
@xpkc34
Sep 25 2015 13:01

Hello everyone, my first time in here... I need help on the Bonfire: Title Case a Sentence. This is my solution:

function titleCase(str) {
  arr = str.toLowerCase().split(' ');
  for (i = 0; i < str.length; i++) {
    word = arr[i];
    word = word.charAt(0).toUpperCase() + word.slice(1);
  };
  str = arr.join('');
  return str;
}

I'm getting an error saying "Cannot read property 'CharAt' of undefined" but as far as I can tell I'm using charAt exactly as specified in the documentation... in fact I tested it out by printing word.charAt(0).toUpperCase() to the console and it works fine there, but for some reason it doesn't like it in the assignation above...

Coira Ellison
@Coira
Sep 25 2015 13:04
@xpkc34 str.length should be arr.length
also, three backticks for formatting :)
explain formatting
CamperBot
@camperbot
Sep 25 2015 13:05

: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

```js ⇦ Type 3 backticks, then type js or html and 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

Sam
@xpkc34
Sep 25 2015 13:06
yeah I'm struggling at the moment haha. trying to copy the formatting from abhiekp's last message but with little joy
Thank-you though!!
CamperBot
@camperbot
Sep 25 2015 13:07
if you want to thank someone, put an @ before their name!
Coira Ellison
@Coira
Sep 25 2015 13:07
i don't know if this helps, but backtick on my keyboard is top left, underneath the esc key
Kouty
@koouty
Sep 25 2015 13:09

Something is wrong on my code in exercise 148

<code>var min = 0;
var max = 9;
function myFunction() {
// Make myFunction return a random number between zero and nine instead of a decimal
// Only change code below this line.

return Math.floor(Math.random() * (9 - 0 + 1) + 0);
}

// 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();})();
</code>

Coira Ellison
@Coira
Sep 25 2015 13:09
nvm, you got it to format with one backtick, ignore me (but don't ignore the arr.length thing!)
Sam
@xpkc34
Sep 25 2015 13:09
woop there it is
Coira Ellison
@Coira
Sep 25 2015 13:11
@navyvel what's the waypoint called?
Jon Tippens
@legalcodes
Sep 25 2015 13:16
http://freecodecamp.com/challenges/bonfire-make-a-person <--- this page doesn't seem to have the intended tests
Anyone ever have this problem?
I keep getting "Program Execution FailureNo user tests were run."
Abhisek Pattnaik
@abhisekp
Sep 25 2015 13:16
@navyvel :point_up: September 25, 2015 6:35 PM
@legalcodes you might have some illegalcodes! :P
Jon Tippens
@legalcodes
Sep 25 2015 13:17
@abhisekp applauds
Bill Zerega
@dedicatedfuture
Sep 25 2015 13:17
hey guys
can anyone help me with Zipline: Build a Tic Tac Toe Game
im going crazy troubleshooting this thing
Abhisek Pattnaik
@abhisekp
Sep 25 2015 13:18
@legalcodes :clap:
Jon Tippens
@legalcodes
Sep 25 2015 13:18
@abhisekp Are those emojis built into the web version of gitter?
Abhisek Pattnaik
@abhisekp
Sep 25 2015 13:19
@legalcodes i guess, they're built into every version of gitter. :)
Jon Tippens
@legalcodes
Sep 25 2015 13:20
OK, I think I got past the problem I cited earlier. Many thanks everyone.
CamperBot
@camperbot
Sep 25 2015 13:20
if you want to thank someone, put an @ before their name!
Jon Tippens
@legalcodes
Sep 25 2015 13:20
And thanks to @abhisekp
Where are the EMOJIS?!?!
Abhisek Pattnaik
@abhisekp
Sep 25 2015 13:21
Jon Tippens
@legalcodes
Sep 25 2015 13:21
givepizza @abhisekp
:grin:
Abhisek Pattnaik
@abhisekp
Sep 25 2015 13:21
umm... that bot is not here. :P
Jon Tippens
@legalcodes
Sep 25 2015 13:21
:hushed:
:rage1:
Abhisek Pattnaik
@abhisekp
Sep 25 2015 13:22
nice! :+1:
Jon Tippens
@legalcodes
Sep 25 2015 13:22
Anyone know of a good tool for making and sending your own emojis?
I have plenty of hilarious pictures of my friends' faces that would make great emojis.
It'd be cool to keep a bank of these pictures stored on the web, for me to recall and use an emojis whenever I pleased, and wherever normal emojis are accepted.
Star Cherrix
@Sparklepaws
Sep 25 2015 14:30
Hmm, can someone explain to me why "id" selectors don't seem to work with div elements?
(Working with some code on CodePen)
Star Cherrix
@Sparklepaws
Sep 25 2015 14:36
Ah wait, it's because I was trying to add well to the id attribute but Bootstrap only uses well with classes
BeastBoy172
@BeastBoy172
Sep 25 2015 14:42
help me or die
CamperBot
@camperbot
Sep 25 2015 14:42
no wiki entry for: me or die
:pencil: click here to create one now!after creating your page type update to reload it here
BeastBoy172
@BeastBoy172
Sep 25 2015 14:42
plz
Chahan Shah
@Chahanshah
Sep 25 2015 14:44
/play secret
Coira Ellison
@Coira
Sep 25 2015 14:48
@BeastBoy172 what do you need help with?
ARRawls
@ARRawls
Sep 25 2015 14:53
This message was deleted
Teejay Parker
@TeejayParker
Sep 25 2015 14:54
Alright ladies & gents, I could use a bit of help... trying to code a website (HTML/CSS) and I can't get my images to line up / be the same size. I have them wrapped in a pre-determined container, but they still bleed over.. you can see them here: http://igenii.us (about midway down)
ARRawls
@ARRawls
Sep 25 2015 14:54
This message was deleted
Ariel
@ArielLeslie
Sep 25 2015 14:57
@Majeye What behavior are you expecting to happen to the images and what code are you expecting to perform that behavior. You're using images with different lxw ratios, so you're going to need to explicitly force them to a particular size.
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 14:58
function celebrityName (firstName) {
    var nameIntro = "This celebrity is ";
    // this inner function has access to the outer function's variables, including the parameter​
   function lastName (theLastName) {
        return nameIntro + firstName + " " + theLastName;
    }
    return lastName;
}
​
​var mjName = celebrityName ("Michael"); // At this juncture, the celebrityName outer function has returned.​
​
​// The closure (lastName) is called here after the outer function has returned above​// Yet, the closure still has access to the outer function's variables and parameter​
mjName ("Jackson"); // This celebrity is Michael Jackson
does that many any sense to you?
it's supposed to be an example about closures
where does the function lastName get the parameter from?
Teejay Parker
@TeejayParker
Sep 25 2015 14:59
@ArielLeslie could you show me an example of forcing them to a particular size?
Ariel
@ArielLeslie
Sep 25 2015 14:59
@TheHighPriestess mjName("Jackson")
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:01
@ArielLeslie ??
I've been looking at it for 15 minutes
Ariel
@ArielLeslie
Sep 25 2015 15:02
@TheHighPriestess That's where it gets the lastName parameter
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:02
What is this: mjName ("Jackson");
Ariel
@ArielLeslie
Sep 25 2015 15:03
That's where theLastName comes from
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:03
that's not a function call
Ariel
@ArielLeslie
Sep 25 2015 15:03
yes it is
because celebrityName returns a function
Paul Simon Ongpin
@mochiii
Sep 25 2015 15:03
hello i have a problem im currently viewing all finished local weather projects under this tag seach http://codepen.io/search?q=local+weather&limit=all&depth=everything&show_forks=false in codepen.io but it i cant see any weather output in every examples. I also tested the openweathermap api with my lattitude and longitude but im getting error: not found city in response. Is it an internet issue?
Ariel
@ArielLeslie
Sep 25 2015 15:03
so mjName is a function
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:04
@ArielLeslie Ok..help me understand this. THIS: ​var mjName = celebrityName ("Michael"); calls the function celebrityName and stores the return value in mjName;
natebrigmon
@natebrigmon
Sep 25 2015 15:05
anyone else having problems with the Node JS waypoints on c9?
Ariel
@ArielLeslie
Sep 25 2015 15:05
and the return value is the function lastName
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:05
yes...which hasn't even been called
this is weird
Ariel
@ArielLeslie
Sep 25 2015 15:06
lastName expects a parameter so mjName("Jackson") is equivalent (sorta) to lastName("Jackson")
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:06
wow..this is really strange
Ariel
@ArielLeslie
Sep 25 2015 15:06
@TheHighPriestess mjName("Jackson") is when the function is called
Functions are first class citizens in javascript
so you can assign them to variables, pass them as parameters, return them as values, etc
@mochiii You probably aren't sharing your location.
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:07
so..even though celebrityName no longer exists...one can still call lastName.
UGH
that's confusing
Paul Simon Ongpin
@mochiii
Sep 25 2015 15:08
@ArielLeslie how do i change that?
Ariel
@ArielLeslie
Sep 25 2015 15:08
@TheHighPriestess What do you mean celebrityName no longer exists?
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:09
@ArielLeslie lastName is inside celebrityName;
Ariel
@ArielLeslie
Sep 25 2015 15:09
@mochiii It depends on what's causing it. You could have it as a browser setting, or it could be due to a firewall or proxy you're behind
@TheHighPriestess It's defined in clebrityName, yes.
Teejay Parker
@TeejayParker
Sep 25 2015 15:09
@ArielLeslie yeah, that isn't working either, the pics keep their aspect ratio even when i set the width parameter to be a smaller size, i want the pictures the exact same size so the bottom and top of the pics align perfectly
Paul Simon Ongpin
@mochiii
Sep 25 2015 15:10
@ArielLeslie oh i see i think i know now how to configure it on my browser thanks
CamperBot
@camperbot
Sep 25 2015 15:10
mochiii sends brownie points to @arielleslie :sparkles: :thumbsup: :sparkles:
:star: 406 | @arielleslie | http://www.freecodecamp.com/arielleslie
Ariel
@ArielLeslie
Sep 25 2015 15:10
@Majeye If you are only setting the width, then the height will change to maintain the aspect ratio
@mochiii :+1:
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:10
I'm afraid that I'm not understand this at all. I need to find another example :(
Teejay Parker
@TeejayParker
Sep 25 2015 15:10
i change the height, and it causes them to bleed outside of the container
hmm.. perhaps if i assign different width sizes to each one? hmm
Ariel
@ArielLeslie
Sep 25 2015 15:11
@Majeye are you setting both the height and width?
Teejay Parker
@TeejayParker
Sep 25 2015 15:11
was trying to, yes
Ariel
@ArielLeslie
Sep 25 2015 15:11
@Majeye code?
Fábio Paraíso Oliveira
@FabioParaiso
Sep 25 2015 15:12
@ArielLeslie I think the @TheHighPriestess wanted to say that celebrityName call with the parameter "Michael" doe't exit. Sort of.
Teejay Parker
@TeejayParker
Sep 25 2015 15:12

CSS:

.sm-img {
    width: 300px;
}

HTML:

    <div class="items">
        <div class="container">
            <div class="col-md-4 item-1 sm-img">
                <img src="images/i1.png" alt="" />
                <h3>We are silly.</h3>
            </div>
            <div class="col-md-4 item-1 sm-img">
                <img src="images/i2.png" alt="" />
                <h3>We are artistic.</h3>
            </div>
            <div class="col-md-4 item-1 sm-img">
                <img src="images/love.png" alt="" />
                <h3>We love to travel.</h3>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
Paul Simon Ongpin
@mochiii
Sep 25 2015 15:12
@ArielLeslie figured it out thanks awesome!!!!!!! <3
CamperBot
@camperbot
Sep 25 2015 15:12
mochiii sends brownie points to @arielleslie :sparkles: :thumbsup: :sparkles:
:warning: mochiii already gave arielleslie points
Ariel
@ArielLeslie
Sep 25 2015 15:12
@Majeye It looks like you are only setting the width.
Teejay Parker
@TeejayParker
Sep 25 2015 15:13
i took out the height ratio because it messes with the container
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:13
@FabioParaiso what I meant to say was that it returns...without being executed
that's VERY unintuitive
Ariel
@ArielLeslie
Sep 25 2015 15:14
@TheHighPriestess A function is a "thing" just like a variable or an object is, so you can pass around the function itself, not just a call to it.
Fábio Paraíso Oliveira
@FabioParaiso
Sep 25 2015 15:15
Yes exactly, that happens because functions can call the variables of the outter functions they are inserted.
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:16
@FabioParaiso thanks i will look at it
CamperBot
@camperbot
Sep 25 2015 15:16
thehighpriestess sends brownie points to @fabioparaiso :sparkles: :thumbsup: :sparkles:
:star: 235 | @fabioparaiso | http://www.freecodecamp.com/fabioparaiso
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:16
thank you as well @ArielLeslie
CamperBot
@camperbot
Sep 25 2015 15:16
thehighpriestess sends brownie points to @arielleslie :sparkles: :thumbsup: :sparkles:
:star: 407 | @arielleslie | http://www.freecodecamp.com/arielleslie
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:17
for example...look at this:
function makeFunc() {
  var name = "Mozilla";
  function displayName() {
    alert(name);
  }
  return displayName;
};

var myFunc = makeFunc();
myFunc();
makeFunc() is called and the result is stored in myFunc.
but...what is this: myFunc();
?
I thought the variable myFunc stores the result of calling makeFunc()
so...I don't understand the call to a function called myFunc();
is that because makeFunc() is returning displayName...which is a function???
if so...then I get it
Ariel
@ArielLeslie
Sep 25 2015 15:19
@TheHighPriestess myFunc becomes an instance of the displayName() function. That function doesn't take any parameters, so to call it you use empty parens, so to make the "Mozilla" allert you call the function with myFunc()
The result of calling makeFunc() is a function, so you are right there
that means that myFunc is now that resultant function. myFunc becomes the name of a function. It is not a value.
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:21
@ArielLeslie ok...that's what I thought.
This is totally new for me.
Somewhat odd concept
Ariel
@ArielLeslie
Sep 25 2015 15:24
@TheHighPriestess This is central to functional programming, which is hard for a lot of people to get used to but awesome once you do.
Elizabeth Hatleli
@TheHighPriestess
Sep 25 2015 15:24
@ArielLeslie Yeah...I am going to do some reading on it....starting with that link Fabio gave me. Thanks again for your help.
CamperBot
@camperbot
Sep 25 2015 15:24
thehighpriestess sends brownie points to @arielleslie :sparkles: :thumbsup: :sparkles:
:warning: thehighpriestess already gave arielleslie points
Ariel
@ArielLeslie
Sep 25 2015 15:25
@TheHighPriestess You're welcome. Have fun. You'll get it .
sayi
@osayi
Sep 25 2015 15:27
hi, having issues with the palindrome challenge
it's returning all my true arguments but non of the false
Ariel
@ArielLeslie
Sep 25 2015 15:28
@osayi code?
tva10
@tva10
Sep 25 2015 15:28
@osayi put your code here
Teejay Parker
@TeejayParker
Sep 25 2015 15:33
well.. got the images to line up on the top and bottom.. but now they aren't centered in the web page :( http://igenii.us
btw.. thank you @ArielLeslie for your help earlier ;) it opened my eyes to a new technique
CamperBot
@camperbot
Sep 25 2015 15:34
majeye sends brownie points to @arielleslie :sparkles: :thumbsup: :sparkles:
:star: 408 | @arielleslie | http://www.freecodecamp.com/arielleslie
sayi
@osayi
Sep 25 2015 15:35

str = str.toLowerCase().replace(/_/ig,'-').replace(/( )/ig,'').replace(/(,)/ig, '').replace(/( )/ig,'-');
str1 = str.split('').reverse().join('');

if (str === str1){

return true;

}

else {

return false;

}

};

palindrome("not a palindrome");

tva10
@tva10
Sep 25 2015 15:37
@osayi hm, first, you can move all this .replace into one replace
@osayi you need to remove all special characters, okay: .replace(/[^0-9a-z]/g,'')
Ariel
@ArielLeslie
Sep 25 2015 15:38
@Majeye That's because of the different widths. It's just not taking up all the space.
Teejay Parker
@TeejayParker
Sep 25 2015 15:39
is there a way to add padding or margins or something to it that'll make it use the space?
tva10
@tva10
Sep 25 2015 15:40
@Majeye may be....
sayi
@osayi
Sep 25 2015 15:40
@ArielLeslie Thanks!
CamperBot
@camperbot
Sep 25 2015 15:40
osayi sends brownie points to @arielleslie :sparkles: :thumbsup: :sparkles:
:star: 409 | @arielleslie | http://www.freecodecamp.com/arielleslie
tva10
@tva10
Sep 25 2015 15:40
@Majeye you can make and check that in chrome dev tools
Coira Ellison
@Coira
Sep 25 2015 15:41
@Majeye maybe flexbox will help? http://flexboxin5.com/ it's what i use to centre and align stuff
Teejay Parker
@TeejayParker
Sep 25 2015 15:42
awesome, thank you
CamperBot
@camperbot
Sep 25 2015 15:42
if you want to thank someone, put an @ before their name!
Ariel
@ArielLeslie
Sep 25 2015 15:42
@Majeye The width setting of the sm-img class is overriding the width of the col-md-4 class
Teejay Parker
@TeejayParker
Sep 25 2015 15:42
i know that
i was using it to test to see how it would affect it
Ariel
@ArielLeslie
Sep 25 2015 15:43
ok. That's why the images aren't centered anymore.
Teejay Parker
@TeejayParker
Sep 25 2015 15:43
ah ok
Ariel
@ArielLeslie
Sep 25 2015 15:43
Is there a particular reason you don't want to just edit the images to have the same ratios?
Teejay Parker
@TeejayParker
Sep 25 2015 15:43
i tried that, it didn't work
those images were significantly larger than what they are now
and when i added them into the container, they looked the exact same
Cody Bouscaren
@codybousc
Sep 25 2015 15:45
This message was deleted
This message was deleted
Pratik Ratnaparkhi
@pratikr1593
Sep 25 2015 15:46
whats wrong with this code? I am stuck and it makes me feel so lame about maths.
var difference = 45 - 13 //make this equal to 12 by changing the 0 into the appropriate number.

// 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(z){return 'difference= '+z;})(difference);
Cody Bouscaren
@codybousc
Sep 25 2015 15:47
hey all, how do you format code again?
Mark
@markwright174
Sep 25 2015 15:47
@pratikr1593 45-13 doesn't equal 12
Coira Ellison
@Coira
Sep 25 2015 15:48
@codybousc three backticks
@codybousc otherwise, you were doing it right
Pratik Ratnaparkhi
@pratikr1593
Sep 25 2015 15:48
@markwright174 I know, I tried with 12, it doesn't work.
Cody Bouscaren
@codybousc
Sep 25 2015 15:48
@Coira thank ya!
CamperBot
@camperbot
Sep 25 2015 15:48
codybousc sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:star: 239 | @coira | http://www.freecodecamp.com/coira
Mark
@markwright174
Sep 25 2015 15:49
@pratikr1593 45-?=12
Cody Bouscaren
@codybousc
Sep 25 2015 15:49
var min = 0;
var max = 12;
function myFunction() {
  // Make myFunction return a random number between zero and nine instead of a decimal
  // Only change code below this line.

  return(Math.floor(Math.random() * (9 - 0 + 1)));
}

// 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());})();
can someone help me out with the above code?
Pratik Ratnaparkhi
@pratikr1593
Sep 25 2015 15:49
@markwright174 I know what I did wrong, I forgot to put semicolon.
Cody Bouscaren
@codybousc
Sep 25 2015 15:49
not too sure what i'm doing wrong
Pratik Ratnaparkhi
@pratikr1593
Sep 25 2015 15:49
@markwright174 Thanks anyways
CamperBot
@camperbot
Sep 25 2015 15:49
pratikr1593 sends brownie points to @markwright174 :sparkles: :thumbsup: :sparkles:
:star: 300 | @markwright174 | http://www.freecodecamp.com/markwright174
Cody Bouscaren
@codybousc
Sep 25 2015 15:50
it's the 'Generate a Random Whole Number Within a Range' challenge
mglallende
@mglallende
Sep 25 2015 15:51
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

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

  .smaller-image {
    width: 100px;
  }

  .thick-green-border {
     border-color: green; border-width: 10px; border-style: solid; 
  }
</style>

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

<img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat">

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
Having problem with border width. Still giving error.
Ariel
@ArielLeslie
Sep 25 2015 15:51
@Majeye If you made the source images different ratios, those ratios should be reflected on the website. (maybe you have a caching issue). If you want to force them into the same ratios though, you need to put your sm-img class on the image tag, not the div
that's what I did here @Majeye
blob
tva10
@tva10
Sep 25 2015 15:52
@codybousc Hey, the test cases in this way point checks: Math.floor(Math.random() * (max - min + 1)) + min
Teejay Parker
@TeejayParker
Sep 25 2015 15:53
hmm ok
tva10
@tva10
Sep 25 2015 15:53
@codybousc because there are variables min max in the start
Mark
@markwright174
Sep 25 2015 15:53
@mglallende I think you have to declare border-style prior to border-width
Cody Bouscaren
@codybousc
Sep 25 2015 15:54
@tva10 hmm, still not sure what i'm doing wrong. in this case, the min number was zero so i just removed it
Teejay Parker
@TeejayParker
Sep 25 2015 15:54
thank you again @ArielLeslie
CamperBot
@camperbot
Sep 25 2015 15:54
:warning: majeye already gave arielleslie points
majeye sends brownie points to @arielleslie :sparkles: :thumbsup: :sparkles:
mglallende
@mglallende
Sep 25 2015 15:54
.thick-green-border {
    border-style: solid;
    border-color: green;
    border-width: 10px; 
  }
@markwright174 Tried changing to above. Still the same
tva10
@tva10
Sep 25 2015 15:55
@codybousc create min and max variables, and paste code from task into return. This testcases can't check your code with (9-0+1)
Ariel
@ArielLeslie
Sep 25 2015 15:56
@mglallende What is the actual error you are getting?
Cody Bouscaren
@codybousc
Sep 25 2015 15:58
@tva10 that definitely worked. i'm not sure that i understand why it needed variables instead of numbers though
either way, thank you!
CamperBot
@camperbot
Sep 25 2015 15:58
if you want to thank someone, put an @ before their name!
tva10
@tva10
Sep 25 2015 15:59
@codybousc there is simple test cases.... which can't recognize all ways
mglallende
@mglallende
Sep 25 2015 16:01
@ArielLeslie Give your image a border width of 10px. with a red cross
Ariel
@ArielLeslie
Sep 25 2015 16:02
@mglallende You reran the tests after changing the code?
mglallende
@mglallende
Sep 25 2015 16:02
@ArielLeslie yes
Ariel
@ArielLeslie
Sep 25 2015 16:03
and the green border shows up in the preview?
mglallende
@mglallende
Sep 25 2015 16:04
@ArielLeslie yes
Ariel
@ArielLeslie
Sep 25 2015 16:05
Are you running the tests by clicking the button or ctrl + enter ?
mglallende
@mglallende
Sep 25 2015 16:05
@ArielLeslie yes, and when i change the 10px to 15px it changes
Ariel
@ArielLeslie
Sep 25 2015 16:06
which way are you running the test?
and what browser are you in?
have you tried copying your code, clicking "reset", pasting your code and rerunning the test?
(you can obviously just move on if you want. I'm just trying to figure out why your test is failing)
mglallende
@mglallende
Sep 25 2015 16:13
@ArielLeslie is there a way to move on? I did the reset and it is not working
Ariel
@ArielLeslie
Sep 25 2015 16:13
Just go to the map and pick the next waypoint
would you mind pasting your complete code, so I can try it in my browser?
mglallende
@mglallende
Sep 25 2015 16:14
@ArielLeslie excellent. I will do that because i don't see the problem. Thank you very much for your help
CamperBot
@camperbot
Sep 25 2015 16:14
mglallende sends brownie points to @arielleslie :sparkles: :thumbsup: :sparkles:
:star: 410 | @arielleslie | http://www.freecodecamp.com/arielleslie
Mark
@markwright174
Sep 25 2015 16:15
@mglallende Yeah that's a weird one, cause I just ran over and copy/pasted your code, and it went right through.
mglallende
@mglallende
Sep 25 2015 16:16
@markwright174 yes and i jumped to the next step but the error is still there. Thank you Mark for your help
CamperBot
@camperbot
Sep 25 2015 16:16
mglallende sends brownie points to @markwright174 :sparkles: :thumbsup: :sparkles:
:star: 301 | @markwright174 | http://www.freecodecamp.com/markwright174
Cody Bouscaren
@codybousc
Sep 25 2015 16:21
hey all, so the only test that's failing for this is the 'you must use the provided code 3 times' which i've done. am i missing something here?
<script>
  function runSlots(){
    var slotOne;
    var slotTwo;
    var slotThree;

    var images = ["http://i.imgur.com/9H17QFk.png", "http://i.imgur.com/9RmpXTy.png", "http://i.imgur.com/VJnmtt5.png"];

    slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
    slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
    slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;

    $('.logger').html('');
    $('.logger').html('Not A Win');

    // Only change code below this line.
    $($('.slot')[0]).html('<img src= "' + images[slotOne -1] + '">'); 
    $($('.slot')[1]).html('<img src= "' + images[slotTwo -1] + '">'); 
    $($('.slot')[2]).html('<img src= "' + images[slotThree -1] + '">'); 



    // Only change code above this line.

    if(slotOne !== slotTwo || slotTwo !== slotThree){
      return null;
    }

    if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){
      $('.logger').html(slotOne);
      $('.logger').append(' ' + slotTwo);
      $('.logger').append(' ' + slotThree);
    }

    return [slotOne, slotTwo, slotThree];
  }

  $(document).ready(function(){
     $('.go').click(function(){
       runSlots();
     });
   });
</script>

<div>
 <div class = 'container inset'>
   <div class = 'header inset'>
     <img src='https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz' alt='learn to code javascript at Free Code Camp logo' class='img-responsive nav-logo'>
     <h2>FCC Slot Machine</h2>
   </div>
   <div class = 'slots inset'>
     <div class = 'slot inset'>

     </div>
     <div class = 'slot inset'>

     </div>
     <div class = 'slot inset'>

     </div>
   </div>
   <br/>
   <div class = 'outset'>
     <button class = 'go inset'>
       Go
     </button>
   </div>
   <br/>
   <div class = 'foot inset'>
     <span class = 'logger'></span>
   </div>
 </div>
</div>

<style>
 .slot > img {
  margin: 0!important;
  height: 71px;
  width: 50px;
 }
 .container {
   background-color: #4a2b0f;
   height: 400px;
   width: 260px;
   margin: 50px auto;
   border-radius: 4px;
 }
 .header {
   border: 2px solid #fff;
   border-radius: 4px;
   height: 55px;
   margin: 14px auto;
   background-color: #457f86
 }
 .header h2 {
   height: 30px;
   margin: auto;
 }
 .header h2 {
   font-size: 14px;
   margin: 0 0;
   padding: 0;
   color: #fff;
   text-align: center;
 }
 .slots{
   display: flex;
   background-color: #457f86;
   border-radius: 6px;
   border: 2px solid #fff;
 }
 .slot{
   flex: 1 0 auto;
   background: white;
   height: 75px;
   width: 50px;
   margin: 8px;
   border: 2px solid #215f1e;
   border-radius: 4px;
   text-align: center;
 }
 .go {
   width: 100%;
   color: #fff;
   background-color: #457f86;
   border: 2px solid #fff;
   border-radius: 2px;
   box-sizing: none;
   outline: none!important;
 }
 .foot {
   height: 150px;
   background-color: 457f86;
   border: 2px solid #fff;
 }

 .logger {
   color: white;
   margin: 10px;
 }

 .outset {
   -webkit-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);
   -moz-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);
     box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);
 }

 .inset {
   -webkit-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);
   -moz-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);
   box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);
 }
</style>
it's actually just these three lines
 $($('.slot')[0]).html('<img src= "' + images[slotOne -1] + '">'); 
    $($('.slot')[1]).html('<img src= "' + images[slotTwo -1] + '">'); 
    $($('.slot')[2]).html('<img src= "' + images[slotThree -1] + '">');
tva10
@tva10
Sep 25 2015 16:24
@codybousc Also there is dummy testcases tooo
ARRawls
@ARRawls
Sep 25 2015 16:25
This message was deleted
Moisés Man
@moigithub
Sep 25 2015 16:25
u need to put the "exact" number of spaces.. extra spaces or missing .. will fail the test , even if code is correct
tva10
@tva10
Sep 25 2015 16:25
@codybousc remove whitespace between slotOne and -1
and for other lines too
Cody Bouscaren
@codybousc
Sep 25 2015 16:28
@tva10 how did you know this?
but yes, right again!
tva10
@tva10
Sep 25 2015 16:29
@codybousc I saw same problems before
Stuart Balcombe
@sbalcombe
Sep 25 2015 16:49
Hello everyone, i'm having some issues scoping my functions could someone take a look at my code?
This message was deleted
CamperBot
@camperbot
Sep 25 2015 16:51
:bulb: to format code use backticks! ``` more info
Stuart Balcombe
@sbalcombe
Sep 25 2015 16:52

''' var type;
$(document).ready(function() {
// UPDATE VARIABLE "type" to equal value of "checkout-choice"
$("input[name=checkout-choice]").click( function()
{
var val = $(this).val();

    if ( val !== "one-time")
    {
        $(".checkout-subscribe .checkout-selection-cta").slideDown("fast", function()
        {
            $(".checkout-one-time").addClass("checkout-choice-selected").removeClass("checkout-choice-grey");
            $(".checkout-subscribe").addClass("checkout-choice-grey").removeClass("checkout-choice-selected");
        });
        $(".checkout-one-time .checkout-selection-cta").slideUp("fast");
    } else {

        $(".checkout-subscribe .checkout-selection-cta").slideUp("fast", function()
        {
            $(".checkout-one-time").addClass("checkout-choice-grey").removeClass("checkout-choice-selected");
            $(".checkout-subscribe").addClass("checkout-choice-selected").removeClass("checkout-choice-grey");
        });
        $(".checkout-one-time .checkout-selection-cta").slideDown("fast");
    }
    console.log(val);
    val = type;
});
//  End of UPDATE VARIABLE "type" to equal value of "checkout-choice" ^^

});
/*

  • CART TOTALS
  • Params:
  • cart_total: total of all products in the cart, #product_total_amount
  • shipping: cost of shipping (always free if subscription, one-timer enforces minimum cart size before free), #modify_shipping_amount
  • total: cart_total + shipping, #modify_total_amount
  • type: subscription or one-timer
    */

function updateCartTotals(cart_total, shipping, total, type, min_purchase)
{
// Hide the checkout options if the pack is empty
$("#checkout-hidden").show("fast");
if (total == 0 ) {
$("#checkout-hidden").hide("fast");
}
// End of hide the checkout options if the pack is empty

var shipping = 0;
var total;
var type;
var min_purchase = 0;
var country;

// Get the users ip address and set it equal to the variable country
$.getJSON('http://api.wipmania.com/jsonp?callback=?', function (data) {
country = data.address.country;

console.log(cart_total);
console.log(shipping);
console.log(total);
console.log(type);
console.log(min_purchase);
console.log(country);    


$("#product_total_amount").html("$" + cart_total);

if ( type == "subscribe" )
{

    // ADJUST SHIPPING COST BASED ON A USERS LOCATION
    if (country == "United States") {
        console.log("I'm in the United States and I'd like to subscribe");
        if (cart_total < 25) {
            shipping = 5;
        }
        else {
            shipping = 0;
        }
    } else if (country == "Canada") {
        console.log("I'm in Canada and I'd like to subscribe");
        if (cart_total <= 49) {
            shipping = 10
        }
        else {
            shipping = 0;
        }
    } else {
        shipping = 20;
    }

    // UPDATE AND RECALCULATE THE CART TOTAL
    $("#modify_shipping_amount").html("$" + shipping);
    $("#modify_total_amount").html("$" + cart_total);

    // CALCULATE SHIPPING FOR ONE TIMERS
} else {
    if (country == "United States") {
        console.log("I'm in the United States but I only need one pack");
        if (cart_total <= 49) {
            shipping = 5;
        }
        else {
            shipping = 0;
        }
    }
    else if (country == "Canada") {
        console.log("I'm in Canada but I only need one pack")
            shipping = 10;
    } else {
        shipping = 20;
    }
    // UPDATE AND RECALCULATE THE CART TOTAL

    //{
        $("#modify_shipping_amount").html("FREE");
        $("#modify_total_amount").html("$" + cart_total);
    //} else {
        $("#modify_shipping_amount").html("$" + shipping);
        $("#modify_total_amount").html("$" + total);
    //}
}

// check for shipping threshold and display appropriate message
/*
if (cart_total >= min_purchase)
{
    $("#minimum_purchase_message").css("display","none");
} else {
    $("#minimum_purchase_message").css("display","block").html("* There is a $" + min_purchase + " minimum purchase required");
    $("#discount_row").css("display","block");
}
*/

})
// Close of get users location function ^^

} '''

CamperBot
@camperbot
Sep 25 2015 16:52
:bulb: to format code use backticks! ``` more info
Rex Schrader
@SaintPeter
Sep 25 2015 16:55
@sbalcombe ok, lotta code
@sbalcombe a Gist might be better.
Stuart Balcombe
@sbalcombe
Sep 25 2015 16:56
Okay, ill make one. This isnt the only code on the page lol, but the bit i'm trying to update. Struggling with passing a variable from the first function to the second
Rex Schrader
@SaintPeter
Sep 25 2015 16:58
@sbalcombe ok, be with you in a moment
Jordan Bourne
@JordanBourne
Sep 25 2015 16:58
The isNan() function just tells me if a value is a number or not.. is there a way to check if a value is NaN though? Checking myVar === NaN doesn't seem to work
My mind is twisted thinking about it
Stuart Balcombe
@sbalcombe
Sep 25 2015 17:00
@JordanBourne you could console.log() the value
@SaintPeter Thank you
CamperBot
@camperbot
Sep 25 2015 17:00
sbalcombe sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 726 | @saintpeter | http://www.freecodecamp.com/saintpeter
Coira Ellison
@Coira
Sep 25 2015 17:01
@JordanBourne I'm not quite sure what you're asking for, but have you checked the examples here https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/isNaN ?
Jordan Bourne
@JordanBourne
Sep 25 2015 17:02
@sbalcombe I'm not sure how I would use that in my function without making it a lot more complicated. I'll show you guys what I'm working on
Bonfire: Falsy Bouncer
CamperBot
@camperbot
Sep 25 2015 17:03
Sorry, can't find a bonfire called flasy bouncer. [ Check the map? ]
Jordan Bourne
@JordanBourne
Sep 25 2015 17:03
function checkIfFalsy(term) {
    if(term === false || term === null || term ===  0 || term === "" || term === undefined || term === NaN) {
        return false;
    } else {
        return true;
    }
}

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

bouncer([false, null, 0, NaN, undefined, ''])
It should return an empty array but it returns [NaN]
I thought about turning all the inputs into strings and checking like that, but that seems like an overcomplication
Rex Schrader
@SaintPeter
Sep 25 2015 17:09
@JordanBourne This one is a trick question. Just do if(term) and leave all of the rest of the checking out. (IE: term === false || term === null)
Jordan Bourne
@JordanBourne
Sep 25 2015 17:12
It also has to be able to pass other inputs such as:
bouncer([7, "ate", "", false, 9]) //output [7, "ate", 9]
bouncer(["a", "b", "c"]) //output ["a", "b", "c"]
Rex Schrader
@SaintPeter
Sep 25 2015 17:13
@JordanBourne Give it a try. just replace all that jazz with if(term) on your second line.
Jordan Bourne
@JordanBourne
Sep 25 2015 17:14
It just outputs an array identical to the input
Rex Schrader
@SaintPeter
Sep 25 2015 17:15
@JordanBourne Oh, I'm sorry, you'll need to reverse your logic as well.
@JordanBourne if(term) { return true; } else { return false }
Jordan Bourne
@JordanBourne
Sep 25 2015 17:16
Oh alright that worked, thanks @SaintPeter
CamperBot
@camperbot
Sep 25 2015 17:16
jordanbourne sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 728 | @saintpeter | http://www.freecodecamp.com/saintpeter
Jordan Bourne
@JordanBourne
Sep 25 2015 17:16
I'm confused why that works though
Rex Schrader
@SaintPeter
Sep 25 2015 17:17
@JordanBourne The reason that it works is because Javascript is what determines if something is truthy or falsey, just by testing it. No need to compare it to anything, it's integral to how the language works.
@JordanBourne in fact, you can change your entire checkIfFalsey function to simply return term; and it'll work
@JordanBourne because .filter also checks if the value is true or false.
Jordan Bourne
@JordanBourne
Sep 25 2015 17:18
Oh I see, thanks!
CamperBot
@camperbot
Sep 25 2015 17:18
if you want to thank someone, put an @ before their name!
Rex Schrader
@SaintPeter
Sep 25 2015 17:18
wiki falsey
CamperBot
@camperbot
Sep 25 2015 17:18

:point_right: js falsey [wiki]

Something which evaluates to FALSE. There are only five falsey values in JavaScript:
undefined, null, NaN, 0, "" (empty string), and false of course.

See also: truthy | Truthy & Falsey blog post
:pencil: read more about js falsey on the FCC Wiki

Jordan Bourne
@JordanBourne
Sep 25 2015 17:18
Wouldn't there be cases where you'd want 0 to be true though?
Rex Schrader
@SaintPeter
Sep 25 2015 17:19
@JordanBourne Javascript basically says "Anything that is not false or falsey (see above) is true."
@JordanBourne Well, if you specifically needed it to be true then you can test for it, like:
if(myValue === 0) - that'll return true if it matches.
Jordan Bourne
@JordanBourne
Sep 25 2015 17:21
Alright, well thanks again for the help @SaintPeter
CamperBot
@camperbot
Sep 25 2015 17:21
jordanbourne sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: jordanbourne already gave saintpeter points
Rex Schrader
@SaintPeter
Sep 25 2015 17:22
@JordanBourne falsey and truthy are really only relevent if you're directly testing a variable.
Stuart Balcombe
@sbalcombe
Sep 25 2015 17:23
Thanks @SaintPeter problem seems to be fixed and learnt something new :)
CamperBot
@camperbot
Sep 25 2015 17:23
sbalcombe sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: sbalcombe already gave saintpeter points
Rex Schrader
@SaintPeter
Sep 25 2015 17:23
wiki scope
CamperBot
@camperbot
Sep 25 2015 17:23

:point_right: scope [wiki]

The current context of execution. The context in which values and expressions are "visible," or can be referenced. If a variable or other expression is not "in the current scope," then it is unavailable for use. Scopes can also be layered in a hierarchy, so that child scopes have access to parent scopes, but not vice versa.

:pencil: read more about scope on the FCC Wiki

Rex Schrader
@SaintPeter
Sep 25 2015 17:23
@sbalcombe Click the read more and there is a great article link in there that talks all about scope and context.
Stuart Balcombe
@sbalcombe
Sep 25 2015 17:24
Awesome thank you.
CamperBot
@camperbot
Sep 25 2015 17:24
if you want to thank someone, put an @ before their name!
Abhisek Pattnaik
@abhisekp
Sep 25 2015 17:25

Falsy Bouncer

Nathan Wind
@Nathan-Wind
Sep 25 2015 17:32
Function destroyer(arr) {
  var args = Array.prototype.slice.call(arguments);
  args.splice(0, 1);
  return arr.filter(function(element) {
    return args.indexOf(element) === -1;
  });
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3, "");
Needs me a little help
this line turns the array and arugments into one array correct? var args = Array.prototype.slice.call(arguments);
tva10
@tva10
Sep 25 2015 17:33
@Nathan-Wind hm
@Nathan-Wind function from little case
DTing
@dting
Sep 25 2015 17:34
@Nathan-Wind ya it can also be shortened to
  var args = Array.prototype.slice.call(arguments, 1);
to get rid of args.splice
tva10
@tva10
Sep 25 2015 17:35
@Nathan-Wind this code works
but also remove Function to function
Nathan Wind
@Nathan-Wind
Sep 25 2015 17:35
oh wait... I found this answer online but it doesn;t work... my bad
wait no i was wrong it works...
:P
Ainuddin Faizan
@andyfaizan
Sep 25 2015 17:36
Hi! Need some help with the Random Quote Generator Zipline. Anyone here completed that?
Abhisek Pattnaik
@abhisekp
Sep 25 2015 17:36
This message was deleted
Nathan Wind
@Nathan-Wind
Sep 25 2015 17:37
@abhisekp so does this make it all one array?
var args = Array.prototype.slice.call(arguments);
Abhisek Pattnaik
@abhisekp
Sep 25 2015 17:38
@Nathan-Wind yes. It outputs an array which has the same elements as in arguments.
oops!
Nathan Wind
@Nathan-Wind
Sep 25 2015 17:38
so even this part is an arguement?
Abhisek Pattnaik
@abhisekp
Sep 25 2015 17:38
I mistakenly, deleted the post :(
Nathan Wind
@Nathan-Wind
Sep 25 2015 17:38
destroyer([1, 2, 3, 1, 2, 3]
Nareg Khoshafian
@nkhoshaf
Sep 25 2015 17:39
Can anyone help me with the Pomodoro Clock?
Nathan Wind
@Nathan-Wind
Sep 25 2015 17:41
sorry still a bit confused guys
Abhisek Pattnaik
@abhisekp
Sep 25 2015 17:42
@Nathan-Wind wats the confusion?

Bonfire - Seek and Destroy

Nathan Wind
@Nathan-Wind
Sep 25 2015 17:43
is this WHOLE thing an arguement or is it a argument and array or is it a couple of arguments and an array?
destroyer([1, 2, 3, 1, 2, 3], 2, 3, "");
yes it is destroying me
Abhisek Pattnaik
@abhisekp
Sep 25 2015 17:44
console.log the arguments object
console.log(arguments);
Ben Heavner
@bheavner
Sep 25 2015 17:49
I think there must be a cleaner way to do what I'm working on at the moment..
'
any tips?
do'h!
I want to pick the first two values off an array and replace them with the result of a function working on them.
Here's my current approach:
var pairLCM = [arr[0] * arr[1]/pairGcd]; var remaining = arr.slice(2); var newArr = pairLCM.concat(remaining);
Moisés Man
@moigithub
Sep 25 2015 17:52
slice extracts/make a copy (keep original unmodified)
splice extracts (modify the original )
Ben Heavner
@bheavner
Sep 25 2015 17:52
Is there a one-liner? something like:
arr.slice(2).unshift([arr[0] * arr[1]/pairGcd])
ah! That's handy! Thx @moigithub !
CamperBot
@camperbot
Sep 25 2015 17:53
bheavner sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star: 357 | @moigithub | http://www.freecodecamp.com/moigithub
DTing
@dting
Sep 25 2015 17:53
pretty sure you just want to reduce
function GCD(a,b) {
  return ...
}

function LCM(a,b) {
  return a * b / GCD(a, b);
}

lcm = arr.reduce(LCM);
Ben Heavner
@bheavner
Sep 25 2015 17:54
I may need to rethink my logic to do that... At the moment, I've written a function to find the LCM for 2 numbers, then recursively apply that to the array - https://tonicdev.com/bheavner/56042275ceeeb60c00e5d701
DTing
@dting
Sep 25 2015 17:56
@bheavner ya check out the reduce function
Ben Heavner
@bheavner
Sep 25 2015 17:57
Ah - and I haven't yet internalized the leap to using closures (if that's what caling a function on a function is called in Javascript...)
which is what reduce does... ah... learning...
Pratik Ratnaparkhi
@pratikr1593
Sep 25 2015 17:58
whats wrong with this code?
var ourArray = [1,2,3];
ourArray[0] = 2;
// ourArray[1] now equals [1,3,3].
var myArray = [3,2,3];
// Only change code below this line.


// 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.
if(typeof(myArray) !== "undefined"){(function(){return myArray;})();}
DTing
@dting
Sep 25 2015 17:59
doesnt look like you have changed any of the code
Pratik Ratnaparkhi
@pratikr1593
Sep 25 2015 17:59
Now modify the data stored at index 0 of myArray to the value of 2.
thats what it says.
DTing
@dting
Sep 25 2015 18:00
var ourArray = [1,2,3];
ourArray[0] = 2;
thats the example
they want you to do the same thing to "myArray"
Laura Veee
@Cyclokitty
Sep 25 2015 18:19
Just started javascript and I'm sure the mistake I've made is ridiculously stupid. This is the coin flip waypoint using conditionals. What am I doing wrong?
var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;
function myFunction(){
  // 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 (flip === 1) {
    return = "tails";
}



  // Only change code above this line.
}

// We use this function to show you the value of your variable in your output box.
var result = myFunction();if(typeof(flip) !== "undefined" && typeof(flip) === "number" && typeof(result) !== "undefined" && typeof(result) === "string"){(function(y,z){return 'flip = ' + y.toString() + ', text = ' + z;})(flip, result);}
tva10
@tva10
Sep 25 2015 18:24
@Cyclokitty return "heads"
withought =
Jason Wood
@catapixel
Sep 25 2015 18:25
^
Laura Veee
@Cyclokitty
Sep 25 2015 18:26
See? I knew it was something dopey! Thanks! I'll try it now.
CamperBot
@camperbot
Sep 25 2015 18:26
if you want to thank someone, put an @ before their name!
Laura Veee
@Cyclokitty
Sep 25 2015 18:26
@tva10
@tva10 thank you!
CamperBot
@camperbot
Sep 25 2015 18:26
cyclokitty sends brownie points to @tva10 :sparkles: :thumbsup: :sparkles:
:star: 251 | @tva10 | http://www.freecodecamp.com/tva10
vmsinc
@vmsinc
Sep 25 2015 18:26
Waypoint: Style Text Inputs as Form Controls -- cannot figure out this, see my input.
tva10
@tva10
Sep 25 2015 18:26
@Cyclokitty and also you can write if(!flip) == if(flip===0)
@Cyclokitty so like that
if(flip) return 'tails';
else return "heads";
Jason Wood
@catapixel
Sep 25 2015 18:28
@vmsinc let's see your code...
vmsinc
@vmsinc
Sep 25 2015 18:29
<input type="text" placeholder="cat photo URL" required>
<button class="btn btn-primary"> <i class="fa fa-paper-plane"></i> <i class="form-control" input="submit">Submit </i></button>
</form>
</div>
Waypoint: Style Text Inputs as Form Controls -- cannot figure out this, see my input above. Help
Avil
@Avil172
Sep 25 2015 18:31
@vmsinc your input needs the class form-control, not <i>
Jason Wood
@catapixel
Sep 25 2015 18:32
@vmsinc yes...This whole thing <i class="form-control" input="submit">Submit </i> needs to be replaced with ' Submit' (leading space).
Avil
@Avil172
Sep 25 2015 18:33
@vmsinc
<input class="form-control" type="text" placeholder="cat photo URL" required>
Jason Wood
@catapixel
Sep 25 2015 18:33
@vmsinc then do the above ^
Avil
@Avil172
Sep 25 2015 18:34

@vmsinc the button element should be ..

<button class="btn btn-primary form-control" type="submit"><i class="fa fa-paper-plane">Submit</i></button>

or this works too..

<button class="btn btn-primary form-control" type="submit"><i class="fa fa-paper-plane"></i>Submit</button>
Tyler Moeller
@TylerMoeller
Sep 25 2015 18:43
Hello - trying to figure out if there's a workaround for displaying content on an HTTPS site that makes an API call over HTTP. Chrome silently blocks the content. Trying to embed a codepen of my random quote machine on my Wordpress site, but the quotes don't show up because the Forismatic API I'm calling is over HTTP.
Guessing this is impossible...but just maybe there's a workaround I haven't been able to find yet. (aside from using a different API)
Ben Heavner
@bheavner
Sep 25 2015 18:46
@dting - what am I missing with reduce? (last code box at https://tonicdev.com/bheavner/56042275ceeeb60c00e5d701 )
TeeReggz
@TeeReggz
Sep 25 2015 18:47
Hey everyone im stuck on a way point challenge for a few days. "Give the text input in your form the class form-control." PLease help me <form action="/submit-cat-photo">
<div class="row">
<div class="col-xs-6">
<label><input type="radio" name="indoor-outdoor"> Indoor</label>
</div>
<div class="col-xs-6">
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
</div>
</div>
<div class="row">
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Loving</label>
</div>
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Lazy</label>
</div>
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Crazy</label>
</div>
</div>
<input type="text" placeholder="cat photo URL" required>
<button class="btn btn-primary" type="submit">Submit<i class=" fa fa-paper-plane"></i></button>
</form>
</div>
aeroldb
@aeroldb
Sep 25 2015 18:50
hey, can someone explain to me how argument work
TeeReggz
@TeeReggz
Sep 25 2015 18:50
I tried <form action="/submit-cat-photo" class="form-control"> but it doesn't work
Kevin Diem
@kgdiem
Sep 25 2015 18:50
@aerb199 the argument object or just arguments in general?
Avil
@Avil172
Sep 25 2015 18:51
@TeeReggz you need to add the class "form-control" to your input element. see..
:point_up: September 26, 2015 12:03 AM
aeroldb
@aeroldb
Sep 25 2015 18:51
@kgdiem argument object, how does it work?
Kevin Diem
@kgdiem
Sep 25 2015 18:51
@aerb199 it is like an array but without all of the functions.
You can iterate through it or push it to an array
aeroldb
@aeroldb
Sep 25 2015 18:52
@kgdiem can you give me an example?
Kevin Diem
@kgdiem
Sep 25 2015 18:53
What is the name of the bonfire again?
aeroldb
@aeroldb
Sep 25 2015 18:53
@kgdiem bonfire seek and destroy
vmsinc
@vmsinc
Sep 25 2015 18:54
Thanks for your help. Below worked-still does not make sense base on instructions for this lesson. This is first one that stumped me.
CamperBot
@camperbot
Sep 25 2015 18:54
if you want to thank someone, put an @ before their name!
vmsinc
@vmsinc
Sep 25 2015 18:54
<input class="form-control" type="text" placeholder="cat photo URL" required>
<button class="btn btn-primary form-control" type="submit"><i class="fa fa-paper-plane">Submit</i></button>
Kevin Diem
@kgdiem
Sep 25 2015 18:55

@aerb199

  for(var i = 1; i < arguments.length; i++){
    console.log(arguments[i]);
  }

So you can access the length of the given arguments (if there is 4 it'd be 4) then iterate through it like you would an array

TeeReggz
@TeeReggz
Sep 25 2015 18:56
Thanks so much @Avil172
CamperBot
@camperbot
Sep 25 2015 18:56
teereggz sends brownie points to @avil172 :sparkles: :thumbsup: :sparkles:
:star: 109 | @avil172 | http://www.freecodecamp.com/avil172
Avil
@Avil172
Sep 25 2015 18:56
@vmsinc it didn't work?
aeroldb
@aeroldb
Sep 25 2015 18:57
@kgdiem so
destroyer([1, 2, 3, 1, 2, 3], 2, 3, "");
the arguments is
destroyer(arguments);
Kevin Diem
@kgdiem
Sep 25 2015 18:58
Well you know that every time arguments[0] is going to be the array you start with
so then in the snipet I pasted above I started i as 1 to skip the initial array. Then, arguments.length goes through the 2, 3, and the ""
aeroldb
@aeroldb
Sep 25 2015 18:58
ahhh i see, but i got that one correct right? the argument = [1,2,3,1,2,3], 2, 3, "");
Kevin Diem
@kgdiem
Sep 25 2015 19:00
I think so. The arguments are what is inside the parenthesis when you call a function if that is what you're asking
aeroldb
@aeroldb
Sep 25 2015 19:01
@kgdiem yes that one! i figured it out now, thanks for your help! :D
CamperBot
@camperbot
Sep 25 2015 19:01
aerb199 sends brownie points to @kgdiem :sparkles: :thumbsup: :sparkles:
:star: 217 | @kgdiem | http://www.freecodecamp.com/kgdiem
Kevin Diem
@kgdiem
Sep 25 2015 19:01
no
problemo
Laura Veee
@Cyclokitty
Sep 25 2015 19:11
Ok, new problem: Waypoint: Bring your JavaScript Slot Machine to Life. I've assigned each slot to slotOne or slotTwo or slotThree but there is something I'm doing wrong but I can't see it.
Patrick Toy
@patrickjtoy
Sep 25 2015 19:12
Has anyone else completed the Zipline: Build a Random Quote Machine challenge? I've got it working locally, but the API the lesson suggests serves over HTTP and Codepen serves over HTTPS, so I can't hit the API from Codepen. Thoughts?
Laura Veee
@Cyclokitty
Sep 25 2015 19:13
$($(".slot")
     [0]).html(slotOne);
    $($(".slot")
     [1]).html(slotTwo);
    $($(".slot")
     [2]).html(slotThree);
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:15
@patrickjtoy you can load codepen over http - that's what I had to do
Of course, codepen embeds won't show the quote when embedded on a https site. Haven't figured out a workaround for that yet.
Patrick Toy
@patrickjtoy
Sep 25 2015 19:19
@TylerMoeller Ah, of course. I was wondering why it was working in Chrome Incognito, I just needed to disable HTTPS Everywhere for Codepen. Good call, thanks!
CamperBot
@camperbot
Sep 25 2015 19:19
patrickjtoy sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star: 194 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:19
@Cyclokitty try putting your code on three lines instead of 6
ninjatron
@ninjatron
Sep 25 2015 19:19
anyone know angular?
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:20
        $($(".slot")[0]).html(slotOne);
        $($(".slot")[1]).html(slotTwo);
        $($(".slot")[2]).html(slotThree);
PersonUvInterest0709
@PersonUvInterest0709
Sep 25 2015 19:20
I need help with nesting!
Laura Veee
@Cyclokitty
Sep 25 2015 19:20
@TylerMoeller THANK YOU!!
CamperBot
@camperbot
Sep 25 2015 19:20
cyclokitty sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star: 195 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:20
np :)
Jordan Bourne
@JordanBourne
Sep 25 2015 19:20
function destroyer(arr, val1, val2, val3) {
    var newArr = [arr, val1, val2, val3]; //Array of all inputs
    var targetArr = newArr.shift(); //Array of just arr, leaving newArr as [val 1, val2, val3]
    for(var i = 0; targetArr.indexOf(newArr[i]) > -1; i++) {    //when newArr[i] exists in targetArr
        var j = 0;
        while(targetArr.indexOf(newArr[j]) > -1) { //while newArr[j] exists in targetArr
            console.log(newArr[j], "in position ", targetArr.indexOf(newArr[j]));
            var cutThis = targetArr.indexOf(newArr[j]); //position of newArr[j] in targetArr
            targetArr.splice(cutThis,1); //cut newArr[j] out
            console.log(targetArr);
        }
        j++; //repeat again with the next term in newArr [NOT WORKING??]
        console.log("i = ", i,"j = ", j);
    }
    return targetArr; //supposed to return [1,1]
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3, "");
Can someone tell me why my while loop doesn't seed to be repeating properly?
Laura Veee
@Cyclokitty
Sep 25 2015 19:21
That worked perfectly.
ninjatron
@ninjatron
Sep 25 2015 19:21
anyone know angular?
PersonUvInterest0709
@PersonUvInterest0709
Sep 25 2015 19:24
@TylerMoeller Can you help me with nesting?
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:25
Maybe - is there a waypoint you're working on?
@PersonUvInterest0709 nesting elements or are you talking about js scope?
PersonUvInterest0709
@PersonUvInterest0709
Sep 25 2015 19:26
yes Nest An Anchor Element Within A Paragraph
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:27
@PersonUvInterest0709 what have you got so far?
PersonUvInterest0709
@PersonUvInterest0709
Sep 25 2015 19:29
<p> View More<a href="freecatphotoapp.com" cat photos</a></p>
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:30
@PersonUvInterest0709 You almost have it correct, just missing a > after the double quote to close the first <a tag
Jason Wood
@catapixel
Sep 25 2015 19:30
@PersonUvInterest0709 you need a > after your .com"
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:31
@PersonUvInterest0709 you'll also want a space after "More" so you don't end up with View Morecat photos
PersonUvInterest0709
@PersonUvInterest0709
Sep 25 2015 19:33
the module is telling me i need to nest the anchor in the paragraph before moving forward. I added the neccessary changes you recommended and i still cannot get past it!
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:33
@PersonUvInterest0709 Can you paste your updated code here?
PersonUvInterest0709
@PersonUvInterest0709
Sep 25 2015 19:33
<p> View More
<a href="freecatphotoapp.com"> cat photos</a>.
</p>
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:34
@PersonUvInterest0709 You are still missing a space after "More"
PersonUvInterest0709
@PersonUvInterest0709
Sep 25 2015 19:35
ok I added the space"Your a element should be nested within your new p element." is what the module is telling me im doing wrong.
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:36
@PersonUvInterest0709 never mind, you put it before 'cat' - try putting it all on one line
PersonUvInterest0709
@PersonUvInterest0709
Sep 25 2015 19:42
putting the anchor on one line?
Ok I found it!!!!
@TylerMoeller Thank you!
CamperBot
@camperbot
Sep 25 2015 19:44
personuvinterest0709 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star: 196 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:45
@PersonUvInterest0709 glad that worked :thumbsup:
JeremyWBean
@JeremyWBean
Sep 25 2015 19:45
If you don't mind, check out the first version of my Simon game. Please, let me know if there are any bugs :smile: http://codepen.io/JeremyWBean/full/vOqwgG/
Wiko
@wico216
Sep 25 2015 19:49
@JeremyWBean it always chooses yellow?
got up to lvl 7 and it was always yellow
JeremyWBean
@JeremyWBean
Sep 25 2015 19:51
@wico216 Strange.... It doesn't do that for me in Firefox. What browser are you using?
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:53
@JeremyWBean very cool - I haven't gotten to that zipline yet. I noticed you can jump ahead in levels by double, triple-clicking the button then it gets all out of order.
pfisterfarm
@pfisterfarm
Sep 25 2015 19:53
Can someone give me a hint on how to start the first Zipline ("Build a Personal Portfolio Page")? It seems like a pretty big jump in difficulty from what came before. I was following along pretty well up to that point
Ariel
@ArielLeslie
Sep 25 2015 19:53
@pfisterfarm Start by forking the example codepen. Then just make small changes incrementally
Wiko
@wico216
Sep 25 2015 19:54
@JeremyWBean using chrome
JeremyWBean
@JeremyWBean
Sep 25 2015 19:55
@TylerMoeller Will look into it. Thanks!
CamperBot
@camperbot
Sep 25 2015 19:55
jeremywbean sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star: 197 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
pfisterfarm
@pfisterfarm
Sep 25 2015 19:55
@ArielLeslie Does the new project need to look identical to the example?
Ariel
@ArielLeslie
Sep 25 2015 19:55
@pfisterfarm Nope. Make your own.
Tyler Moeller
@TylerMoeller
Sep 25 2015 19:55
@pfisterfarm start with something simple, based on what you learned in the first 100 waypoints. You can then customize it as needed. Mine is a work in progress, as I keep updating it while learning new things.
Ariel
@ArielLeslie
Sep 25 2015 19:56
I mean, you can try to duplicate it exactly if you prefer, I think most people want to try their aesthetics
pfisterfarm
@pfisterfarm
Sep 25 2015 19:56
@ArielLeslie @TylerMoeller OK, thanks, the "reverse engineer" was throwing me
CamperBot
@camperbot
Sep 25 2015 19:56
pfisterfarm sends brownie points to @arielleslie and @tylermoeller :sparkles: :thumbsup: :sparkles:
:star: 198 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
:star: 411 | @arielleslie | http://www.freecodecamp.com/arielleslie
Wiko
@wico216
Sep 25 2015 19:56
@JeremyWBean after playing with it i noticed that it only changes to a different color after turn 8
Gerald James Carrow
@gjcarrow
Sep 25 2015 19:57
@pfisterfarm Watch other tutorials on creating your own portfolio page and stuff, too. You'll learn a lot that will help.
Ariel
@ArielLeslie
Sep 25 2015 19:57
@pfisterfarm I think that the idea is show you can do the same things as the example one, but you don't have to make an identical page
pfisterfarm
@pfisterfarm
Sep 25 2015 19:58
@gjcarrow Thank you... do you have links to specific tutorials or should I just search?
CamperBot
@camperbot
Sep 25 2015 19:58
pfisterfarm sends brownie points to @gjcarrow :sparkles: :thumbsup: :sparkles:
:star: 191 | @gjcarrow | http://www.freecodecamp.com/gjcarrow
JeremyWBean
@JeremyWBean
Sep 25 2015 19:59
@wico216 I'll look into that.
Gerald James Carrow
@gjcarrow
Sep 25 2015 20:00
I've watched so many, and there are some that are better than others for sure. If you can give me a minute I'll search through my bookmarks and send a couple of the better ones.
ToddSauce
@ToddSauce
Sep 25 2015 20:03
Hi. I have a question.
I'm new.
Gerald James Carrow
@gjcarrow
Sep 25 2015 20:06
@pfisterfarm Try this one . Its really thorough.
@pfisterfarm There is a playlist, so start at the beginning and just work through them. And the Box Model. I can't stress enough how helpful it is if you truly grasp the concept of the box model when starting out.
Ariel
@ArielLeslie
Sep 25 2015 20:11
@ToddSauce 'sup?
Avil
@Avil172
Sep 25 2015 20:15

hi, i was trying something different with this waypoint..
http://freecodecamp.com/challenges/waypoint-disable-an-element-using-jquery
the objective is to disable target1 button using this..

$("#target1").prop("disabled",true);

and i completed that, but then i tried to disable all buttons of the id "#left-well "
so i wrote this..

$("#left-well").prop("disabled",true);

which should have disabled the left-well buttons(?), but it didn't. can someone tell me what did i do wrong?

Gerald James Carrow
@gjcarrow
Sep 25 2015 20:24
@Avil172 Hi. What you tried to disable was the div element. That is essentially a container that holds the other elements. Disable only works on certain elements. You can't disable a div. Kind of like you can't disable a <p> element, which is a paragraph. Does that make sense?
You're going to essentially disable elements that are in a form. Those kind of elements will accept the disabled property.
Avil
@Avil172
Sep 25 2015 20:26
@gjcarrow thanks for the reply, but then how does it work when we nest elements within each other?
CamperBot
@camperbot
Sep 25 2015 20:26
avil172 sends brownie points to @gjcarrow :sparkles: :thumbsup: :sparkles:
:star: 192 | @gjcarrow | http://www.freecodecamp.com/gjcarrow
Gerald James Carrow
@gjcarrow
Sep 25 2015 20:30
@Avil172 So for that, think about nesting css selectors. Jquery uses that same technique basically. So if your code was
js $("#left-well #target1").prop("disabled",true);
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:30
@Avil172 umm.... $("#left-well").filter('button').prop("disabled",true);
Avil
@Avil172
Sep 25 2015 20:30
@gjcarrow like we use anchor elements, form elements etc to nest one element inside another?
and then apply a class(or something) to the parent element, which causes a change to all elements inside it.
we also use container-fluid class to div element, which actually changes the heading/paragraph/forms, but the other elements that are nested within the div elements remain unaffected.
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:31
@gjcarrow it's not so good for performance to use the descendant selector using jQ. Sizzle is slow. :(
Avil
@Avil172
Sep 25 2015 20:32
@gjcarrow @abhisekp i haven't learned about javascript and filter yet.. so..
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:33
@Avil172 CSS or otherwise called Cascaded stylesheet means the styles are cascaded but the property of an object is only applied to the targetted element. You'll know about Objects once you learn about JS. :)
Gerald James Carrow
@gjcarrow
Sep 25 2015 20:33
@abhisekp You're absolutely right. It was more proof-of-concept. When @Avil172 gets to the point where he/she is thinking about performance I don't think it will be an issue.
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:33
@gjcarrow yes. You're rt. :)
@Avil172 If you dive deep too much, you won't get the gist. Learn as it comes. Don't try to know everything.
https://twitter.com/ossia/status/565907210497040384
Avil
@Avil172
Sep 25 2015 20:37
@gjcarrow so i take it that there will be another waypoint that will describe this? @abhisekp thanks but i am targetting the id #left-well here, what does .css have to do with it?
CamperBot
@camperbot
Sep 25 2015 20:37
avil172 sends brownie points to @gjcarrow and @abhisekp :sparkles: :thumbsup: :sparkles:
:warning: avil172 already gave gjcarrow points
:star: 473 | @abhisekp | http://www.freecodecamp.com/abhisekp
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:39
@Avil172 jQ uses css selector look alike technique to select or target elements.
basically, if you can target an element using css, you can target it using jQ
gn. :)
:wave: bye
Anthony Albertorio
@tesla809
Sep 25 2015 20:40
hey guys!
I have a question
for some reason my CSS is not loading the fonts correctly
any idea why ?
Gerald James Carrow
@gjcarrow
Sep 25 2015 20:41
@Avil172 I wish I could say something to clear it all up for you. Its really awesome that you didn't just target the #target1, because you wanted to try something different and see what happens. Right on! Google is your friend. In web development, you will ALWAYS be learning. ALWAYS. So go look at beginner jquery tutorials and stuff. There are tons of resources out there.
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:42

I'm The Teslaaaa


@tesla809
Boris
@boris-in-london
Sep 25 2015 20:42
blob
any idea why my filter method on line 7 empties my array?
you're help is much obliged!
your*
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:44
@tesla809 do you've HTTPS Everywhere extension installed in your browser?
Anthony Albertorio
@tesla809
Sep 25 2015 20:44
nope
whats that
Gerald James Carrow
@gjcarrow
Sep 25 2015 20:44
@Avil172 Code School has a terrific jquery beginners tutorial that will clear up all the things you're asking about.
Anthony Albertorio
@tesla809
Sep 25 2015 20:44
LOL @abhisekp
Avil
@Avil172
Sep 25 2015 20:45
@gjcarrow yeah i try to google questions like this, but the results include almost every language that i have to learn yet, such as javascript and others, so that makes it even more difficult to me.
i try my best to understand everything from a waypoint before proceeding to the next waypoint.
Anthony Albertorio
@tesla809
Sep 25 2015 20:45
?
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:47
@tesla809 try this
Anthony Albertorio
@tesla809
Sep 25 2015 20:47
I think the problem is in the css code
thought
though
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:47
@Avil172 :point_up: September 26, 2015 2:03 AM
Anthony Albertorio
@tesla809
Sep 25 2015 20:47
the site im linking from i dont belive is HTTPS
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:48
:+1:
Gerald James Carrow
@gjcarrow
Sep 25 2015 20:48
@Avil172 That's another thing that comes with time - you get better at learning this stuff. You're on the right track for sure. If you don't move on until you're certain you've groked the concept, you'll be much better off.
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:48
@Avil172 you can't learn everything. Learn in bits and pieces and join then when the time is rt. You'll know when you're ready. Just go with the flow...
Boris
@boris-in-london
Sep 25 2015 20:49
so ah.... who's done the Palindrome bonfire?
I've been debugging a logic error for hours, sure could use some help
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:50
@boris-in-london the array doesn't have a " "(space) element. Hence, your filter returns empty array.
Boris
@boris-in-london
Sep 25 2015 20:51
.<
i'm an idiot...
Gerald James Carrow
@gjcarrow
Sep 25 2015 20:51
@boris-in-london Your function is telling it to return all the elements that are empty. Instead of == use !==
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:51
@boris-in-london No. You're not. Just use the rt. tool for the job. http://repl.it
Gerald James Carrow
@gjcarrow
Sep 25 2015 20:51
@boris-in-london You're not an idiot!! Its called learning
Boris
@boris-in-london
Sep 25 2015 20:52
thanks thanks
CamperBot
@camperbot
Sep 25 2015 20:52
if you want to thank someone, put an @ before their name!
Boris
@boris-in-london
Sep 25 2015 20:52
quick question, i did put a space between ""
it reads " "
i'm trying to filter out all spaces in strings
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:52
Boris
@boris-in-london
Sep 25 2015 20:53
lol ok i see now
perfect
thank you @gjcarrow @abhisekp
CamperBot
@camperbot
Sep 25 2015 20:53
boris-in-london sends brownie points to @gjcarrow and @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 474 | @abhisekp | http://www.freecodecamp.com/abhisekp
:star: 193 | @gjcarrow | http://www.freecodecamp.com/gjcarrow
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:53
@boris-in-london if possible, pls read the whole doc. It will benefit in long run.
Boris
@boris-in-london
Sep 25 2015 20:53
:)
will do
Abhisek Pattnaik
@abhisekp
Sep 25 2015 20:54
:wave: bye
gn
:zzz:
Anthony Albertorio
@tesla809
Sep 25 2015 21:18
@abhisekp what was the solution you proposed again?
Peter Daily
@thepeted
Sep 25 2015 21:31
Good evening from the UK :-)
Anthony Albertorio
@tesla809
Sep 25 2015 21:31
Whats up @thepeted
Peter Daily
@thepeted
Sep 25 2015 21:32
I'm having 'cross origin request' woes...
trying to load an mp3 for howler.js
the file is hosted on github and I'm working in codepen
do I need to load via ajax / jquery or something?
var alarmSound = new Howl({ urls: ['http://github.com/thepeted/chefmonkey/blob/master/assets/beep.mp3'], sprite: {beep: [0,500] }, loop: true } );
hang on...
might have the url wrong :blush:
Anthony Albertorio
@tesla809
Sep 25 2015 21:35
@thepeted hey I am having those problems too
as we speak. How do you fix them? @thepeted
Peter Daily
@thepeted
Sep 25 2015 21:36
hangon.. lemme try with the corrected url
OK it looks like I got it working.. here is the corrected URL:
var alarmSound = new Howl({ urls: ['https://raw.githubusercontent.com/thepeted/chefmonkey/master/assets/beep.mp3'], sprite: {beep: [0,500] }, loop: true
@tesla809 I was getting the CORS error from a URL I kind of hacked(ish) looking through source files here: http://soundbible.com/mp3/Bleep-SoundBible.com-1927126940.mp3
Tried it on a github repository I have and it seems to have worked, no CORS errors and the sound plays
Worth trying http instead of https or vice versa?
Peter Daily
@thepeted
Sep 25 2015 21:42
Would someone mind trying it out for me on my codepen http://codepen.io/thepeted/pen/RWGXre
You can reduced the timer to 1 min, obvs :-D
CORS a bit of a mystery to me - I have read that jquery's $(AJAX ) includes hacks/magic to get around it
E-Tank
@E-Tank
Sep 25 2015 21:56
I'm sure that I'm making some obvious mistake somewhere, but I'm having issues with the Factorialize bonfire.
function factorialize(num) {
  var x = num;
  for(var i = 0; i < num; i++){
   var y =+ i * x;
  }
    return y;
}

factorialize(5, '');
Took a break and came back. Retained a good bit, but having issues here.
E-Tank
@E-Tank
Sep 25 2015 22:06
Figured out I'm resetting the Y with each loop. disregard, I am an idiot.
Bill
@kirah1314
Sep 25 2015 22:08
@E-Tank don't use i = 0, I think you figured it out
CamperBot
@camperbot
Sep 25 2015 22:08
kirah1314 sends brownie points to @e-tank :sparkles: :thumbsup: :sparkles:
:star: 242 | @e-tank | http://www.freecodecamp.com/e-tank
Bill
@kirah1314
Sep 25 2015 22:08
^ that's weird
^ it's replacing "think you" with "thank you"?
CamperBot
@camperbot
Sep 25 2015 22:09
if you want to thank someone, put an @ before their name!
Bill
@kirah1314
Sep 25 2015 22:13
@abhisekp bot takes in "think you" and gave brownie points, weird see above ^
tank
CamperBot
@camperbot
Sep 25 2015 22:16
if you want to thank someone, put an @ before their name!
Anthony Albertorio
@tesla809
Sep 25 2015 22:19
@thepeted pretty cool app!!!
Peter Daily
@thepeted
Sep 25 2015 22:24
@tesla809 ta muchly! Did you manage to get it to beep?
Anthony Albertorio
@tesla809
Sep 25 2015 22:28
didnt notice
Peter Daily
@thepeted
Sep 25 2015 22:35
ah, just tried - it it works on my android so thats a good sign!
so can confirm howler.js works on codepen for files hosted on github
Daniel Drasdo
@danieldrasdo
Sep 25 2015 22:36
Anyone know the percentage of users who have created an account that have gotten a FCC cert?
Alexander
@teichopsia-
Sep 25 2015 22:44

quick question about javascript.....

var myArray = [1,2,3];
myArray[0] = 3;

when one creates a variable, one must use the keyword var to declare it, right? But after that there is no need to use the keyword var as long as it refers to the same variable? Am I understanding this correctly?

Anthony Albertorio
@tesla809
Sep 25 2015 22:44
@teichopsia- yea
Alexander
@teichopsia-
Sep 25 2015 22:44
@tesla809 thanks!
CamperBot
@camperbot
Sep 25 2015 22:44
teichopsia- sends brownie points to @tesla809 :sparkles: :thumbsup: :sparkles:
:star: 286 | @tesla809 | http://www.freecodecamp.com/tesla809
Hans van Riet
@hansinla
Sep 25 2015 22:44
@teichopsia- yes, as long it’s in the same scope.
Anthony Albertorio
@tesla809
Sep 25 2015 22:45
@teichopsia- you are accessing the first element with myArray[0] and setting it to 3
yup
Alexander
@teichopsia-
Sep 25 2015 22:46
@hansinla @tesla809 basically, whenever I want to store a value in a variable, first I must declare it. Once it has been declared, it can be used without needing to use the 'var' keyword?
Hans van Riet
@hansinla
Sep 25 2015 22:46
Correct.
Anthony Albertorio
@tesla809
Sep 25 2015 22:46
@teichopsia- yes. its just means hey, this is a new variable
@teichopsia- be careful to always include the var first before starting to use a variable.
@teichopsia- if you don't then you set a global variable, which can be edited in any part of the program
Alexander
@teichopsia-
Sep 25 2015 22:48

@tesla809 @hansinla thanks guys. I'm halfway through the javascript waypoint and had that doubt.

@tesla809 could you elaborate more on the last part? Unless it's on the link, then I'll just read it from there....... :smile:

CamperBot
@camperbot
Sep 25 2015 22:48
teichopsia- sends brownie points to @tesla809 and @hansinla and @tesla809 :sparkles: :thumbsup: :sparkles:
:warning: teichopsia- already gave tesla809 points
:warning: teichopsia- already gave tesla809 points
:star: 391 | @hansinla | http://www.freecodecamp.com/hansinla
Anthony Albertorio
@tesla809
Sep 25 2015 22:48
thanks!
CamperBot
@camperbot
Sep 25 2015 22:49
if you want to thank someone, put an @ before their name!
Tyler Moeller
@TylerMoeller
Sep 25 2015 22:54

Hey - I need some help getting a JSON object back from a URL.

    var lat = position.coords.latitude;
    var lon = position.coords.longitude;
    var loc = lat + "," + lon;
    var geocodingAPI = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' + loc;
    $.getJSON('geocodingAPI', function(data) {         
    console.log(data);
    });

Any ideas here? I have not been able to get it working based on the last couple of examples at: http://api.jquery.com/jquery.getjson/

Daniel Creutz
@prykor
Sep 25 2015 22:55
Could anyone tell me why this API request isn't working? http://codepen.io/danielcreutz/pen/bVBVJZ?editors=101
Zack Wallace
@guyinpv
Sep 25 2015 23:06
Don't hit yourself, but you need to add jquery to the codepen first.
Daniel Creutz
@prykor
Sep 25 2015 23:07
asnhdjklasd
Oh my god
Zack Wallace
@guyinpv
Sep 25 2015 23:07
Even so, you won't be able to read data from the URL due to cross-origin request blocked
Hans van Riet
@hansinla
Sep 25 2015 23:07
@TylerMoeller You want to do:
"http://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + lon;
peopleblazin
@peopleblazin
Sep 25 2015 23:08
Hey! I need some help on the Waypoint: Declare JavaScript Variables in FreeCodeCamp. Can anyone help let me know . I am new to Javascript so . I have been doing HTML more than anything else
Hans van Riet
@hansinla
Sep 25 2015 23:10
@peopleblazin show what you have so far.
Tyler Moeller
@TylerMoeller
Sep 25 2015 23:10
@hansinla I can use that URL too, the problem is getting the JSON back so I can parse it
    getJSONP('http://api.openweathermap.org/data/2.5/weather?lat=35.6087583&lon=-120.29642349999999', function(data) {
      console.log(data);
    });
Nothing gets logged
Daniel Creutz
@prykor
Sep 25 2015 23:10
@guyinpv Is there a way to unblock it?
Joshua Abu
@Absolutestunna
Sep 25 2015 23:10
@Absolutestunna
this is going to sound crazy. i am working on the ziplines: build a random quote machine and I don't even know how to add an api from a quote generator. How does that work? Also I don't know how to use html and javascript at the same time.
How does a button created in html be used in js?
peopleblazin
@peopleblazin
Sep 25 2015 23:12
Okay , @hansinla let me put it on here so you can take a look
Peter Daily
@thepeted
Sep 25 2015 23:12
@Absolutestunna no worries - search for a quote API and most of the good ones will have good documentation on their website
peopleblazin
@peopleblazin
Sep 25 2015 23:12
just confused with a 2 year old running around and screaming
Hans van Riet
@hansinla
Sep 25 2015 23:12
@TylerMoeller I used google.maps.Geocoder(); to get lat lon from an address.
Peter Daily
@thepeted
Sep 25 2015 23:12
It will also be helpful to read about AJAX
specifically jquery $(AJAX) - that helped me a lot anyway
Hans van Riet
@hansinla
Sep 25 2015 23:13
@peopleblazin okay. wiki format
Tyler Moeller
@TylerMoeller
Sep 25 2015 23:13
@hansinla How did you get the JSON data back from your URL so you could parse it?
Hans van Riet
@hansinla
Sep 25 2015 23:14
@TylerMoeller from the openweathrmap API you just JSON.parse the result.
Kevin Diem
@kgdiem
Sep 25 2015 23:15
Would someone mind looking at my twitch.tv zipline and telling me why my JSON data doesn't sync up w. my streamer array? http://codepen.io/kgdiem/pen/avBbjm
@TylerMoeller You can do something like this:
```
$.get('url').done(function(json){
});
@TylerMoeller You can do something like this:
```
$.get('url').done(function(json){
});
sorry jesus ill finish writing it this time
peopleblazin
@peopleblazin
Sep 25 2015 23:16
@hansinla how about this ? assert((function(){if(typeof(myName) !== "undefined" && typeof(myName) === "string" && myName.length > 0){return true;}else{return false;}})(), 'myName should be a string that contains at least one character in it.');myName should be a string that contains at least one character in it.
Peter Daily
@thepeted
Sep 25 2015 23:16
@Absolutestunna also, check out jQuery's .click for an example of how you can use HTML & javascript to get a button on your web page to do something. HTH
Kevin Diem
@kgdiem
Sep 25 2015 23:17
@TylerMoeller You can do something like this:
var zipCode;
$.get('url').done(function(json){
zipCode = json.main.zip
});
peopleblazin
@peopleblazin
Sep 25 2015 23:17
How did you get a snap of the console?
Hans van Riet
@hansinla
Sep 25 2015 23:18
@peopleblazin that’s the test case, what’s your code?
Tyler Moeller
@TylerMoeller
Sep 25 2015 23:18
I just tried this and it failed:
url ="http://api.openweathermap.org/data/2.5/weather?lat=35.6087583&lon=-120.29642349999999";
    $.get('url').done(function(json){
      console.log(json);
});
fail = nothing logged
peopleblazin
@peopleblazin
Sep 25 2015 23:18

// var ourName = "FreeCodeCamp";

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

if(typeof(myName) !== "undefined"){(function(v){return v;})(myName);}

Kevin Diem
@kgdiem
Sep 25 2015 23:19
@TylerMoeller don't put 'url' put url
Jessi L Wasell
@JessiW
Sep 25 2015 23:19
anyone here able to help me on the local weather app zipline? I tried the help zipline chat room but there doesn't seem to be anyone in there right now...
Hans van Riet
@hansinla
Sep 25 2015 23:19
@peopleblazin The var name that you need to declare is myName. You declare a variable with: var myName = now use that to set myName to your name.
Kevin Diem
@kgdiem
Sep 25 2015 23:19
@JessiW yee
Tyler Moeller
@TylerMoeller
Sep 25 2015 23:20
Okay, just tried this and it still doesn't log anything:
    var zipCode;
    var url ="http://api.openweathermap.org/data/2.5/weather?lat=35.6087583&lon=-120.29642349999999";
    $.get(url).done(function(json){
      zipCode = json.main.zip
      console.log(zipCode);
});
peopleblazin
@peopleblazin
Sep 25 2015 23:20
This message was deleted
CamperBot
@camperbot
Sep 25 2015 23:20
peopleblazin sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 392 | @hansinla | http://www.freecodecamp.com/hansinla
Jessi L Wasell
@JessiW
Sep 25 2015 23:20
Kevin Diem
@kgdiem
Sep 25 2015 23:21
@TylerMoeller there is no json.main.zip, paste the URL into your browser and check out the JSON.
"main":{"temp":308.4,"pressure":1011,"humidity":13,"temp_min":303.15,"temp_max":310.93},"wind":{"speed":5.7,"deg":190}
Tyler Moeller
@TylerMoeller
Sep 25 2015 23:21
I can do that, but want to get it in code so I can parse it. Am I overlooking something obvious?
Yeah, I'm trying to get that entire object displayed with console.log
Kevin Diem
@kgdiem
Sep 25 2015 23:22
@TylerMoeller inside of the main there are those things. you can console.log json.main or json now
Zack Wallace
@guyinpv
Sep 25 2015 23:22
@prykor maybe this will help. https://blog.codepen.io/2013/09/23/ajax-codepen/
Kevin Diem
@kgdiem
Sep 25 2015 23:22
@JessiW whats the issue
Hans van Riet
@hansinla
Sep 25 2015 23:23
@TylerMoeller try
 $.get(url).done(function(result){
      if (result) console.log(JSON.parse(result));
});
Daniel Creutz
@prykor
Sep 25 2015 23:24
@guyinpv Thanks! I wish FCC included stuff like this...
CamperBot
@camperbot
Sep 25 2015 23:24
prykor sends brownie points to @guyinpv :sparkles: :thumbsup: :sparkles:
:star: 24 | @guyinpv | http://www.freecodecamp.com/guyinpv
Jessi L Wasell
@JessiW
Sep 25 2015 23:24
Sorry, @kgdiem
I have a question about the local weather app - I'm trying to get all of my backgrounds to show up depending on the weather conditions. I have set them to correspond to the codes for the weather icons - and to add classes to the body of the page to change the background.
For some reason some are showing up and others are not. For example, I have my background pics for clouds show up when I type in tulsa, ok - because its cloudy there right now, but when I type in a city like Portland, where it is also cloudy, the background doesn't change... I'm wondering why?
Tyler Moeller
@TylerMoeller
Sep 25 2015 23:24
@hansinla that still doesn't return anything for me.
var url ="http://api.openweathermap.org/data/2.5/weather?lat=35.6087583&lon=-120.29642349999999";
    $.get(url).done(function(result){
    if (result) console.log(JSON.parse(result));
});
Jessi L Wasell
@JessiW
Sep 25 2015 23:25
I'm not quite done with the layout - so it looks a little funny right now...
I just typed in Orlando, florida too and my rain background shows....
but others don't
I just heard back from a couple of people in the HelpZipline room - any input would be appreciated anyway however!
Hans van Riet
@hansinla
Sep 25 2015 23:25
@TylerMoeller Does your function get called at all? Is this on coped? Mind sending the full link?
Tyler Moeller
@TylerMoeller
Sep 25 2015 23:27
Kevin Diem
@kgdiem
Sep 25 2015 23:27
@JessiW to me it seems like it doesn't update after you put the first value -- I put Miami first and it showed raining then kept the same background
@JessiW so maybe move the function?
@JessiW to the button press or json call
look up javascript event loop
MSWindows10
@MSWindows10
Sep 25 2015 23:29
Hi guys. I'm new to HTML5 so I'm a bit confused about this code. What exactly does the instruction say when it asks me to copy and paste the first few words of the Kitty ipsum dolor amet text, but it still shows an X mark. What should I do? P.S. how do I post my code?

<h1>Hello World</h1>

<h2>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</h2>

<p>Hello Paragraph</p>

Shows this error: red X circle: Your p element should contain the first few words of the provided kitty ipsum text.
Hans van Riet
@hansinla
Sep 25 2015 23:31

@TylerMoeller

$.get(url, function(result){

    console.log(result);
});

works for me. Keep in ind that this functon keeps getting called, you should change that. It returns Shandon as the city.

Tyler Moeller
@TylerMoeller
Sep 25 2015 23:32
@hansinla thanks. I'll give that a try. I'll change the function too - it's trying to find a more accurate location for mobile devices, for example, when GPS takes a while.
CamperBot
@camperbot
Sep 25 2015 23:32
tylermoeller sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 393 | @hansinla | http://www.freecodecamp.com/hansinla
MSWindows10
@MSWindows10
Sep 25 2015 23:36
Never mind guys about my code. I put the code in the <h> and </h> line, not the <p> and the </p> line.
peopleblazin
@peopleblazin
Sep 25 2015 23:37
Glad you got it figured out on your own @MSWindows10 ! Its a good thing to be able to correct yourself than the internet ! :+1:
Proves that you have learned ! @MSWindows10
MSWindows10
@MSWindows10
Sep 25 2015 23:42
Hi guys. How do I post my code? I've gotten stuck again.
peopleblazin
@peopleblazin
Sep 25 2015 23:43
I have a question because i am fairly new to GitHub . How do I paste the snap of the console on FreeCodeCamp i mean i know i have to ''' var code="formatted"; ''' . But how do i format it from FreeCodeCamp?
CamperBot
@camperbot
Sep 25 2015 23:43
:bulb: to format code use backticks! ``` more info
MSWindows10
@MSWindows10
Sep 25 2015 23:44

`<h2>CatPhotoApp</h2>

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

Hans van Riet
@hansinla
Sep 25 2015 23:44
wiki format
CamperBot
@camperbot
Sep 25 2015 23:44

: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

```js ⇦ Type 3 backticks, then type js or html and 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

peopleblazin
@peopleblazin
Sep 25 2015 23:45
Okay DUH heh heh Thanks @hansinla @MSWindows10
CamperBot
@camperbot
Sep 25 2015 23:45
peopleblazin sends brownie points to @hansinla and @mswindows10 :sparkles: :thumbsup: :sparkles:
:warning: peopleblazin already gave hansinla points
:star: 9 | @mswindows10 | http://www.freecodecamp.com/mswindows10
peopleblazin
@peopleblazin
Sep 25 2015 23:46

`<style>
h2 {
color: red;
}
</style>

<h2>CatPhotoApp</h2>

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

I dont think it worked
like i wanted it to
MSWindows10
@MSWindows10
Sep 25 2015 23:47
like that? I've seen other people with the black background and the colored code, how?
peopleblazin
@peopleblazin
Sep 25 2015 23:47
Same
MSWindows10
@MSWindows10
Sep 25 2015 23:47
oh man this is funny
peopleblazin
@peopleblazin
Sep 25 2015 23:47
Hold on i think i got it

``` <style>
h2 {
color: red;
}
</style>

<h2>CatPhotoApp</h2>

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

MSWindows10
@MSWindows10
Sep 25 2015 23:48
?
peopleblazin
@peopleblazin
Sep 25 2015 23:48
  h2 {
    color: red;
  }
</style>

<h2>CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
MSWindows10
@MSWindows10
Sep 25 2015 23:48
How the.......did you do that?
peopleblazin
@peopleblazin
Sep 25 2015 23:48
its ``` back ticks then paste code then another three backticks
so <code>
MSWindows10
@MSWindows10
Sep 25 2015 23:48
alright thanks i'll try it. lol
CamperBot
@camperbot
Sep 25 2015 23:48
if you want to thank someone, put an @ before their name!
peopleblazin
@peopleblazin
Sep 25 2015 23:49
^
MSWindows10
@MSWindows10
Sep 25 2015 23:49
thanks @peopleblazin
CamperBot
@camperbot
Sep 25 2015 23:49
mswindows10 sends brownie points to @peopleblazin :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for peopleblazin
peopleblazin
@peopleblazin
Sep 25 2015 23:49
Bruh
MSWindows10
@MSWindows10
Sep 25 2015 23:49

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