These are chat archives for FreeCodeCamp/Help

7th
Sep 2015
lonirose
@lonirose
Sep 07 2015 00:04
Need help on Bonfire Reverse a String
CamperBot
@camperbot
Sep 07 2015 00:04
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
lonirose
@lonirose
Sep 07 2015 00:05
bonfire name
CamperBot
@camperbot
Sep 07 2015 00:05
no, type part of the name of the bonfire! eg bonfire roman
lonirose
@lonirose
Sep 07 2015 00:05
bonfire reverse
CamperBot
@camperbot
Sep 07 2015 00:05

:fire:Bonfire: Reverse a String :link:

function reverseString(str) {
  return str;
}

reverseString('hello');

Reverse the provided string.

more info:  bf details | bf links | hint

lonirose
@lonirose
Sep 07 2015 00:06
bonfire split
CamperBot
@camperbot
Sep 07 2015 00:06
Sorry, can't find a bonfire called split. [ Check the map? ]
Moisés Man
@moigithub
Sep 07 2015 00:07
var reg1=new RegExp (/(\w)\s|_(\w)/g);
var reg2=new RegExp (/([a-z])([A-Z])/g);
return str.replace(reg1, '$1' + '-' + '$2').replace(reg2, '$1' + '-' + '$2').toLowerCase();
}
one first second   (\w)\s //*this pattern target this kind of words
_one_two_three  _(\w)    //*this pattern target this kind of words
@alanbuchanan
Anshul Vyas
@av-7
Sep 07 2015 00:09
Hey guys, I am not able to go beyond the Waypoint 1 of Responsive Design with Bootstrap. The instructions are not very clear. It said to add a <div> with a class="container-fluid" to the whole HTML document. I added 1 <div> tag and nested all HTML elements inside it. But it doesn't work. I also tried individually adding <div> elements to each HTML element in the code and it still doesn't let me pass the Waypoint. Any help would be greatly appreciated.
Alice
@AliceReid
Sep 07 2015 00:10
I'm at Waypoint 17 Size Your Images. I understand the directions, but I'm not sure where to put the code. I'm stuck.
Anshul Vyas
@av-7
Sep 07 2015 00:14
Add
>
.smaller-image {
width: 100px;
}
Moisés Man
@moigithub
Sep 07 2015 00:14

u have an element lets say div (or whatever like p, h1, span, etc )
en element can have attributes.. like class, id, src... etc
the syntax is...

<element attribute="value" >
some attributes (like class) allows multiple values

<element class="value1 value2 valueN" >

Alice
@AliceReid
Sep 07 2015 00:16
@av-7 Thank you, but where do I put it?
CamperBot
@camperbot
Sep 07 2015 00:16
alicereid sends brownie points to @av-7 :sparkles: :thumbsup: :sparkles:
:star: 146 | @av-7 | http://www.freecodecamp.com/av-7
Anshul Vyas
@av-7
Sep 07 2015 00:17
@AliceReid Add it inside your <style> </style> tags. And then add the class to your <img> tag as well.
<img class="smaller-image" src=#/> - like this.
Alice
@AliceReid
Sep 07 2015 00:19
Yay, it worked! Thank you!
CamperBot
@camperbot
Sep 07 2015 00:19
if you want to thank someone, put an @ before their name!
Alice
@AliceReid
Sep 07 2015 00:19
Thank you @av-7
CamperBot
@camperbot
Sep 07 2015 00:19
alicereid sends brownie points to @av-7 :sparkles: :thumbsup: :sparkles:
:warning: alicereid already gave av-7 points
Isaac
@BenBagBag
Sep 07 2015 00:35
Hey everyone:
I'm trying to put together the first zipline (personal portfolio), and I'm having a really hard time making the navbar brand and the space between the navbar brand and the navbar li elements the same color. The problem is that I set the navbar's background-color to one color, but then can't get that to be overridden for the middle space:
This message was deleted
CamperBot
@camperbot
Sep 07 2015 00:38
:bulb: to format code use backticks! ``` more info
Isaac
@BenBagBag
Sep 07 2015 00:38
<div class="container">
  <div class="row">
    <div class="col-md-12">
      <nav class="navbar navbar-fixed-top">
        <div class='col-md-12'>
          <div class="navbar-header">
            </button> <a class="navbar-brand" href="#">Ben Bag Bag</a>
          </div>
       <ul class="nav navbar-nav navbar-right">
         <li class="reg-link"><a href="#">About</a></li>
         <li class="reg-link"><a href="#">Portfolio</a></li>
         <li class="reg-link"><a href="#">Contact</a></li>
       </ul>
   </div>
  </nav>
 </div>
</div>
</div>
</body>
Mowgli418
@Mowgli418
Sep 07 2015 00:40
This message was deleted
Jeff
@cakebatter609
Sep 07 2015 00:41
Thanks @ luishendrix92 @Rafase282
CamperBot
@camperbot
Sep 07 2015 00:41
cakebatter609 sends brownie points to @rafase282 :sparkles: :thumbsup: :sparkles:
:star: 403 | @rafase282 | http://www.freecodecamp.com/rafase282
x34passenger
@x34passenger
Sep 07 2015 00:41
I am having trouble positioning my <h1> text
http://codepen.io/x34passenger/pen/KdwjEB
Mowgli418
@Mowgli418
Sep 07 2015 00:42
Hey guys...
This is beyond embarrassing, but I'm brand new here and am missing something in my syntax... Help the plebeian?
Screen Shot 2015-09-06 at 8.41.43 PM.png
Korina Jimenez
@kjcode25
Sep 07 2015 00:43
hello
@Mowgli418 you need to put .red-text{
then color:red;
then close )
*}
Isaac
@BenBagBag
Sep 07 2015 00:44
@x34passenger where do you want your <h1> to go?
x34passenger
@x34passenger
Sep 07 2015 00:45
@BenBagBag if you look at my codepen, I have it centered but it is too high, I would like to lower it more towards the center
Mowgli418
@Mowgli418
Sep 07 2015 00:46
@kjcode25 :+1: Thank you... I don't know how I kept missing it :/
CamperBot
@camperbot
Sep 07 2015 00:46
mowgli418 sends brownie points to @kjcode25 :sparkles: :thumbsup: :sparkles:
:star: 203 | @kjcode25 | http://www.freecodecamp.com/kjcode25
Korina Jimenez
@kjcode25
Sep 07 2015 00:47
you are welcome :) anytime
Isaac
@BenBagBag
Sep 07 2015 00:48
@x34passenger i see what you mean. your problem isn't with your <h1> tag, it's with the lack of padding between your header and the body of the page, you should put something like padding-top: 50px in the CSS for your <body>
@x34passenger this is because the standard size for navbar is 40 px (IIRC), so add another 10 pixels and you've got enough space to make sure stuff isn't getting cut off
x34passenger
@x34passenger
Sep 07 2015 00:49
@BenBagBag great that worked!!!
@BenBagBag thank you
CamperBot
@camperbot
Sep 07 2015 00:49
x34passenger sends brownie points to @benbagbag :sparkles: :thumbsup: :sparkles:
:star: 208 | @benbagbag | http://www.freecodecamp.com/benbagbag
Isaac
@BenBagBag
Sep 07 2015 00:50
@x34passenger anytime!
x34passenger
@x34passenger
Sep 07 2015 01:23
@BenBagBag I'm having trouble centering my buttons
http://codepen.io/x34passenger/pen/KdwjEB
Isaac
@BenBagBag
Sep 07 2015 01:31
@x34passenger if you use a <ul><li></li></ul> (unordered list) to make your Twitter/Github buttons, you can put text-align: center in your CSS to center them. At least I think that's what you're asking for, my computer is acting weird and your screenshot only shows half your page.
x34passenger
@x34passenger
Sep 07 2015 01:36
@BenBagBag how do I make the button icons appear?
Jack
@yakschuss
Sep 07 2015 01:41

Just started Bonfire, and I realized I know literally nothing about Javascript...lol.

function factorialize(num){

  var num = (n = 1)
  while (num < 5){
    return(num * num)
  }


factorialize(5);

not looking for an answer - just not sure where I'm supposed to start, syntactically.
Any help would be awesome. Thanks!

CamperBot
@camperbot
Sep 07 2015 01:41
if you want to thank someone, put an @ before their name!
Jose M Viloria
@josevill
Sep 07 2015 01:41
@x34passenger Font Awesome or Glyphicons
@yakschuss Hey there
Jack
@yakschuss
Sep 07 2015 01:44
@josevill hello sir
Jose M Viloria
@josevill
Sep 07 2015 01:44
@yakschuss You will need to get into some recursiveness.. Or just using a while loop.
Jack
@yakschuss
Sep 07 2015 01:44
lol, gonna google that sentence
thanks! rabbit hole found
CamperBot
@camperbot
Sep 07 2015 01:45
if you want to thank someone, put an @ before their name!
If you want me to teach you the other way with a while loop, we can create a file @ kobra.io and check that out :)
That's an easier approach
Jack
@yakschuss
Sep 07 2015 01:48
@josevill, I'm a theoretical learner, I need to learn WHY something works, rather then how it works.
once I understand the whys of it, how comes easily
@josevill Thanks!
CamperBot
@camperbot
Sep 07 2015 01:49
yakschuss sends brownie points to @josevill :sparkles: :thumbsup: :sparkles:
:star: 282 | @josevill | http://www.freecodecamp.com/josevill
Jose M Viloria
@josevill
Sep 07 2015 01:49
@yakschuss Gotcha, all cool then
x34passenger
@x34passenger
Sep 07 2015 01:52
@josevill how do you find the github glyphicon?
Jose M Viloria
@josevill
Sep 07 2015 01:55
@x34passenger Glyphicons doesnt have the github logo, font awesome does..
@x34passenger Look through the docs how to install it and usage of the lib.
lonirose
@lonirose
Sep 07 2015 02:00
Bonfire Factorialize
CamperBot
@camperbot
Sep 07 2015 02:00

:fire:Bonfire: Factorialize a Number :link:

function factorialize(num) {
  return num;
}

factorialize(5);

Return the factorial of the provided integer.

more info:  bf details | bf links | hint

lonirose
@lonirose
Sep 07 2015 02:01
@camperbot how do you start writing this code
x34passenger
@x34passenger
Sep 07 2015 02:01
@josevill thank you
CamperBot
@camperbot
Sep 07 2015 02:01
x34passenger sends brownie points to @josevill :sparkles: :thumbsup: :sparkles:
:star: 283 | @josevill | http://www.freecodecamp.com/josevill
Jose M Viloria
@josevill
Sep 07 2015 02:02
@lonirose Just type "hint"
x34passenger
@x34passenger
Sep 07 2015 02:06
@josevill I do not see the free code camp icon
@x34passenger You better make a bigger effort looking for things, we're not going to be there to help you out everytime :/
Michael Bomholt
@bomholtm
Sep 07 2015 02:09
is there a easy way to disable landscape modus for your website and does it make sense? would be cool for responsive design
Richard Gottleber
@rgottleber
Sep 07 2015 02:11
help Waypoint: Use Responsive Design with Bootstrap Fluid Containers
CamperBot
@camperbot
Sep 07 2015 02:11

:point_right: waypoint use responsive design with bootstrap fluid containers [wiki]

Use Responsive Design with Bootstrap Fluid Containers

Bootstrap will figure out how wide your screen is and respond by resizing your HTML elements - hence the name Responsive Design.

With responsive design, there is no need to design a mobile version of your website. It will look good on devices with screens of any width.

You can add Bootstrap to any app just by including it with <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/> at the top of your HTML.

:pencil: read more about waypoint use responsive design with bootstrap fluid containers on the FCC Wiki

Richard Gottleber
@rgottleber
Sep 07 2015 02:11
This one references having added that link but I don't see it or any of div's in the starting code..
is this an issue since it's stuck in between waypoints I finished previously?
Jose M Viloria
@josevill
Sep 07 2015 02:13
They have added the bootstrap stylesheet to your code already. Those divs should be created by you if i'm not mistaken
Richard Gottleber
@rgottleber
Sep 07 2015 02:14
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

that's the only stylesheet link ..

or are you saying ..

  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

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

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

  .smaller-image {
    width: 100px;
  }
that is what's included in the link they reference?
Jose M Viloria
@josevill
Sep 07 2015 02:15
They have bootstrap already running in the background of the page, so they don't need you to add it to your sandbox
Richard Gottleber
@rgottleber
Sep 07 2015 02:15
aaahh
gotcha thanks @josevill
CamperBot
@camperbot
Sep 07 2015 02:16
rgottleber sends brownie points to @josevill :sparkles: :thumbsup: :sparkles:
:star: 284 | @josevill | http://www.freecodecamp.com/josevill
Jose M Viloria
@josevill
Sep 07 2015 02:16
You can check the site's source code and see there's a bootstrap.min.css right there :grin:
Branden
@4everyoungz
Sep 07 2015 02:49
mer I dont under stand this and tried reading on github.

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

I keep getting the error "You should be using the function given in the description to calculate the random in number in a range"
this is the function in the description :
Math.floor(Math.random() * (max - min + 1)) + min
help: Waypoint: Generate Random Whole Numbers within a Range
CamperBot
@camperbot
Sep 07 2015 02:54

:point_right: waypoint generate random whole numbers within a range [wiki]

Generate Random Whole Numbers within a Range

We can use a certain mathematical expression to get a random number between two numbers.

Math.floor(Math.random() * (max - min + 1)) + min

See Also: :scroll: Explanation | Explanation in SO

:pencil: read more about waypoint generate random whole numbers within a range on the FCC Wiki

Jose M Viloria
@josevill
Sep 07 2015 02:55
Hmm
Isn't that one like (3 - 1 + 1)) + 1?
Branden
@4everyoungz
Sep 07 2015 02:55
It's numbers 0-9
which I ahve in my return
I'm getting three green checks and one red x
The last red x : You should be using the function given in the description to calculate the random in number in a range
Which I am using the function in the description :(
Jose M Viloria
@josevill
Sep 07 2015 02:57
Okay
I see it..
First of all
As your Min and Max are already set in a couple variables, you can use them in your functions..
Branden
@4everyoungz
Sep 07 2015 02:58
oh
shit
thanks @josevill
CamperBot
@camperbot
Sep 07 2015 02:58
4everyoungz sends brownie points to @josevill :sparkles: :thumbsup: :sparkles:
:star: 286 | @josevill | http://www.freecodecamp.com/josevill
Jose M Viloria
@josevill
Sep 07 2015 02:58
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() * (max - min + 1) + min);
}

// 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();})();
Ian Wang
@ianw3214
Sep 07 2015 02:58
bonfire no repeats please
Branden
@4everyoungz
Sep 07 2015 02:58
I think that will fix it
CamperBot
@camperbot
Sep 07 2015 02:58

:fire:Bonfire: No repeats please :link:

function permAlone(str) {
  return str;
}

permAlone('aab');

Return the number of total permutations of the provided string that don't have repeated consecutive letters.

more info:  bf details | bf links | hint

Jose M Viloria
@josevill
Sep 07 2015 02:58
It should look like that one :)
Ian Wang
@ianw3214
Sep 07 2015 02:58
hint
CamperBot
@camperbot
Sep 07 2015 02:58
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Rich Hopkins
@Rich-Hopkins
Sep 07 2015 02:58
I'm stuck on Bonfire: Where art thou
Branden
@4everyoungz
Sep 07 2015 02:59
I totally over read into that one @josevill
Jose M Viloria
@josevill
Sep 07 2015 03:00
Read the challenges description twice. If you still have some doubts, read it once more, most of the time the answer lies within the waypoint/bonfire description :)
Branden
@4everyoungz
Sep 07 2015 03:01
Yeah, I read it a couple times -_- I will keep that in mine
mind*
Jose M Viloria
@josevill
Sep 07 2015 03:01
Keep up the good work :)
Rich Hopkins
@Rich-Hopkins
Sep 07 2015 03:04
Bonfire: Where art thou
CamperBot
@camperbot
Sep 07 2015 03:04

: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

Rich Hopkins
@Rich-Hopkins
Sep 07 2015 03:05
Are these things marked "more info" below the camperbot post supposed to be links?
Jose M Viloria
@josevill
Sep 07 2015 03:05
No, you have to type in those as commands :)
bf details
CamperBot
@camperbot
Sep 07 2015 03:05

:fire:Bonfire: Where art thou :link:

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

where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });
Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument).
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
Jose M Viloria
@josevill
Sep 07 2015 03:05
bf links
Rich Hopkins
@Rich-Hopkins
Sep 07 2015 03:05
Ah - thanks so much!
CamperBot
@camperbot
Sep 07 2015 03:05
if you want to thank someone, put an @ before their name!
Jose M Viloria
@josevill
Sep 07 2015 03:06
hints
hint
CamperBot
@camperbot
Sep 07 2015 03:06
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Rich Hopkins
@Rich-Hopkins
Sep 07 2015 03:06
thank @josevill
CamperBot
@camperbot
Sep 07 2015 03:06
rich-hopkins sends brownie points to @josevill :sparkles: :thumbsup: :sparkles:
:star: 287 | @josevill | http://www.freecodecamp.com/josevill
Rich Hopkins
@Rich-Hopkins
Sep 07 2015 03:06
hint
CamperBot
@camperbot
Sep 07 2015 03:06
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Jose M Viloria
@josevill
Sep 07 2015 03:06
Sure, anytime. I'd be glad to help you out sort that one out, but i'm not available at the moment.. Maybe later if you're still there :)
Rich Hopkins
@Rich-Hopkins
Sep 07 2015 03:07
Hopefully I'll have it sorted quickly!
Rich Hopkins
@Rich-Hopkins
Sep 07 2015 03:12
Bonfire: Seek and Destroy
CamperBot
@camperbot
Sep 07 2015 03:12

:fire:Bonfire: Seek and Destroy :link:

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

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

You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.

more info:  bf details | bf links | hint

Shaun Hutchins
@shaun10
Sep 07 2015 03:16
@Rich-Hopkins want to do screen hero on that one
Im starting that now also
if you want to code pair on it
@Rich-Hopkins u down?
escapeplan4
@escapeplan4
Sep 07 2015 03:24
how to put a screenshot here?
Jun
@ArthurZheng
Sep 07 2015 03:27
Thanks @Rafase282 @abhisekp
CamperBot
@camperbot
Sep 07 2015 03:27
arthurzheng sends brownie points to @rafase282 and @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 408 | @abhisekp | http://www.freecodecamp.com/abhisekp
:star: 405 | @rafase282 | http://www.freecodecamp.com/rafase282
Rafael J. Rodriguez
@Rafase282
Sep 07 2015 03:28
@escapeplan4 just drag the image to the screen
then app will take care of it
David Moore
@davemofosho
Sep 07 2015 03:31
Bonfire: Factorialize a Number
CamperBot
@camperbot
Sep 07 2015 03:31

:fire:Bonfire: Factorialize a Number :link:

function factorialize(num) {
  return num;
}

factorialize(5);

Return the factorial of the provided integer.

more info:  bf details | bf links | hint

David Moore
@davemofosho
Sep 07 2015 03:33
help factorial
CamperBot
@camperbot
Sep 07 2015 03:33

:point_right: bonfire factorialize a number [wiki]

The problem

Return the factorial of the provided integer. If the integer is represented with the letter n, a factorial is the product of all positive integers less than or equal to n.

Factorials are often represented with the shorthand notation n!

For example: 5! = 1 * 2 * 3 * 4 * 5 = 120f

:pencil: read more about bonfire factorialize a number on the FCC Wiki

Branden
@4everyoungz
Sep 07 2015 03:46
Im on that too @davemofosho
Jonathan
@jcadle
Sep 07 2015 03:50
I'm running into a problem with the "find the longest word in a string" bonfire
The main thing that's confusing me is that I'm getting an "Unexpected Identifier" error, and I'm not sure what's causing it.

'''function findLongestWord(str) {
var myArray = str.split(',');
var lastWord = " "
for each (var word of myArray) {
if (word.length > lastWord.length) {
lastWord = word;
}
}
str = lastWord;
return str.length;
}

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

CamperBot
@camperbot
Sep 07 2015 03:50
:bulb: to format code use backticks! ``` more info
Jonathan
@jcadle
Sep 07 2015 03:51

