These are chat archives for FreeCodeCamp/Help

4th
Oct 2015
Johnathan Brown
@Legend28469
Oct 04 2015 00:25

Hi guys. I’m having a hard time centering my bottom contacts part of my portfolio. I’ve tried using margins but that isn’t working. Any help? http://codepen.io/Legend28469/pen/ZbpBqP

Would bootstrap cols be able to center them?

Rex Schrader
@SaintPeter
Oct 04 2015 00:27
@Legend28469 In order to center an an element with margins you must have a fixed width.
Johnathan Brown
@Legend28469
Oct 04 2015 00:28
@SaintPeter Should I set a width or is there something in bootstrap to use?
Rex Schrader
@SaintPeter
Oct 04 2015 00:29
@Legend28469 I think you can set a width. There may be a "proper" way to do it, but I'm not entirely certain.
Johnathan Brown
@Legend28469
Oct 04 2015 00:30
Okay I’ll try it out now
Rex Schrader
@SaintPeter
Oct 04 2015 00:30
@Legend28469 Note that your sections are probably full width. It's the inner container that you need to set to a fixed width and margin-left: auto; margin-right: auto
Johnathan Brown
@Legend28469
Oct 04 2015 00:32
What is an ideal fixed width?
Rex Schrader
@SaintPeter
Oct 04 2015 00:35
@Legend28469 Experiment until the buttons fit
Johnathan Brown
@Legend28469
Oct 04 2015 00:36
Okay
Thanks @SaintPeter
CamperBot
@camperbot
Oct 04 2015 00:36
legend28469 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 835 | @saintpeter | http://www.freecodecamp.com/saintpeter
Boris
@boris-in-london
Oct 04 2015 01:13
i noticed something odd, my console results and freecodecamp tests dont match up. what do you guys think
i lost the image, one sec
This message was deleted
This message was deleted
blob
so my console spits out an empty array, which is right
yet the FCC tests say NaN does not equal [] deeply.
yet it shows they expected [] as the result
Tyler Haas
@tylerthehaas
Oct 04 2015 01:18
anyone here completed the tic-tac-toe zipline yet?
Boris
@boris-in-london
Oct 04 2015 01:20
This message was deleted
function bouncer(arr) {
  //debugger;
  function killFalsy(it) {
    if(([false, null, 0, "", undefined, NaN].indexOf(it)) >= 0) {
      return false;
    }
    else {
      return true;
    }    
  }
  return arr.filter(killFalsy);  
}

bouncer([false, null, 0], "");
Jonathan Lee Slew
@jlslew
Oct 04 2015 01:22
@haasDev I have
Rex Schrader
@SaintPeter
Oct 04 2015 01:22
@boris-in-london It's a trick! Replace ALL of your logic in killFalsey with this line:
return it
@haasDev I have
Anthony Albertorio
@tesla809
Oct 04 2015 01:22
hey guys
@tesla809
Hello!
anyone here has used matterJS or a library for 2d animation or physics
Juan Riquelme
@soulchainer
Oct 04 2015 01:22

@boris-in-london You are not testing the same that the test.
In your console, you test:

bouncer([false, null, 0], "");

But the test you are referencing is testing:

bouncer([false, null, 0, NaN, undefined], "");
Anthony Albertorio
@tesla809
Oct 04 2015 01:22
?
Rex Schrader
@SaintPeter
Oct 04 2015 01:22
@boris-in-london Also, I want to go see the movie called "Kill Falsy"
Juan Riquelme
@soulchainer
Oct 04 2015 01:23
So you need to test your code with the same for see if your code behaviour is good.
Rex Schrader
@SaintPeter
Oct 04 2015 01:23
@tesla809 Not really - kinda esoteric. The closest I've come is using an SVG library that had some animation stuff.
Boris
@boris-in-london
Oct 04 2015 01:23
lmfao @SaintPeter
@soulchainer thanks buddy, i didn't notice that.
CamperBot
@camperbot
Oct 04 2015 01:23
boris-in-london sends brownie points to @soulchainer :sparkles: :thumbsup: :sparkles:
:star: 316 | @soulchainer | http://www.freecodecamp.com/soulchainer
Robert Waddington
@RobbWaddington
Oct 04 2015 01:24
In codepen, I'm trying to figure out how to make my buttons link to pages. I've made a function to open the page but am not sure how to target _blank...
Tyler Haas
@tylerthehaas
Oct 04 2015 01:25
@jlslew @SaintPeter what was the basic logic you used for the computer moves. aka what strategy did you have the computer use to make its moves
Rex Schrader
@SaintPeter
Oct 04 2015 01:25
@haasDev I used the minimax algorithm and, at the end, I added alpha-beta pruning
Juan Riquelme
@soulchainer
Oct 04 2015 01:25
<a href="url" target="_blank">
Ô_ó
Tyler Haas
@tylerthehaas
Oct 04 2015 01:26
whats the minimax algorithm
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 01:26
hey guys, did anyone have trouble with the Create a JavaScript slot machine?
Rex Schrader
@SaintPeter
Oct 04 2015 01:27
@haasDev See section 1.5
Rex Schrader
@SaintPeter
Oct 04 2015 01:27
@Leeiaisabelle Yes, it's VERY picky about spacing. You have to copy and paste their code EXACTLY and modify just the indexes and variable names.
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 01:30
@SaintPeter it looks like I got the math formula part correct, but it seems to error out whenever I try to get the numbers to return into the slot machine. I tried push() to push the values to each slot
Rex Schrader
@SaintPeter
Oct 04 2015 01:30
@Leeiaisabelle Can you link me the specific waypoint? There are several. Pretty sure you don't use push on any of them, since they're not arrays.
KimsArk
@KimsArk
Oct 04 2015 01:31
Hi all, I'm hoping someone here can help me out. I'm stuck on Waypoint: Generate Random Whole Numbers within a Range. I've been stuck here for a couple of days now and for the life of me can not figure this out. Is there anyone who can explain this to me? I'm just not getting it.
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 01:31
blob
Rex Schrader
@SaintPeter
Oct 04 2015 01:32

@Leeiaisabelle ok, so all you need to do is say:

slotOne = Math.floow(Math.random() * (3 - 1  + 1)) + 1;

and so on

@Leeiaisabelle A return statement actually exits the current function. It doesn't store anything. "Storing" usually means assignment with an = sign.
@Leeiaisabelle or pushing, if the variable is an array
@KimsArk I can give it a shot
henry fritz
@henryamster
Oct 04 2015 01:34
*Math.floor :P
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 01:34
ok I tried that...maybe my spacing was off. i will try again.
Rex Schrader
@SaintPeter
Oct 04 2015 01:34
@henryamster If I could type, I'd be dangerous
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 01:35
@KimsArk you have to return the formula that they give you
KimsArk
@KimsArk
Oct 04 2015 01:35
@SaintPeter Thank you so much!!! I'm discovering that JavaScript may not be my forte. lol
CamperBot
@camperbot
Oct 04 2015 01:35
kimsark sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 839 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Oct 04 2015 01:36
@KimsArk ok, so the formula is:
Math.floor(Math.random() * (max - min + 1)) + min
and the number or min is 0 and max is 9
so
Math.floor(Math.random() * (9 - 0 + 1)) + 0
@KimsArk These waypoints are not the best. They're a bit tricksy
KimsArk
@KimsArk
Oct 04 2015 01:36
@SaintPeter That's what I have and it's still coming up as being wrong.
@SaintPeter I'm really struggling with the JavaScript. I was able to breeze through everything before this though.
Rex Schrader
@SaintPeter
Oct 04 2015 01:38
@KimsArk Interesting. I'm getting a failure on the last test as well. Trying to figure out why.
KimsArk
@KimsArk
Oct 04 2015 01:39
@SaintPeter Cool!!! Maybe it's not me then. lol
Rex Schrader
@SaintPeter
Oct 04 2015 01:39
@KimsArk OH - they LITERALLY want you to use min and max
KimsArk
@KimsArk
Oct 04 2015 01:39
@SaintPeter I tried that as well with the same results
Juan Riquelme
@soulchainer
Oct 04 2015 01:39
@KimsArk Math.random() creates a number between 0 and 1 always. For getting a number in a integer range, like you get a decimal number between 0 and 1, what we do is multiplicate that number for the upper number we want to get the range. So, for getting a number in range between 0 and 5, we need to multiplicate by (5) that number and. Cause number random never is 1. Its between (0, 1), not inclusive. So 5 * 0.99999 = 4.9999. So, after that, we sum 1 → 5.99999. And Floor that → 5. Same for the other numbers.
Rex Schrader
@SaintPeter
Oct 04 2015 01:39
@KimsArk return Math.floor(Math.random() * (max - min + 1)) + min; worked for me.
Juan Riquelme
@soulchainer
Oct 04 2015 01:40
Sorry, I'm not so fast like @SaintPeter xD. Not english speaker xD.
(But like I write it, I not delete it and finish it xD).

That

slotOne = Math.floow(Math.random() * (3 - 1  + 1)) + 1;

Can be pretty confusing, because it doesn't explain WHY that's done.

And only get people doing a thing without understanding. Bad thing >_<.
Mike G.
@mgraham134
Oct 04 2015 01:43
Hey guys I have a question regarding CSS
DJ Runas
@djrunas
Oct 04 2015 01:44
Fire away, @mgraham134
Mike G.
@mgraham134
Oct 04 2015 01:45
@djrunas Thanks a lot. I placed this code in the style section in order to make the picture smaller but its not executing. .smaller-image { width: 100px; }
CamperBot
@camperbot
Oct 04 2015 01:45
mgraham134 sends brownie points to @djrunas :sparkles: :thumbsup: :sparkles:
:star: 27 | @djrunas | http://www.freecodecamp.com/djrunas
KimsArk
@KimsArk
Oct 04 2015 01:45
@soulchainer I agree. I wish they went into a bit more detail than they do.
DJ Runas
@djrunas
Oct 04 2015 01:45
@mgraham134 , did you apply your class to your image?
So, you have the class declaration correct
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 01:46
Hey @SaintPeter every time I try to type in slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1; I still get errors. I tried deleting everything I typed and tried adding it before and after what I have typed
DJ Runas
@djrunas
Oct 04 2015 01:46
But, you need to apply the class to your img element.
Mike G.
@mgraham134
Oct 04 2015 01:46
aha!
DJ Runas
@djrunas
Oct 04 2015 01:46
Did it work?
Mike G.
@mgraham134
Oct 04 2015 01:47
so if I already have my picture in the img element which is the proper way to apply the class as well?
Rex Schrader
@SaintPeter
Oct 04 2015 01:47
@Leeiaisabelle Have you got the same lines for slotTwo and slotThree?
Mike G.
@mgraham134
Oct 04 2015 01:49
@djrunas aha it worked! I added the class in front of the src
DJ Runas
@djrunas
Oct 04 2015 01:49
Very cool, @mgraham134 :)
If you need anymore help, feel free to ask here!
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 01:49
@SaintPeter yes
Mike G.
@mgraham134
Oct 04 2015 01:50
@djrunas :clap: :smile:
Rex Schrader
@SaintPeter
Oct 04 2015 01:50
@Leeiaisabelle Can you please post your code?
wiki format
CamperBot
@camperbot
Oct 04 2015 01:50

:point_right: code formatting [wiki]

Inline code

alt text

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

Code Block

``` ⇦ Type 3 backticks 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

Rex Schrader
@SaintPeter
Oct 04 2015 01:51
@Leeiaisabelle Like so :point_up:
Jonathan Coleman
@jondcoleman
Oct 04 2015 01:51
how do I open a web browser in c9? I'm totally new to linux
Rex Schrader
@SaintPeter
Oct 04 2015 01:52
@jondcoleman Hit the little play button at the top of the screen
KimsArk
@KimsArk
Oct 04 2015 01:53

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

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

return Math.random()

}

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

That is what I have and it's still coming up as an error.
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 01:54
slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1; slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1; slotThree Math.floor(Math.random() * (3 - 1 + 1)) + 1;
Rex Schrader
@SaintPeter
Oct 04 2015 01:55

@KimsArk Not two lines. One line.

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

should be:

return Math.floor(Math.random) * (max - min + 1) + min;
Jonathan Coleman
@jondcoleman
Oct 04 2015 01:55
This one @SaintPeter?
blob
Rex Schrader
@SaintPeter
Oct 04 2015 01:55
@jondcoleman Yeah - sometimes that works for me
Chris
@cknoxcj
Oct 04 2015 01:55
Having an issue with the free code camp exercise for HTML. I am on step 22. This has to deal with nested anchors in a paragraph. The exercise is saying this piece of code is incorrect. <p>View more <a href='http://freecodecamp.com'> cat photos</a> for you to view.</p>
Jonathan Coleman
@jondcoleman
Oct 04 2015 01:55
I'm trying to read this file but can't seem to figure out how to get it open: file:///home/ubuntu/.nvm/v0.10.35/lib/node_modules/learnyounode/node_apidoc/fs.html
I tried in that run window but no worky
Chris
@cknoxcj
Oct 04 2015 01:56
Anyone have any ideas?
henry fritz
@henryamster
Oct 04 2015 01:56
@cknoxcj try using double quotes instead of single
Rex Schrader
@SaintPeter
Oct 04 2015 01:56
@Leeiaisabelle You may be missing an = on the last line - for slotThree
Chris
@cknoxcj
Oct 04 2015 01:56
Tried that. Same result.
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 01:57
Ha! Got it! Thanks @SaintPeter
CamperBot
@camperbot
Oct 04 2015 01:57
leeiaisabelle sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 841 | @saintpeter | http://www.freecodecamp.com/saintpeter
KimsArk
@KimsArk
Oct 04 2015 01:57
@SaintPeter It's still coming up as wrong.
Rex Schrader
@SaintPeter
Oct 04 2015 01:58
@KimsArk oops, my bad - missing parentheese on the random call
return Math.floor(Math.random()) * (max - min + 1) + min;
@KimsArk Well, your bad too - a function call always gets the parentheses
Chris
@cknoxcj
Oct 04 2015 01:59
Could there be an error in the tutorial validation check.
Rex Schrader
@SaintPeter
Oct 04 2015 01:59
@KimsArk I know, it's a sea of symbols :D
henry fritz
@henryamster
Oct 04 2015 01:59
@cknoxcj from the desciprtion: Now nest your existing a element within a new p element so that the surrounding paragraph says "View more cat photos", but where only "cat photos" is a link, and the rest of the text is plain text.
KimsArk
@KimsArk
Oct 04 2015 01:59
@SaintPeter Duh!!! Ok it worked that time.
Rex Schrader
@SaintPeter
Oct 04 2015 01:59
@cknoxcj Yes, that's possible, but unlikely at this point. We've had thousands of people come though.
henry fritz
@henryamster
Oct 04 2015 01:59
make sure your text is exactly the same
KimsArk
@KimsArk
Oct 04 2015 02:00
@SaintPeter I wasn't using "return" before the script.
Rex Schrader
@SaintPeter
Oct 04 2015 02:00
@KimsArk There ya go.
KimsArk
@KimsArk
Oct 04 2015 02:01
@SaintPeter Thank you so much. I may get this yet, but I'm not holding my breath. lol
CamperBot
@camperbot
Oct 04 2015 02:01
kimsark sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: kimsark already gave saintpeter points
Rex Schrader
@SaintPeter
Oct 04 2015 02:02
@KimsArk It's all good - Gotta keep rolling. As time goes on you'll get an eye for these details that all seem so befuddling now. Remember: Coding is a skill, just like painting or dancing. You wouldn't expect to be Da Vinci or Baryshnikov after just a few weeks, right?
KimsArk
@KimsArk
Oct 04 2015 02:04
@SaintPeter I took HTML and CSS years ago. I like the changes that have been made in both by the way. lol But only scratched the surface of JavaScript and I'm struggling. Bootstrap is cool too. That's new since I took classes.
Jon Martin
@Begbie2006
Oct 04 2015 02:04

<style>

  red-text {color: red; }

</style>

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

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

Rex Schrader
@SaintPeter
Oct 04 2015 02:05
@Begbie2006 To make it a class, you need to have a dot before your class name:
.red-text
@Begbie2006 Otherwise you are correct.
Jon Martin
@Begbie2006
Oct 04 2015 02:05
Thanks. I thought I did that before. @SaintPeter
CamperBot
@camperbot
Oct 04 2015 02:05
begbie2006 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 842 | @saintpeter | http://www.freecodecamp.com/saintpeter
Jon Martin
@Begbie2006
Oct 04 2015 02:07

<style>

 .red-text {color: red; }

</style>

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

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

Can someone tells me why the above hasn't worked
It cant seem to get it to show red
Rex Schrader
@SaintPeter
Oct 04 2015 02:09
@Begbie2006 That looks right to me.
DJ
@qualitymanifest
Oct 04 2015 02:09
yeah same... i've been staring at it funny trying to get it to fess up why it's not working, to no avail
Jon Martin
@Begbie2006
Oct 04 2015 02:10
Yeah I went over alot of examples elsewhere and it seems like it's correct.
Can you skip a lesson and go on to the next?
DJ
@qualitymanifest
Oct 04 2015 02:11
@Begbie2006 yeah
Jon Martin
@Begbie2006
Oct 04 2015 02:13
Can you skip a lesson and go back to it later?
Rex Schrader
@SaintPeter
Oct 04 2015 02:13
@Begbie2006 Sure - just go out to the map and choose the next one
Jon Martin
@Begbie2006
Oct 04 2015 02:14
Ok. Good. thanks. I'll make a note of it and go back later.
CamperBot
@camperbot
Oct 04 2015 02:14
if you want to thank someone, put an @ before their name!
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 02:14
thanks @camperbot
CamperBot
@camperbot
Oct 04 2015 02:14
leeiaisabelle sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star: 292 | @camperbot | http://www.freecodecamp.com/camperbot
Hugo
@hugoender
Oct 04 2015 02:15
I am trying to add a “degree” symbol in javascript… but the following is not working:
$('#location-temp').text(temp_f+' &ordm; F');
any idea why not?
that displays the following: 78.9 º F
oops
it converts it in this chat lol
78.9 &ordm; F
there
thats what it displays on my page
Rex Schrader
@SaintPeter
Oct 04 2015 02:17
@hugoender Try &deg;
henry fritz
@henryamster
Oct 04 2015 02:17
@hugoender I think ° works
woops ^see above
Hugo
@hugoender
Oct 04 2015 02:18
@SaintPeter nope…&deg; doesnt work either
@henryamster i know that it should work but it doesnt
so i am wondering if it’s that i cannot include such code in the .text()
method
Rex Schrader
@SaintPeter
Oct 04 2015 02:19
@hugoender use .html, not .text
henry fritz
@henryamster
Oct 04 2015 02:19
aha! nope need to use .html()
Hugo
@hugoender
Oct 04 2015 02:19
oh let me try that
okay that worked. thank you @SaintPeter and @henryamster
CamperBot
@camperbot
Oct 04 2015 02:22
hugoender sends brownie points to @saintpeter and @henryamster :sparkles: :thumbsup: :sparkles:
:star: 844 | @saintpeter | http://www.freecodecamp.com/saintpeter
:star: 268 | @henryamster | http://www.freecodecamp.com/henryamster
Joel M. Swensen
@JoelMSwensen
Oct 04 2015 02:26
Hey all, can someone who’s good with html take a look at this repo? In the index.html there is a line between the </header> and the ned <div> which reads "THIS SHOULDN'T HAVE TO BE HERE”. Check out what happens when you remove it. Why is that breaking the page? P.s. I have no recolection of how this happened, "THIS SHOULDN'T HAVE TO BE HERE” replace a —> part of a comment i didn’t take out at some point. Any help would be much apreciated!
Kevin Diem
@kgdiem
Oct 04 2015 02:28
hola, working on the javascript calculator zipline, not sure how to parse the operator given as a string
would anyone be able to help me figure that out?
seems the eval() function doesn't work on codepen
Kevin Diem
@kgdiem
Oct 04 2015 02:37
nvm just going to use a switch statement
Jonathan Lee Slew
@jlslew
Oct 04 2015 03:02
@JoelMSwensen add clear: both to the body-divs class
it happen because you are using float
Adam Allard
@Amallard
Oct 04 2015 03:05
Help on bonfire: seek and destroy please. It appears i am getting the right output, but none of the tests are passing. Can someone help me find the error?
CamperBot
@camperbot
Oct 04 2015 03:05
no wiki entry for: on bonfire seek and destroy please it appears i am getting the right output but none of the tests are passing can someone help me find the error
:pencil: click here to create one now!after creating your page type update to reload it here
Jonathan Lee Slew
@jlslew
Oct 04 2015 03:05
@Amallard sure
Joel M. Swensen
@JoelMSwensen
Oct 04 2015 03:06
OH!
Jay Wilson Jr.
@JayWIlsonJr
Oct 04 2015 03:06
help on waypoint over Arrays with map
CamperBot
@camperbot
Oct 04 2015 03:06
no wiki entry for: on bonfire over arrays with map
:pencil: click here to create one now!after creating your page type update to reload it here
Joel M. Swensen
@JoelMSwensen
Oct 04 2015 03:06
@jlslew Thank you very much!
CamperBot
@camperbot
Oct 04 2015 03:06
joelmswensen sends brownie points to @jlslew :sparkles: :thumbsup: :sparkles:
:star: 266 | @jlslew | http://www.freecodecamp.com/jlslew
Jay Wilson Jr.
@JayWIlsonJr
Oct 04 2015 03:07
help with waypoint over Arrays with map
CamperBot
@camperbot
Oct 04 2015 03:07
no wiki entry for: with waypoint over arrays with map
:pencil: click here to create one now!after creating your page type update to reload it here
Jay Wilson Jr.
@JayWIlsonJr
Oct 04 2015 03:07
help over Arrays with map
CamperBot
@camperbot
Oct 04 2015 03:07

:point_right: waypoint iterate over arrays with map [wiki]

Using map is the best way to iterate through an array or object. Map uses a function to pretty much do whatever you want it to do. It will pass each value to the callback function.

//Use map to add three to each value in the array
var array = [1,2,3,4,5];

array = array.map(function(val){
  return val + 3;
});

:pencil: read more about waypoint iterate over arrays with map on the FCC Wiki

Adam Allard
@Amallard
Oct 04 2015 03:09
@jlslew here is my code:

var arg = arguments.length;

var newArr = [];

var found = false;

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

found = false;
for (j = 1; j < arg - 1; j++) {

  if (arr[i] == arguments[j]) {
    found = true;
  }
} 

if (!found) {
  newArr.push(arr[i]);
}

}

return newArr;
}

Jay Wilson Jr.
@JayWIlsonJr
Oct 04 2015 03:10
help Condense arrays with reduce
CamperBot
@camperbot
Oct 04 2015 03:10

:point_right: waypoint condense arrays with reduce [wiki]

Reduce can be useful for condensing an array or numbers into one value.

var array = [4,5,6,7,8];
var singleVal = 0;
// Only change code below this line.

var singleVal = array.reduce(function(previousVal, currentVal){

  return previousVal+currentVal;

});

:pencil: read more about waypoint condense arrays with reduce on the FCC Wiki

Jonathan Lee Slew
@jlslew
Oct 04 2015 03:11
@Amallard arr.length? isn't arr already the length of arguments?
Herman Fassett
@HermanFassett
Oct 04 2015 03:13
No, that's arg @jlslew
Unless he mistyped
Adam Allard
@Amallard
Oct 04 2015 03:13
@jlslew it seems that arr is the array being passed (the first argument). when i just type return arr, the first argument (the array) appears
Herman Fassett
@HermanFassett
Oct 04 2015 03:15
You should probably think about using
var args = Array.prototype.slice(arguments);
Adam Allard
@Amallard
Oct 04 2015 03:16
@HermanFassett never knew about this method. ill research it now. thanks!
CamperBot
@camperbot
Oct 04 2015 03:16
if you want to thank someone, put an @ before their name!
any ideas?
Douglas Luce
@Doug-Luce
Oct 04 2015 03:17
if (searchWord.indexOf(wordTosearch[0]) > -1) && (searchWord.indexOf(wordToSearch[1]) > -1) && (searchWord.indexOf(wordToSearch[2]) > -1) {
    return true;

  }
Why is this statement saying unexpected token &&
Herman Fassett
@HermanFassett
Oct 04 2015 03:18
@henryamster container's kind of cool
@Doug-Luce your if statement ends after that first -1
Remove that parentheses or add one at the beginning
Jonathan Lee Slew
@jlslew
Oct 04 2015 03:19
@Doug-Luce check if all open bracket '(' have a closing bracket ')'
Jon Love
@jayvolr
Oct 04 2015 03:20
@HermanFassett You closed the if statement. The ')' right before the && should be at the end, you don't need two sets of parens
henry fritz
@henryamster
Oct 04 2015 03:20
@HermanFassett hmm. I was leaning towards containers- it's settled. Thanks!
CamperBot
@camperbot
Oct 04 2015 03:20
henryamster sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 292 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Douglas Luce
@Doug-Luce
Oct 04 2015 03:21
@jlslew Thanks!
Daniel
@Smokenham
Oct 04 2015 03:21
$(document).ready(function() {

    var url = "https://api.twitch.tv/kraken/streams/";
    var streamers = ['freecodecamp', 'riotgames']
    var mainSec =$('#mainSec');

    for(i=0; i< streamers.length; i++){
        mainSec.append("The Streamer is: " + streamers[i] + "<br>");
        $.getJSON(url + streamers[i], function(data){
            if(data.stream === null){
                mainSec.append(streamers[i] + " is offline" + "<br>");
            }
            else{
                mainSec.append(streamers[i] + " is online" + "<br>");
            }
        });
    }
});

This returns:

The Streamer is: freecodecamp
The Streamer is: riotgames
undefined is online
undefined is offline

Can someone tell me why the JSON success function is unable to access streamers[i] and saying it is undefined?

Fausto Ramírez L.
@faustor21
Oct 04 2015 03:23
@Smokenham because the function in the getJSON is a callback.. by the time its been called the for loop has already ended
Herman Fassett
@HermanFassett
Oct 04 2015 03:24
@Smokenham Try creating a var streamer which is equal to streamers[i] and using that?
Daniel
@Smokenham
Oct 04 2015 03:31
@faustor21 I'm a bit confused on the order than this code executes. Are you saying the success function is not run on each iteration of the for loop? If that is the case how come it iterates on (data) to output undefined is online and
undefined is offline
@faustor21 thanks ill have a read of that
CamperBot
@camperbot
Oct 04 2015 03:31
smokenham sends brownie points to @faustor21 :sparkles: :thumbsup: :sparkles:
:star: 260 | @faustor21 | http://www.freecodecamp.com/faustor21
Moisés Man
@moigithub
Oct 04 2015 03:31
the problem is cuz async request...
Fausto Ramírez L.
@faustor21
Oct 04 2015 03:32
@Smokenham glad to help..
Moisés Man
@moigithub
Oct 04 2015 03:32
after the it returns the result (callback is called) i is no longer whatever value it had when it was called
Daniel
@Smokenham
Oct 04 2015 03:35
@HermanFassett @moigithub thanks for the help
CamperBot
@camperbot
Oct 04 2015 03:35
smokenham sends brownie points to @hermanfassett and @moigithub :sparkles: :thumbsup: :sparkles:
:star: 293 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
:star: 362 | @moigithub | http://www.freecodecamp.com/moigithub
Daniel
@Smokenham
Oct 04 2015 03:41

is my understanding of this correct? An asynchronous callback function will execute at some point after the function of which is is a parameter has completed?

In my example is there a way I can pass in a reference to the streamer[i] to the JSON success function? Or can I only access what the .getJSON returns in data?

Herman Fassett
@HermanFassett
Oct 04 2015 03:43
Since it's asynchronous, the for loop calls it and continues while getJSON runs.
assigning streamers[i] to a variable right before getJSON function and calling from that inside might work but I've no idea
Moisés Man
@moigithub
Oct 04 2015 03:45
u can use closures....
or IFFE
for(var i=0; i<10; i++){
    (function(val){
        setTimeout(function(){
            console.log(val);
        },Math.floor(Math.random() * 1000));
    })(i);  // <--- u pass   i   here
}
Joseph Cunningham
@Gnasch1972
Oct 04 2015 04:01
It was somewhere but how do I cut and paste my code here?
Jeff Roa
@saltyfresh
Oct 04 2015 04:03
<div>
<div class="row col-xs-4">

<button class="btn btn-block btn-primary">Like</button>
<button class="btn btn-block btn-info">Info</button>
<button class="btn btn-block btn-danger">Delete</button>
</div>
</div>
What am I doing wrong here?
Herman Fassett
@HermanFassett
Oct 04 2015 04:04
You need a div with class col-xs-4 around each button
Joseph Cunningham
@Gnasch1972
Oct 04 2015 04:05
This message was deleted
Tyler Moeller
@TylerMoeller
Oct 04 2015 04:05
wiki format
CamperBot
@camperbot
Oct 04 2015 04:05

:point_right: code formatting [wiki]

Inline code

alt text

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

Code Block

``` ⇦ Type 3 backticks 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

Tyler Moeller
@TylerMoeller
Oct 04 2015 04:06
there you go @Gnasch1972
Jeff Roa
@saltyfresh
Oct 04 2015 04:06
@HermanFassett Thank you, how exactly would that look?
CamperBot
@camperbot
Oct 04 2015 04:06
saltyfresh sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 295 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Joseph Cunningham
@Gnasch1972
Oct 04 2015 04:06
Thanks you
CamperBot
@camperbot
Oct 04 2015 04:06
if you want to thank someone, put an @ before their name!
Herman Fassett
@HermanFassett
Oct 04 2015 04:08
<div class="row">
  <div class="col-xs-4">
    <button class="btn btn-block btn-primary">Like</button>
  </div>
  <div class="col-xs-4">
    <button class="btn btn-block btn-info">Info</button>
  </div>
  <div class="col-xs-4">
    <button class="btn btn-block btn-danger">Delete</button>
  </div>
</div>
@saltyfresh maybe something like that
Jeff Roa
@saltyfresh
Oct 04 2015 04:10
@HermanFassett brilliant, thank you.
CamperBot
@camperbot
Oct 04 2015 04:10
saltyfresh sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:warning: saltyfresh already gave hermanfassett points
Herman Fassett
@HermanFassett
Oct 04 2015 04:11
Yep
Joseph Cunningham
@Gnasch1972
Oct 04 2015 04:17
<p> View more <a href="http://www.freecatphotoapp.com"> cat photos</a> </p>
What am I doing wrong. The error states "Your p element should have the text "View more " (with a space after it)."
Herman Fassett
@HermanFassett
Oct 04 2015 04:20
Try
<p>View more <a href="http://www.freecatphotoapp.com">cat photos</a> </p>
Joseph Cunningham
@Gnasch1972
Oct 04 2015 04:20
Only thing I did not try. Thanks
CamperBot
@camperbot
Oct 04 2015 04:20
if you want to thank someone, put an @ before their name!
vere perrot
@perrot
Oct 04 2015 04:29