```function findLongestWord(str) {
var myArray = str.split(',');
var lastWord = " "
for each (var word of myArray) {
if (word.length > lastWord.length) {
lastWord = word;
}
}
str = lastWord;
return str.length;
}

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

grr. now I'm messing up the chat formatting. sorry
MrDrBird
@MrDrBird
Sep 07 2015 03:52
Bonfire: Make a Person
CamperBot
@camperbot
Sep 07 2015 03:52

:fire:Bonfire: Make a Person :link:

var Person = function(firstAndLast) {
    return firstAndLast;
};

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

Fill in the object constructor with the methods specified in the tests.

more info:  bf details | bf links | hint

MrDrBird
@MrDrBird
Sep 07 2015 03:52
hint
CamperBot
@camperbot
Sep 07 2015 03:52
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
DJ
@qualitymanifest
Sep 07 2015 03:55
@jcadle the problem is your syntax for your for loop
you can do what you're trying to do with a for... in loop
also, to format code on here the backticks need to be on their own lines, above and below the code
Jonathan
@jcadle
Sep 07 2015 03:57
I thought it had to be for each in?
thanks for the tip
CamperBot
@camperbot
Sep 07 2015 03:57
if you want to thank someone, put an @ before their name!
DJ
@qualitymanifest
Sep 07 2015 03:58
maybe in a different language i'm not familar with? in javascript its for (this in that)
it has been deprecated
Branden
@4everyoungz
Sep 07 2015 03:59
Bonefire: Find the longest string
Bonfire: Find the longest string
CamperBot
@camperbot
Sep 07 2015 04:00
Sorry, can't find a bonfire called find the longest string. [ Check the map? ]
DJ
@qualitymanifest
Sep 07 2015 04:00
@jcadle i was literally just reading that haha
Jonathan
@jcadle
Sep 07 2015 04:00
I fixed the syntax, at least. Now to figure out why the rest of the code isn't working, haha :)
Branden
@4everyoungz
Sep 07 2015 04:00
I'm on the same now @jcadle
Jonathan
@jcadle
Sep 07 2015 04:02
@4everyoungz Ah, perhaps you'll have better luck. This is a big adjustment for me from Python, and I wasn't that hot at Python :D
Branden
@4everyoungz
Sep 07 2015 04:03
let me see hmm @jcadle
DJ
@qualitymanifest
Sep 07 2015 04:04
@jcadle i copied your code to work with it and see whats up. this isn't the problem, but you're missing a semicolon
Jonathan
@jcadle
Sep 07 2015 04:04
fixed it
I got it to work:
function findLongestWord(str) {
  var myArray = str.split(' ');
  var lastWord = " ";
  for (var word of myArray) {
    if (word.length > lastWord.length) {
      lastWord = word;
    }
  }
  str = lastWord;
  return lastWord.length;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
Thanks for the help, @qualitymanifest
CamperBot
@camperbot
Sep 07 2015 04:05
jcadle sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 181 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
DJ
@qualitymanifest
Sep 07 2015 04:05
no problem, glad you got it
Branden
@4everyoungz
Sep 07 2015 04:07
Intresting how you sent it to an empty string and not 0
Jonathan
@jcadle
Sep 07 2015 04:07
probably a bad habit.
Branden
@4everyoungz
Sep 07 2015 04:08

'''
function findLongestWord(str) {

var words = str.split(' ');
var wordLength = 0;

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

return str.length;
}

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

CamperBot
@camperbot
Sep 07 2015 04:08
:bulb: to format code use backticks! ``` more info
Jonathan
@jcadle
Sep 07 2015 04:08
you want backticks, not single quotes
the key in the upper left corner of the keyboard, just below Esc
Branden
@4everyoungz
Sep 07 2015 04:08
function findLongestWord(str) {

  var words = str.split(' ');
  var wordLength = 0;

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



  return str.length;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
wow think thats first time I've used back ticks
DJ
@qualitymanifest
Sep 07 2015 04:09
i have to ask, why iterate over ii?
Branden
@4everyoungz
Sep 07 2015 04:09
instead of i ?
DJ
@qualitymanifest
Sep 07 2015 04:09
yeah
Branden
@4everyoungz
Sep 07 2015 04:10
ii is easier to find if I need to quickly find it in my code.... ii is rare and i is pretty common.. easier to search in my opinion @qualitymanifest
DJ
@qualitymanifest
Sep 07 2015 04:10
huh, fair enough
Branden
@4everyoungz
Sep 07 2015 04:10
in this example it doesn't matter cause so little but if you're going through a large JS file... well yeah. haha
DJ
@qualitymanifest
Sep 07 2015 04:11
don't you need to do words[ii].length and not words[i].length then?
Branden
@4everyoungz
Sep 07 2015 04:11
yeah I got an error haha
Jonathan
@jcadle
Sep 07 2015 04:11
just curious:in js, it seems like most people use for loops as you do here, rather than iterating over the values in an array.
is that a better practice for some reason?
Branden
@4everyoungz
Sep 07 2015 04:13
I think it has to do with speed if I remember correctly... I may be wrong @jcadle
DJ
@qualitymanifest
Sep 07 2015 04:13
tbh i didn't even know about for... in loops until recently, so i always did it that way. it does give you more control over the loop (when it starts, ends, how much it iterates), but for... in seems easier if you don't need that control
Jonathan
@jcadle
Sep 07 2015 04:14
I used a lot of for... in when I was learning Python. Seems like I'm going to need to break myself of some bad habits, haha
Andrew
@anjanjanj
Sep 07 2015 04:14
it's a speed thing I think, but the code reads much better using forEach imo
shouldn't matter unless you're going through huge arrays
DTing
@dting
Sep 07 2015 04:15
@jcadle you dont want to use for..in for javascript arrays http://stackoverflow.com/questions/500504/why-is-using-for-in-with-array-iteration-such-a-bad-idea .forEach is probably right. most people learning will use a normal for (var i =0; i < somelength; i++) because it is easier to understand when learning
Jonathan
@jcadle
Sep 07 2015 04:16
I couldn't get for...each to work, @dting . Thanks for the link.
CamperBot
@camperbot
Sep 07 2015 04:16
jcadle sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1032 | @dting | http://www.freecodecamp.com/dting
Branden
@4everyoungz
Sep 07 2015 04:20
I'm totally stuck on Bonfire: Title Case A Sentence
DJ
@qualitymanifest
Sep 07 2015 04:21
post your code, if you've got it
Branden
@4everyoungz
Sep 07 2015 04:21
I'm still working on it. I'm trying to write it out in my head, but I'm kind of stumped
Luis Felipe López G.
@luishendrix92
Sep 07 2015 04:21
I don't see why some like avoiding for loops, if you use a good text editor with built-in snippets you don't have to worry because all you have to do is write 'for' and a TAB. You only have to write the variable names and you're good to go. Besides, if your iteration process consists in one line you could just avoid the { }
for (var i=0, len = target.length; i < len; i++)
  console.log(target[i]);
Branden
@4everyoungz
Sep 07 2015 04:22
function titleCase(str) {

  var wordArray = str.toLowerCase.split(' ');


  return str;
}

titleCase("I'm a little tea pot");
I guess next would be to use a for loop and go through it
Branden
@4everyoungz
Sep 07 2015 04:27
ah got it
Jonathan
@jcadle
Sep 07 2015 04:27
I don't know that you'd need to convert to an array
Branden
@4everyoungz
Sep 07 2015 04:28
I did it and then joined them at the end
Jonathan
@jcadle
Sep 07 2015 04:28
I'm researching it now, but it seems like you could just lower case the whole string, then use a regular expression to find every character preceded by a space and upper case it, more or less.
Branden
@4everyoungz
Sep 07 2015 04:30
hmm i didn't sue regular expressions. I barely even understand those things
My brain hurts. I just started this yesterday. Also been a designer. JavaScript has fried my head.
kgoode517
@kgoode517
Sep 07 2015 04:33

Augh! Can anyone please tell me why this doesnt work? stuck on factorialize a number.
function factorialize(num) {
i = 0;
while(i<=num)
return num *num-1;
i++;
}

factorialize(5);

Henry Erickson
@henryed86
Sep 07 2015 04:34
@kgoode517 try adding the code in quoted in this ```
hello
Hans van Riet
@hansinla
Sep 07 2015 04:35
@kgoode517 when you return, you quit the function.
Henry Erickson
@henryed86
Sep 07 2015 04:37

@kgoode517 you need to create a variable to retain (num -1).

since the loop resets the value of num you always end up with 5 * 4

Jonathan
@jcadle
Sep 07 2015 04:54
Okay, so this works, but is it good code?
function titleCase(str) {
  function upperC(letter){
    return letter.toUpperCase();
  }
  tempStr = str.toLowerCase().replace(/\s(\w)/g, upperC).replace(/(^\w)/, upperC);
  return tempStr;
}

titleCase("I'm a little tea pot");
Arami Guerra
@cowboy63
Sep 07 2015 04:56
Logan Tegman
@ltegman
Sep 07 2015 04:58
@cowboy63 You need to put http:// or https:// in front of the URL or else codepen uses it as a relative path.
Arami Guerra
@cowboy63
Sep 07 2015 04:59
@ltegman Thanks man
CamperBot
@camperbot
Sep 07 2015 04:59
cowboy63 sends brownie points to @ltegman :sparkles: :thumbsup: :sparkles:
:star: 200 | @ltegman | http://www.freecodecamp.com/ltegman
Nila
@star1671
Sep 07 2015 05:08
Hello everyone. I went through the Javascript waypoint exercises pretty easily and I thought I was on top of things, but now that I'm at the bonfire I realize that I have no idea what I'm doing. Does anyone know of any additional resources/readings/etc. that I can turn to to help me understand better before I try to tackle bonfire?
DTing
@dting
Sep 07 2015 05:09
@star1671 people suggest this all the time here http://eloquentjavascript.net/
Jonathan
@jcadle
Sep 07 2015 05:09
StackOverflow has a lot of good explanations for how to accomplish a given task in javascript, and the Bonfires usually link to a relevant part of the Javascript documentation.
Nila
@star1671
Sep 07 2015 05:11
Thank you @dting @jcadle !! I'll definitely look into those.
CamperBot
@camperbot
Sep 07 2015 05:11
star1671 sends brownie points to @dting and @jcadle :sparkles: :thumbsup: :sparkles:
:star: 165 | @jcadle | http://www.freecodecamp.com/jcadle
:star: 1033 | @dting | http://www.freecodecamp.com/dting
Josh
@obscureether
Sep 07 2015 05:12
hey all....
Brad Johnson
@ozjohnson
Sep 07 2015 05:12
wiki bonfire where are thou
CamperBot
@camperbot
Sep 07 2015 05:12
no wiki entry for: bonfire where are thou
:pencil: click here to create one now!after creating your page type update to reload it here
Josh
@obscureether
Sep 07 2015 05:12
poke your brain for some help if I may?
Brad Johnson
@ozjohnson
Sep 07 2015 05:12
wiki bonfire where
CamperBot
@camperbot
Sep 07 2015 05:12

:point_right: bonfire where do i belong [wiki]

Explanation:

This can be a tricky problem to understand. You need to find where in the array a number should be inserted by order, and return the index where it should go.

:pencil: read more about bonfire where do i belong on the FCC Wiki

Josh
@obscureether
Sep 07 2015 05:12
```
Hans van Riet
@hansinla
Sep 07 2015 05:13
@obscureether go ahead.
Josh
@obscureether
Sep 07 2015 05:13
can you tell me what I did not do in this to give it gray background?

```<style>
.gray-background {background-color: gray}

<div>

<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
</div>
</style>

did not use the ```
DTing
@dting
Sep 07 2015 05:14
@obscureether you need to add the class attribute and set it equal to "gray-background" for the element you want to give a gray background
Josh
@obscureether
Sep 07 2015 05:14
lol... thanks @dting
CamperBot
@camperbot
Sep 07 2015 05:14
obscureether sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1034 | @dting | http://www.freecodecamp.com/dting
Hans van Riet
@hansinla
Sep 07 2015 05:15
@obscureether And you’re mssing a semicolon after background-color: gray
Josh
@obscureether
Sep 07 2015 05:16
crap thanks... @hansinla
CamperBot
@camperbot
Sep 07 2015 05:16
obscureether sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 348 | @hansinla | http://www.freecodecamp.com/hansinla
Hans van Riet
@hansinla
Sep 07 2015 05:16
@obscureether no prob
DTing
@dting
Sep 07 2015 05:19
@hansinla @obscureether the last semicolon isnt strictly required as the last semicolons is optional. most people will put them in because it makes it harder to forget to add it when you add another style.
Josh
@obscureether
Sep 07 2015 05:20
thnks for the heads up
CamperBot
@camperbot
Sep 07 2015 05:20
if you want to thank someone, put an @ before their name!
Josh
@obscureether
Sep 07 2015 05:20
thanks
CamperBot
@camperbot
Sep 07 2015 05:20
if you want to thank someone, put an @ before their name!
Brad Johnson
@ozjohnson
Sep 07 2015 05:22
i just finished bf 174 which seemed to require a nested custom function, something we haven't covered yet. did i miss something or do the bf solutions sometimes require things we haven't covered previously?
DTing
@dting
Sep 07 2015 05:23
the bonfires offer some hints but ya you probably will need to look stuff up
and as with most programming problems there are usually many ways to solve each problem. the hints usually just guide you towards one of the many solutions
Brad Johnson
@ozjohnson
Sep 07 2015 05:25
yeah, spent hours scouring the web trying to use something we've already been taught. finally checked hints and saw some really cool--and completely foreign--ways of solving it. ah well. will know for next time. thanks @dting.
CamperBot
@camperbot
Sep 07 2015 05:25
ozjohnson sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1035 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Sep 07 2015 05:25
is 174 bf where art tho?
Brad Johnson
@ozjohnson
Sep 07 2015 05:25
yes
first exposure to objects afaik
DTing
@dting
Sep 07 2015 05:33
that one is also solvable just using a for loop inside a for loop.
Brad Johnson
@ozjohnson
Sep 07 2015 05:38
ah, good to know. wasn't able to get it to work that way unfortunately. but did learn more about objects and custom functions which seem pretty useful. thanks again.
CamperBot
@camperbot
Sep 07 2015 05:38
if you want to thank someone, put an @ before their name!
justindobbs
@justindobbs
Sep 07 2015 05:44
does anyone want to help me get passport working with express. i'm getting error 'user is undefined' when there is a match here's my code https://github.com/justindobbs/expressApp/blob/master/app.js
DTing
@dting
Sep 07 2015 05:46
what's the error stack trace?
justindobbs
@justindobbs
Sep 07 2015 05:47
i'll have to rerun it. part of it's in the serialize function
nree
@nree
Sep 07 2015 05:49
@justindobbs haven't used passport, but is the process.nextTick necessary?
justindobbs
@justindobbs
Sep 07 2015 05:49
no, i'ver tried it without it though
nree
@nree
Sep 07 2015 05:50
@justindobbs you are returning the done() is the main problem i think
DJ
@qualitymanifest
Sep 07 2015 05:50
@dting do you have code for using 2 for loops to solve where art thou, that you could show me? i just finished that in a really gross improper way, with 2 for loops
nree
@nree
Sep 07 2015 05:50
don't return done, call it, and don't use process.nextTick (i don't see the use)
DTing
@dting
Sep 07 2015 05:51
function where(collection, source) {
  var srcKeys = Object.keys(source);
  var result = [];
  for (var i = 0; i < collection.length; i++) {
    var valid = true;
    var item = collection[i];
    for (var j = 0; j < srcKeys.length; j++) {
      var key = srcKeys[j];
      if (!item.hasOwnProperty(key) || item[key] !== source[key]) {
        valid = false;
        break;
      }
    }
    if (valid) {
      result.push(item);
    }
  }
  return result;
}
justindobbs
@justindobbs
Sep 07 2015 05:51
i'll give it a try
DJ
@qualitymanifest
Sep 07 2015 05:51
@dting thanks i'll have to read into that.
CamperBot
@camperbot
Sep 07 2015 05:51
qualitymanifest sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1036 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Sep 07 2015 05:52
np
DJ
@qualitymanifest
Sep 07 2015 05:53
it seems like once they added the last two tests to where art thou it got way more complicated than the other ones in that series. i spent 9 days on where art thou and solved the next one within 30 minutes
DTing
@dting
Sep 07 2015 05:54
i think the original tests were just letting some solutions pass that werent really solving the intended problem. The "where" function is common enough that it's included in the lodash and underscore libraries.
I think they have been trying to rework the wording on that problem. seems like a lot of people get stuck there
DJ
@qualitymanifest
Sep 07 2015 05:57
ah, yeah it actually took me 7 days until i really finally understood what the expected outcomes were. still, my solution wouldn't solve the problem if you changed the inputs. i'll send it to you if you'd like a laugh
justindobbs
@justindobbs
Sep 07 2015 05:57
still the error
Cannot set property 'user' of undefined

TypeError: Cannot set property 'user' of undefined
    at C:\Users\Justin\js\basejumps\express\node_modules\passport-local\node_modules\passport\lib\passport\http\request.js:45:35
    at pass (C:\Users\Justin\js\basejumps\express\node_modules\passport\lib\authenticator.js:267:43)
    at serialized (C:\Users\Justin\js\basejumps\express\node_modules\passport\lib\authenticator.js:276:7)
    at C:\Users\Justin\js\basejumps\express\app.js:65:3
    at pass (C:\Users\Justin\js\basejumps\express\node_modules\passport\lib\authenticator.js:284:9)
    at Authenticator.serializeUser (C:\Users\Justin\js\basejumps\express\node_modules\passport\lib\authenticator.js:289:5)
    at IncomingMessage.req.login.req.logIn (C:\Users\Justin\js\basejumps\express\node_modules\passport-local\node_modules\passport\lib\passport\http\request.js:43:29)
    at Strategy.strategy.success (C:\Users\Justin\js\basejumps\express\node_modules\passport\lib\middleware\authenticate.js:228:13)
    at verified (C:\Users\Justin\js\basejumps\express\node_modules\passport-local\lib\passport-local\strategy.js:83:10)
    at Promise.<anonymous> (C:\Users\Justin\js\basejumps\express\app.js:90:4)
DTing
@dting
Sep 07 2015 05:58
@justindobbs when are you getting the error?
when you try to sign in?
justindobbs
@justindobbs
Sep 07 2015 05:58
yeah, when I enter correct password
nree
@nree
Sep 07 2015 05:58
paste the new app.js
justindobbs
@justindobbs
Sep 07 2015 05:59
it's the same as from github except for removing process.nextTick and removing the return from done
nree
@nree
Sep 07 2015 05:59
well you can't simply strip the returns
you have to rewrite the way you call done()
justindobbs
@justindobbs
Sep 07 2015 06:00
ok
nree
@nree
Sep 07 2015 06:01
@justindobbs in the end you should have only 1 done() or put an else
if that doesn't work, double check the function signatures for passport
nree
@nree
Sep 07 2015 06:07
@justindobbs maybe i'm wrong, according to http://passportjs.org/docs/username-password they return done() .... which makes no sense to me
DTing
@dting
Sep 07 2015 06:10
ya returning done shouldnt be a problem.
I think its because your serializeUser and deserializeUser function aren't right
that might help
Nick Hu
@nicholashu
Sep 07 2015 06:10
wiki bonfire inventory
CamperBot
@camperbot
Sep 07 2015 06:10

:point_right: bonfire inventory update [wiki]

Problem Explanation:

  • Look through an array of new products, in the format: [quantity, name]
  • Return an array containing updated quantities for each item that already existed, and any new products
:pencil: read more about bonfire inventory update on the FCC Wiki
passport.serializeUser(function(user, done) {
  done(null, user.id);
});

passport.deserializeUser(function(id, done) {
  User.findById(id, function(err, user) {
    done(err, user);
  });
});
Mowgli418
@Mowgli418
Sep 07 2015 06:17
Hey. Can one of you fine persons gimme a quick peek? I'm a big dummy and can't remember what I'm missing to introduce the gray background
Screen Shot 2015-09-07 at 2.16.08 AM.png
marzelin
@marzelin
Sep 07 2015 06:19
@Mowgli418 <div class="gray-background">
Mowgli418
@Mowgli418
Sep 07 2015 06:19
@marzelin :) :+1:
Brad Johnson
@ozjohnson
Sep 07 2015 06:38
the last 3 basic algorithm bonfires (15-17) absolutely crushed me. any suggestions on any good sites/tutorials/vids that i can study to help out? complete beginner programmer here.
Mike Bobadilla
@mikebobadilla
Sep 07 2015 06:40
@ozjohnson follow the helpful links
@ozjohnson object and arrays are confusing when you start. I would play around with them on codepen and console.log alot and see what happens when you change values
Brad Johnson
@ozjohnson
Sep 07 2015 06:44
thanks @bitsandbytez i'll try that. the lessons havent introduced codepen or console.log yet so appreciate the advice.
CamperBot
@camperbot
Sep 07 2015 06:44
ozjohnson sends brownie points to @bitsandbytez :sparkles: :thumbsup: :sparkles:
:star: 261 | @bitsandbytez | http://www.freecodecamp.com/bitsandbytez
Woolwit
@Woolwit
Sep 07 2015 06:47
@ozjohnson I can recommend the codecademy javascript track https://www.codecademy.com/tracks/javascript . It's kind of 'friendlier'. You could jump in on a topic you're having trouble with. I also highly recommend this online IDE which lets you step through your code and see the result at each step. I'd be completely lost without it. http://pythontutor.com/visualize.html#mode=edit (Choose Javascript in the 'Write code in' drop down.)
DTing
@dting
Sep 07 2015 06:48

@ozjohnson i'd go back to number 15 and try to figure it out using for loops. the functional methods are nice but being able to work out the flow of the code is very important when trying to write code. you should be able to translate your thoughts to pseudo code to actual code without much resistance.

You can use www.repl.it too if you dont like using your dev console to debug.

Brad Johnson
@ozjohnson
Sep 07 2015 06:50
thanks @Woolwit and @dting. Will follow both of your advice before I move on to the next section. again, really appreciate the advice! this community is awesome.
CamperBot
@camperbot
Sep 07 2015 06:50
ozjohnson sends brownie points to @woolwit and @dting :sparkles: :thumbsup: :sparkles:
:star: 127 | @woolwit | http://www.freecodecamp.com/woolwit
:star: 1038 | @dting | http://www.freecodecamp.com/dting
Knut Jackowski
@doxanthropos
Sep 07 2015 06:53
Jumping in with a Thank you @Woolwit because I knew pythontutor, but have not looked at it for ages (I do not need it for Python) and did not know it now works also for JavaScript. This will be handy. Nice.
CamperBot
@camperbot
Sep 07 2015 06:53
doxanthropos sends brownie points to @woolwit :sparkles: :thumbsup: :sparkles:
:star: 128 | @woolwit | http://www.freecodecamp.com/woolwit
Woolwit
@Woolwit
Sep 07 2015 06:56
I <3 pythontutor!
Samantha North
@sjnorth
Sep 07 2015 06:57
Hey folks, I'm having a problem with the Waypoint Javascript slot machine task - can anyone help?
Brad Johnson
@ozjohnson
Sep 07 2015 06:57
wow, just checked python tutor out. very cool!
Knut Jackowski
@doxanthropos
Sep 07 2015 07:02
@Woolwit Me too. I just did not need it in some time. Last time I used it, is was to explain to a fellow student, how and why recursion works, which is quite simple, if you see what really happens when the code is run, but brain damaging when you try to understand it just in your mind.
angietek
@angietek
Sep 07 2015 07:04

hey any ideas? <style>
.red-text {
color: red;
}
</style>

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

<p { font-size: 16px; } class="red-text">kitty ipsum text: Purr jump eat the grass rip the couch scratched supnbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
<p { font-size: 16px; } class="red-text">kitty ipsum 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>

Knut Jackowski
@doxanthropos
Sep 07 2015 07:05
@angietek The { font-size} parts should be somewhere in a style tag.
angietek
@angietek
Sep 07 2015 07:06
<style>
.red-text {
color: red;
} <h2 class="red-text">CatPhotoApp</h2>

<p { font-size: 16px; } class="red-text">kitty ipsum text: Purr jump eat the grass rip the couch scratched supnbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
<p { font-size: 16px; } class="red-text">kitty ipsum 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>
</style>
like this?
Knut Jackowski
@doxanthropos
Sep 07 2015 07:07
The inline version would be <p style="font-size:16px;">, but I suppose, you will have to use the style tag at the top.
alnano
@alnano
Sep 07 2015 07:08
so i am trying to understand this
var myRe = /d(b+)d/g;
var myArray = myRe.exec("cdbbdbsbz");
console.log("The value of lastIndex is " + myRe.lastIndex);

// "The value of lastIndex is 5"
what is a lastindex ?
Knut Jackowski
@doxanthropos
Sep 07 2015 07:09
@angietek If you want the font-size to be used in all .red-text you have to put it inside the .red-text {} part at the top.
alnano
@alnano
Sep 07 2015 07:09
i got that from firefox readme btw
angietek
@angietek
Sep 07 2015 07:10
thanks
CamperBot
@camperbot
Sep 07 2015 07:10
if you want to thank someone, put an @ before their name!
angietek
@angietek
Sep 07 2015 07:11
@doxanthropos thanks
CamperBot
@camperbot
Sep 07 2015 07:11
angietek sends brownie points to @doxanthropos :sparkles: :thumbsup: :sparkles:
:star: 251 | @doxanthropos | http://www.freecodecamp.com/doxanthropos
Knut Jackowski
@doxanthropos
Sep 07 2015 07:12
@angietek Just a tip for the chat: If you want your code to be more readable, you can put it into a "code block" with these ``` at the beginning and the end of a block.
Like this: This is code
alnano
@alnano
Sep 07 2015 07:16
its dead on here today huh?
Knut Jackowski
@doxanthropos
Sep 07 2015 07:17
@alnano I have no idea. Just ran it through a visualizer, but how it gets to 5? Probably something to to with the RegEx-object. You might have to read there about what exec does with a regular expression. The visualisation looks like this: http://pythontutor.com/visualize.html#code=var+myRe+%3D+/d(b%2B%29d/g%3B%0Avar+myArray+%3D+myRe.exec(%22cdbbdbsbz%22%29%3B%0Aconsole.log(%22The+value+of+lastIndex+is+%22+%2B+myRe.lastIndex%29%3B&mode=display&origin=opt-frontend.js&cumulative=false&heapPrimitives=false&textReferences=false&py=js&rawInputLstJSON=%5B%5D&curInstr=3
@alnano Yes, not many people around right now.
angietek
@angietek
Sep 07 2015 07:18

<style>
.red-text {h1 { font-size: 16px; }.
color: red;
}
</style>

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

<p> class="red-text">kitty ipsum 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>
<p class="red-text">kitty ipsum 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>

Amy Rutherford
@amyruth
Sep 07 2015 07:19
Hello. I'm having a problem with the palindrome challenge.
alnano
@alnano
Sep 07 2015 07:19
@doxanthropos thanks!
CamperBot
@camperbot
Sep 07 2015 07:19
alnano sends brownie points to @doxanthropos :sparkles: :thumbsup: :sparkles:
:star: 252 | @doxanthropos | http://www.freecodecamp.com/doxanthropos
marzelin
@marzelin
Sep 07 2015 07:20
@amyruth what do you need to know to pass this challenge?
Amy Rutherford
@amyruth
Sep 07 2015 07:20

```function palindrome(str) {
// Good luck!
var newarray = [];

str = str.toLowerCase();
var strarray = str.split("");

for(var i = 0; i < strarray.length; i+=1){
if(strarray[i] !== "," && strarray[i] !== "." && strarray[i] !== " "){
newarray.push(strarray[i]);
}
}

var newstr = newarray.reverse().join("");
console.log(newstr);
if(str === newstr){
return true;
}else{return false;}

}

palindrome("eye");```

I was testing it with different strings in the console and I got true but on the site I can't get it to pass.
Knut Jackowski
@doxanthropos
Sep 07 2015 07:21
@angietek Try to use the font-size similar to the color: red; part.
Amy Rutherford
@amyruth
Sep 07 2015 07:21
@marzelin sorry. I tried it in the console and it seemed to work, but not on FCC
maybe I'm overthinking it.
angietek
@angietek
Sep 07 2015 07:22
@doxanthropos thank you i passed!
CamperBot
@camperbot
Sep 07 2015 07:22
angietek sends brownie points to @doxanthropos :sparkles: :thumbsup: :sparkles:
:warning: angietek already gave doxanthropos points
Knut Jackowski
@doxanthropos
Sep 07 2015 07:24
@angietek Great!
angietek
@angietek
Sep 07 2015 07:24
you are very kind
Knut Jackowski
@doxanthropos
Sep 07 2015 07:24
@amyruth I just tried it offline and it seems to work. Can you tell us, which of the tests don't pass?
@angietek I think that's the general attitude here. Just trying to give back. ;)
angietek
@angietek
Sep 07 2015 07:26
of course
Amy Rutherford
@amyruth
Sep 07 2015 07:27
@doxanthropos it's failing on 3, 5, 6, 9 and 10. I just realized I only tried one of the longer strings.
@doxanthropos is it supposed to pass as a string of letters forward and reverse, without the spaces and things?
marzelin
@marzelin
Sep 07 2015 07:29
@amyruth you need to remove punctuation
Knut Jackowski
@doxanthropos
Sep 07 2015 07:29
@amyruth Yes.
@amyruth Like @marzelin said, that might be your problem.
Amy Rutherford
@amyruth
Sep 07 2015 07:30
@marzelin it seems to be taking the puncuation out okay. Let me check again
marzelin
@marzelin
Sep 07 2015 07:30
@amyruth remove any spaces dots etc from the str first
Knut Jackowski
@doxanthropos
Sep 07 2015 07:34
@amyruth @marzelin Somewhat strange: The spaces and dots are removed in @amyruth s code, but still compared false for example in "race car".
@amyruth Oh, now I see.
@amyruth Try to console.log also the "str" before the comparison. You will see.
Amy Rutherford
@amyruth
Sep 07 2015 07:35
@doxanthropos @marzelin I'm thinking I need to rassign the processed string to str before I reverse it, but when i put that in it says no tests are run. Trying to retool now
@doxanthropos I will
Knut Jackowski
@doxanthropos
Sep 07 2015 07:40
@amyruth If you have done some Regular Expressions practice, you might do it easier with that. But don't bother if you didn't.
Amy Rutherford
@amyruth
Sep 07 2015 07:41
@doxanthropos I did the challenges, but I wasn't sure how to implement it. I would put it in the for loop instead of that long && condition, right?
@doxanthropos @marzelin I got it to pass everything except the last test with the ? in it, but I added another condition for that and it stopped working again.
@doxanthropos @marzelin again, just the console :worried:
Knut Jackowski
@doxanthropos
Sep 07 2015 07:42
@amyruth You could useString.replace(Your regular expression that catches all but letters, "");
@amyruth I usually use this for finding the right expression: https://regex101.com/
Amy Rutherford
@amyruth
Sep 07 2015 07:43
@doxanthropos let me give that a try that. Thank you!
CamperBot
@camperbot
Sep 07 2015 07:43
amyruth sends brownie points to @doxanthropos :sparkles: :thumbsup: :sparkles:
:star: 253 | @doxanthropos | http://www.freecodecamp.com/doxanthropos
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 07:49

I feel like I could have done this a better way?

var code "formatted";
function titleCase(str) {
str = str.toLowerCase();
var array = str.split(' ');
var array2 = [];
for(var i = 0; i < array.length; i ++){

 array2.push(array[i].replace(array[i][0], array[i][0].toUpperCase()));

};

return array2.join(' ');
}

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

kioufhs
@kioufhs
Sep 07 2015 07:49
hello, need help with : declare JavaScript Variable, i really cant understand
marzelin
@marzelin
Sep 07 2015 07:50
@kioufhs what's the problem?
Samantha North
@sjnorth
Sep 07 2015 07:51
is there anyone working on the following waypoint who could help me out? Waypoint: Bring your JavaScript Slot Machine to Life
kioufhs
@kioufhs
Sep 07 2015 07:52
@marzelin i need to put name on if(typeof(myName) !== "undefined"){(function(v){return v;})(myName);}
Knut Jackowski
@doxanthropos
Sep 07 2015 07:52
@JoelMSwensen Maybe, but mine looks even more complicated. shrug
zac247
@zac247
Sep 07 2015 07:52
shoot @sjnorth
Samantha North
@sjnorth
Sep 07 2015 07:53
@zac247 thanks - here goes. I've got this code: $($(".slot") [0]).html(slotOne);
$($(".slot") [1]).html(slotTwo);
$($(".slot") [2]).html(slotThree);
CamperBot
@camperbot
Sep 07 2015 07:53
sjnorth sends brownie points to @zac247 :sparkles: :thumbsup: :sparkles:
:star: 199 | @zac247 | http://www.freecodecamp.com/zac247
kioufhs
@kioufhs
Sep 07 2015 07:54
@marzelin i dont know where is example
Samantha North
@sjnorth
Sep 07 2015 07:54
@zac247 but its telling me that I should have used the the selector ".slot" to select each slot and assign it the value of slotOne, slotTwo and slotThree respectively. I thought i wrote this correctlyy, but seems not...
@zac247 do i need to change the ".slot" part of the code also?
marzelin
@marzelin
Sep 07 2015 07:55
@kioufhs which challenge is it?
zac247
@zac247
Sep 07 2015 07:56
just a sec let me take a look at the exercise
kioufhs
@kioufhs
Sep 07 2015 07:56
@marzelin declare Javascript variable
zac247
@zac247
Sep 07 2015 07:57
@sjnorth way point 38,39 or 40?
Samantha North
@sjnorth
Sep 07 2015 07:58
@zac247 39
Knut Jackowski
@doxanthropos
Sep 07 2015 07:58
@kioufhs You don't have to change the code at the bottom only the one at the top.
marzelin
@marzelin
Sep 07 2015 07:59
@kioufhs you just create variable called myName assigned to whatever and you're done var myName = 'my_name';
zac247
@zac247
Sep 07 2015 08:01
@sjnorth that looks correct to me
kioufhs
@kioufhs
Sep 07 2015 08:02
@marzelin thnx done @doxanthropos thnx filos
CamperBot
@camperbot
Sep 07 2015 08:02
kioufhs sends brownie points to @marzelin and @doxanthropos :sparkles: :thumbsup: :sparkles:
:star: 254 | @doxanthropos | http://www.freecodecamp.com/doxanthropos
:star: 83 | @marzelin | http://www.freecodecamp.com/marzelin
zac247
@zac247
Sep 07 2015 08:02
@sjnorth try clicking on the submit button two or three times, sometimes I get false errors like this
Samantha North
@sjnorth
Sep 07 2015 08:03
@zac247 ok - will try that - thanks for taking a look
CamperBot
@camperbot
Sep 07 2015 08:03
sjnorth sends brownie points to @zac247 :sparkles: :thumbsup: :sparkles:
:warning: sjnorth already gave zac247 points
zac247
@zac247
Sep 07 2015 08:04
@sjnorth Found the error!
Its the spacing in your code $($(".slot")[0]).html(slotOne);
$($(".slot")1).html(slotTwo);
$($(".slot")2).html(slotThree);
Samantha North
@sjnorth
Sep 07 2015 08:06
@zac247 aha! well spotted. Thanks! :)
CamperBot
@camperbot
Sep 07 2015 08:06
sjnorth sends brownie points to @zac247 :sparkles: :thumbsup: :sparkles:
:warning: sjnorth already gave zac247 points
zac247
@zac247
Sep 07 2015 08:06
@sjnorth You are welocme :D
Samantha North
@sjnorth
Sep 07 2015 08:07
@zac247 so in this case the square brackets only need to be used once? is that because its a sequence?
Amy Rutherford
@amyruth
Sep 07 2015 08:15
@doxanthropos @marzelin It works now! Thank you for the regex site. It took a minute but I got a combo that worked out.
CamperBot
@camperbot
Sep 07 2015 08:15
amyruth sends brownie points to @doxanthropos and @marzelin :sparkles: :thumbsup: :sparkles:
:warning: amyruth already gave doxanthropos points
:star: 86 | @marzelin | http://www.freecodecamp.com/marzelin
Amy Rutherford
@amyruth
Sep 07 2015 08:16
I have a question about regex though: I tried escaping the question mark and couldn't get it to pass. is the \W an okay substitute for that? That's what I ended up going with.
marzelin
@marzelin
Sep 07 2015 08:18
@amyruth you ecspate qestion mark like this: \?
jb299
@jb299
Sep 07 2015 08:18
@sjnorth you need the square brackets they just don't show here after the first set
Samantha North
@sjnorth
Sep 07 2015 08:20
@jb299 ok - thanks for clarifying :)
CamperBot
@camperbot
Sep 07 2015 08:20
sjnorth sends brownie points to @jb299 :sparkles: :thumbsup: :sparkles:
:star: 4 | @jb299 | http://www.freecodecamp.com/jb299
Amy Rutherford
@amyruth
Sep 07 2015 08:21
@marzelin ah, it was giving me an error on that regex test site and i thought it might be something in use.
@marzelin I was hasty looking around for a glossary and saw that somewhere.
marzelin
@marzelin
Sep 07 2015 08:23
@amyruth did you pass that palindrome challenge?
Amy Rutherford
@amyruth
Sep 07 2015 08:24
@marzelin Finally. And with less code.
marzelin
@marzelin
Sep 07 2015 08:25
@amyruth you've used regexp instead of your own implementation of removing punctuation?
Amy Rutherford
@amyruth
Sep 07 2015 08:25
@marzelin I did.
marzelin
@marzelin
Sep 07 2015 08:27
@amyruth nice, though your method would work as well. Good thinking :)
Amy Rutherford
@amyruth
Sep 07 2015 08:27
@marzelin I'm still pretty green so I still type things out the long way, if just to understand it, hence all the &&. Sometimes if it's too concise i can't follow the logic
@marzelin and regex is still new to me.
Tzahi
@Tzahile
Sep 07 2015 08:27
hey guys!
I have some troubles with the assertion in the bonefire "Where art thou"
although the output is correct
function where(collection, source) {
  var arr = [];
  pass = true;
  for (key in Object.keys(source)){
    for (obj in collection){
      if (obj[key] !== null){
        if (obj[key] !== source[key]){
          pass = false;
        }
      }
      else{
        pass = false;
      }
    }
    if (pass){
      arr.push(obj);
    }
  }
  return arr;
}

where([{ 'a': 1, 'b': 2 }, { 'a': 1 }, { 'a': 1, 'b': 2, 'c': 2 }], { 'a': 1, 'b': 2 }), [{ 'a': 1, 'b': 2 }, { 'a': 1, 'b': 2, 'c': 2 }];
any ideas?
Amy Rutherford
@amyruth
Sep 07 2015 08:28
I feel better about things. And now it's bedtime!
good night/morning everyone and thanks again
CamperBot
@camperbot
Sep 07 2015 08:28
if you want to thank someone, put an @ before their name!
Ozy Design & Software
@OzySky
Sep 07 2015 08:49
@Tzahile what errors are you getting?
Ozy Design & Software
@OzySky
Sep 07 2015 08:56
anyone need any help?
zac247
@zac247
Sep 07 2015 08:59
@sjnorth did you figure it out? I was away
Is anyone working on zipline 1 ? the portfolio website?
Ozy Design & Software
@OzySky
Sep 07 2015 09:04
@zac247 yeah?
kangyao
@kay78
Sep 07 2015 09:08
Thanks @kirah1314 @Rafase282
CamperBot
@camperbot
Sep 07 2015 09:08
kay78 sends brownie points to @kirah1314 and @rafase282 :sparkles: :thumbsup: :sparkles:
:star: 200 | @kirah1314 | http://www.freecodecamp.com/kirah1314
:star: 410 | @rafase282 | http://www.freecodecamp.com/rafase282
Fábio Paraíso Oliveira
@FabioParaiso
Sep 07 2015 09:13
@zac247 Hate it! lol
Tzahi
@Tzahile
Sep 07 2015 09:14
@ozydesign all the assertions gives me error
Ozy Design & Software
@OzySky
Sep 07 2015 09:18
@Tzahile care to post it?
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:18

Any idea why if I do

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

I get only the last item in the x (the array) back.

But when I

for(var i = 0; i < x.length; i++){console.log(i)};

I get all the items in x?

Stein Gee
@Stiino0
Sep 07 2015 09:19
@zac247 I'm doing the portfolio zipline now as well, just finished the "home" section.
When the site is finished and responsive entirely, I'm gonna try to edit the navigation bar. I want something less "bootstrappy" if you know what I mean
marzelin
@marzelin
Sep 07 2015 09:19
@JoelMSwensen because elements in your array are from 0 to ... i
Knut Jackowski
@doxanthropos
Sep 07 2015 09:20
@JoelMSwensen One is returning a value the other is printing of the console. Both are quite different.
Tzahi
@Tzahile
Sep 07 2015 09:20
@ozydesign
function where(collection, source) {
  var arr = [];
  pass = true;
  for (key in Object.keys(source)){
    for (obj in collection){
      if (obj[key] !== null){
        if (obj[key] !== source[key]){
          pass = false;
        }
      }
      else{
        pass = false;
      }
    }
    if (pass){
      arr.push(obj);
    }
  }
  return arr;
}
marzelin
@marzelin
Sep 07 2015 09:21
@JoelMSwensen change the items in x and see what happens
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:21
Hmmmm
DTing
@dting
Sep 07 2015 09:21
@Tzahile Object.keys returns an array. you should avoid iterating arrays with for..in. Also true for iterating collection.
zac247
@zac247
Sep 07 2015 09:21
@FabioParaiso @ozydesign @Stiino0 Thanks for replying. How are you approaching the problem? Right now I am using inspect element option in chrome devtools? But am having trouble finding out which is a bootstrap class and which is not ? Are there any nice documentations / guides?
CamperBot
@camperbot
Sep 07 2015 09:21
zac247 sends brownie points to @fabioparaiso and @ozydesign and @stiino0 :sparkles: :thumbsup: :sparkles:
:star: 259 | @stiino0 | http://www.freecodecamp.com/stiino0
:star: 182 | @ozydesign | http://www.freecodecamp.com/ozydesign
:star: 178 | @fabioparaiso | http://www.freecodecamp.com/fabioparaiso
Knut Jackowski
@doxanthropos
Sep 07 2015 09:21
@JoelMSwensen console.log prints everything to the console, while a function returns only one value. If you do not specify it with "return value" it returns the last.
Stein Gee
@Stiino0
Sep 07 2015 09:22
@zac247 I open the CSS page of bootstrap
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:22
ok cool
oh would a for each work better?
Stein Gee
@Stiino0
Sep 07 2015 09:23
@zac247 I'll try to not look at the code, not even inspect elements. After I've found a solution, I'll try to see how he did it and where I can improve with same functionality
DTing
@dting
Sep 07 2015 09:23
@Tzahile also if (obj[key] !== null){ will give you errors when obj[key] is assigned to null. see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty
Knut Jackowski
@doxanthropos
Sep 07 2015 09:23
@JoelMSwensen Depends on what you want to do with it.
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:23
I'll be back
Stein Gee
@Stiino0
Sep 07 2015 09:24
@zac247 after it is finished I'll also use @media queries to fix the font-size, padding,... things that are annoying on mobile devices!!
Knut Jackowski
@doxanthropos
Sep 07 2015 09:25
@JoelMSwensen Just to make clear the difference: a returned value can be used, for example as a parameter for another function. A console.log only prints to the console, but is does nothing inside your program.
Fábio Paraíso Oliveira
@FabioParaiso
Sep 07 2015 09:25
@zac247 when learning bootstrap i used this a lot http://www.w3schools.com/bootstrap/default.asp
Ozy Design & Software
@OzySky
Sep 07 2015 09:25
@Tzahile I get an empty array....
Fábio Paraíso Oliveira
@FabioParaiso
Sep 07 2015 09:26
Got a lot of nice examples and it's simple to read. But probably there are better options ;)
zac247
@zac247
Sep 07 2015 09:26
@Stiino0 thanks for the tips. Initially I also did the same but it was taking way too much time. I am on a deadline so was looking for short cuts.Guess there aren't any :)
CamperBot
@camperbot
Sep 07 2015 09:26
zac247 sends brownie points to @stiino0 :sparkles: :thumbsup: :sparkles:
:warning: zac247 already gave stiino0 points
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:27
for(var i = 0; i < x.length; i++){y.push(x[i])}
better?
'cause that works :)
zac247
@zac247
Sep 07 2015 09:28
@Stiino0 I thought if you use bootstrap you dont need media queries? Since bootstrap classes make use of it ?
Stein Gee
@Stiino0
Sep 07 2015 09:28
@zac247 no problemo, the shortcut here would be that you copy all files, classes, text and paste it in. But that's not good, you won't learn anything so I suggest taking it as slow or fast as you want but only try to peek at the code once in a while. Good luck!
zac247
@zac247
Sep 07 2015 09:28
@FabioParaiso Did not know w3schools had a boostrap tutorial! Shall check that out, thanks :)
CamperBot
@camperbot
Sep 07 2015 09:28
zac247 sends brownie points to @fabioparaiso :sparkles: :thumbsup: :sparkles:
:warning: zac247 already gave fabioparaiso points
Stein Gee
@Stiino0
Sep 07 2015 09:29
Well I thought so as well but Apparently it doesn't work on my current website. So either I'm doing something wrong or it doesn't work :D However on the first test on W3C school it indeed works. http://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_default&stacked=h
Knut Jackowski
@doxanthropos
Sep 07 2015 09:30
@JoelMSwensen Now you are building an array. That array is itself a value that you return. In short: probably better. To prevent bugs in longer programs, it would be good to write return y after the loop.
Stein Gee
@Stiino0
Sep 07 2015 09:31
@zac247 Now I see, the H1 element doesn't change in font-size, it's just responsive. so the box around it changes, and the text also. However the font-size needs to adjust as well because right now I have font-size: 4em which is way too big when resizing.
So that's what I need to put in my media queries! ;)
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:32
Thanks @doxanthropos I know the difference between console.log and return. Was getting confused 'cause I was typing it all out in the chrome console
CamperBot
@camperbot
Sep 07 2015 09:32
joelmswensen sends brownie points to @doxanthropos :sparkles: :thumbsup: :sparkles:
:star: 255 | @doxanthropos | http://www.freecodecamp.com/doxanthropos
zac247
@zac247
Sep 07 2015 09:33
@Stiino0 Great work ;) I am sure you just saved me from some head scratching in the future :)
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:33
And this is working so far
for(var i = 0; i < x.length; i++){y.push(Math.max.apply(Math, x[i]))}
Knut Jackowski
@doxanthropos
Sep 07 2015 09:33
@JoelMSwensen That happens ;) One line at a time can become confusing.
Stein Gee
@Stiino0
Sep 07 2015 09:34
@zac247 Haha I already did the head-scratching for both of us. I'm glad that with certainty I can now say that this needs to be included in the media query :D
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:35
While I'm working on this one, would anyone care to suggest a better way to do this:
Knut Jackowski
@doxanthropos
Sep 07 2015 09:35
@JoelMSwensen If you want to get around the limitation of the console, you can make yourself a simple html page that loads your JS and then play around with it.
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:35

function titleCase(str) {
str = str.toLowerCase();
var array = str.split(' ');
var array2 = [];
for(var i = 0; i < array.length; i ++){

 array2.push(array[i].replace(array[i][0], array[i][0].toUpperCase()));

};

return array2.join(' ');
}

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

it worked fine
but, seems like the Bonfire was wanting me to do it a different way
Samantha North
@sjnorth
Sep 07 2015 09:37
@zac247 hey, yep it's all sorted now.
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:37
@doxanthropos yes, I could. I just didn't think these Bonfires would take this long ;)
DTing
@dting
Sep 07 2015 09:37
@JoelMSwensen
function titleCase(str) {
  return str
    .toLowerCase()
    .split(' ')
    .map(function(w) {return w[0].toUpperCase() + w.slice(1);})
    .join(' ');
}
Knut Jackowski
@doxanthropos
Sep 07 2015 09:37
@JoelMSwensen Which one of the tests from the bonfire gives you the error?
zac247
@zac247
Sep 07 2015 09:37
@Stiino0 :smile: I feel the first zip line should have been a proper html/css project. That way we could have familiarised with media queries and all before using the frame work
DTing
@dting
Sep 07 2015 09:37
also
help formatting
CamperBot
@camperbot
Sep 07 2015 09:37

:point_right: code formatting [wiki]

Inline code

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

Code Block

```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

marzelin
@marzelin
Sep 07 2015 09:37
@JoelMSwensen have you tried pythontutor.com? It's way easier to understand what's going on in your progam when you have each step clearly visualized
Knut Jackowski
@doxanthropos
Sep 07 2015 09:38
@dting That's nice and clean. Wow!
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:38
@doxanthropos it wasn't giving me an error, it just seemed my code was WAY to complicated
@marzelin no, I haven't. I'll check it out
Stein Gee
@Stiino0
Sep 07 2015 09:39
@zac247 I feel the same way. I was actually hoping that this zipline would actually be the end of HTML/CSS/Bootstrap where we indeed use all classes in the zipline. But it's great for the reverse-engineering skill that we are definitely going to need in the future!
zac247
@zac247
Sep 07 2015 09:39
@sjnorth :+1:
Knut Jackowski
@doxanthropos
Sep 07 2015 09:39
@JoelMSwensen I think you will not get any better than @dting
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:40
@dting oh man, yeah, I knew it could be much prettier!
Stein Gee
@Stiino0
Sep 07 2015 09:41
@dting that look like some great code!!
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:41
Thanks @dting
CamperBot
@camperbot
Sep 07 2015 09:41
joelmswensen sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1039 | @dting | http://www.freecodecamp.com/dting
Knut Jackowski
@doxanthropos
Sep 07 2015 09:41
@JoelMSwensen @dting My version is a complete mess compered to that.
zac247
@zac247
Sep 07 2015 09:44
@Stiino0 I hope so too. Thanks for your inputs.Back to work, am already stuck on this for 3 days!Ciao:)
CamperBot
@camperbot
Sep 07 2015 09:44
zac247 sends brownie points to @stiino0 :sparkles: :thumbsup: :sparkles:
:warning: zac247 already gave stiino0 points
Stein Gee
@Stiino0
Sep 07 2015 09:45
@zac247 since I've done the bonfires, I haven't actually had a lot of time to do the ziplines... so I'm already 2 weeks in... This week I'm finishing the zipline completely. Cheers and good luck :)
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:45