Hi my friend,

I study the unit "Bonfire: Pairwise". It's very interesting. I get a message "resetting on fatal plugin error" in my chrome console. When I try to list all combination of my array, I get this message.

This is a fatal error. I think I can't fix it. :worried:

Isaac
@BenBagBag
Oct 04 2015 04:42
@perrot have you tried another browser or filed a bug report?
vere perrot
@perrot
Oct 04 2015 04:44
Thank you for your suggestion @BenBagBag . I will try another browser later. Thanks.:)
CamperBot
@camperbot
Oct 04 2015 04:44
perrot sends brownie points to @benbagbag :sparkles: :thumbsup: :sparkles:
:star: 225 | @benbagbag | http://www.freecodecamp.com/benbagbag
vere perrot
@perrot
Oct 04 2015 04:51

Hi,
I study the unit "Waypoint: Start a Nodejs Server". At the check item '19. Complete "Make it Modular"'. I get a error message "Your additional module file [mymodule.js] did not return an Array with the correct number of elements as the second argument of the callback" in my terminal after I command "learnyounode verify program.js".
Here is my code:
mymodule.js

var ext='';
 module.exports= function (path,extenstion,callback ){ 

     var fs = require('fs');

ext=extenstion;
fs.readdir(path,callback);


 }

program.js

var mymodule = require('./mymodule.js')
mymodule(process.argv[2],process.argv[3],callback);

function callback (err, list) { 
    //console.log(err);
    var arr=[];
    if(!err){
        var p = require('path');
        for(var i=0;i< list.length;i++){
            //console.log(p.extname(list[i]));
            if(p.extname(list[i])==='.'+process.argv[3]){
                console.log(list[i]);
                arr.push(list[i])
            }
        }
    }
    list=arr;
    };
Robert Richey
@0x0936
Oct 04 2015 04:59

@perrot in program.js the mymodule is only supposed to print an error if the callback was called with one, otherwise, callback should just print out the file names

var mymodule = require('./mymodule.js')
mymodule(process.argv[2],process.argv[3],callback);

// turned into a function expression so that the variable name gets hoisted to the top so that it's available to the mymodule call
var callback = function(err, list) { 
  if (err) { console.error(err); }
  else {
    list.forEach(function(fileName) {
      console.log(fileName);
    });
  }  
});

I'll talk about mymodule.js next

Robert Richey
@0x0936
Oct 04 2015 05:06
// require needed modules up top
var fs = require('fs');
var path = require('path');

// this module's function will be called with 3 arguments
module.exports= function (dir, ext, callback ) { 
  fs.readdir(dir, function(err, list) {
    // by convention, callbacks are called with errors as the only argument
    if (err) { return callback(err); }
    else {
      list = list.filter(function(file) {
        return path.extname(file) === '.' + ext;
      });
      // with no errors, callback is called with null errors and data
      return callback(null, list);
    }
  });
});
pepsifraek
@pepsifraek
Oct 04 2015 05:15
blob
blob
blob
blob
pepsifraek
@pepsifraek
Oct 04 2015 05:22
did not mean to post that 4 times
Puiyee Tong
@pytong
Oct 04 2015 05:39
anybody having problems running "npm install bl" on c9.io?
Hans van Riet
@hansinla
Oct 04 2015 05:44
@pytong For Basejumps? Yes, known issue.
Puiyee Tong
@pytong
Oct 04 2015 05:47
@hansinla Do you know how to get around that issue?
Rex Schrader
@SaintPeter
Oct 04 2015 05:55
@pytong Most folks are using a local dev environment. Note that in the next couple days they're going to be switching to Clementine JS - check out the beta site for instructions on it.
Hans van Riet
@hansinla
Oct 04 2015 05:55
Very soon, FCC will release new ways to get the Basejumps done by using Clementine.js on C9.io You may want to head over to Clementine.js to get a start on it. There’s a framework specially made for FCC.
Rex Schrader
@SaintPeter
Oct 04 2015 05:56
Darn, they don't have it updated on the Beta site yet.
@pytong You can just get started with the base tutorial. It takes you from bare bones to fullstack
Kevin Diem
@kgdiem
Oct 04 2015 05:59

can anyone tell me why

function steamroller(arr) {
  // I'm a steamroller, baby
  var ans = []
  function join(array){
    if(!Array.isArray(array)){
      ans.push(array);
    }
    else{
      for(var i = 0; i < arr.length; i++){
        join(array[i]);
      };
    };
  };
  for(var i = 0; i < arr.length; i++){
    join(arr[i]);
  }

  function notNull(value){
    return value !== null
  };
  return ans.filter(notNull);
}

is returning a bunch of null values?

nvm go it lol
got it*
I needed to remove !== null from notNull function
Puiyee Tong
@pytong
Oct 04 2015 06:00
Thanks @SaintPeter @hansinla
CamperBot
@camperbot
Oct 04 2015 06:00
pytong sends brownie points to @saintpeter and @hansinla :sparkles: :thumbsup: :sparkles:
:star: 406 | @hansinla | http://www.freecodecamp.com/hansinla
:star: 847 | @saintpeter | http://www.freecodecamp.com/saintpeter
Aleksander Gębicki
@Takumar
Oct 04 2015 06:38
wiki topic
CamperBot
@camperbot
Oct 04 2015 06:38

:point_right: topic [wiki]

This is an example. You should replace topic with the thing you want to find info on.
For example:

wiki css    # find a wiki page on css
find js     # find all pages related to css

:pencil: read more about topic on the FCC Wiki

Aleksander Gębicki
@Takumar
Oct 04 2015 06:39
wiki topics
CamperBot
@camperbot
Oct 04 2015 06:39
no wiki entry for: topics
:pencil: click here to create one now!after creating your page type update to reload it here
Aleksandar B.
@aleksandar-b
Oct 04 2015 07:37
Why i need to put [0] after getElementsByClassName() to access the array of elements?For example if I wanted the first element I must type two zeroes document.getElementsByClassName('example')[0][0].
ivanprihhodko
@ivanprihhodko
Oct 04 2015 07:39
hello, anyone can help with Quote Machine ?
@samosale I dont know, I usually use jQuery
ivanprihhodko
@ivanprihhodko
Oct 04 2015 07:53
anyone alive here ?
Abhisek Pattnaik
@abhisekp
Oct 04 2015 07:53
I'm alive
@ivanprihhodko I personally haven't done the machine but just asking what's the issue?
ivanprihhodko
@ivanprihhodko
Oct 04 2015 07:55
well, I did the array version
Abhisek Pattnaik
@abhisekp
Oct 04 2015 07:55
@samosale i don't think you need to put two zeros to access the element.
@ivanprihhodko nice! :+1:
ivanprihhodko
@ivanprihhodko
Oct 04 2015 07:56
and then i wanted to try API version
Abhisek Pattnaik
@abhisekp
Oct 04 2015 07:56
great! :+1:
ivanprihhodko
@ivanprihhodko
Oct 04 2015 07:56
and I just dont know ho to do it in a straightforward manner
Gary Wong
@gary-w
Oct 04 2015 07:57
Kinda a broad question… but why does If..Else statement doesn’t always need to end with “else”. I saw some end with “else if”.
Abhisek Pattnaik
@abhisekp
Oct 04 2015 08:01
@ivanprihhodko Check source of http://api.forismatic.com/api/jsonp/
add the script dynamically to the pg.
There is a easier method. But first do it the hard way! :P
ivanprihhodko
@ivanprihhodko
Oct 04 2015 08:02
soo how do i do that in a hard way ?
Abhisek Pattnaik
@abhisekp
Oct 04 2015 08:03
@ivanprihhodko add the script dynamically to the pg.
@gary-w
if ("everything was ideal in this world") {
   // I could've rejoiced this world
}
else if("I was God") {
   // I would've enabled God mode and killed everyone. :P
}
// no else needed anymore. :P
// the above accounts all alternatives. :D
ivanprihhodko
@ivanprihhodko
Oct 04 2015 08:07
´´ ´$("#external").click(function(){
$.getJSON("http://api.forismatic.com/api/jsonp/", function(result){
$("#exquote").text(result);
});
});´
´´´
this doesnt work
Abhisek Pattnaik
@abhisekp
Oct 04 2015 08:08
@gary-w and in the above if...else i don't wanna check if("i was normal"). So else statement not needed. :)
@ivanprihhodko I asked you to check the source of that pg. not retrieve it.
ivanprihhodko
@ivanprihhodko
Oct 04 2015 08:09
i dont konw how to do that:(
Abhisek Pattnaik
@abhisekp
Oct 04 2015 08:09
@ivanprihhodko umm.... right click and view source? :P
ivanprihhodko
@ivanprihhodko
Oct 04 2015 08:11
omg
you are an angel
@abhisekp tnx
CamperBot
@camperbot
Oct 04 2015 08:11
ivanprihhodko sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 531 | @abhisekp | http://www.freecodecamp.com/abhisekp
Abhisek Pattnaik
@abhisekp
Oct 04 2015 08:12
@ivanprihhodko no. I'm not. I'm the devil :rage:. Because that's the hard way to do it. I've not yet told you the easy way! :P
@ivanprihhodko in fact that's the RAW way to do it w/o using jQuery
ivanprihhodko
@ivanprihhodko
Oct 04 2015 08:13
hehe
Abhisek Pattnaik
@abhisekp
Oct 04 2015 08:15
@ivanprihhodko and you must use this to see how the API works before writing any codes.
Gary Wong
@gary-w
Oct 04 2015 08:17
@abhisekp thanks matey! haha love the example. cool dude
CamperBot
@camperbot
Oct 04 2015 08:17
gary-w sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 532 | @abhisekp | http://www.freecodecamp.com/abhisekp
Abhisek Pattnaik
@abhisekp
Oct 04 2015 08:18
@ivanprihhodko btw, it can also generate code for you. :D But that won't help you learn. :(
Abhisek Pattnaik
@abhisekp
Oct 04 2015 08:42
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 09:11
Can someone tell me why on earth the test for [1,1] isn't working? It should return 1...but doesn't. I haven't figure it out. It's Bonfire Symmetric Difference:
https://repl.it/BNCo/1
Karolis
@Luomint
Oct 04 2015 09:11
bf art
CamperBot
@camperbot
Oct 04 2015 09:11

: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

Karolis
@Luomint
Oct 04 2015 09:12
hint
CamperBot
@camperbot
Oct 04 2015 09:12
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 09:15
It seems that I need a test there...to find out if all the values are the same.
DTing
@dting
Oct 04 2015 09:20
bf details
CamperBot
@camperbot
Oct 04 2015 09:20

: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:
DTing
@dting
Oct 04 2015 09:20
bf sym
CamperBot
@camperbot
Oct 04 2015 09:20

:fire:Bonfire: Symmetric Difference :link:

function sym(args) {
  return arguments;
}

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

Create a function that takes two or more arrays and returns an array of the symmetric difference of the provided arrays.

more info:  bf details | bf links | hint

DTing
@dting
Oct 04 2015 09:21
@TheHighPriestess you can make the assumption that the result wont include duplicates
bf details
CamperBot
@camperbot
Oct 04 2015 09:21

:fire:Bonfire: Symmetric Difference :link:

function sym(args) {
  return arguments;
}

sym([1, 2, 3], [5, 2, 1, 4]);
Create a function that takes two or more arrays and returns an array of the symmetric difference of the provided arrays.
The mathematical term symmetric difference refers to the elements in two sets that are in either the first or second set, but not in both.
Remember to use <a href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank'>RSAP</a> if you get stuck. Try to pair program. Write your own code.
links:
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 09:22
@dting One of the tests is {1,1] though
and that's the one that's not passing
DTing
@dting
Oct 04 2015 09:22
even if the second argument is undefined, all elements in the first array will be returned but there still should be no duplicates in the result
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 09:22
I am gettng an empty array returned
and I don't understand why
since from the console.log....[1] should be the result
DTing
@dting
Oct 04 2015 09:30
@TheHighPriestess the simple way to fix that is not to call difference and just return removeDuplicates if the arguments length is 1.
but it doesnt fix the other failing test
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 09:31
well...the other tests work
yes...that is a good idea. thank you @dting
CamperBot
@camperbot
Oct 04 2015 09:32
thehighpriestess sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1304 | @dting | http://www.freecodecamp.com/dting
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 09:33
but...after I call removeDuplicates...it says that the array is [1,1]
so it didn't remove the duplicate
Here's my code. It's very strange:
function sym(args){

    var arr = [];
    var argslength = arguments.length;

    if(argslength === 1){
        arr = arguments[0];
        removeDuplicates(arr);
        console.log(arr);
        difference(arr);
        return good;
    }
    else if (argslength === 2){
        arr = arguments[0].concat(arguments[1]);
        difference(arr);
        return good;
    }
    else if (argslength === 3){
        arr = arguments[0].concat(arguments[1]);
        difference(arr);
        arr = good.concat(arguments[2]);
        difference(arr);
        return good;
    }

    //function to find the symmetric difference between two arrays
    function difference(arr){

    var discarded = [];
    good = [];
    var test;
    var len = arr.length;//test
    console.log("array len is " + len);//test


    while (test = arr.pop())
     if (arr.indexOf(test) > -1){
         discarded.push(test);
         continue;
     } 
     else if(discarded.indexOf(test) == -1){
         good.push(test);
     }

     }//end difference

     //function to remove duplicates
    function removeDuplicates(origArr) {
    var newArr = [],
        origLen = origArr.length,
        found, x, y;


    for (x = 0; x < origLen; x++) {
        found = undefined;
        for (y = 0; y < newArr.length; y++) {
            if (origArr[x] === newArr[y]) {
                found = true;
                break;
            }
        }
        if (!found) {
            newArr.push(origArr[x]);
        }
        console.log("After removeDuplicates the array is " + newArr);
    }

    //return newArr;
}
}

//sym([1, 2, 3], [5, 2, 1, 4]); //correct
//sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]); //correct
//sym([1, 2, 5], [2, 3, 5], [3, 4, 5]); //correct
sym([1, 1]);
The console.log WITHIN the removeDuplicates function says that the array length is 1. However, when difference is called...it says that the array length is 2
Something isn't right there.
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 09:41
Oh..I see that the other test with duplicates isn't working either
I think it was at one point though.
oh..well...i see that I still need to call that function.
Matthias Kern
@matthiaskern
Oct 04 2015 09:46
is there a way to manually reset bonfires from outside the bonfire? I accidentally clicked run with unfinished code and now it tries to run an infinite loop and the page goes unresponsive
DTing
@dting
Oct 04 2015 09:46
you can clear you browser cache
it will remove that answer
or dig into the local storage and remove it from there
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 09:47
my problem seems to be in the removeDuplicates function
DTing
@dting
Oct 04 2015 09:47
@TheHighPriestess I solved it in a slightly different manner. I made a function that returned the difference of 2 arrays rather than combining them first.
Matthias Kern
@matthiaskern
Oct 04 2015 09:47
worked, thanks @dting
CamperBot
@camperbot
Oct 04 2015 09:47
kema00 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1305 | @dting | http://www.freecodecamp.com/dting
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 09:48
@dting I initially did it another way...but then I watched the video link from the Bonfire and changed it.
but...it seems that the removeDuplicates function isn't working properly
However, I am a bit confused about variables and scope
and I'm wondering if this is the problem
because if you see...remove Duplicates isn't returning a value
and if I return the variable newArr...is that the same as the "arr" variable that I call difference with?
function sym(args){

    var arr = [];
    var argslength = arguments.length;

    if(argslength === 1){
        arr = arguments[0];
        removeDuplicates(arr);
        console.log(arr);
        difference(arr);
        return good;
    }
    else if (argslength === 2){
        arr = arguments[0].concat(arguments[1]);
        difference(arr);
        return good;
    }
    else if (argslength === 3){
        arr = arguments[0].concat(arguments[1]);
        console.log(arr);
        removeDuplicates(arr);
        console.log(arr);
        difference(arr);
        arr = good.concat(arguments[2]);
        difference(arr);
        return good;
    }

    //function to find the symmetric difference between two arrays
    function difference(arr){

    var discarded = [];
    good = [];
    var test;



    while (test = arr.pop())
     if (arr.indexOf(test) > -1){
         discarded.push(test);
         continue;
     } 
     else if(discarded.indexOf(test) == -1){
         good.push(test);
     }

     }//end difference

     //function to remove duplicates
    function removeDuplicates(origArr) {
    var newArr = [],
        origLen = origArr.length,
        found, x, y;


    for (x = 0; x < origLen; x++) {
        found = undefined;
        for (y = 0; y < newArr.length; y++) {
            if (origArr[x] === newArr[y]) {
                found = true;
                break;
            }
        }
        if (!found) {
            newArr.push(origArr[x]);
        }

    }

    //return newArr;
}
}

//sym([1, 2, 3], [5, 2, 1, 4]); //correct
sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]); 
//sym([1, 2, 5], [2, 3, 5], [3, 4, 5]); //correct
//sym([1, 1]);
So...as I see it...newArr should be returned from removeDuplicates...and that this value(newArr) should be what I call difference with. Yes?
azaleas
@azaleas
Oct 04 2015 10:38
This message was deleted
CamperBot
@camperbot
Oct 04 2015 10:38
no wiki entry for: bonfire vaildate us telephone numbers
:pencil: click here to create one now!after creating your page type update to reload it here
azaleas
@azaleas
Oct 04 2015 10:39
help bonfire validate us telephone numbers
CamperBot
@camperbot
Oct 04 2015 10:39

:point_right: bonfire validate us telephone numbers [wiki]

Problem Explanation:

  • The task is not that hard to understand, implementing it is the hardest part. You have a to validate an US phone number. This means there is a certain amount of numbers required, while you don't need to put the country code, you will still need the area code and use one of the few formats allowed.
:pencil: read more about bonfire validate us telephone numbers on the FCC Wiki
Harry Gill
@mygnu
Oct 04 2015 10:44
Bonfire: Spinal Tap Case
CamperBot
@camperbot
Oct 04 2015 10:44
Sorry, can't find a bonfire called spinal tap case . [ Check the map? ]
Harry Gill
@mygnu
Oct 04 2015 10:44
Bonfire: Spinal Case
CamperBot
@camperbot
Oct 04 2015 10:44
Sorry, can't find a bonfire called spinal case. [ Check the map? ]
Derek Frankel
@TuvyaYis
Oct 04 2015 11:07
Bonfire: Find The Longest Word in a String
CamperBot
@camperbot
Oct 04 2015 11:07

:fire:Bonfire: Find the Longest Word in a String :link:

function findLongestWord(str) {
  return str.length;
}

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

Return the length of the longest word in the provided sentence.

more info:  bf details | bf links | hint

Derek Frankel
@TuvyaYis
Oct 04 2015 11:08
help Bonfire Find The Longest Word in a String
CamperBot
@camperbot
Oct 04 2015 11:08

:point_right: bonfire find the longest word in a string [wiki]

Explanation:

You have to go through each word and figure out which one is the longest and return not the word, but how many characters it has.

:pencil: read more about bonfire find the longest word in a string on the FCC Wiki

PatrykKozyra
@PatrykKozyra
Oct 04 2015 11:10
help Waypoint: Add Font Awesome Icons to our Buttons
CamperBot
@camperbot
Oct 04 2015 11:10

:point_right: waypoint add font awesome icons to our buttons [wiki]

Add Font Awesome Icons to our Buttons

Font Awesome is a convenient library of icons. These icons are vector graphics, stored in the .svg file format. These icons are treated just like fonts. You can specify their size using pixels, and they will assume the font size of their parent HTML elements.

<i class="fa fa-thumbs-up"><button class="btn btn-block btn-primary">Like</i></button>

:pencil: read more about waypoint add font awesome icons to our buttons on the FCC Wiki

Irma Millirons
@badjedi
Oct 04 2015 11:24
Waypoint: Make Object Properties Private
Jonny Morley
@morley92
Oct 04 2015 11:41

Can anybody give me any feedback on this please ? Would be much appreciated :)

http://codepen.io/Morleee/full/ZbexRV/

mnm135
@mnm135
Oct 04 2015 11:53
@morley92 I'm not far enough to say enything about code but looks nice and clean for me
Aleksander Gębicki
@Takumar
Oct 04 2015 11:54
@morley92 Looks good and works good. Personally I would like something like a title bar for "Free Code Camp news"
Maybe just give a simple light gray background to <div> containing all content and title?
Or maybe not entire content but just a title, so it will have a blue background like all thumbnails?
Irma Millirons
@badjedi
Oct 04 2015 11:55
help Waypoint: Make Object Properties Private
CamperBot
@camperbot
Oct 04 2015 11:55

:point_right: waypoint make object properties private [wiki]

Objects have their own attributes, called properties_, and their own functions, called _methods.

You can use the this keyword to reference public properties and methods of the current objects. However, when You need to create private ones, so they are not accessible from the outside of the object.

For that, you just remove the keyword this from the object property or method declaration.

var Bike = function() {
  speed = 100; // private
  function addUnit(value) { // private
    return value + "KM/H";
  }

  this.getSpeed = function () {  // public
    return addUnit(speed);
  };

};

:pencil: read more about waypoint make object properties private on the FCC Wiki

Shair Mir
@ShairMir
Oct 04 2015 11:56
Hey guys, can somebody give me a little nudge in the right direction. I'm trying to get only a certain part of a string, how would i do that?
for instance, everything except the first letter
mnm135
@mnm135
Oct 04 2015 11:56
@ShairMir slice()?
Shair Mir
@ShairMir
Oct 04 2015 11:56
oh yea!
@mnm135 thanks!
CamperBot
@camperbot
Oct 04 2015 11:56
shairmir sends brownie points to @mnm135 :sparkles: :thumbsup: :sparkles:
:star: 115 | @mnm135 | http://www.freecodecamp.com/mnm135
mnm135
@mnm135
Oct 04 2015 11:57
@ShairMir No problem, 1st point from gitter, feels good :D
Shair Mir
@ShairMir
Oct 04 2015 11:57
haha :D
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 12:17
Can someone tell me why this little function that is supposed to remove the duplicates isn't working?
function removeDuplicates(origarr) {
     var arr = [],
        origLen = origarr.length,
        found, x, y;


    for (x = 0; x < origLen; x++) {
        found = false;
        for (y = 0; y < origLen; y++) {

            if (origarr[x] === arr[y]) {
                found = true;
                break;
            }
            else if (!found) {
               arr.push(origarr[x]);
            }     
        }

            return arr;
    }//end for
}

removeDuplicates([ 1, 1, 2, 5, 2, 2, 3, 5 ]);
When I step through it on paper...it works. So, I'm clearly overlooking something.
azaleas
@azaleas
Oct 04 2015 12:23
@TheHighPriestess shouldn't y loop between 0 and arr.length?
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 12:24
@azaleas when I do that it returns an empty array
Well...I guess the first time through it....the arr.length === 0
so nothing happens
azaleas
@azaleas
Oct 04 2015 12:27
at first it's zero, but then it will push into arr, so the length will increase
theoretically:D
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 12:28
but it never gets to do anything...because y is never less than arr.length or origLen
Aleksander Gębicki
@Takumar
Oct 04 2015 12:31
@TheHighPriestess why are you returning your arr array before ending your for (x=0... loop? You never check anything apart from first element.
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 12:32
you mean the break statement @Takumar ??
azaleas
@azaleas
Oct 04 2015 12:33
@TheHighPriestess your last return arr is in the for loop
Aleksander Gębicki
@Takumar
Oct 04 2015 12:33
No, return statement. Move return arr; to the last line before last }
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 12:33
oh .ok..hold on
Aleksander Gębicki
@Takumar
Oct 04 2015 12:34
But it is not enough. We have to look in it more.
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 12:34
still returns an empty array
Yes, there is something very wrong here
lol
it's strange because...when I step through it on paper...I can't find the problem
Blauelf
@Blauelf
Oct 04 2015 12:35
It should not be else if. Move that check for !found outside the loop over y.
You want to push only if !found after looping through the whole array.
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 12:35
ok...but one problem I do see is that y starts out as equal to arr.length...
Blauelf
@Blauelf
Oct 04 2015 12:36
No problem at all, if you set found to false before the y loop and check for !found after the y loop.
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 12:38
@Blauelf that did it
Thank you @Blauelf @Takumar @azaleas
CamperBot
@camperbot
Oct 04 2015 12:38
thehighpriestess sends brownie points to @blauelf and @takumar and @azaleas :sparkles: :thumbsup: :sparkles:
:star: 380 | @takumar | http://www.freecodecamp.com/takumar
:star: 327 | @blauelf | http://www.freecodecamp.com/blauelf
:star: 222 | @azaleas | http://www.freecodecamp.com/azaleas
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 13:30
OK, after I have confirmed that the function removeDuplicates works.....I'm still have trouble getting it to work as part of the Symmetric Difference bonfire. It must be something to do with returning the array.
function sym(args){

    var arr = [];
    var argslength = arguments.length;

    if(argslength === 1){
        arr = arguments[0];
        removeDuplicates(arr);
        console.log(arr);
        difference(arr);
        return good;
    }
    else if (argslength === 2){
        arr = arguments[0].concat(arguments[1]);
        difference(arr);
        return good;
    }
    else if (argslength === 3){
        arr = arguments[0].concat(arguments[1]);
        removeDuplicates(arr);
        console.log("after removing duplictes: " + arr);
        difference(arr);
        arr = good.concat(arguments[2]);
        difference(arr);
        return good;
    }

    //function to find the symmetric difference between two arrays
    function difference(arr){

    var discarded = [];
    good = [];
    var test;



    while (test = arr.pop())
     if (arr.indexOf(test) > -1){
         discarded.push(test);
         continue;
     } 
     else if(discarded.indexOf(test) == -1){
         good.push(test);
     }

     }//end difference



     //function to remove duplicates
    function removeDuplicates(origarr) {
     var arr = [],
        origLen = origarr.length,
        found, x, y;


    for (x = 0; x < origLen; x++) {
        found = undefined;
        for (y = 0; y < arr.length; y++) {
            if (origarr[x] === arr[y]) {
                found = true;
                break;
            }
        }
        if (!found) {
            arr.push(origarr[x]);

        }
        return arr;
    }


}
}

//sym([1, 2, 3], [5, 2, 1, 4]); //correct
sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]); 
//sym([1, 2, 5], [2, 3, 5], [3, 4, 5]); //correct
//sym([1, 1]);
So...the function removeDuplicates WORKS....on it's own. However, as part of the function "sym" it does not.
Hans van Riet
@hansinla
Oct 04 2015 14:46

@TheHighPriestess

if(argslength === 1){
        arr = arguments[0];
        removeDuplicates(arr);
        console.log(arr);
        difference(arr);
        return good;
    }

good is not a global var so what are you returning here? Also, the difference function doesn’t return anything.

Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 14:48
@hansinla Yes, I know that I'm having trouble because I'm confused about scope etc
pappilino
@pappilino
Oct 04 2015 14:48
need help with bonfire the palindrome...
CamperBot
@camperbot
Oct 04 2015 14:48
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
pappilino
@pappilino
Oct 04 2015 14:48
bonfire palindrome
CamperBot
@camperbot
Oct 04 2015 14:48

:fire:Bonfire: Check for Palindromes :link:

function palindrome(str) {
  // Good luck!
  return true;
}



palindrome("eye");

Return true if the given string is a palindrome. Otherwise, return false.

more info:  bf details | bf links | hint

Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 14:49
...but right now I don't understand why the removeDuplicate function works on its own..but not here
Puiyee Tong
@pytong
Oct 04 2015 14:49
@pappilino you can compare the original string and the reversed string and check if the two strings are equal
kaushalmathpal
@kaushalmathpal
Oct 04 2015 14:50
var myArray = [1,2,3];

myArray[0];
var myData = myArray[1];
Hans van Riet
@hansinla
Oct 04 2015 14:51
@TheHighPriestess All your functions are nested now. That’s the first thing that I would change. Then make sure everything function returns something, don’t use global variables. Lastly, the way you code now, you hard-code for three cases. That’s not a bgreat way to solve any problem, be\cause your code will break when 4 arrays are supplied as argument. You should code so your function can handle any number of arrays.
kaushalmathpal
@kaushalmathpal
Oct 04 2015 14:51

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

myArray0;
var myData = myArray1;
``` i have done exactly as per example..m not able to get it

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

myArray[0];
var myData = myArray1;
``` i have done exactly as per example..m not able to get it

Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 14:52
@hansinla you mean....remove difference and removeDuplicates from inside sym?
pappilino
@pappilino
Oct 04 2015 14:52
yeah i did it... for the true part its correct. the false part, i don't know what's wrong
kaushalmathpal
@kaushalmathpal
Oct 04 2015 14:52
var myArray = [1,2,3];

myArray[0];
var myData = myArray[1];
i have done exactly as per example..m not able to get it
waypoint challenge 18 basic java script
Puiyee Tong
@pytong
Oct 04 2015 14:53
@pappilino how does your false condition look like?
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 14:53
@hansinla yes, you're right about the fact that it won't work for more than 3 arrays. I did it that way because of what the bonfire requires..
pappilino
@pappilino
Oct 04 2015 14:53
code

codefunction palindrome(str) {
var converted = str.replace(/[^\w\s]/gi, '');
var toBeCompared = converted.split('').reverse().join('');
if (str.toLowerCase() == toBeCompared.toLowerCase()) {
return true;
}
else {
return false;
}

}

palindrome("eye");