var foo = true;
Sorry, had to figure out the block thing
Knut Jackowski
@doxanthropos
Sep 07 2015 09:47
The block thing and map are two great takeaways. ;)
DTing
@dting
Sep 07 2015 09:47
function titleCase(str) {
  return str.toLowerCase()
    .replace(/\S+/g, function(match) { 
      return match[0].toUpperCase() + match.slice(1);
    });
}
is another possible answer using regex
Knut Jackowski
@doxanthropos
Sep 07 2015 09:49
@dting :)
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:50
Ok! This finally worked
@dting I wanna pick your brain about how this could be built better, mind if we pm?
Knut Jackowski
@doxanthropos
Sep 07 2015 09:52
@dting I like the map version better, because it is easier to read.
Nnxoxo
@Nnxoxo
Sep 07 2015 09:54
hm, when I have 2 divs one inner div and the other outer div, so if i want to center the inner div inside of outer, I write margin: 0 auto?
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 09:58
This worked. Any suggestions for a better way?

function largestOfFour(arr) {
  // You can do this!
  var arrayFinal = [];
 for(var i = 0; i < arr.length; i++){
   arrayFinal.push(Math.max.apply(Math, arr[i]))
 }

  return arrayFinal;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Roy
@CruelCoin
Sep 07 2015 10:10
@JoelMSwensen I like that solution! Mine is rather more simple.....
function largestOfFour(arr)
{
  var returnArray = [];

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

      for (j = 0; j < arr[i].length; j++)
        {
          if (arr[i][j] > largestNumber)
            {
              largestNumber = arr[i][j];
              returnArray[i] = largestNumber;
            }
        }
    }

  return returnArray;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
DTing
@dting
Sep 07 2015 10:12
@CruelCoin yours has a slight problem when you have sub arrays with all negative numbers.
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 10:12
@CruelCoin I like yours too :)
did you notice they mentioned using Chai.js
Roy
@CruelCoin
Sep 07 2015 10:13
@dting Do i? If the sub array is [-12, -2, -53, -15] for example, i'd expect my code to return -2, as its greater than the others?
Would love to understand the issue
DTing
@dting
Sep 07 2015 10:14
@CruelCoin it would return 0
since you start it at 0.
-2 < 0
Roy
@CruelCoin
Sep 07 2015 10:15
@dting ah.....
So i'd n eed to rework my code such that largestNumber is initialised with the smallest number in the array, or initialise with the lowest possible integer
@dting Thanks for pointing out the issue. Will go back and fix.
CamperBot
@camperbot
Sep 07 2015 10:17
cruelcoin sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1040 | @dting | http://www.freecodecamp.com/dting
Roy
@CruelCoin
Sep 07 2015 10:17
@JoelMSwensen Cheers, i hadn't noticed the Chai.js. Will take a look
DTing
@dting
Sep 07 2015 10:18
@CruelCoin there is another option that is a bit easier
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 10:18
I just hadn't seen it in mention yet. I guess testing is somehting to look up on our own
@CruelCoin ^^^
Roy
@CruelCoin
Sep 07 2015 10:18
@JoelMSwensen I may have ignored it, as i see that testing is now its own section later in the course. Thanks anyway.
CamperBot
@camperbot
Sep 07 2015 10:18
cruelcoin sends brownie points to @joelmswensen :sparkles: :thumbsup: :sparkles:
:star: 161 | @joelmswensen | http://www.freecodecamp.com/joelmswensen
Roy
@CruelCoin
Sep 07 2015 10:19
@dting Aye?
DTing
@dting
Sep 07 2015 10:19
just initialize it with the first number of the subarray.
Roy
@CruelCoin
Sep 07 2015 10:20
@dting soab.... Yup. Cheers, and thanks again
CamperBot
@camperbot
Sep 07 2015 10:20
cruelcoin sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:warning: cruelcoin already gave dting points
Joel M. Swensen
@JoelMSwensen
Sep 07 2015 10:21
@CruelCoin I checkout the Automated Testing and Debugging section, and it leaves much to be desired. Unless I'm blind I don't believe there is much on testing so far.
Fábio Paraíso Oliveira
@FabioParaiso
Sep 07 2015 10:28
Hello all. Any of you tried implementing the tweet button on zipline:random quote machine...
HAving some problems implementing it and understanding the code I'm reading on the internet or why it doesn't work.
Fábio Paraíso Oliveira
@FabioParaiso
Sep 07 2015 10:35
Solved. Will use a Post URL directly.
Roy
@CruelCoin
Sep 07 2015 10:42
Is there anyway to code in my preferred language? For example, i dislike having to go back and fix "errors" from typing "centre" as opposed to american english "center"?
Rory Smith
@alanbuchanan
Sep 07 2015 10:48
@CruelCoin if only...
Pratik Ratnaparkhi
@pratikr1593
Sep 07 2015 10:53
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  h2 {
    font-family: Lobster, Monospace;
  }

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