Puiyee Tong
@pytong
Oct 04 2015 14:56
@pappilino It looks correct to me. Which test case is not working for you? To simplify the code, simply return the results of (str.toLowerCase() == toBeCompared.toLowerCase()
pappilino
@pappilino
Oct 04 2015 14:57
assert(palindrome("race car") === true, '"race car" should return true.');"race car" should return true.
the one that contains space as the test case is not working. maybe the regex?
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 14:58
@hansinla thank you for the suggestions. I will do that.
CamperBot
@camperbot
Oct 04 2015 14:58
thehighpriestess sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 407 | @hansinla | http://www.freecodecamp.com/hansinla
Puiyee Tong
@pytong
Oct 04 2015 14:59
@pappilino that is because "race car".replace(/[^\w\s]/gi, '') returns "race car". The regex didn't remove the space at all
pappilino
@pappilino
Oct 04 2015 15:01
trying out regex...
Puiyee Tong
@pytong
Oct 04 2015 15:03
@pappilino yes, the regex is incorrect. ^\w is the problematic part. It is matching one character only and "race car" has 4 characters before the space...
pappilino
@pappilino
Oct 04 2015 15:04
tried adding w+, doesn't work
i'm a true noob with regex
Puiyee Tong
@pytong
Oct 04 2015 15:07
@pappilino sorry about my previous hint, it wasn't fully correct
all you need to to is to replace space with nothing
don't care about all those characters
\s matches a space, so you just need to globally replace it with ''
pappilino
@pappilino
Oct 04 2015 15:08
in that case my regex should be correct
str.replace(/[^\w\s]/gi, '')
Puiyee Tong
@pytong
Oct 04 2015 15:09
your Regex is trying to replace a character (at the beginning of a string) that is followed by a space
but "race car" has 4 characters at the beginning of the string
your goal is to remove space, so you don't need to think too much about whether there are characters at the beginning of a string
converted.replace(/\s/gi, '') is the correct way
pappilino
@pappilino
Oct 04 2015 15:12
and any special characters like punctuations. aside from space
Puiyee Tong
@pytong
Oct 04 2015 15:12
you can even remove the i, because there is upper or lower case for space
*there is no
special characters is complicated, do the test cases test for that?
x34passenger
@x34passenger
Oct 04 2015 15:14
I am not sure how to approach Bonfire: Symmetric Difference. Is it possible to create dynamically named arrays?
Puiyee Tong
@pytong
Oct 04 2015 15:14
If not, your answer is good enough
pappilino
@pappilino
Oct 04 2015 15:15

assert(palindrome("0_0 (: /-\ :) 0-0") === true, '"0_0 (: /-\ :) 0-0" should return true.');"0_0 (: /-\ :) 0-0" should return true.

yes it does

Puiyee Tong
@pytong
Oct 04 2015 15:16
if they test for "!" for example, you can do convertetd= str.replace(/!/g, "");
just like what you did for space
x34passenger
@x34passenger
Oct 04 2015 15:19
l
pappilino
@pappilino
Oct 04 2015 15:26

I did it with ur help and hugoender... this is the code

function palindrome(str) {
  var converted = str.replace(/[\W_]+/gi, '');
  var stre = str.replace(/[\W_]+/gi, '')
  var toBeCompared = converted.split('').reverse().join('');
  if (stre.toLowerCase() == toBeCompared.toLowerCase()) {
    return true;
  }
  else {
    return false;
  }

}



palindrome("eye");

thanks @pytong and @hugoender

CamperBot
@camperbot
Oct 04 2015 15:26
pappilino sends brownie points to @pytong and @hugoender :sparkles: :thumbsup: :sparkles:
:warning: pappilino already gave hugoender points
:star: 231 | @pytong | http://www.freecodecamp.com/pytong
Aleksander Gębicki
@Takumar
Oct 04 2015 15:34
@pappilino your first two strings: "converted" and "stre" are constructed in the same way by using regular expressions. So when you have "converted" you can get "stre" just by assigning value of one string to another: var stre = converted;
kaushalmathpal
@kaushalmathpal
Oct 04 2015 15:43
var myArray = [1,2,3];

myArray[0];
var myData = myArray[1];
what's the problem with this? waypoint challenge javascript 18
Hugo
@hugoender
Oct 04 2015 15:44
@kaushalmathpal you are not setting equal to first value of array
you are setting it equal to second value
index of array starts at 0
not 1
your third line myArray[0]; is not doing anything btw
so delete it
kaushalmathpal
@kaushalmathpal
Oct 04 2015 15:45
@hugoender but the examples shows the similar way
Hugo
@hugoender
Oct 04 2015 15:45
@kaushalmathpal thats an example
@kaushalmathpal but myArray[0]; returns the first value of myArray but you are not assigning it to anything so its returning that value to nothing
kaushalmathpal
@kaushalmathpal
Oct 04 2015 15:46
@hugoender so how can i assign it
Hugo
@hugoender
Oct 04 2015 15:46
if you were doing var firstValue = myArray[0]; that would make more sense
the example text is not the best example text…if you want, submit a bug by clicking the bug issue and bring this up with the FCC developers
maybe they will agree and can change the example text
bug button*
@kaushalmathpal do you understand why i am saying what I am saying about the variables and the array?
if not… tell me what part doesnt make sense to you. its better to fully understand this before moving on
vere perrot
@perrot
Oct 04 2015 15:49

Hi my friend,
I study the unit "Bonfire: Pairwise".
Have a problem. I am not sure my output is correct or wrong.
My output is a can be paired array. For example, pairwise([1, 4, 2, 3, 0, 5], 7) should return [4,2,3,5].

And I have a trouble in test case 3 and 4.
In test case 3. "expect(pairwise([1,1,1], 2)).to.equal(1);". My output paired array is [1], Is correct?
In test case 4. "expect(pairwise([0, 0, 0, 0, 1, 1], 1)).to.equal(10);". My output paired array is [0,1], Is correct?

Thanks.

kaushalmathpal
@kaushalmathpal
Oct 04 2015 15:52
@hugoender in array variable we can store muliple data...so in case we have access data inside the index ...is it to be done in similar fashion like waypoint 9
Hugo
@hugoender
Oct 04 2015 15:53
@kaushalmathpal not sure exactly what you mean but basically when you have an array full of data you can access a specific piece of data if you know what index it’s in. So for example if you want to access the third number in an array of numbers you would use myArray[2]
but you normally want to access a value in order to assign it to a variable or do something iwth it
Hans van Riet
@hansinla
Oct 04 2015 15:54
@hugoender Wouldn’t that be myArray[2] for the third element?
Hugo
@hugoender
Oct 04 2015 15:54
so just typing myArray[2]; does nothing. you need to do something with the value its going to return. either stor it in a variable by doing `var myVar = myArray[2];'
@hansinla YES!
you are right
got my numbers wrong
there you go…fixed it
@kaushalmathpal you can also do math with it so you can do this var sumOfFirstAndSecond = myArray[0] + myArray[1];
@kaushalmathpal does this make sense and answer your question?
kaushalmathpal
@kaushalmathpal
Oct 04 2015 15:57
@hugoender yeah...m getting ur point..but m not able to pass the challenge..i will try what u told now
Hugo
@hugoender
Oct 04 2015 15:57
@kaushalmathpal try it and if it still doesnt work… copy and paste your code here by using the gitter formatting
help format
CamperBot
@camperbot
Oct 04 2015 15:57

:point_right: code formatting [wiki]

Inline code

alt text

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

Code Block

``` ⇦ Type 3 backticks 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

kaushalmathpal
@kaushalmathpal
Oct 04 2015 15:58
@hugoender kk
noobstar
@namsir
Oct 04 2015 16:04
hello?
Hans van Riet
@hansinla
Oct 04 2015 16:04
hi
Hugo
@hugoender
Oct 04 2015 16:04
@namsir hello
noobstar
@namsir
Oct 04 2015 16:04
I have a question regards to the slot machine exercise.
Hugo
@hugoender
Oct 04 2015 16:04
@namsir shoot
noobstar
@namsir
Oct 04 2015 16:04
I did everything correctly but it won't let me pass lol.
Hugo
@hugoender
Oct 04 2015 16:04
paste your code in here
noobstar
@namsir
Oct 04 2015 16:05
// 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.
Hugo
@hugoender
Oct 04 2015 16:05
and which exercise is it exactly?
noobstar
@namsir
Oct 04 2015 16:05
Machine some stylish images
just simple selectors
it marks this line in red "Use the provided code three times. One for each slot."
kaushalmathpal
@kaushalmathpal
Oct 04 2015 16:06
@hugoender i guess m too confused now...i have to create myData that equals to first value of myArray..
noobstar
@namsir
Oct 04 2015 16:06
the slot machine works as expected.
Hugo
@hugoender
Oct 04 2015 16:07
@namsir hmmm
Hans van Riet
@hansinla
Oct 04 2015 16:07
@kaushalmathpal Keep in mind an array is zero indexed. So the first value is myArray[0]
noobstar
@namsir
Oct 04 2015 16:07
i'm using the most updated Chrome.
Hugo
@hugoender
Oct 04 2015 16:07
@namsir no your code is wrong
@namsir im just trying to find out why
noobstar
@namsir
Oct 04 2015 16:08
wrong?
slot returns as an array.
are you saying my selectors were wrong?
Hugo
@hugoender
Oct 04 2015 16:09
@namsir remove the space between the slotOne - 1
between the minus sign
and the letters and number
remove all that spacing
noobstar
@namsir
Oct 04 2015 16:09
ok
Hugo
@hugoender
Oct 04 2015 16:09
it doesnt seem to like it
i would actually go ahead and use the Bug button to submit a bug report
cuz that shouldn’t be an issue
noobstar
@namsir
Oct 04 2015 16:10
lol works now.
i thought javascript careless about spaces.
Hugo
@hugoender
Oct 04 2015 16:10
@namsir it doesnt care
@namsir but their test does
@namsir and it shouldnt
noobstar
@namsir
Oct 04 2015 16:10
Thanks hugoender :D
CamperBot
@camperbot
Oct 04 2015 16:10
if you want to thank someone, put an @ before their name!
Hugo
@hugoender
Oct 04 2015 16:10
@namsir so you should submit a bug issue
noobstar
@namsir
Oct 04 2015 16:10
@hugoender thank you
CamperBot
@camperbot
Oct 04 2015 16:10
namsir sends brownie points to @hugoender :sparkles: :thumbsup: :sparkles:
:star: 221 | @hugoender | http://www.freecodecamp.com/hugoender
Hugo
@hugoender
Oct 04 2015 16:11
@kaushalmathpal what exactly are you confused about?
noobstar
@namsir
Oct 04 2015 16:11
@hugoender i'll do so.
@hugoender how did you figure that out? Did you help to build this project?
Hugo
@hugoender
Oct 04 2015 16:11
@kaushalmathpal you have to create a variable which you do with var myVariableName
then you assign it the value in the first index of the array (or first slot or row) with = myArray[0];
so putting it all together you get var myVariableName = myArray[0];
@namsir i just went back to that waypoint…did it myself real quick and it worked. then i compared my code to yours and the only difference was the spacing
@namsir no i have not helped build any of this
noobstar
@namsir
Oct 04 2015 16:14
@hugoender oh alright :) i'm going back to finish this up :D
Hunter
@retnuh1974
Oct 04 2015 16:14
Don't forget you can get Free Code Camp T-Shirts: https://teespring.com/get-free-code-camp-t-shirt
noobstar
@namsir
Oct 04 2015 16:16
already ordered mine :D
azaleas
@azaleas
Oct 04 2015 16:18
help bonfire: exact change
CamperBot
@camperbot
Oct 04 2015 16:18

:point_right: bonfire exact change [wiki]

Problem Explanation:

  • You have to create a program that will handle when the register does not have enough cash or will have no cash after the transaction. Other than that it needs to return an array of the change in the form of an array, so that will be a 2D array.
:pencil: read more about bonfire exact change on the FCC Wiki
JensGryspeert
@JensGryspeert
Oct 04 2015 16:19
Got a problem with mine jquery code.
<script>
$(document).ready(function() {
$("button").addClass("animated shake");
$(".btn").addClass("animated shake");
$("#target1").addClass("animated shake btn-primary");


});
</script>
Problems saids: Your #target1 element should have the classes animated‚ shake and btn-primary.
But so far I see this is what I did isn't it?
Hugo
@hugoender
Oct 04 2015 16:22
@JensGryspeert you need to add the btn-primary class to all three
@JensGryspeert the error is not very helpful in this case
@JensGryspeert honestly the wording in this waypoint is not very good. I had a problem with it as well and i suggest you click the Bug button and submit an issue
@JensGryspeert FCC needs to redo the wording and error checking for this waypoint
JensGryspeert
@JensGryspeert
Oct 04 2015 16:23
@hugoender Thanks for the information I'll do that. :smile: Also how can I type here with the code marked down. Those ''' I can't find that on my keyboard.
CamperBot
@camperbot
Oct 04 2015 16:23
jensgryspeert sends brownie points to @hugoender :sparkles: :thumbsup: :sparkles:
:star: 222 | @hugoender | http://www.freecodecamp.com/hugoender
Hugo
@hugoender
Oct 04 2015 16:24
the back ticks are above your tab key
help format
CamperBot
@camperbot
Oct 04 2015 16:24

:point_right: code formatting [wiki]

Inline code

alt text

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

Code Block

``` ⇦ Type 3 backticks 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

noobstar
@namsir
Oct 04 2015 16:25
testing
JensGryspeert
@JensGryspeert
Oct 04 2015 16:26
'''
CamperBot
@camperbot
Oct 04 2015 16:26
:bulb: to format code use backticks! ``` more info
JensGryspeert
@JensGryspeert
Oct 04 2015 16:26
'''
testing
'''
CamperBot
@camperbot
Oct 04 2015 16:26
:bulb: to format code use backticks! ``` more info
JensGryspeert
@JensGryspeert
Oct 04 2015 16:26
Doesn't have those backticks on azerty keyboard damnit
tva10
@tva10
Oct 04 2015 16:26
@JensGryspeert copy paste them
JensGryspeert
@JensGryspeert
Oct 04 2015 16:26
II'll thx
CamperBot
@camperbot
Oct 04 2015 16:26
if you want to thank someone, put an @ before their name!
JensGryspeert
@JensGryspeert
Oct 04 2015 16:27
testing
@tva10 @hugoender : thanks bois
CamperBot
@camperbot
Oct 04 2015 16:27
jensgryspeert sends brownie points to @tva10 and @hugoender :sparkles: :thumbsup: :sparkles:
:warning: jensgryspeert already gave hugoender points
:star: 287 | @tva10 | http://www.freecodecamp.com/tva10
tva10
@tva10
Oct 04 2015 16:27
@JensGryspeert save solution into file :D
JensGryspeert
@JensGryspeert
Oct 04 2015 16:28
How do you mean?
<script>
  $(document).ready(function() {
    $("button").addClass("animated shake btn-primary");
    $(".btn").addClass("animated shake btn-primary");
    $("#target1").addClass("animated shake btn-primary");


  });
</script>
Still doesn't work I changed them all but still same error
tva10
@tva10
Oct 04 2015 16:29
@JensGryspeert I mean save ticks into file ))
JensGryspeert
@JensGryspeert
Oct 04 2015 16:29
I found the button after google search with ALT+code :p
Hans van Riet
@hansinla
Oct 04 2015 16:29
@JensGryspeert On each line you should only add one class, so that in the end #target3 has three classes.
Hugo
@hugoender
Oct 04 2015 16:29
@JensGryspeert that code works for me
make sure you refresh your browser
@hansinla you can add multiple classes in one line
JensGryspeert
@JensGryspeert
Oct 04 2015 16:30
Indeed after refreshing it works. What's the cause of that
Hugo
@hugoender
Oct 04 2015 16:30
and the waypoint does not ask to change #target3
tva10
@tva10
Oct 04 2015 16:30
@JensGryspeert Use the jQuery addClass() function to give the classes animated and bounce to your button elements.
this point don't work?
Hugo
@hugoender
Oct 04 2015 16:30
@JensGryspeert sometimes the site gets hung up on your last submission
Hans van Riet
@hansinla
Oct 04 2015 16:30

@hugoender The problem states that you need to add ONLY one class at the time so the test fails if you supply the above code.

<script>
  $(document).ready(function() {
    $("button").addClass("animated");
    $(".btn").addClass("shake");
    $("#target1").addClass("btn-primary");
  });
</script>

passes

Hugo
@hugoender
Oct 04 2015 16:31
@hansinla the above code passes as well
JensGryspeert
@JensGryspeert
Oct 04 2015 16:31
They worked after hard refreshing. I added the code I provided before.
tva10
@tva10
Oct 04 2015 16:31
@JensGryspeert try $("button").addClass("animated bounce btn-primary");
Hans van Riet
@hansinla
Oct 04 2015 16:31
@hugoender Not for me
Junior Griffiths
@Jegriff23
Oct 04 2015 16:31

hello all need help with this question: Try giving your form, which now has the id attribute of cat-photo-form, a green background. this is what I put, but it doesnt seem to work``` .smaller-image {
width: 100px;
}

.gray-background {
background-color: gray
}

.#cat-photo-element { background-color: green; }