</style>

<div class="container-fluid">
  <div class="row">
    <div class="col-xs-8">
      <h2 class="text-primary text-center">CatPhotoApp</h2>
    </div>
    <div class="col-xs-4">
      <a href="#"><img class="img-responsive thick-green-border" src="https://bit.ly/fcc-relaxing-cat"></a>
    </div>
  </div>
  <img src="http://bit.ly/fcc-running-cats" class="img-responsive">
  <div class="row">
    <div class="col-xs-4">
      <button class="btn btn-block btn-primary"><i class="fa fa-thumbs-up"></i> Like</button>
    </div>
    <div class="col-xs-4">
      <button class="btn btn-block btn-info"><i class="fa fa-info-circle"></i> Info</button>
    </div>
    <div class="col-xs-4">
      <button class="btn btn-block btn-danger"><i class="fa fa-trash"></i> Delete</button>
    </div>
  </div>
  <p>Things cats <span class="text-danger">love:</span></p>
  <ul>
    <li>cat nip</li>
    <li>laser pointers</li>
    <li>lasagna</li>
  </ul>
  <p>Top 3 things cats hate:</p>
  <ol>
    <li>flea treatment</li>
    <li>thunder</li>
    <li>other cats</li>
  </ol>
  <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>
    <div class="row col-xs-7">
    <input type="text" class="form-control" placeholder="cat photo URL" required>
    <div class="col-x-5">
    <button type="submit" class=" col-x-5 btn btn-primary"><i class="fa fa-paper-plane"></i> Submit</button>
      </div>
    </div>
  </form>
</div>

this condition is still to satisfied.

Nest your form submission button in a div with the class col-xs-5.

Rory Smith
@alanbuchanan
Sep 07 2015 10:54
you've put col-x-5 not col-xs-5
Ozy Design & Software
@OzySky
Sep 07 2015 10:58
@CruelCoin grep perhaps?
then streamline it with grunt
Roy
@CruelCoin
Sep 07 2015 10:59
@ozydesign I'm going to nod ploitely like i know what those are..... But thanks for the suggestion! Will go take a look
CamperBot
@camperbot
Sep 07 2015 10:59
cruelcoin sends brownie points to @ozydesign :sparkles: :thumbsup: :sparkles:
:star: 183 | @ozydesign | http://www.freecodecamp.com/ozydesign
Ozy Design & Software
@OzySky
Sep 07 2015 11:00
@CruelCoin imposter here... so no worries :blush:
Teesmo
@Teesmo
Sep 07 2015 11:01
Hi everyone! I'm trying to nest anchor text inside a p element. I think the code is correct bu it keeps telling me that I have to nest inside a new p element. how do I do that? ( my code looks like this: <p> Click here for <a href="http://freecatphotoapp.com"> cat photos </a></p>)
marzelin
@marzelin
Sep 07 2015 11:02
@Teesmo looks legit
Fábio Paraíso Oliveira
@FabioParaiso
Sep 07 2015 11:03
@Teesmo I think you are missing the target="_blank" if you are using codepen
Teesmo
@Teesmo
Sep 07 2015 11:04
@FabioParaiso you are totally losing me right now. do you mean there might be a problem with my href?
Ozy Design & Software
@OzySky
Sep 07 2015 11:05

@FabioParaiso i don't think he is using code pen.....

I think the code is correct bu it keeps telling me that I have to nest inside a new p element.)