</style>
```

Hugo
@hugoender
Oct 04 2015 16:31
@hansinla the wording for this waypoint is confusing imo
@hansinla different people read it differently
@hansinla which is why i suggested that @JensGryspeert submit a bug issue so that they reword it
Junior Griffiths
@Jegriff23
Oct 04 2015 16:31
``` .smaller-image {
width: 100px;
}
.gray-background {
background-color: gray
}
.#cat-photo-element { background-color: green; }
</style>
Hans van Riet
@hansinla
Oct 04 2015 16:31
@hugoender How can you read this otherwise
Use the addClass() jQuery function to give the element one new class for each selector: animated, shake, and btn-primary.
Hugo
@hugoender
Oct 04 2015 16:32
@Jegriff23 no dot in front of #
Junior Griffiths
@Jegriff23
Oct 04 2015 16:32
how do you post the code anyone with ``` or ---
ok @hugoender
Hugo
@hugoender
Oct 04 2015 16:32
@Jegriff23 for elements you just put the element (i.e. img) for classes you put . and for id you put #
Junior Griffiths
@Jegriff23
Oct 04 2015 16:32
but it still doesnt work @hugoender
Hugo
@hugoender
Oct 04 2015 16:32
@Jegriff23 with the back ticks which are located above tab button
@Jegriff23 paste all of your code
did you include the id name in your element in the html?
noobstar
@namsir
Oct 04 2015 16:33
background-color: gray is missing semicolon
Junior Griffiths
@Jegriff23
Oct 04 2015 16:33
is it 3 back ticks @hugoender
Hugo
@hugoender
Oct 04 2015 16:34
yes
Junior Griffiths
@Jegriff23
Oct 04 2015 16:34
and 3 after @hugoender
Hugo
@hugoender
Oct 04 2015 16:34
@namsir technically…the last property doesnt need a semicolon
@Jegriff23 yes
@namsir but its good practice to always put semicolon
Junior Griffiths
@Jegriff23
Oct 04 2015 16:34
.smaller-image { width: 100px; } .gray-background { background-color: gray } .#cat-photo-element { background-color: green; } </style>
Hugo
@hugoender
Oct 04 2015 16:34
@namsir just incase you add more properties, itstill works
noobstar
@namsir
Oct 04 2015 16:34
@hugoender ohhhhh i've never known that :D
Hugo
@hugoender
Oct 04 2015 16:34
help format
CamperBot
@camperbot
Oct 04 2015 16:34

:point_right: code formatting [wiki]

Inline code

alt text

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

Code Block

``` ⇦ Type 3 backticks 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

Hugo
@hugoender
Oct 04 2015 16:34
@Jegriff23 use that formatting
Junior Griffiths
@Jegriff23
Oct 04 2015 16:35
.smaller-image { width: 100px; } .gray-background { background-color: gray } .#cat-photo-element { background-color: green; } </style>
Hugo
@hugoender
Oct 04 2015 16:35
shift enter
@Jegriff23 and you still havent removed the dot in front of the #
noobstar
@namsir
Oct 04 2015 16:37
lol oh yeah the dot :D
Junior Griffiths
@Jegriff23
Oct 04 2015 16:39
 .smaller-image {
width: 100px;
}
.gray-background {
background-color: gray
}
.#cat-photo-element { background-color: green; }
</style>
Hugo
@hugoender
Oct 04 2015 16:39
@Jegriff23 dot is still there lol
noobstar
@namsir
Oct 04 2015 16:40
lol
Junior Griffiths
@Jegriff23
Oct 04 2015 16:40

@hugoender it still didnt work```
.smaller-image {
width: 100px;
}

.gray-background {
background-color: gray
}

cat-photo-element { background-color: green; }

</style>
```


  .smaller-image {
    width: 100px;
  }

   .gray-background {
    background-color: gray
   }

  #cat-photo-element { background-color: green; }


</style>
Hugo
@hugoender
Oct 04 2015 16:41
@Jegriff23 you need the #
Junior Griffiths
@Jegriff23
Oct 04 2015 16:41
but the # sign is there @hugoender
Hugo
@hugoender
Oct 04 2015 16:42
@Jegriff23 send me ALL of your code
all of it
stop skimping on me
Junior Griffiths
@Jegriff23
Oct 04 2015 16:43
lol @hugoender
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

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

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

  .smaller-image {
    width: 100px;
  }
  .gray-background {
    background-color: gray
  }

  #cat-photo-element { background-color: green; }
</style>

<h2 class="red-text">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>

<div class="gray-background">
  <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>

<form action="/submit-cat-photo" id="cat-photo-form">
  <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
  <label><input type="radio" name="indoor-outdoor"> Outdoor</label>
  <label><input type="checkbox" name="personality" checked> Loving</label>
  <label><input type="checkbox" name="personality"> Lazy</label>
  <label><input type="checkbox" name="personality"> Energetic</label>
  <input type="text" placeholder="cat photo URL" required>
  <button type="submit">Submit</button>
</form>
Hugo
@hugoender
Oct 04 2015 16:45
@namsir may be right
you may need a semicolon after the gray
im going to go look that up now
Junior Griffiths
@Jegriff23
Oct 04 2015 16:46
@hugoender ok
Hugo
@hugoender
Oct 04 2015 16:46
nope…you dont need a semicolon for the last property of a css block….but maybe FCC doesnt like that you left it out?
try putting it in
 .gray-background {
    background-color: gray;
  }
Junior Griffiths
@Jegriff23
Oct 04 2015 16:50
ok @hugoender
no they want the background to be green
Hugo
@hugoender
Oct 04 2015 16:51
i didnt say to change the background color
i said to add a semicolon to the gray
@Jegriff23 ohhhhhh
i know whats wrong
you named the id #cat-photo-element in the styles section but in the form you called it cat-photo-form
noobstar
@namsir
Oct 04 2015 16:52
amen.
Hugo
@hugoender
Oct 04 2015 16:53
that’s what i get for asking you to paste all of your code and then not looking at all of your code lol
Junior Griffiths
@Jegriff23
Oct 04 2015 16:53
ok @hugoender ill try
Hugo
@hugoender
Oct 04 2015 16:54
@Jegriff23 do or do not…there is no try
@Jegriff23 and if it doesnt work dont come back only saying it doesnt work… i want to see all of your code again!
Junior Griffiths
@Jegriff23
Oct 04 2015 17:00

```<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<style>



.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

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

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

.smaller-image {
width: 100px;
}

.gray-background {
background-color: gray;
}

.#cat-photo-form {
background-color: green;
}


</style>

<h2 class="red-text">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>

<div class="gray-background">
<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>

<form action="/submit-cat-photo" id="cat-photo-form">
<label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality" checked> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Energetic</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
```

Hugo
@hugoender
Oct 04 2015 17:00
@Jegriff23 SHIFT+ENTER!
lol
Junior Griffiths
@Jegriff23
Oct 04 2015 17:00
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>



  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

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

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

  .smaller-image {
    width: 100px;
  }

   .gray-background {
    background-color: gray;
   }

  .#cat-photo-form { 
    background-color: green; 
   }


</style>


<h2 class="red-text">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>

<div class="gray-background">
  <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>

<form action="/submit-cat-photo" id="cat-photo-form">
  <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
  <label><input type="radio" name="indoor-outdoor"> Outdoor</label>
  <label><input type="checkbox" name="personality" checked> Loving</label>
  <label><input type="checkbox" name="personality"> Lazy</label>
  <label><input type="checkbox" name="personality"> Energetic</label>
  <input type="text" placeholder="cat photo URL" required>
  <button type="submit">Submit</button>
</form>
Hugo
@hugoender
Oct 04 2015 17:01
@Jegriff23 btw just as an FYI…you can always edit your post by clicking the three dots tot he right of your post
@Jegriff23 REMOVE THE FU#$#%^ dot!!
lol
noobstar
@namsir
Oct 04 2015 17:01
amen.
Hugo
@hugoender
Oct 04 2015 17:01
@namsir lol
noobstar
@namsir
Oct 04 2015 17:01
smoke break for me lol brb
@hugoender do you work as a web developer?
Hugo
@hugoender
Oct 04 2015 17:06
@namsir lol i wish
im an EE
electrical engineer
noobstar
@namsir
Oct 04 2015 17:07
oh. are you in a process of switching carreer?
career*
Hugo
@hugoender
Oct 04 2015 17:08
@namsir not sure
@namsir learning to see if i like it enough
i just started FCC less than a month ago
Tyler York
@yorkcommatyler
Oct 04 2015 17:08
noobstar
@namsir
Oct 04 2015 17:08
@hugoender i just started FCC yesterday.
Hugo
@hugoender
Oct 04 2015 17:09
@yorkcommatyler shoot
Tyler York
@yorkcommatyler
Oct 04 2015 17:09
I know I have to be entering the code right, because the output seems to be working! here's what I have:
how do I format the code when pasting here?
Hugo
@hugoender
Oct 04 2015 17:09
help format
CamperBot
@camperbot
Oct 04 2015 17:09

:point_right: code formatting [wiki]

Inline code

alt text

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

Code Block

``` ⇦ Type 3 backticks 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

Tyler York
@yorkcommatyler
Oct 04 2015 17:09
<3
noobstar
@namsir
Oct 04 2015 17:09
LOL
<3
Tyler York
@yorkcommatyler
Oct 04 2015 17:10
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();})();
noobstar
@namsir
Oct 04 2015 17:10
  • 1 at the end
Tyler York
@yorkcommatyler
Oct 04 2015 17:10
seems it's failing the last test: You should be using the function given in the description to calculate the random in number in a range
the +1?
noobstar
@namsir
Oct 04 2015 17:11
yeah
Aleksander Gębicki
@Takumar
Oct 04 2015 17:11
@yorkcommatyler you should use your variables: max and min
noobstar
@namsir
Oct 04 2015 17:11
put the multiplication in ()
Tyler York
@yorkcommatyler
Oct 04 2015 17:12
oh my gosh. the variables are declared above the function.
I'm an idiot.
it's been a long morning lol.
Hugo
@hugoender
Oct 04 2015 17:12
@yorkcommatyler lol
Tyler York
@yorkcommatyler
Oct 04 2015 17:12
thanks guys!
CamperBot
@camperbot
Oct 04 2015 17:12
if you want to thank someone, put an @ before their name!
Hugo
@hugoender
Oct 04 2015 17:12
@namsir lol his code is right
hes just not using max and min
vars
Aleksander Gębicki
@Takumar
Oct 04 2015 17:12
@yorkcommatyler it happens to the best
Junior Griffiths
@Jegriff23
Oct 04 2015 17:13
sorry @hugoender my pc restarted and update
noobstar
@namsir
Oct 04 2015 17:13
why plus 0 at the end?
Hugo
@hugoender
Oct 04 2015 17:13
@Jegriff23 it wasn’t happy with your code ;)
@namsir it should have been min at the end
he used the actual values instead of the variables
and the min value was 0
noobstar
@namsir
Oct 04 2015 17:13
oh i see
Hugo
@hugoender
Oct 04 2015 17:13
so he put 0
Junior Griffiths
@Jegriff23
Oct 04 2015 17:13
def not @hugoender
Tyler York
@yorkcommatyler
Oct 04 2015 17:13
yep lol
Hugo
@hugoender
Oct 04 2015 17:13
@Jegriff23 show it who’s boss and let’s finish this waypoint
Tyler York
@yorkcommatyler
Oct 04 2015 17:14
I wrote the numbers about 10 different ways, but it was just looking for me to use the variables.
Junior Griffiths
@Jegriff23
Oct 04 2015 17:14
ok so what was wrong with my code @hugoender
Hugo
@hugoender
Oct 04 2015 17:14
@yorkcommatyler sometimes the errors messages cause more confusion
@Jegriff23 i dont know…paste it in here!
Fausto Ramírez L.
@faustor21
Oct 04 2015 17:14
@namsir also since the min is 0 it could be omitted and it would work.. (if the min changes thats another story)
noobstar
@namsir
Oct 04 2015 17:15
@faustor21 yeah there's no point for adding 0
Hugo
@hugoender
Oct 04 2015 17:15
because math lol
Fausto Ramírez L.
@faustor21
Oct 04 2015 17:15
lol
Tyler York
@yorkcommatyler
Oct 04 2015 17:15
the moral of this story is read the code.
Aleksander Gębicki
@Takumar
Oct 04 2015 17:15
0 is very important but in good place.
noobstar
@namsir
Oct 04 2015 17:16
did anyone finish all the waypoints?
Fausto Ramírez L.
@faustor21
Oct 04 2015 17:16
on the right side @Takumar
lol
Junior Griffiths
@Jegriff23
Oct 04 2015 17:17
@hugoender it works
hugoender @hugoender claps
Junior Griffiths
@Jegriff23
Oct 04 2015 17:17
thanks @hugoender and @namsir
CamperBot
@camperbot
Oct 04 2015 17:17
jegriff23 sends brownie points to @hugoender and @namsir :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for namsir
:star: 223 | @hugoender | http://www.freecodecamp.com/hugoender
hugoender @hugoender points at next waypoint
Hugo
@hugoender
Oct 04 2015 17:17
ONWARDS!
@Jegriff23 unless of course you dont fully understand this waypoint you just finished. in which case let us know
so we can clear any doubt or confusion
need to form a solid foundation
Junior Griffiths
@Jegriff23
Oct 04 2015 17:18
ok, please explain @hugoender
noobstar
@namsir
Oct 04 2015 17:18
good foundation will take you further in coding :)
Hugo
@hugoender
Oct 04 2015 17:18
@Jegriff23 what do you need an explanation of?
@Jegriff23 what do you not get or are confused about?
noobstar
@namsir
Oct 04 2015 17:19
selectors maybe
Junior Griffiths
@Jegriff23
Oct 04 2015 17:20
why it doesnt have to have a " ."
noobstar
@namsir
Oct 04 2015 17:21
@Jegriff23 you need to learn what type of selector you are targeting.
Hugo
@hugoender
Oct 04 2015 17:21
@Jegriff23 when creating a css block for elements you don’t have to put anything in front of the element tag (i.e. div { }). when creating one for a class you put a . in front of it (i.e. .class-name { }). when creating one for an id you put a # in front of it (i.e.. #id-name { })
so nothing in front for an element, . in front for a class, # in front for an id
@Jegriff23 is that a good enough explanation or am i a terrible person and you are still confused?
noobstar
@namsir
Oct 04 2015 17:22
@Jegriff23 you would need to know the differences between element, class, and id.
Hugo
@hugoender
Oct 04 2015 17:23
@namsir your turn… explain the differences!
noobstar
@namsir
Oct 04 2015 17:23
with class, you can apply to many elements as possible
on the other hand, id is unique.
so when you set an id for an element. only that element has that id and nothing else.
so when you selecting which elements in the html code, you target them with a class name preceding with a dot.
when you are selecting an id you add # instead of a dot.
with elements without classes or ids. select them by their names.
Hugo
@hugoender
Oct 04 2015 17:26
@namsir but what is an element!?
Junior Griffiths
@Jegriff23
Oct 04 2015 17:27
thank you for the break down @hugoender and @namsir
CamperBot
@camperbot
Oct 04 2015 17:27
jegriff23 sends brownie points to @hugoender and @namsir :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for namsir
:warning: jegriff23 already gave hugoender points
noobstar
@namsir
Oct 04 2015 17:27
an element is the html code within your html.
Hugo
@hugoender
Oct 04 2015 17:28
@namsir LOL
noobstar
@namsir
Oct 04 2015 17:28
am i right?
Hugo
@hugoender
Oct 04 2015 17:28
@namsir eh you get a C- for that answer
noobstar
@namsir
Oct 04 2015 17:28
elements made up html.
Hugo
@hugoender
Oct 04 2015 17:28
@namsir not saying you are awrong
noobstar
@namsir
Oct 04 2015 17:28
they are the component of your html.
i'm terrible at explaining things.
Hugo
@hugoender
Oct 04 2015 17:29
@namsir im just giving you a hard time man ;)
noobstar
@namsir
Oct 04 2015 17:29
<3
noobstar
@namsir
Oct 04 2015 17:29
i'm learning still :D
hugoender @hugoender highfives @namsir
Junior Griffiths
@Jegriff23
Oct 04 2015 17:29
ok
Hugo
@hugoender
Oct 04 2015 17:30
we did good man… we did good. I think @Jegriff23 is now going to go on to be an expert programmer because of us
is now*
noobstar
@namsir
Oct 04 2015 17:30
@Jegriff23 do you have any experiences with coding in HTML before?
Junior Griffiths
@Jegriff23
Oct 04 2015 17:31
lol
@namsir not too much
noobstar
@namsir
Oct 04 2015 17:31
if you don't, i would suggest doing the waypoints and research at the same time.
Hugo
@hugoender
Oct 04 2015 17:31
@Jegriff23 being able to complete waypoints is good but just make sure you understand WHY you are doing what you are doing in each waypoint
understand how it works
take the time to google it if you have to
like anything else you start to learn if you dont understand the fundamentals… its going to be a lot harder to get through the more advanced topics
noobstar
@namsir
Oct 04 2015 17:33
it will be extremely difficult when you get to javascript oop
udemy.com has some free courses you can look into :)
youtube has good playlist selections you can learn from also.
Jonny Morley
@morley92
Oct 04 2015 17:41
could anybody do me a huge favour and give me feedback/test this please? thanks will be given :)
http://codepen.io/Morleee/full/GpWPOx/
Mitzi Withrow
@mitziw
Oct 04 2015 17:42
function myReplace(str, before, after) {
  var start = str.indexOf(before);
  var re = "[A-Z]";
  var isCap = str.substr(start,1).match(re);
  if(isCap){
    after = after.charAt(0).toUpperCase()+ after.slice(1);
  }
  return str.replace(before,after);  
//  console.log(arr);
}

myReplace("Let us get back to more Coding", "Coding", "bonfires");
passes all tests and bonfire wont take it
Hugo
@hugoender
Oct 04 2015 17:43
@mitziw if it passes all tests (it shows no errors in the FCC environment) then try refreshing page
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 17:45
Question: Where is the best place/way to declare functions that you're going to call?
Mitzi Withrow
@mitziw
Oct 04 2015 17:46
@hugoender thanks didnt help, even reset. still say "replace is not defined". wow
CamperBot
@camperbot
Oct 04 2015 17:46
mitziw sends brownie points to @hugoender :sparkles: :thumbsup: :sparkles:
:star: 225 | @hugoender | http://www.freecodecamp.com/hugoender
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 17:46
@morley92 It's working for me.
Hugo
@hugoender
Oct 04 2015 17:47
@mitziw hmmmm
Mitzi Withrow
@mitziw
Oct 04 2015 17:47
@morley92 nice!
Aleksander Gębicki
@Takumar
Oct 04 2015 17:47
@morley92 Its working good. It generates good links, randomizes and search given string.
Hugo
@hugoender
Oct 04 2015 17:48
@mitziw which waypoint/bonfire is this?
Hugo
@hugoender
Oct 04 2015 17:49
@mitziw lmao i havent even gotten to that bonfire yet
you’re spoiling it for me!
Mitzi Withrow
@mitziw
Oct 04 2015 17:49
@hugoender awe
i say it should pass!
Hugo
@hugoender
Oct 04 2015 17:59
@mitziw then submit a bug report
@mitziw see what they say
Lionel Croes
@lionelx1
Oct 04 2015 18:01
Does any one knows if it matters if i use ‘string’ or “string” in js??
Hugo
@hugoender
Oct 04 2015 18:01
it does not matter
Lionel Croes
@lionelx1
Oct 04 2015 18:01
Thanks @hugoender
CamperBot
@camperbot
Oct 04 2015 18:01
lionelx1 sends brownie points to @hugoender :sparkles: :thumbsup: :sparkles:
:star: 226 | @hugoender | http://www.freecodecamp.com/hugoender
Alexandrix Ikechukwu
@SpaghettiThots
Oct 04 2015 18:03
But be on the lookout @lionelx1 . In one of the Bonfire exercises, I submitted the bug though, it seemed to matter. You might encounter it. Just switch to the other version if you do.
Lionel Croes
@lionelx1
Oct 04 2015 18:04
@IshMary thanks for the tip
CamperBot
@camperbot
Oct 04 2015 18:04
lionelx1 sends brownie points to @ishmary :sparkles: :thumbsup: :sparkles:
:star: 192 | @ishmary | http://www.freecodecamp.com/ishmary
Alexandrix Ikechukwu
@SpaghettiThots
Oct 04 2015 18:06
Anytime mate.
Mitzi Withrow
@mitziw
Oct 04 2015 18:07
@hugoender thanks i will then. :-)
CamperBot
@camperbot
Oct 04 2015 18:07
mitziw sends brownie points to @hugoender :sparkles: :thumbsup: :sparkles:
:warning: mitziw already gave hugoender points
Timofey Sudanov
@snate28
Oct 04 2015 18:09
What does replace() do in JS? C
Jonny Morley
@morley92
Oct 04 2015 18:11
@Takumar @mitziw @TheHighPriestess Thanks :)
CamperBot
@camperbot
Oct 04 2015 18:11
morley92 sends brownie points to @takumar and @mitziw and @thehighpriestess :sparkles: :thumbsup: :sparkles:
:star: 275 | @thehighpriestess | http://www.freecodecamp.com/thehighpriestess
:star: 297 | @mitziw | http://www.freecodecamp.com/mitziw
:star: 382 | @takumar | http://www.freecodecamp.com/takumar
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 18:36
.
kaushalmathpal
@kaushalmathpal
Oct 04 2015 18:44
var myDog = {
  "name": "Tommy",
  "legs": 4,
  "tails": 1,
  "friends":("Humans","Rat")
   };
myDog should have friends attribute and it should be an array--way point 25 - javascript-- whats wrong with the code
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 18:46
@kaushalmathpal that's not an array
Mitzi Withrow
@mitziw
Oct 04 2015 18:46
@kaushalmathpal i think his frieds need “{“ instead of “("
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 18:46
["Humans", "Rat"]
oh...is it brackets?
try both
I'm not sure...but parentheses are not correct
Mitzi Withrow
@mitziw
Oct 04 2015 18:47
yes try both
noobstar
@namsir
Oct 04 2015 18:48
Brackets is used for array
Alexander Griswold
@AlexGriswold
Oct 04 2015 18:52
can anyone tell me how I would assign the numbers outside of the [] to a variable?
destroyer([1, 2, 3, 1, 2, 3], 2, 3, "");
Devon Jones
@jones-codes
Oct 04 2015 18:57
You'll want to take the whole set of arguments passed to the destroyer funtion and make them into an array
function*
x34passenger
@x34passenger
Oct 04 2015 18:58
Did the gitter free code camp rooms by cities disappear?
Devon Jones
@jones-codes
Oct 04 2015 18:58
No, they just stopped advertising them b/c FB groups are more active
kaushalmathpal
@kaushalmathpal
Oct 04 2015 18:58
@TheHighPriestess @mitziw i have tried all the brackets its not working...even the example is similar to this
x34passenger
@x34passenger
Oct 04 2015 18:59
@jones-codes how do I get the list of cities for FCC gitter?
kaushalmathpal
@kaushalmathpal
Oct 04 2015 18:59
got it guys...the problem was with brackets only @TheHighPriestess @mitziw thanks
CamperBot
@camperbot
Oct 04 2015 18:59
kaushalmathpal sends brownie points to @thehighpriestess and @mitziw :sparkles: :thumbsup: :sparkles:
:star: 276 | @thehighpriestess | http://www.freecodecamp.com/thehighpriestess
:star: 298 | @mitziw | http://www.freecodecamp.com/mitziw
Devon Jones
@jones-codes
Oct 04 2015 18:59
No clue, sorry, I just never closed mine
maybe search for a city in the top right. Or if you find the FB group I'm sure those people will know where it is
Mitzi Withrow
@mitziw
Oct 04 2015 19:01
@kaushalmathpal how abour “friends”:{[“Humans”],[“Rat”]} ?
oh oops
kaushalmathpal
@kaushalmathpal
Oct 04 2015 19:02
instead of these () , i used []
Ryder Bush
@waterswim
Oct 04 2015 19:06
Hey guys does FCC actually ever explain how to use an API?
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 19:15
@waterswim not yet...no
but I think they're going to do that soon
Ryder Bush
@waterswim
Oct 04 2015 19:16
@TheHighPriestess Oh okay. Don't we need to know how in order to complete all of the Ziplines?
Marcelo Marzola Leite
@marmleite
Oct 04 2015 19:16
This message was deleted
How do I paste a piece of code here with the same layout of the FCC ?
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 19:17
@waterswim Yes...and until they add that...you'll need to do some Googling
Ryder Bush
@waterswim
Oct 04 2015 19:17
@TheHighPriestess Cool. Thanks for the help. I wanted to make sure I wasn't missing something.
CamperBot
@camperbot
Oct 04 2015 19:17
waterswim sends brownie points to @thehighpriestess :sparkles: :thumbsup: :sparkles:
:star: 277 | @thehighpriestess | http://www.freecodecamp.com/thehighpriestess
Devon Jones
@jones-codes
Oct 04 2015 19:18
@marmleite
```
code here
3 more thingies
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 19:18
@waterswim Unfortunately, I don't have any great tutorials that I can recommend for APIs. However, you will find a lot of information online...and check out YouTube as well
Devon Jones
@jones-codes
Oct 04 2015 19:19
``` << these should be below your escape key
Ryder Bush
@waterswim
Oct 04 2015 19:20
@TheHighPriestess That's okay! I really appreciate your help! :smile:
Marcelo Marzola Leite
@marmleite
Oct 04 2015 19:21
@jones-codes Thank you!
Devon Jones
@jones-codes
Oct 04 2015 19:22
no worries :D
Abeda Alam
@abbeyalam
Oct 04 2015 19:23
Hi guys! I'm relatively new and am stuck! I keep getting an error while trying to do the Waypoint: Style Text Inputs as Form Controls:
This message was deleted
This message was deleted
<form action="submit-cat-photo btn btn-primary form-control">
<div class="row">
<div class="col-xs-6">
<label><input type="radio" name="indoor-outdoor"> Indoor</label>
</div>
<div class="col-xs-6">
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
</div>
</div>
<div class="row">
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Loving</label>
</div>
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Lazy</label>
</div>
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Crazy</label>
</div>
</div>
<input type="text" placeholder="cat photo URL" required>
<button type="submit"> <i class="fa fa-paper-plane"></i> </button>
</form>
</div>
That's what it looks like, but I don't know how to add a text input in my form the class form-control and how to give my submit button the class btn btn-primary. I'm so confused on where to look. Any help will be appreciated!
TheC0mposer
@TheC0mposer
Oct 04 2015 19:28
hello!! I had no idea this chat room existed, any PhP fans here?
Devon Jones
@jones-codes
Oct 04 2015 19:28
@abbeyalam You don't need to add a text input field
it is already there at the bottom
the line that reads
Abeda Alam
@abbeyalam
Oct 04 2015 19:29
Why is that?
And which line?
Devon Jones
@jones-codes
Oct 04 2015 19:29
<input type="text" placeholder="cat photo URL" required>
you need to add a form-control class to that
Abeda Alam
@abbeyalam
Oct 04 2015 19:29
What does that exactly do, if you don't mind me asking?
JensGryspeert
@JensGryspeert
Oct 04 2015 19:30
@TheC0mposer Yep mate I'm a php fan ;) Laravel user ftw (a)
Richard Robert
@Richardmarobert
Oct 04 2015 19:30
hello,
JensGryspeert
@JensGryspeert
Oct 04 2015 19:30
Hello Richard!
Aleksander Gębicki
@Takumar
Oct 04 2015 19:30
Welcome @Richardmarobert
Devon Jones
@jones-codes
Oct 04 2015 19:31
That implements a CSS style class imported from Bootstrap
Richard Robert
@Richardmarobert
Oct 04 2015 19:31
I'm a bit struggling with making instances with a constructor. I should make a property a number
TheC0mposer
@TheC0mposer
Oct 04 2015 19:31
@JensGryspeert hahah you were just in the gen chat! and awesome
Richard Robert
@Richardmarobert
Oct 04 2015 19:31
But for as far as I know I do this like : this.engine = 4;
Devon Jones
@jones-codes
Oct 04 2015 19:31
It gives the text box element certain properties that make it look different
Abeda Alam
@abbeyalam
Oct 04 2015 19:32
Ahhh. Thank you! It means a lot!
CamperBot
@camperbot
Oct 04 2015 19:32
if you want to thank someone, put an @ before their name!
Abeda Alam
@abbeyalam
Oct 04 2015 19:32
Thank you @jones-codes !
CamperBot
@camperbot
Oct 04 2015 19:32
abbeyalam sends brownie points to @jones-codes :sparkles: :thumbsup: :sparkles:
:star: 201 | @jones-codes | http://www.freecodecamp.com/jones-codes
Devon Jones
@jones-codes
Oct 04 2015 19:32
so add class="form-control" to your input tag and see what happens to the input field at the bottom of the app
Aleksander Gębicki
@Takumar
Oct 04 2015 19:33
@abbeyalam maybe you went to fast past first waypoints. Look at these: Create a text field and Add Placeholder Text to a Text Field
Abeda Alam
@abbeyalam
Oct 04 2015 19:33
I think I did, thanks @Takumar !
CamperBot
@camperbot
Oct 04 2015 19:33
abbeyalam sends brownie points to @takumar :sparkles: :thumbsup: :sparkles:
:star: 384 | @takumar | http://www.freecodecamp.com/takumar
Richard Robert
@Richardmarobert
Oct 04 2015 19:39
Can anyone help me out with a question on Javascript and constructing a instance of an object?
JensGryspeert
@JensGryspeert
Oct 04 2015 19:40
Go ahead Richard. What's your question mate
Lena
@Vivelena
Oct 04 2015 19:40
hi, there. I have found a bug or I just stuck. Need help in 18 lesson. Must be so easy adding a border to an image. I did everything right. But test does not want to run. Tried to restart the page. Please help me, someone!
Aleksander Gębicki
@Takumar
Oct 04 2015 19:41
@Vivelena show your code so we can help you.
wiki format
CamperBot
@camperbot
Oct 04 2015 19:41

:point_right: code formatting [wiki]

Inline code

alt text

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

Code Block

``` ⇦ Type 3 backticks 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

Richard Robert
@Richardmarobert
Oct 04 2015 19:41
@JensGryspeert I need to make the property engine a number. Here's what I have:

var myCar = new Car()

function myCar(engines) {

this.engines = (1);
this.wheels = 4;

};

Lena
@Vivelena
Oct 04 2015 19:42

'''<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

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

h2 {
font-family: Lobster, Monospace;
}

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

.smaller-image {
width: 100px;
}

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

</style>

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

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

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

<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
'''

CamperBot
@camperbot
Oct 04 2015 19:42
:bulb: to format code use backticks! ``` more info
Lena
@Vivelena
Oct 04 2015 19:42
sorry))

```<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

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

h2 {
font-family: Lobster, Monospace;
}

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

.smaller-image {
width: 100px;
}

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