Aleksandar B.
@aleksandar-b
Sep 07 2015 11:05
@Teesmo what is that Waypoint?
Rory Smith
@alanbuchanan
Sep 07 2015 11:05
@Teesmo just speculating but have you tried getting rid of the space after <p>, the space before <a> and the spaces inside the link (before and after sentence)
Costas Chaitas
@CostasChaitas
Sep 07 2015 11:05
help with the misssing letters bonfire
CamperBot
@camperbot
Sep 07 2015 11:05
no wiki entry for: with the misssing letters bonfire
:pencil: click here to create one now!after creating your page type update to reload it here
Costas Chaitas
@CostasChaitas
Sep 07 2015 11:05
function fearNotLetter(str) {  
  var alphabet = 'abcdefghijklmnopqrstuvwxyz';
  var out;

  for (var i = 0; i < str.length; i++) {
    if (str[i] !== alphabet[i]) {
      out = alpha[i]; 
      break;
    }
  }
  return out;
}

fearNotLetter('abcdefghjklmno');
here is my code
Fábio Paraíso Oliveira
@FabioParaiso
Sep 07 2015 11:06
@Teesmo Yes. When using codepen you have to add target="_blank" inside the <a href="..." target="_blank"> </a>
Aleksandar B.
@aleksandar-b
Sep 07 2015 11:07
@rasakos you have not understood the task.
Costas Chaitas
@CostasChaitas
Sep 07 2015 11:07
?
zac247
@zac247
Sep 07 2015 11:08
The font awesome icons are not appearing. Here is my code : <a class="btn btn-default" target="_blank" href="#" role="button"> <i class="fa fa-twitter fa-lg"></i> Twitter</a>
Apologies,.I was about to format it, send it by mistake.
Rory Smith
@alanbuchanan
Sep 07 2015 11:08
@zac247 do you have this in your <head>?
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
Teesmo
@Teesmo
Sep 07 2015 11:09
thanks everyone, I kind figured out where I went wrong. I had already been provided with the anchor text, and only had to nest it in a new p element. But what I did was, I created a new p and a element, and the code checker didn't recognise it because I actually only had to nest the already existing a element.
CamperBot
@camperbot
Sep 07 2015 11:09
if you want to thank someone, put an @ before their name!
Fábio Paraíso Oliveira
@FabioParaiso
Sep 07 2015 11:09
@zac247 add fon-awesome in css like you did for bootstrap
*font-awesome
Aleksandar B.
@aleksandar-b
Sep 07 2015 11:09
@rasakos you need to find missing letter in a range from first one to the last one. Use String.charCodeAt() String.fromCharCode()
zac247
@zac247
Sep 07 2015 11:09
@alanbuchanan I don't! thank you very much :)
CamperBot
@camperbot
Sep 07 2015 11:09
zac247 sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 256 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
Rory Smith
@alanbuchanan
Sep 07 2015 11:10
@zac247 it's here if you need it again
zac247
@zac247
Sep 07 2015 11:11
Its working now.Its magic :D Thanks @FabioParaiso @alanbuchanan
CamperBot
@camperbot
Sep 07 2015 11:11
zac247 sends brownie points to @fabioparaiso and @alanbuchanan :sparkles: :thumbsup: :sparkles:
:warning: zac247 already gave alanbuchanan points
:star: 180 | @fabioparaiso | http://www.freecodecamp.com/fabioparaiso
Rory Smith
@alanbuchanan
Sep 07 2015 11:11
@zac247 :+1:
Fábio Paraíso Oliveira
@FabioParaiso
Sep 07 2015 11:11
@zac247 np =)
Aleksandar B.
@aleksandar-b
Sep 07 2015 11:14
@rasakos you need to do for loop on string to transform each word into a unicode number with charCodeAt(). Then create a new loop that is starting from the first value of previous loop and ends with last value, and put that in a new arrar.
Costas Chaitas
@CostasChaitas
Sep 07 2015 11:17
oo got it with different way
function fearNotLetter(str) {
  var Missing ;

  for(var i=0; i<str.length; i++) {
    Letter = str.charCodeAt(i);
    prevLetter = str.charCodeAt(i-1);

    if(Letter > (prevLetter+1)) {
      Missing = String.fromCharCode(prevLetter+1);
    }    
  }

  if (Missing === "") {
    return undefined;
  } else {
    return Missing;
  }

}

fearNotLetter('abce');
check the current value with the previous
can u give me your solutions >
Rory Smith
@alanbuchanan
Sep 07 2015 11:20
@rasakos i didn't even use charCodeAt
function fearNotLetter(str) {
    var alphabet = 'abcdefghijklmnopqrstuvwxyz';
    for (var i = alphabet.indexOf(str[0]), j = 0; i < alphabet.length, j < str.length; i++, j++) {
        if(str[j] !== alphabet[i]){
            return alphabet[i];
        };
    }
    return undefined;
}
Aleksandar B.
@aleksandar-b
Sep 07 2015 11:20
@rasakos
function fearNotLetter(str) {
  for (var i = 0; i < str.length - 1; i++) {
    if (str.charCodeAt(i) + 1 != str.charCodeAt(i + 1)){
      return String.fromCharCode(str.charCodeAt(i) + 1);
    }
  }
Costas Chaitas
@CostasChaitas
Sep 07 2015 11:24
very clever @alanbuchanan you use the indexOf yo start from the 0th position o the str string
you can also write it
function fearNotLetter(str) {
    var alphabet = 'abcdefghijklmnopqrstuvwxyz';
    var start = alphabet.indexOf(str[0]);

    for (i=start, j = 0; i,j < str.length; i++,j++) {
        if(str[j] !== alphabet[i]){
            return alphabet[i];
        };
    }
    return undefined;
}
fearNotLetter('yz');
Rory Smith
@alanbuchanan
Sep 07 2015 11:28
@rasakos nice :+1:
Costas Chaitas
@CostasChaitas
Sep 07 2015 11:39
:)
function boo(bool) {
  if(bool=null || bool=0 || bool=-0 || bool=undefined || bool=NaN || bool=""){
    return false;
  }else{
    return true;
  }

}

boo(null);
Costas Chaitas
@CostasChaitas
Sep 07 2015 11:44
why this doenst work?
Aniruddh Agarwal
@anrddh
Sep 07 2015 11:45
= is not a comparison operator
It is an assignment operator
You usually use === or == to compare
Costas Chaitas
@CostasChaitas
Sep 07 2015 11:45
it doesnt work for === either
Aniruddh Agarwal
@anrddh
Sep 07 2015 11:45
That's likely because the data-types are different
What are you trying to achieve with the code?
Is it the bonfire where you filter out all the falsey values?
Costas Chaitas
@CostasChaitas
Sep 07 2015 11:46
check if the bool is boolena
boolean
and i dont want to use the if(typeof bool="boolean)
Rory Smith
@alanbuchanan
Sep 07 2015 11:47
why not?
Aniruddh Agarwal
@anrddh
Sep 07 2015 11:47
You should be good if you check bool === true/bool === false
Costas Chaitas
@CostasChaitas
Sep 07 2015 11:48
yeah right
;)
forgot it
just for another solution @alanbuchanan
to check all the possible solutions
function boo(bool) {
  if(bool===null || bool===0 || bool===-0 || bool===undefined || bool===NaN || bool==="" || bool===true || bool===false){
    return true;
  }else{
    return false;
  }
}
boo(null);
thats all
Rory Smith
@alanbuchanan
Sep 07 2015 11:54
or just
function boo(bool) {
  return (bool===null || bool===0 || bool===-0 || bool===undefined || bool===NaN || bool==="" || bool===true || bool===false);
}
Costas Chaitas
@CostasChaitas
Sep 07 2015 11:55
true
DTing
@dting
Sep 07 2015 12:01
bf boo
CamperBot
@camperbot
Sep 07 2015 12:01

:fire:Bonfire: Boo who :link:

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

boo(null);

Check if a value is classified as a boolean primitive. Return true or false.

more info:  bf details | bf links | hint

DTing
@dting
Sep 07 2015 12:02
hmm those test cases need to be updated
boo(0) should return false
boo(null) should also return false
Costas Chaitas
@CostasChaitas
Sep 07 2015 12:03
bf Bonfire: Sorted Union
CamperBot
@camperbot
Sep 07 2015 12:03

: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

Costas Chaitas
@CostasChaitas
Sep 07 2015 12:03
function unite(arr1, arr2, arr3) {
  var totalArr=arr1.concat(arr2,arr3);
  var finalArr=[];

  for(i=0; i<totalArr.length; i++){
    if(finalArr.indexOf(totalArr[i])===-1){
      finalArr.push(totalArr[i]);
    }
  }  
  return finalArr;
}

unite([1, 3, 2], [5, 2, 1, 4], [2, 1]);
help?
CamperBot
@camperbot
Sep 07 2015 12:03

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

Basic Commands:

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

:speech_balloon: meet CamperBot in this room!

:pencil: read more about camperbot on the FCC Wiki

Costas Chaitas
@CostasChaitas
Sep 07 2015 12:08
?????
Costas Chaitas
@CostasChaitas
Sep 07 2015 12:13
anyone?
Aniruddh Agarwal
@anrddh
Sep 07 2015 12:14
the loop won't execute when the index reaches -1
oh nvm
also i used apply
minakasiin
@minakasiin
Sep 07 2015 12:18
In javascript, when making a function, example "function myFun(){}", what, when and why should I put something in the colons after the function name?
Rory Smith
@alanbuchanan
Sep 07 2015 12:19
@minakasiin the brackets rather than colons right?
minakasiin
@minakasiin
Sep 07 2015 12:20
This message was deleted
In the waypoints, it sometimes shows, that there is something put into the colons
Andrew
@anjanjanj
Sep 07 2015 12:20
these? () they are called brackets, inside you put any parameters for the function
minakasiin
@minakasiin
Sep 07 2015 12:20
like "function myFunction(a,b){return a+b;}"
Oh sorry, brackets then yea. Sorry my english is not good =P
Andrew
@anjanjanj
Sep 07 2015 12:21
it's so your function can use the variables a and b
Rory Smith
@alanbuchanan
Sep 07 2015 12:21
@minakasiin you define what a and b are when you call the function
Andrew
@anjanjanj
Sep 07 2015 12:21
function myFunction() {return a+b; }
here it has no idea what a and b are
unless you specifically define two variables called a and b before using the function
Rory Smith
@alanbuchanan
Sep 07 2015 12:21
so if you wrote myFunction(1, 2) the value of that line is 3
Andrew
@anjanjanj
Sep 07 2015 12:22
in which case, the function isn't that useful
minakasiin
@minakasiin
Sep 07 2015 12:22
So it pretty much defines/adds variables, if i have not made variables before the function?
Rory Smith
@alanbuchanan
Sep 07 2015 12:23
it doesn't matter what you name them inside the function
minakasiin
@minakasiin
Sep 07 2015 12:24
Okay, thanks @alanbuchanan @anjanjanj
CamperBot
@camperbot
Sep 07 2015 12:24
minakasiin sends brownie points to @alanbuchanan and @anjanjanj :sparkles: :thumbsup: :sparkles:
:star: 237 | @anjanjanj | http://www.freecodecamp.com/anjanjanj
:star: 257 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
DTing
@dting
Sep 07 2015 12:25
I've always heard () called parenthesis, [] brackets or square brackets and {} braces or curly brackets.
Rory Smith
@alanbuchanan
Sep 07 2015 12:25
function add(a, b) {
   return a + b;
}

is the same as

function add(something, somethingElse) {
   return something + somethingElse;
}

you can call both with add(1, 2) and you will get the same answer

minakasiin
@minakasiin
Sep 07 2015 12:25
Okey, thanks again.
CamperBot
@camperbot
Sep 07 2015 12:25
if you want to thank someone, put an @ before their name!
minakasiin
@minakasiin
Sep 07 2015 12:28
@dting I messed up before, I thought they meant brackets as [], but don't know why I wrote colons. :/ Most likely because I don't use English too often.
Andrew
@anjanjanj
Sep 07 2015 12:30
@dting is right... it's definitely parenthesis. In a second language it must be confusing... I'm English so no excuse for me!
Rolands Jegorovs
@Rolandisimo
Sep 07 2015 12:45
Hey, guys, wondering if someone could help me with ajax. I'm stuck for more than an hour right now. :/
Campbell Sinclair
@watsondr
Sep 07 2015 12:47
bf chunkymonkey
CamperBot
@camperbot
Sep 07 2015 12:47
Sorry, can't find a bonfire called chunkymonkey. [ Check the map? ]
Campbell Sinclair
@watsondr
Sep 07 2015 12:47
bf chunky monkey
CamperBot
@camperbot
Sep 07 2015 12:47

:fire:Bonfire: Chunky Monkey :link:

function chunk(arr, size) {
  // Break it up.
  return arr;
}

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

Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.

more info:  bf details | bf links | hint

Rolands Jegorovs
@Rolandisimo
Sep 07 2015 12:49
Hey, guys, wondering if someone could help me with ajax. I'm stuck for more than an hour right now. :/
Joe Smith
@joesmith100
Sep 07 2015 12:54
Hey @Rolandisimo, what you stuck on?
Rolands Jegorovs
@Rolandisimo
Sep 07 2015 12:54
Hey @joesmith100
@joesmith100 The problem is - I write my code in Codepen. When the ajax is sent it rewrites the requested url
var status = document.getElementById("status"),
      lat,
      lng,
      options = {
    enableHighAccuracy: true,
    timeout: 5000,
    maximumAge: 0
  };
  function success(pos) {
      var crd = pos.coords;
      lat = crd.latitude.JSON.stringify;
      lon = crd.longitude.JSON.stringify;
  };     
  function error(err) {
    console.warn('ERROR(' + err.code + '): ' + err.message);
  };

  if (navigator.geolocation) {
     navigator.geolocation.getCurrentPosition(success, error, options);
  }

  $.ajax({
      type: "GET",
      url: 'api.openweathermap.org/data/2.5/weather?lat=' + lat + '&lon=' + lng,
      datatype: 'jsonp',
      success: function (data) {
        status.innerHTML = data;
      },
      error: function (error) {
        status.innerHTML = error;
      }
  });
DTing
@dting
Sep 07 2015 12:56
@Rolandisimo your url needs an http://
Rolands Jegorovs
@Rolandisimo
Sep 07 2015 12:56
@joesmith100 it becomes a prefix to the web page opened
DTing
@dting
Sep 07 2015 12:57
url: 'http://api.openweathermap.org/data/2.5/weather?lat='
Joe Smith
@joesmith100
Sep 07 2015 12:58
that was going to be my suggestion
Rolands Jegorovs
@Rolandisimo
Sep 07 2015 12:58
@dting Oh, it's so simple... I just started ajax, so I thought it adds it
@joesmith100 @dting Thanks. It seems now that it processes correctly the url.
CamperBot
@camperbot
Sep 07 2015 12:59
rolandisimo sends brownie points to @joesmith100 and @dting :sparkles: :thumbsup: :sparkles:
:star: 216 | @joesmith100 | http://www.freecodecamp.com/joesmith100
:star: 1042 | @dting | http://www.freecodecamp.com/dting
Rolands Jegorovs
@Rolandisimo
Sep 07 2015 12:59
@dting Still I have this error - Uncaught TypeError: Cannot read property 'stringify' of undefined
DTing
@dting
Sep 07 2015 13:00
you dont need to stringify
Rolands Jegorovs
@Rolandisimo
Sep 07 2015 13:00
@dting Simply .JSON ?
DTing
@dting
Sep 07 2015 13:00
  function success(pos) {
      var crd = pos.coords;
      lat = crd.latitude;
      lon = crd.longitude;
  };
and if you were to stringify something you would do it like this:
JSON.stringify(pos);
also the ajax call is asyncronous. so is the navigator.geolocation.getCurrentPosition
calling .geolocation.getCurrentPosition isnt blocking that means your ajax request will happen before lat and log have values
you should probably make that request directly from inside your success function
Rolands Jegorovs
@Rolandisimo
Sep 07 2015 13:04
@dting Yes, I thought about the async being a problem here
Santiago Melo
@smeloa
Sep 07 2015 13:04

Hi, can some one help me with a code error I am unable to solve regarding the Pomodoro Zipline. This is the problem code:

HTML

<div id="timer-buttons" class="text-center">
    <div id="more-work" class="inline"></div>
</div>

JS:

$(document).ready(function () {
        $( "#more-work" ).click (function() {
               alert( "Handler for .click() called." );
    });
});

CSS:

#timer-buttons {
    padding-top: 20px;
}
.inline {
    display: inline-block;
}
#more-work {
    width: 50px;
    height: 50px;
    background-color: red;
}

Basically the problem that I have is that when I click on the div the alert doesn't pop up and I keep getting an unexpected token error regarding the: ) that closes the click function.

DTing
@dting
Sep 07 2015 13:04
i'm off the a bit. gluck all
Rolands Jegorovs
@Rolandisimo
Sep 07 2015 13:05
@dting Good luck!
Santiago Melo
@smeloa
Sep 07 2015 13:05
@Rolandisimo what method are you using to get your lat and lon?
Costas Chaitas
@CostasChaitas
Sep 07 2015 13:06
anyone can help with Sorted Union bonfire
CamperBot
@camperbot
Sep 07 2015 13:06
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Costas Chaitas
@CostasChaitas
Sep 07 2015 13:06
function unite(arr1, arr2, arr3) {
  var concat = arr1.concat(arr2).concat(arr3);
  var answer = [];

  for (var i =0; i<concat.length;i++) {
    if(answer.indexOf(concat[i])===-1) {
      answer.push(concat[i]);
    }
  }
  return answer;
}

unite([1, 2, 3], [5, 2, 1, 4], [2, 1]);
this is my code
Rolands Jegorovs
@Rolandisimo
Sep 07 2015 13:07
@smeloa navigator.geolocation.getCurrentPosition(success, error, options); Look it up. Very easy docs you'll find
@smeloa For the api check - http://openweathermap.org/current
Santiago Melo
@smeloa
Sep 07 2015 13:08
@Rolandisimo that no longer works in newer versions of Chrome. I used Wunderground Weather Api to solve this.
Rolands Jegorovs
@Rolandisimo
Sep 07 2015 13:09
@smeloa I've read that for security reasons they will deprecate navigator.geolocation or smthing
@smeloa I'll check it out. Thnks
CamperBot
@camperbot
Sep 07 2015 13:10
rolandisimo sends brownie points to @smeloa :sparkles: :thumbsup: :sparkles:
:star: 296 | @smeloa | http://www.freecodecamp.com/smeloa
Rahul
@RahulReddy75
Sep 07 2015 13:10

@Rahul1992
what is wrong in the code
function where(arr, num) {
// Find my place in this sorted array.

arr.push(num);

arr.sort();

return arr.indexOf(num);
}

where([35, 40, 50], 35);
Bonfire: Where do I belong

Santiago Melo
@smeloa
Sep 07 2015 13:10
Yeah it happened last week: http://codepen.io/smeloa/pen/KpjGYJ here is my solution which only works if you open it in a different tab though due to the GeoLocation issue.
TeeReggz
@TeeReggz
Sep 07 2015 13:13
Hey Everyone, I need help with the Waypoint bootstrap challenge. Center text with bootstrap. Here's my error please help "Your h2 element should be centered by applying the class text-center"

and here is my code <link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

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

h2 {
font-family: Lobster, Monospace;

}

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

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

.smaller-image {
width: 100px;
}

.text-center {

}
</style>

<div class="container-fluid">
<h2 class="red-text" "text-center">CatPhotoApp</h2>


<p>Click here for <a href="#">cat photos</a>.</p>

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

<img src="http://bit.ly/fcc-running-cats" class="img-responsive">
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
<form action="/submit-cat-photo">
<label><input type="radio" name="indoor-outdoor"> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality"> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Crazy</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
</div>

Rolands Jegorovs
@Rolandisimo
Sep 07 2015 13:14
@smeloa I see you didn't remove the openweather urls. Accident or on purpose?
Santiago Melo
@smeloa
Sep 07 2015 13:17
@Rolandisimo on purpose, I had to hack the Wunderground implementation, so Wunderground is only used to get the lat/lon, but OpenWeather does the rest. If I ever go back to it, I would implement everything just with Wunderground which is more complete than OW.
Rolands Jegorovs
@Rolandisimo
Sep 07 2015 13:17
@smeloa Oh, I see, it seems that you use Wunderground to get lat/long
@smeloa Yes, interesting. I thought about the deprecation dangers. :D
TeeReggz
@TeeReggz
Sep 07 2015 13:22
error.png
i pasted a screenshot too, please help. I'm stuck
Gary Wong
@gary-w
Sep 07 2015 13:23
has anyone here ever considered joining https://learn.modern-developer.com
Joe Smith
@joesmith100
Sep 07 2015 13:23
@gary-w I seriously considered it but the cost was too much
If I had the money I may have very well done it though
Gary Wong
@gary-w
Sep 07 2015 13:27
@joesmith100 i hear you. it’s expensive.
rayner-villalba-coderoad-com
@rayner-villalba-coderoad-com
Sep 07 2015 13:29
@TeeReggz I see the problem is when you define the class in h2 tag. It should not define the class in separated Strings. It should be something like this:
<h2 class="red-text text-center">CatPhotoApp</h2>
TeeReggz
@TeeReggz
Sep 07 2015 13:33
@rayner-villalba-coderoad-com thank you SOOO much!!
CamperBot
@camperbot
Sep 07 2015 13:33
teereggz sends brownie points to @rayner-villalba-coderoad-com :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for rayner-villalba-coderoad-com
Rashid Al-Qasem
@Rashidoz
Sep 07 2015 13:36
guys i need your help , i'm stuck with the radio buttons , what is the problem with my code ?
<lable><input type="radio" name="indoor-outdoor">indoor</lable>
<lable><input type="radio" name="indoor-outdoor">outdoor</lable>
techstonia
@techstonia
Sep 07 2015 13:36
does anyone find node.js waypoints confusing? i think the materials could be better :-)
Mateja Trifunovski
@Matko95
Sep 07 2015 13:37
@Rashidoz i think it's <label></label> issue
@Rashidoz a typo
TeeReggz
@TeeReggz
Sep 07 2015 13:38
@Rashidoz you're spelling label wrong
Rashid Al-Qasem
@Rashidoz
Sep 07 2015 13:38
god lol :P thanks guys
CamperBot
@camperbot
Sep 07 2015 13:38
if you want to thank someone, put an @ before their name!
Rashid Al-Qasem
@Rashidoz
Sep 07 2015 13:38
@TeeReggz @Matko95
Andreia Melo
@andreiamlm
Sep 07 2015 13:41
hi. where do you do your ziplines projects? on codepen? do you use github ? what are the tools recomended? thanks
Spatz
@Spatzerny
Sep 07 2015 13:43
@andreiamlm literaly the first checkmark
what's #1 on the left?
:P
Spatzerny @Spatzerny ponders for a second
Spatz
@Spatzerny
Sep 07 2015 13:44
or perhaps i'm a pompous asshole and that was a question about preference
Mateja Trifunovski
@Matko95
Sep 07 2015 13:45
could be :D
Rory Smith
@alanbuchanan
Sep 07 2015 13:45

can i have a hint for my code for Bonfire: Sum All Odd Fibonacci Numbers please?

var sumFibs = function(n){
    var a = 0,
         b = 1,
         result = 1;
    var c = a + b;
    while(c < n){
        if(c % 2 === 1){
            result += c;
        }
        a = b;
        b = c;
        c = a + b;
    }

    return result;
}

expect(sumFibs(75024)).toEqual(60696); passes but
expect(sumFibs(75025)).toEqual(135721); doesn't . it returns 60696 ( the value of the previous one! )

Andreia Melo
@andreiamlm
Sep 07 2015 13:46
I thought you had to really publish the projects online, not just on codepen. As for the use of git isn't that always recommended to save your work?
Spatz
@Spatzerny
Sep 07 2015 13:47
@alanbuchanan seems then like there's a problem with even/odd checking since tests are for 75024/75025 :P
lightest hint possible :P
I haven't found a reason to play with version control since i'm not doing anything big enough for that to matter
Mateja Trifunovski
@Matko95
Sep 07 2015 13:49
@andreiamlm c <= n could help i think
Rory Smith
@alanbuchanan
Sep 07 2015 13:50
@Matko95 damn, you're right. thanks :satisfied:
CamperBot
@camperbot
Sep 07 2015 13:50
alanbuchanan sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 217 | @matko95 | http://www.freecodecamp.com/matko95
Rory Smith
@alanbuchanan
Sep 07 2015 13:50
the maths bonfires just baffle me
same for euler problems
Mateja Trifunovski
@Matko95
Sep 07 2015 13:51
yeah, but they help develop some logic :D
Spatz
@Spatzerny
Sep 07 2015 13:51
except for the physics one which exists only to piss people off
Doug Riblet
@DougRiblet
Sep 07 2015 13:52
@andreiamlm I use codepen for all the ziplines. Save frequently, and use "fork" when you want to experiment. You can save to github by using Share -> Save as Github Gist anytime. Just personal taste I suppose.
Mateja Trifunovski
@Matko95
Sep 07 2015 13:53
Does anyone have any good source for learning how to pull JSON from some APIs
Rory Smith
@alanbuchanan
Sep 07 2015 13:54
Spatz
@Spatzerny
Sep 07 2015 13:54
This message was deleted
Mateja Trifunovski
@Matko95
Sep 07 2015 13:54
@alanbuchanan thanks :)
CamperBot
@camperbot
Sep 07 2015 13:54
matko95 sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 259 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
Andreia Melo
@andreiamlm
Sep 07 2015 13:55
thanks @Spatzerny @Matko95
CamperBot
@camperbot
Sep 07 2015 13:55
andreiamlm sends brownie points to @spatzerny and @matko95 :sparkles: :thumbsup: :sparkles:
:star: 325 | @spatzerny | http://www.freecodecamp.com/spatzerny
:star: 218 | @matko95 | http://www.freecodecamp.com/matko95
Andreia Melo
@andreiamlm
Sep 07 2015 13:55
thanks @smashzen your explanation helped a lot!
CamperBot
@camperbot
Sep 07 2015 13:55
andreiamlm sends brownie points to @smashzen :sparkles: :thumbsup: :sparkles:
:star: 322 | @smashzen | http://www.freecodecamp.com/smashzen
Mateja Trifunovski
@Matko95
Sep 07 2015 13:59
Should i always use AJAX or only when needed?
Spatz
@Spatzerny
Sep 07 2015 13:59
i'll just shut up for today, i'm slightly off
Rory Smith
@alanbuchanan
Sep 07 2015 14:01
@Matko95 whenever you're using a n asynchronous call or a callback function, you are using ajax
Mateja Trifunovski
@Matko95
Sep 07 2015 14:02
Oh ok
Paul Simon Ongpin
@mochiii
Sep 07 2015 14:08