</style>

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

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

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

<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
```

Richard Robert
@Richardmarobert
Oct 04 2015 19:43
I can't seem to understand what I do wrong; and I am not fully catching the 'function'
kaushalmathpal
@kaushalmathpal
Oct 04 2015 19:44
var myArray = [];
var i=0

while(i<4) {
  myArray.push(i)}; 
i++;
}
whats wrong with this while loop - waypoint challenge 27- javascript
JensGryspeert
@JensGryspeert
Oct 04 2015 19:44
@Richardmarobert Can you copy paste the complete code between ``` brackets pls.
Richard Robert
@Richardmarobert
Oct 04 2015 19:44

'var myCar = new Car()

function myCar(engines) {

this.engines = (1);
this.wheels = 4;

};'

JensGryspeert
@JensGryspeert
Oct 04 2015 19:44
wiki format
CamperBot
@camperbot
Oct 04 2015 19:44

:point_right: code formatting [wiki]

Inline code

alt text

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

Code Block

``` ⇦ Type 3 backticks 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

Aleksander Gębicki
@Takumar
Oct 04 2015 19:44
@Vivelena I have pasted your code in waypoint window and it works for me :-(
Lena
@Vivelena
Oct 04 2015 19:45
it works... and shows in the same sreen but testing does not lead me to the next lesson
screen*
Richard Robert
@Richardmarobert
Oct 04 2015 19:45

`var myCar = new Car()

function myCar(engines) {

this.engines = (1);
this.wheels = 4;

};`

Aleksander Gębicki
@Takumar
Oct 04 2015 19:45
@kaushalmathpal myArray.push(i)}; line is wrong, you don't need '}' at the end;
JensGryspeert
@JensGryspeert
Oct 04 2015 19:46
@Richardmarobert the () aren't neccesary you can leave them. Otherwise can you change the constructor or must you use a method for it? (like myArray["property] = "test") ?
Lena
@Vivelena
Oct 04 2015 19:46
my lesson stays not done in the map of lessons...
@Takumar so I have found a bug then?
Richard Robert
@Richardmarobert
Oct 04 2015 19:47

```var myCar = new Car()

function myCar(engines) {

this.engines = (1);
this.wheels = 4;

};```
this is the complete challenge:

JensGryspeert
@JensGryspeert
Oct 04 2015 19:47
@Vivelena try to refresh your page with CTRL+F5
Aleksander Gębicki
@Takumar
Oct 04 2015 19:47
@Vivelena are you sure you are working on: "Waypoint: Add Borders Around your Elements"?
Lena
@Vivelena
Oct 04 2015 19:48
@JensGryspeert tried it 5 times))
@Takumar yes
Richard Robert
@Richardmarobert
Oct 04 2015 19:48

```var Car = function() {
this.wheels = 4;
};

// Only change code below this line.
var myCar = new Car()

function myCar(engines) {

this.engines = 1;
this.wheels = 4;

};

//Add the property "engines" to myCar, and make it a number.

// Only change code above this line.
(function() {return JSON.stringify(myCar);})();
```

kaushalmathpal
@kaushalmathpal
Oct 04 2015 19:48
@Takumar thanks
CamperBot
@camperbot
Oct 04 2015 19:48
kaushalmathpal sends brownie points to @takumar :sparkles: :thumbsup: :sparkles:
:star: 385 | @takumar | http://www.freecodecamp.com/takumar
Lena
@Vivelena
Oct 04 2015 19:49
it shows i had to do 5 tasks, all have now green "done" marks, but one is red - Give your image a border width of 10px.
Aleksander Gębicki
@Takumar
Oct 04 2015 19:51
@Vivelena but you have in your "thick-green-border" class style of: border-width: 10px;. Maybe just copy your code to another editor then "reset" your exercise and paste your code and run it again.
JensGryspeert
@JensGryspeert
Oct 04 2015 19:52
@Richardmarobert You don't need to create a new function. The function Car() is already created. In that function there is a property wheels. You only need to add an extra property to that.
Lena
@Vivelena
Oct 04 2015 19:52
@Takumar yes I do... I tried to choose in maps the next lesson manually and it works, but this one lesson stays not done then...
JensGryspeert
@JensGryspeert
Oct 04 2015 19:53
var Car = function() {
   this.wheels = 4;
};

// Only change code below this line.
var myCar = new Car();

//Add the property "engines" to myCar, and make it a number.
myCar['Property'] = valueOfProperty;

// Only change code above this line.
(function() {return JSON.stringify(myCar);})();
@Richardmarobert Hope this helps you more mate
Richard Robert
@Richardmarobert
Oct 04 2015 19:55
thanx @JensGryspeert . I made life far too difficult :)
CamperBot
@camperbot
Oct 04 2015 19:55
richardmarobert sends brownie points to @jensgryspeert :sparkles: :thumbsup: :sparkles:
:star: 181 | @jensgryspeert | http://www.freecodecamp.com/jensgryspeert
Lena
@Vivelena
Oct 04 2015 19:57
@Takumar I tried to copy it to jsfeedle, it works. But when i copy it back to waypoint, the same story((
Aleksander Gębicki
@Takumar
Oct 04 2015 19:57
@Vivelena once again. Your code is good. Use "Reset" button and paste in your code again.
Lena
@Vivelena
Oct 04 2015 19:57
@Takumar did it.
no change
reset does not help...maybe to try not to copy but to type everything again...?
JensGryspeert
@JensGryspeert
Oct 04 2015 19:58
@Richardmarobert YW ;)
Aleksander Gębicki
@Takumar
Oct 04 2015 19:59
@Vivelena do you have another webbrowser? Firefox, Chrome, IE, Safari? Maybe try to run FCC in another browser or try to clear cache of your browser.
ptulip
@ptulip
Oct 04 2015 20:01
Hmm, I'm stuck with .replace and entering suitable regexp
Lena
@Vivelena
Oct 04 2015 20:01
@Takumar I will try it now, thx
CamperBot
@camperbot
Oct 04 2015 20:01
vivelena sends brownie points to @takumar :sparkles: :thumbsup: :sparkles:
:star: 386 | @takumar | http://www.freecodecamp.com/takumar
ptulip
@ptulip
Oct 04 2015 20:01
Is this allowed...
str = str.replace('/[,.\s]+/g', '');
Im trying to remove punctuation and spaces for the bonfire-palindrome
Aleksander Gębicki
@Takumar
Oct 04 2015 20:05
@ptulip look at the page: http://regexr.com/ there you can check your expression. For now it doesn't remove all unnecessary characters.
Lena
@Vivelena
Oct 04 2015 20:06
@Takumar yep!!! it worked in Explorer, but not in Chrome. Thank you one more time.
CamperBot
@camperbot
Oct 04 2015 20:06
vivelena sends brownie points to @takumar :sparkles: :thumbsup: :sparkles:
:warning: vivelena already gave takumar points
Aleksander Gębicki
@Takumar
Oct 04 2015 20:07
@Vivelena maybe old solution exists in cache of Chrome and that's the reason why new one is not working. I really don't know.
What a pity I cannot get another point although you thanked me again :-)
Lena
@Vivelena
Oct 04 2015 20:12
:-) @Takumar
JAWs41493
@JAWs41493
Oct 04 2015 20:12
Is everyone trying to just find the answer or does anyone have an actual way or place that explains how to get to the answer without looking it up? I'd rather learn the method of getting to an answer than repeatedly looking them up.
ptulip
@ptulip
Oct 04 2015 20:12
^ this
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 20:12
can anyone here help me with Waypoint: Make Instances of Objects with a Constructor Function
Aleksander Gębicki
@Takumar
Oct 04 2015 20:13
@JAWs41493 i try to do all exercises myself but it takes so looong :-)
noobstar
@namsir
Oct 04 2015 20:13
function reverseString(str, seperator) {
  var arrayOfString = str.split(seperator);
  arrayOfString.reverse();
  str = arrayOfString.join(seperator);
  return str;
};

reverseString("hello", "");
reverseString("Howdy", "");
reverseString("Greetings from Earth", "");
could anyone help?
i can't make it pass.
Aleksander Gębicki
@Takumar
Oct 04 2015 20:14
@namsir any errors?
Marcelo Marzola Leite
@marmleite
Oct 04 2015 20:14
function palindrome(str) {
str = str.toLowerCase();
str = str.replace(/[^a-z]/|/[^0-9]/,"");
str = str.split("");
if(str === str.reverse())
return true;
return false;
}
Bonfire: Check for Palindromes - in places where the challenge should return false does not. Does anyone know why ? http://www.freecodecamp.com/challenges/bonfire-check-for-palindromes
noobstar
@namsir
Oct 04 2015 20:14
couldn't pass the second, third, and the fourth.
Bonfire: 171
CamperBot
@camperbot
Oct 04 2015 20:15
Sorry, can't find a bonfire called 171. [ Check the map? ]
noobstar
@namsir
Oct 04 2015 20:15
doing the bonfire 171
JAWs41493
@JAWs41493
Oct 04 2015 20:15
I agree that there isn't much info to go off of, but in reality there should be more learning resources to do before we're introduced to problems in the bonfire challenges in my opinion freecodecamp should be linking us to learning how to work up to those problems, codecademy was a good outside intro to learning in the beginning, but we need a resource that teaches more advanced problems and gives practice problems step by step in my opinion. trying to do guess work shouldn't be something you do for problems everyone else more experienced can already answer.
noobstar
@namsir
Oct 04 2015 20:16
there's nothing wrong with my code. i've tested it with dev tool.
just don't know why i can't pass it.
maybe i can pass it if i chain the methods?
Matt Yamamoto
@MattYamamoto
Oct 04 2015 20:18
@namsir get rid of the second paramenter (the seperator) in your function and just use "" in your split and join.
Aleksander Gębicki
@Takumar
Oct 04 2015 20:18
@namsir it looks like your parameter 'seperator' is not working. When you change it in functions to: split('') and join('') everythings passes.
noobstar
@namsir
Oct 04 2015 20:19
gotcha
lol that's weird.
Luciano Britis
@LucianoBritis
Oct 04 2015 20:19
Guys, I need you to help me solve the following. I have a footer that when I reduce the screen, it is about the contents of formulario..não could adjust the position below this content. Help me do this. http://codepen.io/Luciano_Britis/pen/avBdmy
Elizabeth Hatleli
@TheHighPriestess
Oct 04 2015 20:22
I have changed my code around...so that my functions aren't nested. I also tested the functions separately..and they work fine. However, when I call removeDuplicates from the sym function...and then do a console.log on "arr"....the duplicates aren't removed. So, something is happening with the communication between the two functions.
//FUNCTION TO REMOVE DUPLICATES

function removeDuplicates(origarr) {
        var arr = [];
        var origLen = origarr.length;
        var found, x, y;


    for (x = 0; x < origLen; x++) {
        found = undefined;
        for (y = 0; y < arr.length; y++) {
            if (origarr[x] === arr[y]) {
                found = true;
                break;
            }
        }
        if (!found) {
            arr.push(origarr[x]);

        }       
    }

return arr;
}//end removeDuplicates

//FUNCTION TO FIND DIFFERENCE

function difference(arr){

     var discarded = [];
     var good = [];
     var test = 0;


     while (test = arr.pop()){

     if (arr.indexOf(test) > -1){
         discarded.push(test);
         continue;
     } 

     else if(discarded.indexOf(test) == -1){
         good.push(test);
     }

     }//end while

     return good;

}//end difference


function sym(args){

    var arr = [];
    var argslength = arguments.length;

    if(argslength === 1){
        arr = arguments[0];
       console.log(arr);
       removeDuplicates(arr);
       console.log(arr);

    }

    else if (argslength === 2){
        arr = arguments[0].concat(arguments[1]);
       //console.log(arr);

    }

    else if (argslength > 2){
    arr=arguments[0].concat(arguments[1]);         
           for(i=2;i<arguments.length;i++){
      arr=arr.concat(arguments[i]);         
           }   
 // console.log(arr);
    }
}//end sym

sym([1, 1, 2, 5]);
Maybe I'm not understanding something about returning variables
Matt Yamamoto
@MattYamamoto
Oct 04 2015 20:29
@marmleite I thnik you need to convert your arrays back to strings before checking if they are equal
zac247
@zac247
Oct 04 2015 20:30
@TheHighPriestess I did not go through your code in detail, but I found this odd:function sym(args){
var arr = [];
var argslength = arguments.length;
shouldn't it be args.lenth ?
'''
CamperBot
@camperbot
Oct 04 2015 20:30
:bulb: to format code use backticks! ``` more info
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 20:30
hi everyone! Did anyone have trouble with the Object orientation waypoints?
zac247
@zac247
Oct 04 2015 20:31
function sym(args){
var arr = [];
var argslength = arguments.length;
Herman Fassett
@HermanFassett
Oct 04 2015 20:31
@Leeiaisabelle tell us what your trouble is and we'll try to help
Coira Ellison
@Coira
Oct 04 2015 20:32
@TheHighPriestess try changing removeDuplicates(arr); to arr=removeDuplicates(arr);
Matt Yamamoto
@MattYamamoto
Oct 04 2015 20:33
@TheHighPriestess your removeDuplicates function returns an array, so you need to store that in a variable. so I think you need arr = removeDuplicates(arr)
oh..just like @Coira said
Coira Ellison
@Coira
Oct 04 2015 20:33
:)
Matt Yamamoto
@MattYamamoto
Oct 04 2015 20:33
I should scroll down before I submit my comments!
Marcelo Marzola Leite
@marmleite
Oct 04 2015 20:34
Thanks @MattYamamoto ! I think I must now consider the spaces in the regex
CamperBot
@camperbot
Oct 04 2015 20:34
marmleite sends brownie points to @mattyamamoto :sparkles: :thumbsup: :sparkles:
:star: 348 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 20:34
I am working on Waypoint: Make Instances of Objects with a Constructor Function. I cannot seem to get it to work. I'm not sure what I am missing though @HermanFassett
Herman Fassett
@HermanFassett
Oct 04 2015 20:35
What've you tried?
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 20:35

@HermanFassett this is what I have: ```var Car = function() {
this.wheels = 4;
};

// Only change code below this line.
var myCar = new Car();

//Add the property "engines" to myCar, and make it a number.
myCar.engines: 1;
// Only change code above this line.
(function() {return JSON.stringify(myCar);})();```

Herman Fassett
@HermanFassett
Oct 04 2015 20:36
Assign engines value with an = instead of a :
That should be all you need to change
Leeia Isabelle
@Leeiaisabelle
Oct 04 2015 20:38
Not sure why that showed up, but I have an = there
ok...I see! I needed to change something they already had written there
thanks @HermanFassett
CamperBot
@camperbot
Oct 04 2015 20:39
leeiaisabelle sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 299 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Herman Fassett
@HermanFassett
Oct 04 2015 20:39
Yep
Craig Morrison
@frogmorton
Oct 04 2015 20:45
@kgdiem are you online?
I have a question with hosted css
noobstar
@namsir
Oct 04 2015 20:46
i have a question with the factorialize if anyone could help pls. it might be something stupid.
function factorialize(num) {
  var result=1;
  if(num === 0 ){ return 1;}
  for(var i=1; i < num; i++){
    result = result * i;
  }
  return result;
}

factorialize(5);
factorialize(10);
factorialize(20);
zac247
@zac247
Oct 04 2015 20:47
@frogmorton could you mind sharing the qn...looks interesting
noobstar
@namsir
Oct 04 2015 20:47
it doesn't let me pass. is it asking different way to code it?
DTing
@dting
Oct 04 2015 20:48
@namsir you need to include num
  for(var i=1; i <= num; i++){