can sombody help me i cant figure out whats wrong here function palindrome(str) {
// Good luck!
str.toLowerCase();
str.replace(/[.,-\/#!$%\^&*;:{}=-_`~()]/g,"");
str.replace(/ /g,"");

testStr=str;
check= true;
j=str.length-1;
for(i=0; i<str.length; i++){

if(str[i]!==testStr[j]){ 


  check=false; break;}

j--;

}

if(check === true){
return true;
}
else{
return false;
}
}

palindrome("eye");

Mateja Trifunovski
@Matko95
Sep 07 2015 14:10
@mochiii .toLowerCase(); and .replace methods don't store the value, they just make a new string
@mochiii you need to save them
Paul Simon Ongpin
@mochiii
Sep 07 2015 14:10
oh i see i try it then
hmmm how do i store those functions in one variable?

like this?

var newStr='';
newStr =str.toLowerCase();
newStr =str.replace(/[.,-\/#!$%\^&*;:{}=-_`~()]/g,"");
newStr =str.replace(/ /g,"");

Mateja Trifunovski
@Matko95
Sep 07 2015 14:13
yes you can do it like that
Paul Simon Ongpin
@mochiii
Sep 07 2015 14:14
hmmmm im still getting the errors on palindrome with string with spaces and punctuation
i changed the str to newStr it worked. but i still have 1 error left
Mateja Trifunovski
@Matko95
Sep 07 2015 14:19
which one
Grace
@dogbot101
Sep 07 2015 14:20
Anyone want to help out with Angular ng show/hide toggle for Twitch Zipline?
zac247
@zac247
Sep 07 2015 14:22
Hi guys, am doing zipline 1 (portfolio project). I have a set of buttons that are aligned to the left of my page.I want to align them responsively to the centre of my page. I tried to give them a right padding but then it becomes non responsive. Any ideas?Are any classes in bootstrap which makes this possible?
Mateja Trifunovski
@Matko95
Sep 07 2015 14:22
@zac247 text-center class
Paul Simon Ongpin
@mochiii
Sep 07 2015 14:23

this code has 3 errors the 5th, 9th, and 10th

function palindrome(str) {
// Good luck!
var newStr='';
newStr =str.toLowerCase();
newStr =str.replace(/[.,-\/#!$%\^&*;:{}=-_`~()]/g,"");
newStr =str.replace(/ /g,"");

testStr=newStr;
check= true;
j=newStr.length-1;
for(i=0; i<newStr.length; i++){

if(newStr[i]!==testStr[j]){ 


  check=false; break;}

j--;

}

if(check === true){
return true;
}
else{
return false;
}
}

palindrome("A man, a plan, a canal. Panama");

in the palindrome bonfire excercise
zac247
@zac247
Sep 07 2015 14:24
@Matko95 thanks much! let me check it out! BTW, do you know how I can locate information like this in the future about bootstrap classes?
CamperBot
@camperbot
Sep 07 2015 14:24
zac247 sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 219 | @matko95 | http://www.freecodecamp.com/matko95
Mateja Trifunovski
@Matko95
Sep 07 2015 14:26
@mochiii why are you even using a for loop?
Paul Simon Ongpin
@mochiii
Sep 07 2015 14:27
should i use the split reverse join method?
Mateja Trifunovski
@Matko95
Sep 07 2015 14:27
@mochiii str.toLowerCase().replace(/[.,!?]/g,"").replace(/\s/g,"")===str.toLowerCase().replace(/[.,!?]/g,"").replace(/\s/g,"").split('').reverse().join('') yeah, something like this
@zac247 there is some info on the official twitter bootstrap website
Paul Simon Ongpin
@mochiii
Sep 07 2015 14:29
ok thank you i'll figure it out myself thanks for helpig awesome man!
CamperBot
@camperbot
Sep 07 2015 14:29
if you want to thank someone, put an @ before their name!
Paul Simon Ongpin
@mochiii
Sep 07 2015 14:29
@Matko95 thanks
CamperBot
@camperbot
Sep 07 2015 14:29
mochiii sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 220 | @matko95 | http://www.freecodecamp.com/matko95
Mateja Trifunovski
@Matko95
Sep 07 2015 14:29
np :)
Paul Simon Ongpin
@mochiii
Sep 07 2015 15:24
do i have to do bubble sort in Bonfire: Find the Longest Word in a String?
Cristián Berríos
@crisberrios
Sep 07 2015 15:27
hmm I don't think so
but sorting would be a way to do it
you can do sort() with a custom sorting function (by length) and then choosing the longest
or you could just go through all the words and comparing with the current longest found so far
Paul Simon Ongpin
@mochiii
Sep 07 2015 15:30
i already figured out the solution to Bonfire: Find the Longest Word in a String quite simple hahahahah just compare and store the value in loops haha. thanks @crisberrios for answering
CamperBot
@camperbot
Sep 07 2015 15:30
mochiii sends brownie points to @crisberrios :sparkles: :thumbsup: :sparkles:
:star: 158 | @crisberrios | http://www.freecodecamp.com/crisberrios
Cristián Berríos
@crisberrios
Sep 07 2015 15:30
you're welcome :)
Rory Smith
@alanbuchanan
Sep 07 2015 15:42
i came across this great solution to query a prime number, but i don't understand why i increases by 6 on every iteration
    function isPrime(n) {
        if (isNaN(n) || !isFinite(n) || n % 1 || n < 2) return false; 

        if (n % 2 == 0) return (n == 2);
        if (n % 3 == 0) return (n == 3);

        var m = Math.sqrt(n);
        for (var i = 5; i <= m; i += 6) {
            if (n % i === 0)          return false;
            if (n % (i + 2) === 0)    return false;
        }
        return true;
    }
Sean Campbell
@natac13
Sep 07 2015 15:42
Hey everyone just wondering if anyone has had problems running the FCC app locally.. everything was good when I went to bed last night now when I run gulp to start the app it crashes and will not start like normal..... any help would really be appreacitated
Moisés Man
@moigithub
Sep 07 2015 15:43
for (var i = 5; i <= m; i += 6) {
Sean Campbell
@natac13
Sep 07 2015 15:44
the first error I get is listen EADDRINUSE
then watch ENNOSPC
Blauelf
@Blauelf
Sep 07 2015 15:46
Interesting one. Checks for dividers of type 6k-1 and 6k+1, as all other potential dividers are themselves divisable by 2 or 3. I would have checked all odd numbers, which is 50% more.
Kevin Vansylyvong
@kansylyvong
Sep 07 2015 15:47
Can anyone help me out on the pomodoro zip line? I'm not sure how to create an alarm sound. I was thinking to upload a wav file or something like that, but I'm not sure how to do that on codepen.
Rory Smith
@alanbuchanan
Sep 07 2015 15:49
@moigithub yes i can see where it iterates...what i mean is i don't know why it's necessary to go by 6
Blauelf
@Blauelf
Sep 07 2015 15:52
The loop checks for two possible dividers every six numbers. The other four would be themselves divisable by two or three, so no need to check them.
Moisés Man
@moigithub
Sep 07 2015 15:53
im not a math guy.... i googled for an algorithm :P
Rory Smith
@alanbuchanan
Sep 07 2015 15:53
@moigithub neither am i but i'm at least trying to understand such algorithms
@Blauelf that's starting to make sense, thank you
CamperBot
@camperbot
Sep 07 2015 15:54
alanbuchanan sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star: 261 | @blauelf | http://www.freecodecamp.com/blauelf
Doug Riblet
@DougRiblet
Sep 07 2015 16:01
@kansylyvong You could try using audioContext. I learned it yesterday to add tones of different frequencies to the Simon zipline. There's a learning curve, but it's really cool and useful.
https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createOscillator
Rory Smith
@alanbuchanan
Sep 07 2015 16:02
@Blauelf what does k refer to in that context?
DrillSoul
@DrillSoul
Sep 07 2015 16:20

Could I get a hit for what I am doing wrong with Waypoint: Give your JavaScript Slot Machine some stylish images?
The instructions say to use this code for each slot, and modify accordingly:

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

And my code is:

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

But I receive the error:

Use the provided code three times. One for each slot

Never mind...found it
Grace
@dogbot101
Sep 07 2015 16:35
Anyone know what would be best for using Angular for separating the online and offline status? I'm not sure if it's best to do a custom filter, ng if, ng show, etc.
Ryan Wilson
@rbwilson
Sep 07 2015 16:37
What is wrong with my for loop?
var myArray = [0,1,2,3,4];
for(var i = 0; i < 5; i++){
  myArray.push(i);
}
CamperBot
@camperbot
Sep 07 2015 16:37
:bulb: to format code use backticks! ``` more info
Roel Verbunt
@roelver
Sep 07 2015 16:38
@rbwilson missing } ??
Ryan Wilson
@rbwilson
Sep 07 2015 16:39
my bad @roelver I added that. I'm getting the error:
assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');myArray should equal [0,1,2,3,4]: expected [ 1, 2, 3, 4, 0, 1, 2, 3, 4 ] to deeply equal [ 0, 1, 2, 3, 4 ]
Roel Verbunt
@roelver
Sep 07 2015 16:41
@rbwilson Why do you need the loop, if you already initialize the array with the expected value?
@rbwilson Or you should start with var myArray = [];
Robert Richey
@0x0936
Sep 07 2015 16:43
@rbwilson you're pushing values onto an array with existing values
Ryan Wilson
@rbwilson
Sep 07 2015 16:46
thanks guys! @roelver @0x0936
CamperBot
@camperbot
Sep 07 2015 16:46
rbwilson sends brownie points to @roelver and @0x0936 :sparkles: :thumbsup: :sparkles:
:star: 116 | @0x0936 | http://www.freecodecamp.com/0x0936
:star: 285 | @roelver | http://www.freecodecamp.com/roelver
Jason
@jason
Sep 07 2015 16:55
if anyone's around... i'm fairly lost on bonfire wherefore art thou
Dhananjay Mehrotra
@dj8923
Sep 07 2015 16:55
bonfire Seek and Destroy
CamperBot
@camperbot
Sep 07 2015 16:55

:fire:Bonfire: Seek and Destroy :link:

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

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

You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.

more info:  bf details | bf links | hint

Dhananjay Mehrotra
@dj8923
Sep 07 2015 16:55
@jason yes jason
hint
CamperBot
@camperbot
Sep 07 2015 16:56
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Jason
@jason
Sep 07 2015 16:56
bonfire wherefore art thou
CamperBot
@camperbot
Sep 07 2015 16:56
Sorry, can't find a bonfire called wherefore art thou. [ Check the map? ]
Jason
@jason
Sep 07 2015 16:56
bonfire Where art thou
CamperBot
@camperbot
Sep 07 2015 16:56

: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

Dhananjay Mehrotra
@dj8923
Sep 07 2015 16:57
jason tell me the code
Jason
@jason
Sep 07 2015 16:57
bf hint
CamperBot
@camperbot
Sep 07 2015 16:57
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Dhananjay Mehrotra
@dj8923
Sep 07 2015 16:57
@jason tell me your code buddy
Jason
@jason
Sep 07 2015 16:57
lol
i've been trying to experiment with hasOwnProp -
Dhananjay Mehrotra
@dj8923
Sep 07 2015 16:57
ok..
then..?
Jason
@jason
Sep 07 2015 16:58
collection.hasOwnProperty(source)
nodice.
Roel Verbunt
@roelver
Sep 07 2015 16:58
Did anyone succeed to get the angular-fullstack server running on Cloud9? The biggest problem was that npm refused to install lots of packages. No errmsg. Does it run out of the box , or with another Node version? It runs fine on my laptop but not on Cloud9.
Dhananjay Mehrotra
@dj8923
Sep 07 2015 16:59
@jason what is the value of source
chek it
whats the output u are getting?
Jason
@jason
Sep 07 2015 16:59
{last: capulet}
i'm getting false
so i tried collection[2].hasOwnProperty(source)
Robert Richey
@0x0936
Sep 07 2015 16:59
@jason source is an object, not a property
Jason
@jason
Sep 07 2015 17:00
so I need to test against the key and the hash?
collection[2].hasOwnProperty(source[last])
Dhananjay Mehrotra
@dj8923
Sep 07 2015 17:01
@jason Object.keys(source) this will give u the array object with ["last"] element
now u have to check this
whether it is present in collection
so what u can do is u have to iterate through every collection item via loop
then collection[i].hasOwnProperty(Object.keys(source)[0]); //condition u are checking one property but suppose there might be the case when u have one or more properties then what..u will do then source[j] where j is another inside loop
Jason
@jason
Sep 07 2015 17:04
oh i get it
Dhananjay Mehrotra
@dj8923
Sep 07 2015 17:04
@jason :)
cool jason
Jason
@jason
Sep 07 2015 17:05
thanks, dj
CamperBot
@camperbot
Sep 07 2015 17:05
if you want to thank someone, put an @ before their name!
Jason
@jason
Sep 07 2015 17:06
thanks @dj8923
CamperBot
@camperbot
Sep 07 2015 17:06
jason sends brownie points to @dj8923 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for dj8923
Florian Peninon
@florianpnn
Sep 07 2015 17:10
Hello everyone!
Is it possible to skip some biplane and not get stuck later? (I have the knowledge and I see some of them as not interesting to do for me)
Lux3
@Lux3
Sep 07 2015 17:11
@florianpnn do you think your future boss would let you skip a project because you don't find it interesting?
jparrish62
@jparrish62
Sep 07 2015 17:12
Question am I required to learn all these other frameworks like node.js, angular.js and express.js how does this work ...I prefer ember.
Roel Verbunt
@roelver
Sep 07 2015 17:12
@florianpnn you can skip whatever you want. But you have to complete all challenges before you can start working on non-profit projects.
Florian Peninon
@florianpnn
Sep 07 2015 17:12
@Lux3 No, but designing a bootstrap portfolio without any JS when you had a web integrator experience in the past is not really useful..
@roelver That was my fear :/
Thanks!
CamperBot
@camperbot
Sep 07 2015 17:13
florianpnn sends brownie points to @roelver :sparkles: :thumbsup: :sparkles:
Lux3
@Lux3
Sep 07 2015 17:13
You can use javascript if you want to
CamperBot
@camperbot
Sep 07 2015 17:13
:star: 286 | @roelver | http://www.freecodecamp.com/roelver
Roel Verbunt
@roelver
Sep 07 2015 17:14
@florianpnn .. and indeed some challenges are quite boring. :-(
Jason
@jason
Sep 07 2015 17:14
are you still around?
@dj8923 are you still around?

function where(collection, source) {
var arr = [];
// What's in a name?
for (var i in collection) {
if (collection[i].hasOwnProperty(Object.keys(source))) {
if (collection[i][Object.keys(source)] == source[Object.keys(source)]) {
return i;
}
}
}

}

Lux3
@Lux3
Sep 07 2015 17:16
wiki format
CamperBot
@camperbot
Sep 07 2015 17:16

: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

Lux3
@Lux3
Sep 07 2015 17:17
function where(collection, source) {
  var arr = [];
  // What's in a name?
    for (var i in collection) {
      if (collection[i].hasOwnProperty(Object.keys(source))) {
        if (collection[i][Object.keys(source)] == source[Object.keys(source)]) {
          return i;
        }
      }
    }

 }
Jason
@jason
Sep 07 2015 17:17
` if (collection[i].hasOwnProperty(Object.keys(source))) {
if (collection[i][Object.keys(source)] == source[Object.keys(source)]) {
return i;
}
}
Lux3
@Lux3
Sep 07 2015 17:17
you need 3 backticks on its own line then shift + enter
Florian Peninon
@florianpnn
Sep 07 2015 17:17
@roelver I’ll take the challenge in a different way but I’ll do it to pass ;)
Jason
@jason
Sep 07 2015 17:19
      if (collection[i].hasOwnProperty(Object.keys(source))) {
        if (collection[i][Object.keys(source)] == source[Object.keys(source)]) {
          return i;
        }
      }
there we go
Roel Verbunt
@roelver
Sep 07 2015 17:19
@florianpnn You can cheat a little of course to write code that only makes the tests pass.
Jason
@jason
Sep 07 2015 17:20
can anyone help withe where art thou?
    for (var i in collection) {
      if (collection[i].hasOwnProperty(Object.keys(source))) {
        if (collection[i][Object.keys(source)] == source[Object.keys(source)]) {
          return i;
        }
      }
    }
Lux3
@Lux3
Sep 07 2015 17:21
yes @jason
Jason
@jason
Sep 07 2015 17:21
sorry about the markdown spam, trying to figure out how to paste, lol
Lux3
@Lux3
Sep 07 2015 17:21
no worries
JustinDudo
@JustinDudo
Sep 07 2015 17:22
Thanks @Rafase282 for help with 'Seek and Destroy'
CamperBot
@camperbot
Sep 07 2015 17:22
justindudo sends brownie points to @rafase282 :sparkles: :thumbsup: :sparkles:
:star: 411 | @rafase282 | http://www.freecodecamp.com/rafase282
Lux3
@Lux3
Sep 07 2015 17:23
arr.push(collection[i]);
you need to push from collection if the if statement is true
Jason
@jason
Sep 07 2015 17:23
So I would think that the above code would run...
Lux3
@Lux3
Sep 07 2015 17:23
and not return i, that is jsut a number
I dont understand the for loop either mine looks like this
for(var i = 0; i < collection.length; i++){
Jason
@jason
Sep 07 2015 17:24
oh. ha, yeah. i thought it said to return the number not the object
Lux3
@Lux3
Sep 07 2015 17:24
you want to return arr
Jason
@jason
Sep 07 2015 17:24
it's enumerate. shortcute to iterate through arrays
Lux3
@Lux3
Sep 07 2015 17:25
here is my full code.
function where(collection, source) {
  var arr = [];
  // What's in a name?
  for(var i = 0; i < collection.length; i++){
    if(collection[i].hasOwnProperty(Object.keys(source))){      
      if(collection[i][Object.keys(source)] === source[Object.keys(source)]){
        arr.push(collection[i]);  
      }

    }
  }
  return arr;
}

where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });
Hope that helps
Jason
@jason
Sep 07 2015 17:28
so mine passes the first 2 tests, but fails the last 2
Lux3
@Lux3
Sep 07 2015 17:28
@jason you want your return outside of the if statements as well as the for loop
Bill
@kirah1314
Sep 07 2015 17:28
@Lux3 FCC updated that bonfire and many previous solutions will fail last 2 tests
Lux3
@Lux3
Sep 07 2015 17:29
oh really
I have not gone back to it
Bill
@kirah1314
Sep 07 2015 17:29
yeah, I got the same solution as you and it doesn't pass the last 2
Lux3
@Lux3
Sep 07 2015 17:29
maybe I should
crazy
Jason
@jason
Sep 07 2015 17:29
maybe they changed it
Lux3
@Lux3
Sep 07 2015 17:29
@kirah1314 thanks for the heads up
CamperBot
@camperbot
Sep 07 2015 17:29
lux3 sends brownie points to @kirah1314 :sparkles: :thumbsup: :sparkles:
:star: 201 | @kirah1314 | http://www.freecodecamp.com/kirah1314
Bill
@kirah1314
Sep 07 2015 17:29
they added additional checks
Lux3
@Lux3
Sep 07 2015 17:30
I will be back later, good luck everyone
Bill
@kirah1314
Sep 07 2015 17:31
laters @Lux3
Jason
@jason
Sep 07 2015 17:31
kirah, do you want to pair?
Dhananjay Mehrotra
@dj8923
Sep 07 2015 17:31
@jason jason first two test correct na
u r on a right track
Jason
@jason
Sep 07 2015 17:31
yah
Bill
@kirah1314
Sep 07 2015 17:32
@jason the last 2 checks need filter() method
Dhananjay Mehrotra
@dj8923
Sep 07 2015 17:32
now suppose in the source there are more than one property
then u need to compare both the properties
to that which is in the collection
Bill
@kirah1314
Sep 07 2015 17:32
@jason I can't pair at the moment, working on a zipline :thumbsup:
Dhananjay Mehrotra
@dj8923
Sep 07 2015 17:33
think buddy how will u do that....hint-u need to do another iteration for acessing the properties of source
and comparing that to the collection one
Jason
@jason
Sep 07 2015 17:33
well, filter will go through the elements - but kirah said it earlier, lol
i wanna move onto ziplines. gotta do this one first
Bill
@kirah1314
Sep 07 2015 17:34
haha, I didn't know @dj8923 was going to pick your brains
Dhananjay Mehrotra
@dj8923
Sep 07 2015 17:35
@jason i dunno about filter i am telling u the one what I did :)
@kirah1314 :)
i can give u the code itself but that wont be good na...so try buddy :) i am helping u step wise
Dhananjay Mehrotra
@dj8923
Sep 07 2015 17:41