These are chat archives for FreeCodeCamp/Help

24th
Sep 2015
Hugo
@hugoender
Sep 24 2015 00:00
on the site itself*
Jordan Bourne
@JordanBourne
Sep 24 2015 00:00
@hugoender yeah thanks, I've experienced that but I've sort of been making due lol. Right now I have secondStr which is just the first letter from each word that is capitalized and the rest of the word is truncated for some reason
CamperBot
@camperbot
Sep 24 2015 00:00
jordanbourne sends brownie points to @hugoender :sparkles: :thumbsup: :sparkles:
Hugo
@hugoender
Sep 24 2015 00:00
you can also use regex101.com for regex
CamperBot
@camperbot
Sep 24 2015 00:00
:star: 186 | @hugoender | http://www.freecodecamp.com/hugoender
Hugo
@hugoender
Sep 24 2015 00:01
@JordanBourne that last message of mine was a hint ;)
it sucks the FCC doesn't save the code you submitted to move on to the next bonfire. I would be nice for me to be able to go back to my previous bonfires and refresh my memory as to what I did. Maybe I will have to start saving them myself on github or something
Jordan Bourne
@JordanBourne
Sep 24 2015 00:02
It doesnt? My previous ones are still there
Maybe it's stored in cache or something and you've cleared it?
Hugo
@hugoender
Sep 24 2015 00:04
maybe but if that's the case then that means yours will be cleared at some point as well
@JordanBourne another camper just informed me that all of your bonfire submissions are saved in your profile page (scroll down)
I did not know this... now I do and it's cool :D
Donavin Northrup
@dnorthrupva
Sep 24 2015 00:07
Open Question - I don't have an old' calculator near-by. If I have entered into a calculator and done 2 + 2 + 3 (The saved number is now 4, and 3 is displayed on my screen) and I hit MR, does it save 3, or does it save 7? 3, right?
Jordan Bourne
@JordanBourne
Sep 24 2015 00:08
Pretty sure it'd save 3
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:09
It saves 7 on my old calculator
Donavin Northrup
@dnorthrupva
Sep 24 2015 00:09
Damn!
I must find one similar to mine to test.
I have conflicting input.
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:09
My windows calc saves 3 :)
Donavin Northrup
@dnorthrupva
Sep 24 2015 00:09
Haha
Jordan Bourne
@JordanBourne
Sep 24 2015 00:09
It would just save whatever is on the screen, so after you hit enter it'd save 7
lonirose
@lonirose
Sep 24 2015 00:10

Need help or hint? I don't understand what it wants me to do.

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.


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

Its lesson Waypoint: Make Instances of Objects with a Constructor Function

Donavin Northrup
@dnorthrupva
Sep 24 2015 00:10
Okay, I'll run off it saving 7 currently. Thanks.
CamperBot
@camperbot
Sep 24 2015 00:10
if you want to thank someone, put an @ before their name!
Donavin Northrup
@dnorthrupva
Sep 24 2015 00:10
THANKS @JordanBourne @TylerMoeller God Camperbot get off my D.
CamperBot
@camperbot
Sep 24 2015 00:10
dnorthrupva sends brownie points to @jordanbourne and @tylermoeller :sparkles: :thumbsup: :sparkles:
:star: 177 | @jordanbourne | http://www.freecodecamp.com/jordanbourne
:star: 189 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:10
Yay my first brownie point
Hugo
@hugoender
Sep 24 2015 00:14
@lonirose I will help you give me a second
Garrett Schultz
@garettschultz
Sep 24 2015 00:18
with jQuery, how do I remove one class from multiple elements?
Hugo
@hugoender
Sep 24 2015 00:18
@lonirose sorry for the delay
this waypoint wants you to create a new property "engines" and assign it a value "1"
but you need to do it within the commented lines
Garrett Schultz
@garettschultz
Sep 24 2015 00:19
Im supposed to remove the btn-default class from all of our button elements. There are 6 button elements
Hugo
@hugoender
Sep 24 2015 00:19
look up "javascript constructor" for help
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:20
lonirose
@lonirose
Sep 24 2015 00:20
I know that but I can't add it to the Car constructor and I try making a new constructor and it's not working
@hugoender I know that but I can't add it to the Car constructor and I try making a new constructor and it's not working
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:23
@hugoender it's also helpful to learn about properties. Object.property http://www.w3schools.com/js/js_properties.asp
Garrett Schultz
@garettschultz
Sep 24 2015 00:23
@TylerMoeller that's a bit out of my knowledge as far as where I am at. I just started the jQuery stuff and so Im not even sure what I am looking at in that link you sent lol.
Im supposed to Remove the btn-default class from all of my button elements. and there are 6 button elements and this is what I have so far: $("button").removeClass(".btn-default");
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:25
@gratschultz2013 In the accepted answer, they show the removeClass() method. Maybe check that out for more details: http://www.w3schools.com/jquery/html_removeclass.asp
There's a good tutorial on that page to see how the code removes classes from elements
Phou
@nuttdguy
Sep 24 2015 00:27
Hello all! I'm stumped on "LongestWord" exercise; I don't know how to compare store the values of the "for loop" so that it can be compared. My code is here:

function findLongestWord(str) {
var word = str.split(" ");
var arrayLength = word.length;
console.log(word);

for (i = 0; i < arrayLength; i++) {
arrayValue = word[i].length;
console.log(arrayValue);
}

// return str.length;
}

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

Any help would be great
Garrett Schultz
@garettschultz
Sep 24 2015 00:29
@TylerMoeller that worked but what I dont understand is earlier in the FCC tutorial it said for selecting classes im supposed to use .classname, but in what just worked I didnt use a .classname I just used classname even though its a class.
Hugo
@hugoender
Sep 24 2015 00:29
@lonirose there is more than one way to create a new property for an object. one way is in the object declaration itself (which is out of bounds for you) and another is like so objectName.property
Phou
@nuttdguy
Sep 24 2015 00:29
?? Would you use an if statement?? Or how would you introduce a comparison operator ...
Confused with this one ... :-(
lonirose
@lonirose
Sep 24 2015 00:30
This message was deleted
Garrett Schultz
@garettschultz
Sep 24 2015 00:30
oh nevermind, I think im only supposed to use .classname if Im (selecting) a class.
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:30
@gratschultz2013 starting to get beyond my expertise now ;)
Hugo
@hugoender
Sep 24 2015 00:30
@lonirose so if you wanted to add a "seat" property to a "bike" object by the name of "myBike"... you would do myBike.seat
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:32
@Nuttdguy Lots of ways to do this exercise. Some harder than others. I think sorting the array first by length of each value may make it easier.
Garrett Schultz
@garettschultz
Sep 24 2015 00:33
thank you for your help @TylerMoeller
CamperBot
@camperbot
Sep 24 2015 00:33
gratschultz2013 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star: 190 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:33
np :+1:

I'm trying to get this button to execute my javascript...not sure what I'm doing wrong. Help? Hint?

<script src = 'http://url to an api I'm calling'>
  function getUrl(data) {
    document.getElementById("author").innerHTML = data.articleAuthor;
    document.getElementById("contents").innerHTML = data.articleContents;
  }
</script>
<html>
<body>
<p id="author"></p>
<p id="contents"></p>

<input type="button" id="newQuote" class="btn" value="New Quote" onclick="getQuote();" />
<body>
<html>

It's the call to "getQuote()" - I'm not passing in the right argument I think.

Typo - that should be onclick="getUrl()
Shaina Shockley
@sashockster
Sep 24 2015 00:36
I'm kind of stuck on these intermediate Algorithm Scripting Bonfires. Any one have any good resources to help with them?
Phou
@nuttdguy
Sep 24 2015 00:36
@TylerMoeller .. still stumped. Maybe I should attempt to figure it out a bit longer ... it just hasn't clicked for me yet. I still have no idea how to compare OR create code to look for a highest value... really no clue at the moment ... lol
Aaron Freidus
@shadowfool
Sep 24 2015 00:37
@sashockster http://eloquentjavascript.net/ best resource around
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:38
@Nuttdguy That one was hard for me too. No need to compare though if you just put the words into an array and sort by length. The sorting does the comparison for you.
Donavin Northrup
@dnorthrupva
Sep 24 2015 00:38
@TylerMoeller I don't see a function called getQuote() and I wouldn't put a semicolon in the onclick
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:38
That should be getUrl() sorry about that.
lonirose
@lonirose
Sep 24 2015 00:39
@hugoender http://www.w3schools.com/js/js_object_definition.asp
I understand constructor, I get objectName.property I don't understand how I would add to the already established constructor they call it "instances"?
var Car = function() {
   this.wheels = 4;

};

// Only change code below this line.
function Car() {
    this.engines = 1;
}
var myCar = new Car();
//Add the property "engines" to myCar, and make it a number.


// Only change code above this line.
(function() {return JSON.stringify(myCar);})();
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:39
It works if I do onclick="history.go(0)" but that's cheating
Donavin Northrup
@dnorthrupva
Sep 24 2015 00:39
Just saw your comment, wasn't scrolled down apparently. I don't think removing the semi colon will fix it, but you don't need it there. Can I see the CodePen? I'm not sure how you're calling the JSON
Phou
@nuttdguy
Sep 24 2015 00:40
@TylerMoeller ... That sort of makes sense. But I haven't quite pieced it together yet .. thanks!
CamperBot
@camperbot
Sep 24 2015 00:40
nuttdguy sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star: 191 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:40
Sure, it's for the random quote machine though. I obfuscated the code above in case folks haven't gotten there yet. http://codepen.io/TylerMoeller/pen/WQGjvO
Good luck @Nuttdguy !
The button is on line 29 of the html
Donavin Northrup
@dnorthrupva
Sep 24 2015 00:43
@TylerMoeller It's interesting how it gets the first quote. I'll change it around a bit and re-link how I'd do it.
Tyler Moeller
@TylerMoeller
Sep 24 2015 00:43
Wasn't sure if I needed to replace text with jquery onclick or what...been trying all day and finally gave up to ask for help
@lonirose the only other hint I can think of giving without giving the answer is that it is only one line of code to solve the problem.
Donavin Northrup
@dnorthrupva
Sep 24 2015 01:03
@TylerMoeller Sorry - I got side-tracked with my wife. So for Forismatic I usually call it as an AJAX - I can modify it to resemble JSON (See http://codepen.io/dnorthrupva/pen/yYaogV ) but essentially it needs to re-call the API every time it's clicked.
In your script, I only see it loaded once, and that's at the beginning.
Tyler Moeller
@TylerMoeller
Sep 24 2015 01:04
thanks @dnorthrupva I will take a look now
CamperBot
@camperbot
Sep 24 2015 01:04
tylermoeller sends brownie points to @dnorthrupva :sparkles: :thumbsup: :sparkles:
:star: 302 | @dnorthrupva | http://www.freecodecamp.com/dnorthrupva
Tyler Moeller
@TylerMoeller
Sep 24 2015 01:04
It's appending each new quote to the next, but I think I can fix that :)
Stefan Stokic
@StefanStokic
Sep 24 2015 01:05
bf title case a sentence
CamperBot
@camperbot
Sep 24 2015 01:05

:fire:Bonfire: Title Case a Sentence :link:

function titleCase(str) {
  return str;
}

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

Return the provided string with the first letter of each word capitalized.

more info:  bf details | bf links | hint

Stefan Stokic
@StefanStokic
Sep 24 2015 01:05
hint
CamperBot
@camperbot
Sep 24 2015 01:05
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Donavin Northrup
@dnorthrupva
Sep 24 2015 01:06
@TylerMoeller http://codepen.io/dnorthrupva/pen/NGRvwx - Sorry, I modifed it a bit to match your original code, and not be jQuery reliant.
And yea, just replace .append with .html - Was something I was testing.
I was marking the .click event to the wrong ID (You confused me because I saw "New Quote" at the top, but the button code is down below.
Tyler Moeller
@TylerMoeller
Sep 24 2015 01:09
Thanks again @dnorthrupva very helpful. I'll try to get it working on my site now. Dinner first!
CamperBot
@camperbot
Sep 24 2015 01:09
tylermoeller sends brownie points to @dnorthrupva :sparkles: :thumbsup: :sparkles:
:warning: tylermoeller already gave dnorthrupva points
Donavin Northrup
@dnorthrupva
Sep 24 2015 01:10
@TylerMoeller No worries, like I said the second link I posted is using all of your original code. If you need any help, feel free to PM. API's seem complex but if you install a JSON View add to your browser, and just look at the link yourself (To see HOW it's going to report the info) it becomes much easier to manipulate it.
Stefan Stokic
@StefanStokic
Sep 24 2015 01:37
function titleCase(str) {
  str.toLowerCase();
  var splitarr = str.split(" ");
  return str;
}


titleCase("I'm a little tea pot");
Why doesn't this lowercase it?
Donavin Northrup
@dnorthrupva
Sep 24 2015 01:59
Isn't that the opposite of the objective @KingInTheNorth ?
DJ
@qualitymanifest
Sep 24 2015 02:00
@KingInTheNorth you need to assign the first line to str
Donavin Northrup
@dnorthrupva
Sep 24 2015 02:01
If you console.log that 'splitarr' you'll see now you just have a lowered case array of each word, but neither 'str' or 'splitarr' will be lowercase.
DJ
@qualitymanifest
Sep 24 2015 02:01
@dnorthrupva no since you need to lowercase all of the non-first letters, some words aRe lIkE tHis
Donavin Northrup
@dnorthrupva
Sep 24 2015 02:02

Okay, so you would do

str = str.toLowerCase();

to modify the str.

DJ
@qualitymanifest
Sep 24 2015 02:02
yup
Donavin Northrup
@dnorthrupva
Sep 24 2015 02:03

Just

str.toLowerCase();

won't do it.

DJ
@qualitymanifest
Sep 24 2015 02:03
that's what i was saying above
Donavin Northrup
@dnorthrupva
Sep 24 2015 02:03
@qualitymanifest Ohhh, I thought you were the original one who asked. My B
Haha
DJ
@qualitymanifest
Sep 24 2015 02:04
no worries i think he's gone anyway though
@dnorthrupva hey i just noticed in helpziplines you're on the calculator... so assuming you've completed the weather app then, which API did you use?
i'm on that one now and having trouble making up my mind. APIs are a new concept to me as it is
Donavin Northrup
@dnorthrupva
Sep 24 2015 02:07
@qualitymanifest I used SimplyWeatherJS - I enjoyed the way it returns info, and has the barebone basics, but also enough to build upon.
APIs were difficult to me, but once I got in the habit of posting the API link into a new tab and reviewing it, I suddenly find them not so confusing anymore.
SimpleWeatherJS* I mis-said it's name apparently.
DJ
@qualitymanifest
Sep 24 2015 02:08
okay cool. i've been looking into that. i do read something regarding changing the weather icons while using simplyweather that said "this will require having images for all (even if the same is used over) Condition Codes of which there are about 50. "
which worries me about the potential complexity of changing the background depending on weather
did you have problems with that aspect?
Donavin Northrup
@dnorthrupva
Sep 24 2015 02:10
@qualitymanifest Not at all. The icons are a BIT excessive, I won't lie. But since you can get things like 'temp' and 'status' in a JSON, I did like
if (temp > 70) {
~code to modify CSS background});
Etc etc.
DJ
@qualitymanifest
Sep 24 2015 02:10
or is changing the background totally different process than changing the icon?
ahh cool
Donavin Northrup
@dnorthrupva
Sep 24 2015 02:10
Once I understood the API calls, it was simple.
DJ
@qualitymanifest
Sep 24 2015 02:10
@dnorthrupva thanks
CamperBot
@camperbot
Sep 24 2015 02:10
qualitymanifest sends brownie points to @dnorthrupva :sparkles: :thumbsup: :sparkles:
:star: 303 | @dnorthrupva | http://www.freecodecamp.com/dnorthrupva
Donavin Northrup
@dnorthrupva
Sep 24 2015 02:11

Won't ruin any of the code but

 if (weather.temp <= 55){
     declare='info'
     saying= "Brr, better bundle up! It's cold out there!"
   } else if (weather.temp <= 70){
     declare='success';
     saying="It's a bit chilly, might I recommend a sweater?";;
   } else if (weather.temp <=120){
     declare='warning';
     saying="It's getting a bit warm outside, but not too bad.";
   } else{
     declare='declare';
     saying="It's gonna be a scorcher! Dress cool!"
   }

This is a snippet for a 'Thermometer' I made. I had something VERY similar change the background based on heat.

As you can guess 'weather.temp' is returning a numerical value, in farenheit.
And saying was a variable to append some HTMl, etc etc.
DJ
@qualitymanifest
Sep 24 2015 02:12
ah, i like it. now i just need to stop putting it off haha
Donavin Northrup
@dnorthrupva
Sep 24 2015 02:14
Yea, and as for the 44 icons, I can paste you the code if you need.
Though I must say looking back on it, I had the most fun with the weather one. I probably learned the most from the Quote, or maybe the Pomodoro Clock.
The Twitch one made me want to punch someone in the face.
DJ
@qualitymanifest
Sep 24 2015 02:15
nah don't worry about it, i'd like to figure the rest out on my own. thanks though
CamperBot
@camperbot
Sep 24 2015 02:15
if you want to thank someone, put an @ before their name!
Donavin Northrup
@dnorthrupva
Sep 24 2015 02:15
The Twitch API made me take a break, haha, actually. But I had a vacation planned anyway.
No worries! Wish you luck.
azazel913
@azazel913
Sep 24 2015 02:27

for Waypoint: Override Class Declarations by Styling ID Attributes I have ```<style>
body {
background-color: black;
font-family: Monospace;
color: green;
}
.pink-text {
color: pink;
}
.blue-text {
color: blue;

}
.orange-text{
color:orange;
}

</style>

<h1 class="pink-text orange-text blue-text">Hello World!</h1>```

but am missing Give your h1 element the id of orange-text. and
Create a CSS declaration for your orange-text id can some one tell me what am missing or did wrong
Star Cherrix
@Sparklepaws
Sep 24 2015 02:38

Hey guys, I just have a quick question about the teaching method being employed here. I'm at Bonfires now and probably about 10 Bonfires in, I began to realize that I don't understand half of what I'm doing. There's lots of code I feel I'm not retaining enough information about and (pardon the pun) it seems like I'm being thrown into the fire.

How should I be approaching these lessons? Is it important to solidify all of this information in my brain or should I just acknowledge it and move on?

Donavin Northrup
@dnorthrupva
Sep 24 2015 02:43

@Sparklepaws I can only offer an opinion - When you go from Waypoints to Bonfires, it feels like you went from "Too easy, just doing what it says." to "Sinking under." You're basically being thrown out into the world, because in my experience that's exactly how it is. When I want to learn how to do X function, I can't just say "How do I do this?" because it doesn't really mean that's how Person A, B, or C does it They need to completely understand my code, etc etc.

I can tell you, I didn't spend much time on Bonfires. I learned the useful ones, or ones that seemed interesting and then I went onto Ziplines. Doing full-projects, figuring out how I wanted to do things, and how to make them work, helped my basic knowledge. Then I went back and suddenly the Bonfires were very easy.

CamperBot
@camperbot
Sep 24 2015 02:43
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Donavin Northrup
@dnorthrupva
Sep 24 2015 02:44
tl;dr - If you don't feel like you're learning from the Bonfire, move on and come back later. It's mostly just teaching you how to research. A lot of programming is reading documentation.
But you won't remember every element, or aspect, or every function you do. If you have a basic understanding, definitely move on.
Star Cherrix
@Sparklepaws
Sep 24 2015 02:46
@dnorthrupva Thanks, that definitely helps a lot. It's a little intimidating but I definitely understand how the codes are working. Just not feeling like that knowledge is sticking anywhere. I AM becoming better at researching, so that's a plus.
CamperBot
@camperbot
Sep 24 2015 02:46
sparklepaws sends brownie points to @dnorthrupva :sparkles: :thumbsup: :sparkles:
:star: 304 | @dnorthrupva | http://www.freecodecamp.com/dnorthrupva
Donavin Northrup
@dnorthrupva
Sep 24 2015 02:47
@Sparklepaws I think that's the key point. If you're able to SOLVE the bonfires, you're ahead of a lot of people going from top-to-bottom. Most people I've seen in Help will get answers else-where, and reverse engineer them.
Jae
@jaestaar
Sep 24 2015 02:51
help check for palindromes
CamperBot
@camperbot
Sep 24 2015 02:51

:point_right: bonfire check for palindromes [wiki]

Explanation:

You have to check if the string you get as an input is a palindrome and return true if it is, and false otherwise.

:pencil: read more about bonfire check for palindromes on the FCC Wiki

Donavin Northrup
@dnorthrupva
Sep 24 2015 02:54
I wish CodePen could create a Repo instead of a Gist :( Must be an easier way to do this.
azazel913
@azazel913
Sep 24 2015 03:02
need to Create a CSS declaration for your orange-text id can some one help me plz
Gerald James Carrow
@gjcarrow
Sep 24 2015 03:03
@azazel913 I'll give it a shot. I'm not sure exactly what you're asking, though. An element with an id of orange-text would look like this in CSS : #orange-text{ color: orange; };
So any element in the page with that particular id (id's are supposed to be unique so there should only be one) will have a text-color of orange;
azazel913
@azazel913
Sep 24 2015 03:05
ill try it
Gerald James Carrow
@gjcarrow
Sep 24 2015 03:06
Let me know how it works out.
John Wilson
@johnthewilson
Sep 24 2015 03:34
Bonfire: Arguments Optional// any idea how to work with returned functions
CamperBot
@camperbot
Sep 24 2015 03:34
Sorry, can't find a bonfire called arguments optional any idea how to work with returned functions. [ Check the map? ]
Brandon Mellus
@mels065
Sep 24 2015 03:53
Hey guys! Do you know how you could make it so you can't type into an input number field? By input number, I mean this:
<input type="number"></input>
Kathy C
@tamienne
Sep 24 2015 03:55
Put disabled in it
'''
CamperBot
@camperbot
Sep 24 2015 03:56
:bulb: to format code use backticks! ``` more info
Kathy C
@tamienne
Sep 24 2015 03:56
Bah.. Can't type back ticks with my phone
Gerald James Carrow
@gjcarrow
Sep 24 2015 03:59
<input type="number" disabled />
Brandon Mellus
@mels065
Sep 24 2015 04:00
But wouldn't that make it so it won't be able to be used? I want the number ticker to work, I just don't want the user to be able to type into it.
Gerald James Carrow
@gjcarrow
Sep 24 2015 04:00
@tamienne That's what you had in mind, yes?
Right, that would render it disabled. I see what you mean. You want the user to be forced to use the arrows, rather than being able to type in their own number?
Michael L.
@mlyonstudent
Sep 24 2015 04:04
Hi everyone! First time poster with a question to a bonfire on the .pop function, anyone care to help?
Brandon Mellus
@mels065
Sep 24 2015 04:06
@gjcarrow That's right.
Kathy C
@tamienne
Sep 24 2015 04:09
Thats what you want right?
Gerald James Carrow
@gjcarrow
Sep 24 2015 04:10
I could tell you how to do that dynamically. Using javascript. But I'm not sure there is a way to do that in html or css. Now I'm curious though so let me check it out. Can I ask why you want this particular functionality? You can control the actual numbers that the user types in essentially. With min and max attributes.
Hans van Riet
@hansinla
Sep 24 2015 04:11
@mlyonstudent Yep!
Kathy C
@tamienne
Sep 24 2015 04:12
@mels065 you working on the pomodoro zip line?
Michael L.
@mlyonstudent
Sep 24 2015 04:12
@hansinla Thank you! Forgive me for the ignorance, but how do I post the bonfire I'm having issues with in this chat?
CamperBot
@camperbot
Sep 24 2015 04:12
mlyonstudent sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 390 | @hansinla | http://www.freecodecamp.com/hansinla
Hans van Riet
@hansinla
Sep 24 2015 04:13
wiki format
CamperBot
@camperbot
Sep 24 2015 04:13

:point_right: code formatting [wiki]

Inline code

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

Code Block

```js ⇦ Type 3 backticks, then type js or html and then press [shift + enter ⏎]

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

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

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

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

Brandon Mellus
@mels065
Sep 24 2015 04:14
@tamienne Yep
@gjcarrow I did set min and max values, but it seems that you can still go around them by typing in the number
Gerald James Carrow
@gjcarrow
Sep 24 2015 04:16
Oh, I see. In most browsers, when you press submit you will get an error if you've entered a number out of the range of min and max. You know what I mean?
Kathy C
@tamienne
Sep 24 2015 04:18
There's no point to making it an input field if they can't do anything with it. You can just update the content of a span or div element
navicyclical
@navicyclical
Sep 24 2015 04:18
so I've gotten a little further with the palindrome bonfire, but it's returning just false -
function palindrome(str) {
  // Good luck!
  var palindromes = ["racecar", "eye"];
  str = str.replace(/\s\gi/, "X").toLowerCase();
    for (var i = 0; i=str.length; i++){
      if (str[i] === palindromes){      
        return true;
        } 
      else{ 
          return "false";
      }
    }
}

palindrome("eye");
Gerald James Carrow
@gjcarrow
Sep 24 2015 04:18
Or you can use the input type "range". You've seen that. The little slider.
Kathy C
@tamienne
Sep 24 2015 04:19
Usability-wise I didn't like the arrows to change the time
DTing
@dting
Sep 24 2015 04:19
@navicyclical you are comparing a character to an array
Kathy C
@tamienne
Sep 24 2015 04:19
If I wanted big numbers that would really stink
Rex Schrader
@SaintPeter
Sep 24 2015 04:19
@navicyclical Your regex is formatted wrong. It should look like this: /\s/gi. Also, you should probably just remove the matches, not replace them with 'X'.
@navicyclical you can replace them with a blank string: ''
Kathy C
@tamienne
Sep 24 2015 04:20
@mels065 are you using jquery
DTing
@dting
Sep 24 2015 04:20
you also dont want to hard code the strings into the function you want to create the reverse of the input str and compare that to the input str after stripping all the punctuation and spaces and lower casing it.
Michael L.
@mlyonstudent
Sep 24 2015 04:21
// var numbers = [1,2,3];
// console.log(numbers); // logs [1,2,3]
// var removed = numbers.pop();
// console.log(numbers); // logs [1,2]
// console.log(removed); // logs 3

var myArray = ["John", 23, ["cat", 2]];
// Only change code below this line.
var removed = myArray.pop();
var removed = myArray; // This should be ["cat", 2] and myArray should now be ["John", 23]

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z);})(myArray, removed);
Brandon Mellus
@mels065
Sep 24 2015 04:21
@tamienne Yeah, I'm using jquery. Sorry, I've been a little distracted.
Michael L.
@mlyonstudent
Sep 24 2015 04:22
@hansinla Sorry for the wait, took me a bit to get the format down.
Rex Schrader
@SaintPeter
Sep 24 2015 04:22
@mlyonstudent Rather than adding your own line, just edit the line they have. You've got all the syntax right, but you're doing it "twice". Just reset your code and add the .pop() to myArray
Hans van Riet
@hansinla
Sep 24 2015 04:24
@mlyonstudent Yes, what @SaintPeter said. LOL
Kathy C
@tamienne
Sep 24 2015 04:24
@mels065 that'll make it much easier
Michael L.
@mlyonstudent
Sep 24 2015 04:25
@SaintPeter @hansinla Trying it out now.
@SaintPeter @hansinla I'm baffled by how simple that was made to be and how hard I made it out to be, thanks guys.
CamperBot
@camperbot
Sep 24 2015 04:26
mlyonstudent sends brownie points to @saintpeter and @hansinla :sparkles: :thumbsup: :sparkles:
:warning: mlyonstudent already gave hansinla points
:star: 704 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Sep 24 2015 04:26
@mlyonstudent If it's any consolation, that one trips up a lot of people. It's maybe too confusingly worded.
Gerald James Carrow
@gjcarrow
Sep 24 2015 04:27
@navicyclical That palindrone challenge is a beast. Keep at it. The tests are tricky. It
Brandon Mellus
@mels065
Sep 24 2015 04:27
@tamienne Yeah, I think I know what to do now. Thanks, @tamienne !
CamperBot
@camperbot
Sep 24 2015 04:27
mels065 sends brownie points to @tamienne and @tamienne :sparkles: :thumbsup: :sparkles:
:star: 274 | @tamienne | http://www.freecodecamp.com/tamienne
:star: 274 | @tamienne | http://www.freecodecamp.com/tamienne
navicyclical
@navicyclical
Sep 24 2015 04:28
@camperbot help
Gerald James Carrow
@gjcarrow
Sep 24 2015 04:28
is tough, but you'll get it, and feel a great sense of satisfaction. That one took me forever.
Saad Mehmood
@saadmehmood233
Sep 24 2015 04:29
help
CamperBot
@camperbot
Sep 24 2015 04:29

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

Basic Commands:

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

:speech_balloon: meet CamperBot in this room!

:pencil: read more about camperbot on the FCC Wiki

Saad Mehmood
@saadmehmood233
Sep 24 2015 04:29
@navicyclical :point_up:
Michael L.
@mlyonstudent
Sep 24 2015 04:29
@SaintPeter I'd testify to that, the wording makes me think I was supposed to make a new line of code for the array and add .pop() to the new line instead of the one they already give you.
navicyclical
@navicyclical
Sep 24 2015 04:29
thanks @gjcarrow
CamperBot
@camperbot
Sep 24 2015 04:29
navicyclical sends brownie points to @gjcarrow :sparkles: :thumbsup: :sparkles:
:star: 185 | @gjcarrow | http://www.freecodecamp.com/gjcarrow
navicyclical
@navicyclical
Sep 24 2015 04:29
and thanks @dting
CamperBot
@camperbot
Sep 24 2015 04:29
navicyclical sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1238 | @dting | http://www.freecodecamp.com/dting
Hans van Riet
@hansinla
Sep 24 2015 04:32
@mlyonstudent But then popping the array twice would twice remove the last element of the array.
Michael L.
@mlyonstudent
Sep 24 2015 04:34
@hansinla Exactly what happened as I constantly failed to do this bonfire. Arrays are just a handful of misery.
navicyclical
@navicyclical
Sep 24 2015 04:47
@gjcarrow - is there anything wrong with using an array to hold the values I need to check against?
Gerald James Carrow
@gjcarrow
Sep 24 2015 04:53
Do you mean the array you have there called 'palindromes?;
navicyclical
@navicyclical
Sep 24 2015 04:55
yes
Gerald James Carrow
@gjcarrow
Sep 24 2015 04:57
There isn't anything wrong with it, per se. It isn't serving any purpose as it is now. I suppose you could look at the tests and populate that array with all the test strings they're going to give you, and run a check against that. You could pass the test that way, but it's kind of cheating. You want your function to take any string and return a true if its a palindrome and false if it's not. You are on the right track. Take the palendrome array out of there.
Hans van Riet
@hansinla
Sep 24 2015 04:58
@mlyonstudent Nah, you’ll learn to love them.
Avil
@Avil172
Sep 24 2015 05:02
@Coira i slept early so didn't see your post about the stack overflow,
thanks for the link btw
CamperBot
@camperbot
Sep 24 2015 05:02
avil172 sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:star: 234 | @coira | http://www.freecodecamp.com/coira
Gerald James Carrow
@gjcarrow
Sep 24 2015 05:04
Someone mentioned the regular expression. Have you fixed that syntax? And the second argument to the replace function shouldn't be X but rather an empty space ''. And the call to toLowerCase() is right on. So at that point you have the string that was passed in as an argument. You've taken out any whitespace, and made it all lower case. Now you have to make a copy of it, and reverse that copy. If the copies are === to each other, then it's a palindrome. Two strings that are the same forward and backwards.
Michael Cheung
@m6cheung
Sep 24 2015 05:50
why is that when I run my mouse over one of my p elements it highlights?
Jake Goldstein
@jakegoldstein
Sep 24 2015 05:57
bonfire factorialize
CamperBot
@camperbot
Sep 24 2015 05:57

:fire:Bonfire: Factorialize a Number :link:

function factorialize(num) {
  return num;
}

factorialize(5);

Return the factorial of the provided integer.

more info:  bf details | bf links | hint

Jake Goldstein
@jakegoldstein
Sep 24 2015 05:57
hint
CamperBot
@camperbot
Sep 24 2015 05:57
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Gerald James Carrow
@gjcarrow
Sep 24 2015 05:57
@jakegoldstein recursive functions
@m6cheung The :hover pseudo-class must be set. It may be bootstrap if you're using that.
Jake Goldstein
@jakegoldstein
Sep 24 2015 06:00
yeesh, recursion. never thought about that and I've been trying to only use a for loop this whole time
guess that explains why I was completely stuck
thanks @gjcarrow
CamperBot
@camperbot
Sep 24 2015 06:00
jakegoldstein sends brownie points to @gjcarrow :sparkles: :thumbsup: :sparkles:
:star: 186 | @gjcarrow | http://www.freecodecamp.com/gjcarrow
Michael Cheung
@m6cheung
Sep 24 2015 06:05
@gjcarrow how do I disable the hover?
Gerald James Carrow
@gjcarrow
Sep 24 2015 06:08
If you can find it in the stylesheet just delete it. If you can't find it, you can create a new style rule for it. So let's say the text is black, and when you hover it turns red. It's hard without any context to tell you the best way to do it. A quick fix would be to go to your stylesheet and make this rule:
p:hover { color: black; }
Or whatever the color the text is. Does that make sense?
Rhys Powell
@rhyspowell
Sep 24 2015 06:12
Hi guys looking for help on Seek and destroy
it might just be me being very tired this morning but I thought that when the function was called all items would be passed into the function
so destroyer([0, 2, 3, 1, 2, 3], 2, 3, "");
Gerald James Carrow
@gjcarrow
Sep 24 2015 06:13
@rhyspowell I literally just did that one.
jjb1990
@jjb1990
Sep 24 2015 06:13
hint bonfire:palindrome
CamperBot
@camperbot
Sep 24 2015 06:13
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Rhys Powell
@rhyspowell
Sep 24 2015 06:14
would send the array and then the values after it, all I'm seeing is the array
SojournerOctocat
@SojournerOctocat
Sep 24 2015 06:14
@rhyspowell Paste your code?
Gerald James Carrow
@gjcarrow
Sep 24 2015 06:14
Yeah, all 4 of those arguments are passed into the function.
Rhys Powell
@rhyspowell
Sep 24 2015 06:14
@gjcarrow Cool, then its me being daft then
SojournerOctocat
@SojournerOctocat
Sep 24 2015 06:14
help format
CamperBot
@camperbot
Sep 24 2015 06:14

:point_right: code formatting [wiki]

Inline code

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

Code Block

```js ⇦ Type 3 backticks, then type js or html and then press [shift + enter ⏎]

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

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

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

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

Rhys Powell
@rhyspowell
Sep 24 2015 06:17

`
function destroyer(arr) {
// Remove all the values
// function filtered(obj) {
// for (i = 1; i < arr.arguments.length; i++) {
// console.log(obj);
// return val !== arr.arguments[i];
// };
// }

// var array = arr[0];
console.log(arr);
// console.log(array);
// var newarray = array.filter(filtered);
// return newarray;
}

destroyer([0, 2, 3, 1, 2, 3], 2, 3, "");
`

so in the console I would expect to be seeing [0, 2, 3, 1, 2, 3], 2, 3, "" but I'm just getting
Should be displaying bad tests
(program):11 [0, 2, 3, 1, 2, 3]
Gerald James Carrow
@gjcarrow
Sep 24 2015 06:19
Javascript is a little different in the sense that you can send in as many arguments as you want, even if it only calls for one. But functions are objects, and they have an arguments property. It's like an array, but not really an array. It has a length property. But you can't use regular array methods on it like indexOf or filter()
SojournerOctocat
@SojournerOctocat
Sep 24 2015 06:20
@rhyspowell I don't know why it's doing that. And I'm not sure how to fix it. I tried console.log(arguments) and got a more complete answer, given as objects.
Gerald James Carrow
@gjcarrow
Sep 24 2015 06:21
You need access to those other arguments that are being passed in. The way to access them is with that arguments object.
Try doing console.log(arguments[1]) or arguments[2]
Rhys Powell
@rhyspowell
Sep 24 2015 06:21
so you can't call it like you would an array ie arr1 to get the first filter?
cool, I can see
Gerald James Carrow
@gjcarrow
Sep 24 2015 06:22
The same way you would access an arrays elements, you can access the elements in the arguments object. (It's technically not an object.It's a node list).
Rhys Powell
@rhyspowell
Sep 24 2015 06:23
hmmm a little bit different from what I am used to but all good, thank you very much :)
CamperBot
@camperbot
Sep 24 2015 06:23
if you want to thank someone, put an @ before their name!
Gerald James Carrow
@gjcarrow
Sep 24 2015 06:24
In ES6, there is a simple way to transform that arguments object into a real array. The way to do it now, though, is like this:
Rhys Powell
@rhyspowell
Sep 24 2015 06:24
thanks @gjcarrow @SojournerOctocat
CamperBot
@camperbot
Sep 24 2015 06:24
rhyspowell sends brownie points to @gjcarrow and @sojourneroctocat :sparkles: :thumbsup: :sparkles:
:star: 325 | @sojourneroctocat | http://www.freecodecamp.com/sojourneroctocat
:star: 188 | @gjcarrow | http://www.freecodecamp.com/gjcarrow
Gerald James Carrow
@gjcarrow
Sep 24 2015 06:25
var args = Array.prototype.slice.call(arguments)
If you do that, then args will be a regular array so it might be less confusing. Gotta split now, glad I could help...
Rhys Powell
@rhyspowell
Sep 24 2015 06:26
:thumbsup:
Jorge Sagastume
@HorgeJ
Sep 24 2015 06:34
im getting an "unexpected token" message in the Java Script section waypoint 39, anyone else have this issue?
navicyclical
@navicyclical
Sep 24 2015 06:34

@gjcarrow here's the latest iteration of my code:

```js

err
function palindrome(str) {
  // Good luck!
  str = string.replace(/\s/gi'').toLowerCase();
  var reverseString = str.reverse();
  if (str === reverseString && reverseString === str){
  return true;
  }
  else
    {
      return false;
    }
}



palindrome("eye");
jjb1990
@jjb1990
Sep 24 2015 06:37
hello
Gerald James Carrow
@gjcarrow
Sep 24 2015 06:38
@navicyclical You're getting there. You've got the right idea. In the replace function, you're just missing a comma. str.replace(/\s/gi,'')
jjb1990
@jjb1990
Sep 24 2015 06:39
@navicyclical why are you using &&?
Gerald James Carrow
@gjcarrow
Sep 24 2015 06:39
And there is no reverse() method for strings. So you will get an error there calling str.reverse()
jjb1990
@jjb1990
Sep 24 2015 06:39
in the if statement?
DTing
@dting
Sep 24 2015 06:42
You can refer to the earlier bonfire, reverse a string for how to reverse the string
bf reverse
CamperBot
@camperbot
Sep 24 2015 06:42

:fire:Bonfire: Reverse a String :link:

function reverseString(str) {
  return str;
}

reverseString('hello');

Reverse the provided string.

more info:  bf details | bf links | hint

Gerald James Carrow
@gjcarrow
Sep 24 2015 06:44
Right, the && conditional is superfluous. You won't need that. But you've got the right idea. Just work out the kinks. I took the string and used the split('') method on it to convert it to an array. Arrays have a reverse() method. So split the string, it becomes an array, reverse that, and use the join() method to make it a string again.
navicyclical
@navicyclical
Sep 24 2015 06:47
@gjcarrow, I'll have another lick at this tomorrow. It's getting close to bed time for me.
Gerald James Carrow
@gjcarrow
Sep 24 2015 07:01
@navicyclical Sometimes the best thing to do when you're having a hard time with this stuff is to walk away from it and go back to it later with a clear head. You're on the right track, though, so don't give up. You'll get there.
Avil
@Avil172
Sep 24 2015 07:07
hi.. can anyone tell me the correct format for form submission link
which one of these is correct?
<form action="/www.yourwebsite.com">
<form action="www.yourwebsite.com">
<form action="http://www.yourwebsite.com">
venson7
@venson7
Sep 24 2015 07:11

hello! anyone could help me with Bonfire: Exact Change?
here is my code:

function drawer(price, cash, cid) {
  var change = cash-price;
  var changeArr = [];
  var times;


  switch(true){
    case(change>=100.00):
      times = Math.floor(change/100.00);
      if(times*100.00<=cid[8][1]){
        cid[8][1] -= times*100.00;
      }else{
        times= Math.floor(cid[8][1]/100.00);
        cid[8][1] = 0;
      }
      change -= times*100;
      if(times>0){
        changeArr.push([cid[8][0], times*100.00]);
      }

    case(change>=20.00):
      times = Math.floor(change/20.00);
      if(times*20.00<=cid[7][1]){
        cid[7][1] -= times*20.00;
      }else{
        times= Math.floor(cid[7][1]/20.00);
        cid[7][1] = 0;
      }
      change -= times*20;
      if(times>0){
        changeArr.push([cid[7][0], times*20.00]);
      }

    case(change>=10.00):
      times = Math.floor(change/10.00);
      if(times*10.00<=cid[6][1]){
        cid[6][1] -= times*10.00;
      }else{
        times= Math.floor(cid[6][1]/10.00);
        cid[6][1] = 0;
      }

      change -= times*10.00;
      if(times>0){
        changeArr.push([cid[6][0], times*10.00]);
      }

    case(change>=5.00):
      times = Math.floor(change/5.00);
      if(times*5.00<=cid[5][1]){
        cid[5][1] -= times*5.00;  
      }else{
        times= Math.floor(cid[5][1]/5.00);
        cid[5][1] = 0;
      }
      change -= times*5.0;
      if(times>0){
        changeArr.push([cid[5][0], times*5.00]);
      }

    case(change>=1.00):
      times = Math.floor(change/1.00);
      if(times*1.00<=cid[4][1]){
        cid[4][1] -= times*1.00;  
      }else{
        times= Math.floor(cid[4][1]/1.00);
        cid[4][1] = 0;
      }
      change -= times*1.0;
      if(times>0){
        changeArr.push([cid[4][0], times*1.00]);
      }
    case(change>=0.25):
      times = Math.floor(change/0.25);
      if(times*0.25<=cid[3][1]){
        cid[3][1] -= times*0.25;  
      }else{
        times= Math.floor(cid[3][1]/0.25);
        cid[3][1] = 0;
      }
      change -= times*0.25;
      if(times>0){
        changeArr.push([cid[3][0], times*0.25]);
      }

    case(change>=0.10):
      times = Math.floor(change/0.10);
      if(times*0.10<=cid[2][1]){
        cid[2][1] -= times*0.10;  
      }else{
        times= Math.floor(cid[2][1]/0.10);
        cid[2][1] = 0;
      }
      change -= times*0.10;
      if(times>0){
        changeArr.push([cid[2][0], times*0.10]);
      }

    case(change>=0.05):
      times = Math.floor(change/0.05);
      if(times*0.05<=cid[1][1]){
        cid[1][1] -= times*0.05;  
      }else{
        times= Math.floor(cid[1][1]/0.05);
        cid[1][1] = 0;
      }
      change -= times*0.05;
      if(times>0){
        changeArr.push([cid[1][0], times*0.05]);
      }

    case(change>=0.01):
      times = Math.floor(change/0.01);
      if(times*0.01<=cid[0][1]){
        cid[0][1] -= times*0.01;  
      }else{
        times= Math.floor(cid[0][1]/0.01);
        cid[0][1] = 0;
      }
      change -= times*0.01;
      if(times>0){
        changeArr.push([cid[0][0], times*0.01]);
      }

    }
    console.log(cid);
    if(change>0){
      return "Insufficient Funds";
    }else if(isEmpty(cid)){
      console.log("here");
      return "Closed";
    }else{
      console.log(changeArr);
      return changeArr;
    }
  }


function isEmpty(arr){
  for(var i=0;i<arr.length;i++){
    if(arr[i][1] != 0){
      return false;
    }
  }
  return true;
}

I have problem with fifth assertion, the one that calls:

drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['TWENTY', 60.00], ['TEN', 20.00], ['FIVE', 15], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ]
Joseph Miller
@joemillervi
Sep 24 2015 07:13
@Avil172 I would use the last one as it is a complete url
Avil
@Avil172
Sep 24 2015 07:14
@jobo440 thanks
can you tell me if the first one is correct?
CamperBot
@camperbot
Sep 24 2015 07:14
avil172 sends brownie points to @jobo440 :sparkles: :thumbsup: :sparkles:
:star: 229 | @jobo440 | http://www.freecodecamp.com/jobo440
Joseph Miller
@joemillervi
Sep 24 2015 07:37
@Avil172 I believe that putting the '/' first will make your browser look locally for a file in the root directory
Avil
@Avil172
Sep 24 2015 07:39
@jobo440 but this(http://freecodecamp.com/challenges/waypoint-create-a-form-element) states that the first one should be the correct method.
so what's the difference between the first one and the third one?
the 3rd one won't look into the local directory?
DTing
@dting
Sep 24 2015 07:42
@venson7 your test case isnt passing due to floating point inaccuracy. You should probably deal with cents rather than dollars or use .toFixed
venson7
@venson7
Sep 24 2015 08:00
@dting thanks!
venson7
@venson7
Sep 24 2015 08:05
@dting What's the meaning of the second array? If you see the function call (assertion) from my previous post, there is another change array, separated with comma after the function call
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 08:20

I don't know what the Arguments Option Bonfire means by this:

"If only one argument is provided, then return a function that expects one argument and returns the sum.

For example, add(2, 3) should return 5, and add(2) should return a function.

Calling this returned function with a single argument will then return the sum:

var sumTwoAnd = add(2);

sumTwoAnd(3) returns 5."

I'm confused. If there's only one argument...2....where does the 3 comes from?

I've been looking at this for 2-3 days now...Googling...and I still don't know what I'm supposed to do.
Jérémy Diallo
@jeremyid
Sep 24 2015 09:19
Hi, is anyone available for help on a javascript issue ?
casielane
@casielane
Sep 24 2015 09:41
Hi Experience111, on some atm. What seems to be the problem
Jérémy Diallo
@jeremyid
Sep 24 2015 09:44

Hi @casielane , I'm trying to make this code work :

function World(map, legend) {
    var grid = new Grid(map[0].length, map.length);
    this.grid = grid;
    this.legend = legend;
    //Fill the grid with elements
    map.forEach(function(line, y) {
        //The callback is called with two arguments : the value of the element and the index of the element
        for (var x=0; x < line.length; x++)
            grid.set(new Vector(x,y), elementFromChar(legend, line[x]));
    });
}

But the console tells me that grid.set is not a function, while I defined the method earlier in my code :

Grid.prototype.set = function(vector, value) {
    this.space[vector.x + this.width * vector.y] = value;
};

And I should also provide the Grid and Vector constructors :

function Vector(x, y) {
    this.x = x;
    this.y = y;
};

function Grid(width, height) {
    this.space = new Array(width * height);
    this.width = width;
    this.height = height;
}

What could be wrong ?

CamperBot
@camperbot
Sep 24 2015 09:44

welcome to FreeCodeCamp @Experience111!

Michael Cheung
@m6cheung
Sep 24 2015 09:48
anyone here? I need some help with the personal portfolio project
Roy
@CruelCoin
Sep 24 2015 09:55
Can i sue the array.filter() method with regex to search for strings? Or is it usefull only for numbers?
casielane
@casielane
Sep 24 2015 09:55
@Experience111 I'm not sure. I think it's over my head at the moment. :( I'm sorry I can't be of any help
Roy
@CruelCoin
Sep 24 2015 09:58

Another question: I sometimes see code like "return values less than 6" written like this:

return val <= 5

as opposed to written like this:

return val < 6

Which is better code? It seems to me that the <6 method is more explicit?

Richard Vankoningsveld
@richyvk
Sep 24 2015 10:14
Brilliant explanation of falsy thanks @dting "That challenge is kind of a trick question. If you take a look at https://developer.mozilla.org/en-US/docs/Glossary/Falsy
you will see that all the values they want you to return false for themselves are falsy
the Array.filter function will evaluate your returned value from the callback for truthy or falsy so you dont even need a conditional in your filterfalse function. you just need to return the value"
CamperBot
@camperbot
Sep 24 2015 10:14
richyvk sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1241 | @dting | http://www.freecodecamp.com/dting
Richard Vankoningsveld
@richyvk
Sep 24 2015 10:15
@CruelCoin < is less than, <= is less than or equal to
Kainau
@Kainau
Sep 24 2015 11:02
function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  return arr.filter(function(value){
    return [false, null, 0, "", undefined, NaN].indexOf(value)==-1;
  });
}

bouncer([7, "ate", "", false, 9], "");
this answer of mine for Falsy Bouncer doesn't seem to work some how. Could any one help me to find the problem?
CamperBot
@camperbot
Sep 24 2015 11:02
:bulb: to format code use backticks! ``` more info
Gilean
@Gilean
Sep 24 2015 11:54
Guys, I almost broke my head with Twitch.tv API. Is there any examples or additional information about how to use that Request-Response thing?
tva10
@tva10
Sep 24 2015 12:13
@Gilean You can search that for example on codepen.io
Katie
@Katie-S
Sep 24 2015 12:36
So, maybe I'll find out the answer as I go along, but I've just done the problem in js chapter regarding how you can use pop() to remove a portion of an array?(forgive my forgetfulness), but my question is, what exactly specifies how much or what exactly is removed or "popped" from the array?
tva10
@tva10
Sep 24 2015 12:38
@Katie-S Look around stack in google...
.pop() removes last element of an array and returns them.
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 12:40

I don't know what the Arguments Option Bonfire means by this:

"If only one argument is provided, then return a function that expects one argument and returns the sum.
For example, add(2, 3) should return 5, and add(2) should return a function.
Calling this returned function with a single argument will then return the sum:
var sumTwoAnd = add(2);
sumTwoAnd(3) returns 5."

I'm confused. If there's only one argument...2....where does the 3 comes from?
I've been looking at this for 2-3 days now...Googling...and I still don't know what I'm supposed to do.

tva10
@tva10
Sep 24 2015 12:40
@Katie-S
arr =[1,2,3,4,5];
arr.pop();  // -->5,   arr=[1,2,3,4];
arr.pop();  // -->4,   arr=[1,2,3];
arr.push(12); // arr=[1,2,3,12];
@TheHighPriestess they mean that you should return a function, which has an argument, which you can sum
@TheHighPriestess the answer will be like this sum(5)(3) //--> 8
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 12:45
@tva10 I confused about where the other number comes from.
I call a function like this: sum(2)(3) ?? I've never seen this before.
tva10
@tva10
Sep 24 2015 12:46
@TheHighPriestess there is one test case expect(add(2)(3)).to.equal(5);
which check your returned function
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 12:46
I know...but what does that mean? How can one argument return a sum?
I'm almost ready to look at the answer because I don't understand the question.
tva10
@tva10
Sep 24 2015 12:47
@TheHighPriestess If I know I see that in Eloquent JavaScript book
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 12:47
yeah?
tva10
@tva10
Sep 24 2015 12:47
but can not find that now (
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 12:47
hmm
tva10
@tva10
Sep 24 2015 12:47
give me a minute
I whant to find that
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 12:48
higher-order functions???
tva10
@tva10
Sep 24 2015 12:48
yes
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 12:49
ok...thank you @tva10 I will read about it and hope that this clears everything up.
CamperBot
@camperbot
Sep 24 2015 12:49
thehighpriestess sends brownie points to @tva10 :sparkles: :thumbsup: :sparkles:
:star: 246 | @tva10 | http://www.freecodecamp.com/tva10
tva10
@tva10
Sep 24 2015 12:49
@TheHighPriestess there is an Higher-order functions part in Higher-order functions
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 12:49
ok
tva10
@tva10
Sep 24 2015 12:50
near noisy example...
@TheHighPriestess but that task is easy...
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 12:52
ok
tva10
@tva10
Sep 24 2015 12:53
@TheHighPriestess I mean that part of task like this: If you have one argument you need to save it in other function and return that func. And after, that function will be eval with any argument....
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 12:57
ok
Zoltan Biber
@zoltanbiber
Sep 24 2015 13:11
This message was deleted
Robert Richey
@0x0936
Sep 24 2015 13:13
@zoltanbiber missing bracket notation for arguments1, should be arguments[1] although your code probably is correct in this regard and it just didn't parse correctly in chat
tva10
@tva10
Sep 24 2015 13:13
@zoltanbiber first that I see is that: if (Number.isInteger(arguments0) === false || Number.isInteger(arguments1) === false) this is equal if (!Number.isInteger(arguments0)|| !Number.isInteger(arguments1))
Mike Doubintchik
@allurewebsolutions
Sep 24 2015 14:41
For the palindrome problem, they are claiming that the following string is a palidrome: 0_0 (: /-\ :) 0-0
"0_0 (: /-\ :) 0-0"
Kiki
@kststudio
Sep 24 2015 14:42
Hello everyone! First time on Gitter. Is there anyone available for a simple AngularJS questions?
Jordan Bourne
@JordanBourne
Sep 24 2015 14:47
@allurewebsolutions It's not exactly a palindrome, but your program is supposed to emit all special characters such as _)/: etc in which case it will be one
Mike Doubintchik
@allurewebsolutions
Sep 24 2015 14:50
Thanks @JordanBourne!
CamperBot
@camperbot
Sep 24 2015 14:50
allurewebsolutions sends brownie points to @jordanbourne :sparkles: :thumbsup: :sparkles:
:star: 179 | @jordanbourne | http://www.freecodecamp.com/jordanbourne
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 14:50

I'm trying to do something like this. However, it's giving me "23" instead of 5. Obvously, it's because one of them is an array. How can I get this to add to 5?

var test = 2+[3];
console.log(test);

i've tried this: x[0] and that doesn't work.
Mateja Trifunovski
@Matko95
Sep 24 2015 14:56
@TheHighPriestess you could do something like this
var test=2+parseInt([3]);//it returns 5
//or if you use a float number
var test=2+parseFloat([3]);
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 14:57
@Matko95 ah...ok...thank you
CamperBot
@camperbot
Sep 24 2015 14:57
thehighpriestess sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 363 | @matko95 | http://www.freecodecamp.com/matko95
Mateja Trifunovski
@Matko95
Sep 24 2015 14:58
@TheHighPriestess but it will only work if the array has only 1 element though
Star Cherrix
@Sparklepaws
Sep 24 2015 14:59

Alright friends, I have another question! I was working on a bonfire and this code passes the requirements:

function destroyer(arr) {
  var newArr = [];
    for(i = 1; i < arguments.length; i++){
    newArr.push(arguments[i]);
  }
  return arr.filter(function(stuff){
   if(newArr.indexOf(stuff) >= 0){
     return false; 
  } else {
    return true;
  }
 });
}

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

Now, I understand everything going on here, but what I don't understand is this line

if(newArr.indexOf(stuff) >= 0)

Why are we checking to see if it's >= 0?

Mateja Trifunovski
@Matko95
Sep 24 2015 15:00
@Sparklepaws The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.
@TheHighPriestess this also works though, and it's more straightforward and simpler
var x=[3];
var test= 2+x[0];
console.log(test);
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:02
@Matko95 actually...I'm just totally confused lol
function add() {

 arg1 = arguments[0];
 arg2 = arguments[1]; 

 if (arguments.length === 1 && typeof arg1 === 'number'){

     return function(arg){

        var sumup = arg1+arg;
        return sumup;
    }

 }

 else if(isNum(arg1) && isNum(arg2)) {

    return arg1 + arg2;

 } else if(isNum(arg1) && !isNum(arg2)) {
     console.log("one of these is not a number");
   return;

 } else if(!isNum(arg1)) {
     console.log("this is not a number");
   return;

 } 


}

add(2,[3]);

function isNum(num) {
   return typeof num === 'number';
}

function oneArg(arg){
    console.log("ask 4 number");
}
Mateja Trifunovski
@Matko95
Sep 24 2015 15:02
@TheHighPriestess why? :D
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:02
see my code
it passes all the tests except the one there...with the [3]
and i'm stuck..
i'm not sure what to do
Mateja Trifunovski
@Matko95
Sep 24 2015 15:04
did you check if your isNum works?
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:04
it does
Star Cherrix
@Sparklepaws
Sep 24 2015 15:04
@Matko95 Ahh I see, so it's making sure it's only working if -1 isn't present. Can I also ask, how does returning "false" and "true" filter through the necessary items? I guess I'm not seeing how filter is managing to use the function to remove items from the array.
Mateja Trifunovski
@Matko95
Sep 24 2015 15:06
@Sparklepaws Ok so filter tests every element if they pass a test, it makes a new array, and if it evaluates to true it pushes that element, when it's false, it discards it
Star Cherrix
@Sparklepaws
Sep 24 2015 15:07
@Matko95 OH got it! Damn, filter does so much. Thank you!
CamperBot
@camperbot
Sep 24 2015 15:07
sparklepaws sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 364 | @matko95 | http://www.freecodecamp.com/matko95
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:07
@Matko95 well...obviously it's picking up the fact that [3] is not a number
but that's correct...from the bonfire instructions, I think
Mateja Trifunovski
@Matko95
Sep 24 2015 15:08
@TheHighPriestess what is that bonfire?
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:08
@Matko95 Arguments Optional
It tells me: "expect(add(2)([3])).to.be.undefined;expected '23' to be undefined"
but isn't that what return; by itself returns....undefined???
...and it's not adding the 2 numbers...to "23"....
but the bonfire says that it is
Mateja Trifunovski
@Matko95
Sep 24 2015 15:13
@TheHighPriestess
function add() {

 arg1 = arguments[0];
 arg2 = arguments[1]; 

 if (arguments.length === 1 && typeof arg1 === 'number'){

     return function(arg){

        var sumup = arg1+arg;
        return sumup;
    }

 }

 else if(isNum(arg1) && isNum(arg2)) {

    return arg1+arg2;

 } else if(isNum(arg1) && !isNum(arg2)) {
     console.log("one of these is not a number");
   return undefined;

 } else if(!isNum(arg1)) {
     console.log("this is not a number");
   return undefined;

 } 


}

add(2,[3]);

function isNum(num) {
   return typeof num === 'number';
}

function oneArg(arg){
    console.log("ask 4 number");
}
could you try this?
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:13

function add() {

arg1 = arguments[0];
arg2 = arguments1;

if (arguments.length === 1 && typeof arg1 === 'number'){

 return function(arg){

    var sumup = arg1+arg;
    return sumup;
}

}

else if(isNum(arg1) && isNum(arg2)) {

return arg1 + arg2;

} else if(isNum(arg1) && !isNum(arg2)) {
console.log("one of these is not a number");
return;

} else if(!isNum(arg1)) {
console.log("this is not a number");
return;

}

}

add((2),[3]);

function isNum(num) {
return typeof num === 'number';
}

Ariel
@ArielLeslie
Sep 24 2015 15:13
@TheHighPriestess What the test case is telling you is that your function returned 23 when it should have returned undefined
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:14

@ArielLeslie yes

@Matko95 I get the same response

Sorry for the mess with the code above...I tried to get rid of it

So...what I have is:

function add() {

 arg1 = arguments[0];
 arg2 = arguments[1]; 

 if (arguments.length === 1 && typeof arg1 === 'number'){

     return function(arg){

        var sumup = arg1+arg;
        return sumup;
    }

 }

 else if(isNum(arg1) && isNum(arg2)) {

    return arg1 + arg2;

 } else if(isNum(arg1) && !isNum(arg2)) {
     console.log("one of these is not a number");
   return;

 } else if(!isNum(arg1)) {
     console.log("this is not a number");
   return;

 } 


}

add((2),[3]);

function isNum(num) {
   return typeof num === 'number';
}
The message "one of these is not a number" gets printed....but it should then return undefined
Bonfire error message is: "expect(add(2)([3])).to.be.undefined;expected '23' to be undefined"
CamperBot
@camperbot
Sep 24 2015 15:18
Sorry, can't find a bonfire called error message is expectadd23tobeundefinedexpected 23 to be undefined. [ Check the map? ]
Mateja Trifunovski
@Matko95
Sep 24 2015 15:18
@TheHighPriestess when i run it in JSBin it returns undefined
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:19
on repl.it it must be as well...because it prints out that message
Just a sec and I'll make a screenshot of the Bonfire
Mateja Trifunovski
@Matko95
Sep 24 2015 15:20
@TheHighPriestess I know, i tested it on FCC, and it doesn't work
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:22
@Matko95 ...and isn't FCC saying that it returns undefined? That's what I get.
Mateja Trifunovski
@Matko95
Sep 24 2015 15:22
@TheHighPriestess no, It's saying that you are getting 23, instead of undefined
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:23
@Matko95 it says "undefined" though...above that
i don't know how to post a screenshot here
but under "reset" "pair" "bug" etc...it says "undefined"
Mateja Trifunovski
@Matko95
Sep 24 2015 15:24
@TheHighPriestess hmm i see...
Jordan Bourne
@JordanBourne
Sep 24 2015 15:25

Bonfire: Repeat a string

function repeat(str, num) {
  // repeat after me
  var strAns = [""];
  if(num > 0) {
    for(var i = 0; i < num; i++){
      strAns.push(str);
    }
    return strAns.join("");
  }
  return strAns;
}

repeat("abc", -2, "");

Can someone tell me why this answer is unsatisfactory?

CamperBot
@camperbot
Sep 24 2015 15:25
Sorry, can't find a bonfire called repeat a stringjsfunction repeatstr num repeat after me var strans ifnum 0 forvar i 0 i num i stranspushstr return stransjoin return stransrepeatabc -2 can someone tell me why this answer is unsatisfactory. [ Check the map? ]
Jordan Bourne
@JordanBourne
Sep 24 2015 15:25
Bonfire: repeat a string
CamperBot
@camperbot
Sep 24 2015 15:25

:fire:Bonfire: Repeat a string repeat a string :link:

function repeat(str, num) {
  // repeat after me
  return str;
}

repeat('abc', 3);

Repeat a given string (first argument) n times (second argument). Return an empty string if n is a negative number.

more info:  bf details | bf links | hint

Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:27
@Matko95 could it be a bug?
Oliver Mensah
@OMENSAH
Sep 24 2015 15:27
Mateja Trifunovski
@Matko95
Sep 24 2015 15:27
@TheHighPriestess it could, because it logs "one of these is not a number" and returns undefined
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:28
Mateja Trifunovski
@Matko95
Sep 24 2015 15:30
@TheHighPriestess something is wrong here definently, when you try to log all the returns, it displays 2 bad tests
Coira Ellison
@Coira
Sep 24 2015 15:32
@TheHighPriestess you don't check whether arg in your returned function is a number
Mateja Trifunovski
@Matko95
Sep 24 2015 15:33
@Coira good job :)
Coira Ellison
@Coira
Sep 24 2015 15:33
@TheHighPriestess also, you might need to add var to arg1 = arguments[0]; and arg2, but i don't know if that makes a difference
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:33
@Coira where shuld that check go? i'm really confused now
Mateja Trifunovski
@Matko95
Sep 24 2015 15:34
@TheHighPriestess
function add() {

 var arg1 = arguments[0];
 var arg2 = arguments[1]; 

 if (arguments.length === 1 && typeof arg1 === 'number'){

     return function(arg){
       if(typeof(arg)==='number')
       return arg1+arg;
    }

 }
 else if(arguments.length>1){

        if(isNum(arg1) && isNum(arg2)) {

          return arg1+arg2;

       } else if(isNum(arg1) && !isNum(arg2)) {
           console.log("one of these is not a number");
           return;

         } else if(!isNum(arg1)) {
           console.log("this is not a number");
             return;

         } 
}

}

add((2),[3]);

function isNum(num) {
   return typeof num === 'number';
}
this definently works
Coira Ellison
@Coira
Sep 24 2015 15:34
^ ^ :)
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:34
@Coira aaahh.......thank you.
CamperBot
@camperbot
Sep 24 2015 15:34
thehighpriestess sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:star: 235 | @coira | http://www.freecodecamp.com/coira
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:34
so close and yet so far again LOL
I know that those instructions were on the wiki....
to make that check
the concept is confusing though...because it's new for me
Mateja Trifunovski
@Matko95
Sep 24 2015 15:37
Well, you were close :D
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:37
I was reading Eloquent Javascript...to figure it out. I came really close, yeah
Coira Ellison
@Coira
Sep 24 2015 15:37
yep, it was just a little thing you were missing really
Elizabeth Hatleli
@TheHighPriestess
Sep 24 2015 15:40
@Matko95 @Coira thank you
CamperBot
@camperbot
Sep 24 2015 15:40
thehighpriestess sends brownie points to @matko95 and @coira :sparkles: :thumbsup: :sparkles:
:warning: thehighpriestess already gave coira points
:warning: thehighpriestess already gave matko95 points
Avil
@Avil172
Sep 24 2015 15:45
hi.. can anyone tell me what does "form-control" do, aside from lengthening the text field box?(bootstrap question)
Jason Wood
@catapixel
Sep 24 2015 15:49
Has anyone successfully completed "Waypoint: Manage Packages with NPM" step 11 "Dist Tag" recently? I'm getting E404, see a bunch of other people have complained about the same issue, and nothing I'm doing (including the special instructions in the waypoint) is resolving it. Really getting frustrated... :frowning:
Nareg Khoshafian
@nkhoshaf
Sep 24 2015 15:53
Hey guys I would love some help for the Pomodoro clock
cole570
@cole570
Sep 24 2015 15:58
Hi, I'm working on the Bonfire: Title Case a sentence. Here's the code I have so far:

function titleCase(str) {
str = str.split(' ');
str = str.map(function(){
str.String.charAt(0).toUpperCase();
})

str = str.join(' ');

return str;
}

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

The error I'm getting is: "Cannot read property 'charAt' of undefined"
Jordan Bourne
@JordanBourne
Sep 24 2015 16:05
For the String.charAt() function, you replace "String" with the name of your string variable
Mateja Trifunovski
@Matko95
Sep 24 2015 16:06
@cole570 you wrote str.String.charAt(0) , remove the String
cole570
@cole570
Sep 24 2015 16:08
oh ok thank you guys!
CamperBot
@camperbot
Sep 24 2015 16:08
if you want to thank someone, put an @ before their name!
cole570
@cole570
Sep 24 2015 16:09
@Matko95 @JordanBourne Thanks so much!
CamperBot
@camperbot
Sep 24 2015 16:09
cole570 sends brownie points to @matko95 and @jordanbourne :sparkles: :thumbsup: :sparkles:
:star: 365 | @matko95 | http://www.freecodecamp.com/matko95
:star: 184 | @jordanbourne | http://www.freecodecamp.com/jordanbourne
PersonUvInterest0709
@PersonUvInterest0709
Sep 24 2015 16:48
I need help sizing an image with the css property "width"
Pandapro720
@Pandapro720
Sep 24 2015 16:48
I need help with what I'm doing
Mark
@markwright174
Sep 24 2015 16:50
@PersonUvInterest0709 @Pandapro720 Can you be more specific?
PersonUvInterest0709
@PersonUvInterest0709
Sep 24 2015 16:51
I do not know where to place the class needed to size an image in my code
Mark
@markwright174
Sep 24 2015 16:52
@PersonUvInterest0709 Have you looked through this? http://www.w3schools.com/tags/tag_img.asp
Alan Wilson
@nulland
Sep 24 2015 16:52
Could someone please help me with
PersonUvInterest0709
@PersonUvInterest0709
Sep 24 2015 16:54
@markwright174 yes, i need to use the class "smaller-image though" where do i plug that element class in?
"smaller-image" though
Mark
@markwright174
Sep 24 2015 16:55
@PersonUvInterest0709 So you mean you want to put the class in the tag, and then size it via a css stylesheet? If so it would look something like <img class="smaller-image" src="...
Kiki
@kststudio
Sep 24 2015 16:56

I am currently learning Angularjs and I have completed/ watch a few tutorials online and I get the overall concept of the language. I am working on a project for work where I have a huge search form with a bunch of input and checkboxes where they can search through our database of contacts. After the user selects the requirements of what they are searching for (ex: company name, city, and state), the results will show up in a list on a new page.

I know how to show the database, how to sort, and how to filter and show the results on the same page under the form (like most tutorials will show you) but I would like to carry the results onto a new page after the user hits submit.

any idea?
PersonUvInterest0709
@PersonUvInterest0709
Sep 24 2015 17:03
I tried plugging the class in but somehow it affected the src and the picture dissappears.
@markwright174
Aaron Markle
@aaronmarkle
Sep 24 2015 17:04
@PersonUvInterest0709 paste the code your using in here, we'll look at it
Aleksander Gębicki
@Takumar
Sep 24 2015 17:04
@PersonUvInterest0709 <img src="image.jpg" class="smaller-image"> or show your code like @aaronmarkle said.
PersonUvInterest0709
@PersonUvInterest0709
Sep 24 2015 17:06
<style> .larger-image { width: 500px; } </style>.
Where would that be inputted? @markwright174
sp plugged in
Aleksander Gębicki
@Takumar
Sep 24 2015 17:08
@PersonUvInterest0709 you put <style> ... </style> section between <head> ... </head> tags.
PersonUvInterest0709
@PersonUvInterest0709
Sep 24 2015 17:09
ok so i input the style inbetween the elemnt id tags?
Aleksander Gębicki
@Takumar
Sep 24 2015 17:10
<html>
<head>
  <style> .larger-image { width:500px; }
  </style>
</head>
<body> <img src="image.jpg" class="larger-image">
</body>
</html>
PersonUvInterest0709
@PersonUvInterest0709
Sep 24 2015 17:12

For example, if we wanted to create a CSS class called larger-image that gave HTML elements a width of 500 pixels, we'd use: <style> .larger-image { width: 500px; } </style>.

Create a class called smaller-image and use it to resize the image so that it's only 100 pixels wide.

Avil
@Avil172
Sep 24 2015 17:12
@PersonUvInterest0709
<style> 
.larger-image { 
width: 500px;
 } 
</style>
<img src="image.jpg" class="larger-image">
PersonUvInterest0709
@PersonUvInterest0709
Sep 24 2015 17:13
Ok create the class within the img src for a reference as well
Avil
@Avil172
Sep 24 2015 17:13
<style> 
.smaller-image { 
width: 100px;
 } 
</style>
<img src="image.jpg" class="smaller-image">
@PersonUvInterest0709
PersonUvInterest0709
@PersonUvInterest0709
Sep 24 2015 17:15
Thank you i understad it alot better now!
CamperBot
@camperbot
Sep 24 2015 17:15
if you want to thank someone, put an @ before their name!
Avil
@Avil172
Sep 24 2015 17:15
@PersonUvInterest0709 you first declare the class and what you want to do with it, like you want to create a smaller-image class with width of 100px,
then you apply that class to your element
@PersonUvInterest0709
src is there to point to the particular image, without src, you can't point to the image(which you want to resize) so, it should be always like
<img src="theimageyouwanttouse.jpg">
Kory J. Campbell
@KoryJCampbell
Sep 24 2015 17:41
What's a good way to keep code readable? I'm in the bootstrap section of the map, and the code is getting quite confusing?
Abhisek Pattnaik
@abhisekp
Sep 24 2015 17:43
@Avil172 nice! :+1:
@KoryJCampbell write short, sweet and beautiful code.
@KoryJCampbell but you can't use that on pure HTML
Avil
@Avil172
Sep 24 2015 17:45

@KoryJCampbell yeah it indeed becomes confusing. i normally keep some spaces between elements to make it look a bit clean.
also, instead of writing something like <style>...</style>, i write..

<style>
...
</style>

this works unless they are nested within each other

@abhisekp you still online?
Abhisek Pattnaik
@abhisekp
Sep 24 2015 17:46
@Avil172 :fire:
Roger K.
@misterhtmlcss
Sep 24 2015 18:02
hey quick question is there a certificate of learning at the end or at each level?
Abhisek Pattnaik
@abhisekp
Sep 24 2015 18:05
@pythonlabsstudent yes! :+1:
wiki cert
CamperBot
@camperbot
Sep 24 2015 18:06

:point_right: free code camp front end development certificate [wiki]

Here's how to earn our verified Front End Development Certificate:

An image of a sample Front End Development Certificate
  1. Complete our Basic Bonfires
  2. Build Zipline: Build a Personal Portfolio Webpage
  3. Build Zipline: Build a Random Quote Machine
  4. Build Zipline: Show the Local Weather
  5. Build Zipline: Build a Pomodoro Clock
  6. Build Zipline: Use the Twitch.tv JSON API
  7. Build Zipline: Stylize Stories on Camper News
  8. Build Zipline: Wikipedia Viewer Incomplete
  9. Build Zipline: Build a JavaScript Calculator
  10. Complete this form
    :pencil: read more about free code camp front end development certificate on the FCC Wiki
Abhisek Pattnaik
@abhisekp
Sep 24 2015 18:06
@pythonlabsstudent :point_up: September 24, 2015 11:36 PM
Matt Anderson
@MDAWebDev
Sep 24 2015 18:18
I'm stuck at the fist Node.js waypoint. Part 11 of the tutorial, adding a dist-tag. It gives this (npm dist-tag add <pkg>@<version> [<tag>]) as an example but I can't figure out what to put in for <pkg> or <tag>.
What are some other dist-tags I can use?
Matt Anderson
@MDAWebDev
Sep 24 2015 18:24
What does pkg specifically refer to?
ITCaseMaker
@ITCaseMaker
Sep 24 2015 18:24

Hi. I stepped away for a couple weeks and seem to have forgotten how to do some elemental things. Right now I'm stuck on Waypoint: Give a Background Color to a Div Element. My solution:

.gray-background {
background-color: gray;
}
right before </style> isn't working. What am I missing, or am I totally off the beam?

Rex Schrader
@SaintPeter
Sep 24 2015 18:26
@ITCaseMaker That is correct, but you ALSO have to add the class attribute to the <div>
ITCaseMaker
@ITCaseMaker
Sep 24 2015 18:27
Thanks, St. Pete. How do I do that again?
CamperBot
@camperbot
Sep 24 2015 18:27
if you want to thank someone, put an @ before their name!
Avil
@Avil172
Sep 24 2015 18:27
@ITCaseMaker you create the gray-background class using style element
then use the class inside your div element like <div class="gray-background"> to give the div elements gray background
Rex Schrader
@SaintPeter
Sep 24 2015 18:27
@ITCaseMaker what @Avil172 said ;)
ITCaseMaker
@ITCaseMaker
Sep 24 2015 18:28
Thanks, @SaintPeter , @Avil172 . But where do I put that again?
CamperBot
@camperbot
Sep 24 2015 18:28
itcasemaker sends brownie points to @saintpeter and @avil172 :sparkles: :thumbsup: :sparkles:
:star: 710 | @saintpeter | http://www.freecodecamp.com/saintpeter
:star: 94 | @avil172 | http://www.freecodecamp.com/avil172
Maxim
@mvr1976
Sep 24 2015 18:28
Hi there!
x34passenger
@x34passenger
Sep 24 2015 18:28
What is a boolean primitive?
Rex Schrader
@SaintPeter
Sep 24 2015 18:28
@ITCaseMaker Look for the <div> in the body of the problem
x34passenger
@x34passenger
Sep 24 2015 18:28
How can something be true and false at the same time?
Rex Schrader
@SaintPeter
Sep 24 2015 18:29
@x34passenger true and false
Matt Anderson
@MDAWebDev
Sep 24 2015 18:29
Has anyone here completed the Node.js waypoints?
Rex Schrader
@SaintPeter
Sep 24 2015 18:29
@x34passenger It can't.
x34passenger
@x34passenger
Sep 24 2015 18:29
@SaintPeter can you explain to me what a boolean primitive is? I didn't find anything on google search
Rex Schrader
@SaintPeter
Sep 24 2015 18:29
@x34passenger Give me some context?
ITCaseMaker
@ITCaseMaker
Sep 24 2015 18:30
SUCCESS!!!
Rex Schrader
@SaintPeter
Sep 24 2015 18:30
This message was deleted
Whoot!
Avil
@Avil172
Sep 24 2015 18:30
<style>
.gray-background {
background-color: gray;
}
</style>
<div class="gray-background">
write h1/p elements here
</div>
@ITCaseMaker
Matt Anderson
@MDAWebDev
Sep 24 2015 18:30
I'll take the lack of response for a no.
Rex Schrader
@SaintPeter
Sep 24 2015 18:30
@MDAWebDev Many have - what's the issue?
x34passenger
@x34passenger
Sep 24 2015 18:30
@SaintPeter Bonfire: Boo who. It says "Boolean primitives are true and false". I don't understand that statement
Matt Anderson
@MDAWebDev
Sep 24 2015 18:31
I'm stuck at the fist Node.js waypoint. Part 11 of the tutorial, adding a dist-tag. It gives this (npm dist-tag add <pkg>@<version> [<tag>]) as an example but I can't figure out what to put in for <pkg> or <tag>.
Maxim
@mvr1976
Sep 24 2015 18:31

I've stuck with the case of verifying of palindrome: function palindrome(str) {

str = str.replace(/\s+/g, '').toLowerCase();
var newStr = str.split("").reverse().join("");

if(str == newStr){
return true;
}else{return false;}

}

console.log(palindrome("eye")); //this code works 100% in code editor, but returns Undefined in the task window. What's wrong with it?

Rex Schrader
@SaintPeter
Sep 24 2015 18:31
@x34passenger Boolean logic is true or false. A 'primitive' is a fundamental building block of a language. There are two keywords:true and false for Boolean values. Boolean is a datatype in Javascript.
@MDAWebDev Let me fire that up and take a look - it'll be a sec
x34passenger
@x34passenger
Sep 24 2015 18:32
@SaintPeter so not a class but a primitive like int and float in java?
Veronica Eulenberg
@HappyViki
Sep 24 2015 18:33
what is this reverseString("hello", ""); called?
Rex Schrader
@SaintPeter
Sep 24 2015 18:33
@x34passenger There are datatypes in Javascript that are similar to int and float (kinda) but they cast a wider net. One of those types is Boolean, which can have one of two values (true/false). In the same way that an int can only be a non-float numeric in JS.
@HappyViki I think that's an error.
x34passenger
@x34passenger
Sep 24 2015 18:34
@SaintPeter It says that one of the cases or tests: boo(false) should return true, instead of false, I don't understand that
Veronica Eulenberg
@HappyViki
Sep 24 2015 18:34
@SaintPeter am i supposed to fix it into an array
Rex Schrader
@SaintPeter
Sep 24 2015 18:35
@MDAWebDev I'm having a hard time figuring out what waypoint you're on.
Veronica Eulenberg
@HappyViki
Sep 24 2015 18:36

@SaintPeter also, why is function reverseString(str) {
return str;
}

reverseString("hello", "");

var arr = [reverseString];

arr.reverse("");

returning "null"?
Rex Schrader
@SaintPeter
Sep 24 2015 18:36
@HappyViki You need to put your code into the function reverseString
Veronica Eulenberg
@HappyViki
Sep 24 2015 18:36
@SaintPeter what do you mean?
Matt Anderson
@MDAWebDev
Sep 24 2015 18:37
It's the npm turoial.
Rex Schrader
@SaintPeter
Sep 24 2015 18:38
@MDAWebDev ok - I have not done that one yet, it's new, but I'm installing it now. I'll let you know ASAP
Matt Anderson
@MDAWebDev
Sep 24 2015 18:38
There are 16 parts. I'm stuck on 11.
Rex Schrader
@SaintPeter
Sep 24 2015 18:38
@HappyViki
function reverseString(str) {
   // CODE GOES HERE, ONLY
return str;
}
reverseString("hello", "");
// Never code here
var arr = [reverseString];
arr.reverse("");
@MDAWebDev understood
Matt Anderson
@MDAWebDev
Sep 24 2015 18:39
I hope someone can figure it out.
Boris
@boris-in-london
Sep 24 2015 18:39
i'm looking for a free javascript IDE
x34passenger
@x34passenger
Sep 24 2015 18:39
Can anyone explain the logic of Bonfire: Boo who, I don't know how most of the test cases result in false
Boris
@boris-in-london
Sep 24 2015 18:39
what do you guys use?
Veronica Eulenberg
@HappyViki
Sep 24 2015 18:39
@SaintPeter whaaat. why not?
x34passenger
@x34passenger
Sep 24 2015 18:40
buy Webstorm
Boris
@boris-in-london
Sep 24 2015 18:40
lol im broke
FREE
x34passenger
@x34passenger
Sep 24 2015 18:40
or if you are on windows, you can use visual studio express
Boris
@boris-in-london
Sep 24 2015 18:40
yeah im on windows
does it have debuging?
and unit testing?
x34passenger
@x34passenger
Sep 24 2015 18:40
@boris-in-london not sure about unit testing but yes on debugging
Rex Schrader
@SaintPeter
Sep 24 2015 18:41
@HappyViki Because that's how these work. The function that you write/modify will be called by the tests. All of your code must be in the function in order to be tested.
Boris
@boris-in-london
Sep 24 2015 18:41
thanks @x34passenger i'll her a try
CamperBot
@camperbot
Sep 24 2015 18:41
boris-in-london sends brownie points to @x34passenger :sparkles: :thumbsup: :sparkles:
:star: 210 | @x34passenger | http://www.freecodecamp.com/x34passenger
Boris
@boris-in-london
Sep 24 2015 18:41
give it a try*
x34passenger
@x34passenger
Sep 24 2015 18:41
macbook is recommended by Quincy Larson however, not windows
Rex Schrader
@SaintPeter
Sep 24 2015 18:41
@boris-in-london Eclipse is ok, I think. Personally, I use Atom for editing JS. I don't use an IDE.
Abhisek Pattnaik
@abhisekp
Sep 24 2015 18:41
@Avil172 .form-control simply makes the width: 100% http://getbootstrap.com/css/#forms
Boris
@boris-in-london
Sep 24 2015 18:42
@SaintPeter i've never heard of Atom, what do you use to debug and call stacks?
@x34passenger my friend if i could afford a mac book i would own one. i'm running on an old machine
x34passenger
@x34passenger
Sep 24 2015 18:42
@boris-in-london atom is the up and coming text editor, much better than sublime I think
Matt Anderson
@MDAWebDev
Sep 24 2015 18:42
Are you Boris Johnson, @boris-in-london? :D
Rex Schrader
@SaintPeter
Sep 24 2015 18:42
@boris-in-london Chrome dev tools
Veronica Eulenberg
@HappyViki
Sep 24 2015 18:43

@SaintPeter its still giving me an error message function reverseString(str) {
reverseString.reverse();
// CODE GOES HERE, ONLY
return str;
}

reverseString("hello", "");
// Never code here

x34passenger
@x34passenger
Sep 24 2015 18:43
@boris-in-london you can linux
Boris
@boris-in-london
Sep 24 2015 18:43
@MDAWebDev loool nope i'm just some Russian guy in London
@SaintPeter that sounds like a great combo, i'll give it a try. thanks
CamperBot
@camperbot
Sep 24 2015 18:43
boris-in-london sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 711 | @saintpeter | http://www.freecodecamp.com/saintpeter
Avil
@Avil172
Sep 24 2015 18:43
:point_up: September 24, 2015 11:54 PM
@abhisekp
x34passenger
@x34passenger
Sep 24 2015 18:44
Can anyone explain the logic of Bonfire: Boo who, I don't know how most of the test cases result in false
Rex Schrader
@SaintPeter
Sep 24 2015 18:44
@HappyViki Yes, because reverse is an Array function, not a string function. Also, the name of your parameter is str, not reverseString. But before you can reverse it you need to use split to turn it into an array.
Avil
@Avil172
Sep 24 2015 18:44
@abhisekp the exercise is still in html/css, so..
Boris
@boris-in-london
Sep 24 2015 18:45
@x34passenger yeah i should be linux'ing idk what's wrong with me. I've grown to love this old machine as is. But as soon as i make my first 100K off of coding i'll buy one of each OS
lol
Veronica Eulenberg
@HappyViki
Sep 24 2015 18:45

@SaintPeter function reverseString(str) {
str.split(" ");
// CODE GOES HERE, ONLY
return str;
}

reverseString("hello", "Bye");
// Never code here

it is only returning "hello"
x34passenger
@x34passenger
Sep 24 2015 18:46
@boris-in-london you can install linux on any windows machine
Boris
@boris-in-london
Sep 24 2015 18:46
@x34passenger yeah i know... i should too but i've grown to like my setup.
Avil
@Avil172
Sep 24 2015 18:46
@abhisekp btw, why would you create the ".form-control" class separately? i don't think that's needed, isn't it?
Boris
@boris-in-london
Sep 24 2015 18:46
not big on change.
Veronica Eulenberg
@HappyViki
Sep 24 2015 18:46
@SaintPeter btw thanks for helping me. I sometimes get so confused on the most simplest things.
CamperBot
@camperbot
Sep 24 2015 18:46
happyviki sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 712 | @saintpeter | http://www.freecodecamp.com/saintpeter
x34passenger
@x34passenger
Sep 24 2015 18:46
@boris-in-london you can dual boot linux and windows
Boris
@boris-in-london
Sep 24 2015 18:47
@x34passenger how much is linux paying you? and where can i apply?
lol i'm joking...
I'll get mint up and running as soon as i come over my attachment issues.
x34passenger
@x34passenger
Sep 24 2015 18:48
@boris-in-london linux is free and not paying me a penny or pence. Ever since I discovered BASH, I find it more convenient than windows :)
Nur Azhar
@nurazhar
Sep 24 2015 18:48
guys what does this means?
can't seem to get thru this :worried:
Nest your text input element within a form element.
Matt Anderson
@MDAWebDev
Sep 24 2015 18:48
Any luck on that npm tutorial yet, @SaintPeter?
x34passenger
@x34passenger
Sep 24 2015 18:48
@boris-in-london and all the software is free for linux, not like windows
Rex Schrader
@SaintPeter
Sep 24 2015 18:49
@HappyViki Couple things:
1) split doesn't modify the string, it returns an array, so you have to assign that to a variable
2) you will have to do split, then reverse, then join.
3) Read the MDN pages on each of these functions and see what each is doing.
4) if you get lost or want to see how things work along the way, cut and paste your code over to http://repl.it - you can add console.log statements to see your variables
@MDAWebDev working on it, slowly
Boris
@boris-in-london
Sep 24 2015 18:49
@x34passenger you're preaching to the choir brother! amen i was saved ages ago. I use to run arch linux on an old desktop.
I just have to stop being lazy and install it.
Abhisek Pattnaik
@abhisekp
Sep 24 2015 18:49
@boris-in-london Webstorm, Brackets, Atom, Sublime, Visual Studio Code, Visual Studio Community.
So many options... Whichever you like. :)
Boris
@boris-in-london
Sep 24 2015 18:50
@abhisekp thanks you!
CamperBot
@camperbot
Sep 24 2015 18:50
boris-in-london sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 462 | @abhisekp | http://www.freecodecamp.com/abhisekp
Avil
@Avil172
Sep 24 2015 18:50

@nurazhar you will need to write like..

<form>
<input type="text">
</form>

Nur Azhar
@nurazhar
Sep 24 2015 18:50
@Avil172 thank you! oh my bad :clap:
CamperBot
@camperbot
Sep 24 2015 18:50
nurazhar sends brownie points to @avil172 :sparkles: :thumbsup: :sparkles:
:star: 95 | @avil172 | http://www.freecodecamp.com/avil172
Avil
@Avil172
Sep 24 2015 18:51
@nurazhar i gave you the format. don't forget to add the button, action etc
x34passenger
@x34passenger
Sep 24 2015 18:54
Can anyone explain th Bonfire: Convert HTML Entities. I don't know what they are asking for?
Nur Azhar
@nurazhar
Sep 24 2015 18:54
@Avil172 :+1:
Mateja Trifunovski
@Matko95
Sep 24 2015 18:55
@x34passenger You need to replace characters like & with corresponding HTML entity, etc. "&"
Blah can't write it.. &.amp.;
Matt Anderson
@MDAWebDev
Sep 24 2015 18:56
I found that one really confusing too, @x34passenger .
the solution is full of regexs
x34passenger
@x34passenger
Sep 24 2015 18:57
@Matko95 why would should escape characters: expected 'Dolce & Gabbana' to match /Dolce &(amp|AMP|#x00026|#38); Gabbana/
@Matko95 why would an apostrophe turn into forward slash escape character?
Mateja Trifunovski
@Matko95
Sep 24 2015 18:58
You can find all the entities in the description, and a link for them
x34passenger
@x34passenger
Sep 24 2015 18:59
@Matko95 I'm looking at the link now and an apostrophe is &apos, not a forward slash
Matt Anderson
@MDAWebDev
Sep 24 2015 19:01
Try this @x34passenger :
function convert(str) {
  re = new RegExp('(&|<|>|"|\')', 'g');
  str = str.replace(re, function(match) {
    switch (match) {
      case '&':
        return '&amp;';
      case '<':
        return '&lt;';
      case '>':
        return '&gt;';
      case '"':
        return '&quot;';
      case '\'':
        return '&apos;';
    }
  });

  return str;
}

convert('Dolce & Gabbana');
Mateja Trifunovski
@Matko95
Sep 24 2015 19:02
I wrote an ampersand if i'm not wrong
Roger Hoffman
@rhoffman3621
Sep 24 2015 19:02
Nest two div class="col-xs-6" elements within your div class="row" element.
x34passenger
@x34passenger
Sep 24 2015 19:02
@MDAWebDev but I still don't understand why there would be forward slash where the first apostrophe would be?
Mateja Trifunovski
@Matko95
Sep 24 2015 19:02
I'm on mobile chat so it might format badly
Matt Anderson
@MDAWebDev
Sep 24 2015 19:03
it's a backslash.
backslash is before the apostrope.
Roger Hoffman
@rhoffman3621
Sep 24 2015 19:07

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

</div>
</div>
It says nest two div class "col-xs-6 within the div class="row"

Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:07
@x34passenger you use HTML entities to reduce the ambiguity between a HTML code and the actual character you meant to write. E.g. if you want to write <hello>, how would the browser know if you meant to create a new tag with name hello or you really wanted to write the text <hello>.
Hence, the soln. is to use HTML entities and write it as &lt;hello&gt;. That will show up as <hello> in the browser.
Roger Hoffman
@rhoffman3621
Sep 24 2015 19:07
not working
Rex Schrader
@SaintPeter
Sep 24 2015 19:07
@MDAWebDev ok, I'm caught up
Matt Anderson
@MDAWebDev
Sep 24 2015 19:08
great, were you able to figure it out?
Rex Schrader
@SaintPeter
Sep 24 2015 19:08
@MDAWebDev You're wondering "what is <pkg> and what is the dist tag", right?
Matt Anderson
@MDAWebDev
Sep 24 2015 19:08
yes
Rex Schrader
@SaintPeter
Sep 24 2015 19:08
@MDAWebDev Ok, if you'll recall, earlier in the how-to-npm you created a package
Matt Anderson
@MDAWebDev
Sep 24 2015 19:09
It would be nice if they provided some sort of example.
Rex Schrader
@SaintPeter
Sep 24 2015 19:09
@MDAWebDev You should be able to see it with the username you created by doing an npm ls
Matt Anderson
@MDAWebDev
Sep 24 2015 19:09
Is the package the .json file?
Avil
@Avil172
Sep 24 2015 19:09
@rhoffman3621 add </div> after each <div class="col-xs-6">
Rex Schrader
@SaintPeter
Sep 24 2015 19:10
@MDAWebDev a package includes a package.json file, but is the collection of files in the package directory and its dependancies
@MDAWebDev look at the top of your package.json file and you'll see a line like this:
"name": "@saintpeter/chat-example",
@MDAWebDev That is the package name
Avil
@Avil172
Sep 24 2015 19:11
@rhoffman3621
<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="col-xs-6"></div>
<div class="col-xs-6"></div>
</div>
</div>
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:11
or a line like this
"name": "@badsaintpeter/chat-example", :P
Matt Anderson
@MDAWebDev
Sep 24 2015 19:11
Ok, looks like mine is: "name": "npm-project",
Rex Schrader
@SaintPeter
Sep 24 2015 19:12
@MDAWebDev You understand that packages have versions, right? You can see the current version in the package.json file as well, on the very next line. A "dist-tag" allows you to create a new version that will not automatically be set as "latest"
x34passenger
@x34passenger
Sep 24 2015 19:12
I'm not understanding the Bonfire: Boo who. I don't know why most of the test cases return false
Rex Schrader
@SaintPeter
Sep 24 2015 19:13
@MDAWebDev Like . . . say you had an experimental branch or something. You could create a tag called "unsafe" or something, so people could test it, but not get it installed by default.
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:13
bf boo
CamperBot
@camperbot
Sep 24 2015 19:13

:fire:Bonfire: Boo who :link:

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

boo(null);

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

more info:  bf details | bf links | hint

Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:13
bf details
CamperBot
@camperbot
Sep 24 2015 19:13

:fire:Bonfire: Boo who :link:

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

boo(null);
Check if a value is classified as a boolean primitive. Return true or false.
Boolean primitives are true and false.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
x34passenger
@x34passenger
Sep 24 2015 19:14
For Boo hoo I don't know why most of the test cases return false
Rex Schrader
@SaintPeter
Sep 24 2015 19:14
@x34passenger I think you need to do something like this:
if(bool === true || bool === false) {  
  return true; 
} else {
  return false;
}
Matt Anderson
@MDAWebDev
Sep 24 2015 19:14
Looks like I'm still doing something wrong. I tried npm dist-tag add npm-project@1.02 [new] this time
the current version is 1.0.1 so I tried 1.0.2
x34passenger
@x34passenger
Sep 24 2015 19:15
@SaintPeter why would boo([1, 2, 3]) this return false?
Rex Schrader
@SaintPeter
Sep 24 2015 19:15
@x34passenger because [1, 2, 3] is an array, not a boolean.
x34passenger
@x34passenger
Sep 24 2015 19:16
@SaintPeter okay, I get it now
thanks @SaintPeter
CamperBot
@camperbot
Sep 24 2015 19:16
x34passenger sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 713 | @saintpeter | http://www.freecodecamp.com/saintpeter
Matt Anderson
@MDAWebDev
Sep 24 2015 19:16
I understand what the point of dist-tags are, I just need to figure what I'm supposed to type to add a new one.
Not this apparently: npm dist-tag add npm-project@1.02 [new]
Rex Schrader
@SaintPeter
Sep 24 2015 19:16
@MDAWebDev ok, poking at it now
Matt Anderson
@MDAWebDev
Sep 24 2015 19:19
This is what my package.json file looks like:
{
  "name": "npm-project",
  "respository": "https://ide.c9.io/mdawebdev/free-code-camp-npm",
  "version": "1.0.1",
  "description": ",-----.,--.                  ,--. ,---.   ,--.,------.  ,------.     '  .--./|  | ,---. ,--.,--. ,-|  || o   \\  |  ||  .-.  \\ |  .---'     |  |    |  || .-. ||  ||  |' .-. |`..'  |  |  ||  |  \\  :|  `--,      '  '--'\\|  |' '-' ''  ''  '\\ `-' | .'  /   |  ||  '--'  /|  `---.      `-----'`--' `---'  `----'  `---'  `--'    `--'`-------' `------'     -----------------------------------------------------------------",
  "main": "server.js",
  "dependencies": {
    "@linclark/pkg": "^1.0.2",
    "async": "^0.2.10",
    "express": "^3.2.6",
    "socket.io": "^0.9.17"
  },
  "devDependencies": {},
  "scripts": {
    "test": "node test.js"
  },
  "author": "",
  "license": "ISC"
}
Rex Schrader
@SaintPeter
Sep 24 2015 19:21
@MDAWebDev nodeschool/discussions#995
@MDAWebDev I've tried their solutions and am not getting it towork
Cristián Berríos
@crisberrios
Sep 24 2015 19:21
the description is very descriptive @MDAWebDev. Save the ascii art for the README :)
Matt Anderson
@MDAWebDev
Sep 24 2015 19:22
that was actually there by default @crisberrios.
I can't claim credit for such impressive ascii art.
Rex Schrader
@SaintPeter
Sep 24 2015 19:23
@MDAWebDev "Note that you can only add dist tags to the specific version numbers published in steps 8 and 10. If you receive a 403 or 404 error, run how-to-npm and try again."
Matt Anderson
@MDAWebDev
Sep 24 2015 19:24
hmm, I'm about to just skip this step all together.
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:24
@SaintPeter how to use the reduce method for bf sum all number?
bf sum all
CamperBot
@camperbot
Sep 24 2015 19:24

:fire:Bonfire: Sum All Numbers in a Range :link:

function sumAll(arr) {
  return(1);
}

sumAll([1, 4]);

We'll pass you an array of two numbers. Return the sum of those two numbers and all numbers between them.

more info:  bf details | bf links | hint

Rex Schrader
@SaintPeter
Sep 24 2015 19:24
@abhisekp You need to set an initial value for the callback
@abhisekp So: arr.reduce(sumFunction, 0);
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:25
@SaintPeter how to implement the sum function?
Erik Cohen
@cohenpts
Sep 24 2015 19:25
Hey Campers good afternoon,
Rex Schrader
@SaintPeter
Sep 24 2015 19:26
@abhisekp
function sumFunction(acc, curr) {
  return acc + curr;
}
@MDAWebDev Yeah
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:26
@SaintPeter that'll only add the first and last.
Rex Schrader
@SaintPeter
Sep 24 2015 19:26
@abhisekp Um . . . no, it'll add them all.
Erik Cohen
@cohenpts
Sep 24 2015 19:26
I am having abit of trouble with the smallest common multiple bonfire, and need a bit of help with the algorithm to get it to work, is this the right place to ask for help?
Rex Schrader
@SaintPeter
Sep 24 2015 19:26
@abhisekp look at how I called the function again
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:27
acc???
Rex Schrader
@SaintPeter
Sep 24 2015 19:27
@cohenpts Yes, this is the right place.
@abhisekp I use it for "accumulator"
Hugo
@hugoender
Sep 24 2015 19:28
What is the difference between array.prototype.filter() and array.filter()
jeevan-kr
@jeevan-kr
Sep 24 2015 19:29
Hi folks, I am not able to view the failed tests. Hence, not able to debug my js algo exercises. I recall that there is a chrome plugin that could help debug in more detail. Can you please point me too it? I could find the answer when i googled.
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:29
@hugoender ppl should write the former rather than the later. The later doesn't exist.
Erik Cohen
@cohenpts
Sep 24 2015 19:30

@SaintPeter thank you for the prompt response,

function smallestCommons(arr) {
  arr = arr.sort();
  var max = arr[1];
  var min = arr[0];
  var commons = 2;

  for (x = min + 1; x<max; x++){
    while (x % commons === 0){
      console.log (x + " %  " + commons);
      commons++;
    }
  }
  return commons;

}

This is what i have so far, my challenge is keeping tabs on x while its looping to make sure all of them are divisible by commons.

CamperBot
@camperbot
Sep 24 2015 19:30
:bulb: to format code use backticks! ``` more info
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:31
@SaintPeter
function sumAll(arr) {
  var sortedArr = arr.sort((a,b) => a-b);

  var sum = sortedArr.reduce(function sumFunction(acc, curr) {
    return acc + curr;
  }, 0);

  return sum;
}

console.log(sumAll([1, 4])); // 5 (wrong!! answer)
Rex Schrader
@SaintPeter
Sep 24 2015 19:31
@abhisekp Why are you sorting?
Erik Cohen
@cohenpts
Sep 24 2015 19:31
@jeevan-kr I have been using jsbin its been working pretty well, have you tried it?
Rex Schrader
@SaintPeter
Sep 24 2015 19:32
@abhisekp OH. OH. I forgot you had to enumerate. You have to count up from arr[0] to arr1 and sum those.
jeevan-kr
@jeevan-kr
Sep 24 2015 19:32
@cohenpts will give it a shot
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:32
@SaintPeter for that i've to write a for loop inside it. :(
The question says : The lowest number will not always come first.
Hence, sorting
Rex Schrader
@SaintPeter
Sep 24 2015 19:32
@cohenpts Keep in mind that your actual number is going to be larger than max - it MUST be larger than max
@abhisekp Yeah, sorry, I thought you were asking how to sum an array of numbers. But the bit before that just requires a for loop. And if you're going to do a for loop, might as well just sum the numbers as you go.
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:33
@SaintPeter what's your soln?
Rex Schrader
@SaintPeter
Sep 24 2015 19:34
@abhisekp
function sumAll(arr) {
  var start = Math.min(arr[0],arr[1]);
  var end = Math.max(arr[0],arr[1]);
  var total = 0;
  for(i=start;i < end+1;i++) {
    total += i;
  }
  return total;
}
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:34
@SaintPeter I've this soln. already but it's not what the queston says
function sumAll(arr) {
  // Buckle up everything to one!
  var sortedArr = arr.sort((a,b) => a-b);
  var firstNum = arr[0];
  var lastNum = arr[1];
  // Using Arithmetic Progression summing formula
  // https://en.wikipedia.org/wiki/Arithmetic_progression#Sum
  var sum = (lastNum - firstNum + 1) * (firstNum + lastNum) / 2;
  return sum;
}

sumAll([1, 4]);
Erik Cohen
@cohenpts
Sep 24 2015 19:34
@SaintPeter well i set the control to less then max since i am looping through the range of arr[0] and arr1 the second control is to make sure commons divids equally through the range. thats the part i havent been successfull. ill let you finish with @abhisekp first. thanks again.
CamperBot
@camperbot
Sep 24 2015 19:34
cohenpts sends brownie points to @saintpeter and @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 714 | @saintpeter | http://www.freecodecamp.com/saintpeter
:star: 464 | @abhisekp | http://www.freecodecamp.com/abhisekp
Rex Schrader
@SaintPeter
Sep 24 2015 19:35
@cohenpts I mean that the lowest that the number can POSSIBLY be is the lowest number times the highest number.
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:35
@cohenpts I'm finished. :)
my life is gone. :(
Erik Cohen
@cohenpts
Sep 24 2015 19:36
@SaintPeter I need a first loop to go through the range then a second loop to make sure x % commons === 0 right?
Im having a hard time with the logic of how to keep track that all the ranged numbers are divisible by commons
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:37
@SaintPeter isn't using the reduce method for that question too much? Shouldn't the question ask about using sm other methods?
Rex Schrader
@SaintPeter
Sep 24 2015 19:38
@cohenpts Correct. But you also have to do the multiplication. The common number is the lowest common multiple. That means that you need to have a number you're checking that starts at the lowest number in the range times the highest number in the range and increasing.
@abhisekp There may be a way to use reduce to solve that, but I am not aware of it. It seems silly to loop through to create an array, then loop again to sum it.
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:39
yes. so it seems. :worried:
Erik Cohen
@cohenpts
Sep 24 2015 19:39
I didnt use the range to create a commons range since i dont know where it can end i used it for the variables in between arr[0] and arr[1]
jeevan-kr
@jeevan-kr
Sep 24 2015 19:40
@abhisekp why don't you sum 1...Math.max(x,y) and 1....Math.min(x,y) and subtract one from the other?
Hugo
@hugoender
Sep 24 2015 19:41
@abhisekp but the documentation examples use it without prototype
Rex Schrader
@SaintPeter
Sep 24 2015 19:41
@cohenpts You're going to need an outer loop here, I think, and it must be a while loop. The inner loop, where you check each number for divisibility, is fine.
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:41
@jeevan-kr but is it more efficient than just summing from min...max?
Overall i've to use the same sum function. rt?
Erik Cohen
@cohenpts
Sep 24 2015 19:42
got it, im going to try to create an array of the range
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:42
@hugoender whc documentation?
Erik Cohen
@cohenpts
Sep 24 2015 19:42
@SaintPeter thanks again
CamperBot
@camperbot
Sep 24 2015 19:42
cohenpts sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: cohenpts already gave saintpeter points
Hugo
@hugoender
Sep 24 2015 19:42
@abhisekp the Mozilla MDN site
The first result in google
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:42
@hugoender yes.
Rex Schrader
@SaintPeter
Sep 24 2015 19:42
@cohenpts Note that you can use break to exit a for loop
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:43
@hugoender they're defined in Array.prototype object.
Hugo
@hugoender
Sep 24 2015 19:43
@abhisekp what is? And what does that mean? And why can I use it with or without prototype and it works fine either way
Coira Ellison
@Coira
Sep 24 2015 19:43
@hugoender the prototype version means that filter is on the object Array's prototype, e.g. that all arrays and objects that inherit from Array have this method (I think)
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:43

@hugoender but when you use it, as in

var arr = [1, 2, 3];
arr.filter()

You have to write it like that.

Rex Schrader
@SaintPeter
Sep 24 2015 19:43
Anyone waiting for help?
Coira Ellison
@Coira
Sep 24 2015 19:43
but to use filter, you leave out prototype
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:44
@hugoender there is a reason. For that you need to watch some videos for better understanding. :)
wiki js res
Hugo
@hugoender
Sep 24 2015 19:44
Okay so to use filter you leave out prototype. So when do you leave it in?
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:44
Coira Ellison
@Coira
Sep 24 2015 19:45
@hugoender you don't, abhisekp's right, when you learn about prototype it'll make more sense
Hugo
@hugoender
Sep 24 2015 19:45
@abhisekp @Coira okay. Thank you
CamperBot
@camperbot
Sep 24 2015 19:45
hugoender sends brownie points to @abhisekp and @coira :sparkles: :thumbsup: :sparkles:
:star: 236 | @coira | http://www.freecodecamp.com/coira
:star: 465 | @abhisekp | http://www.freecodecamp.com/abhisekp
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:45

@hugoender while saying about the method to someone as in

Hey! @hugoender you know there is a nice method calledas Array.prototype.filter that can make your life easy! :)

That's when you use the it. :)
Other times, you don't.
Coira Ellison
@Coira
Sep 24 2015 19:46
hey @abhisekp in your code arr.sort((a,b) => a-b);, what's this mean =>. ES6?
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:46
(and there are many more things to know as @Coira says)
Coira Ellison
@Coira
Sep 24 2015 19:47
i've not seen it before
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:47
@Coira it's an Arrow function as mentioned in the comment.
it's new in ES6
latest quality product :P
Coira Ellison
@Coira
Sep 24 2015 19:47
ah cool, thanks
CamperBot
@camperbot
Sep 24 2015 19:47
if you want to thank someone, put an @ before their name!
Coira Ellison
@Coira
Sep 24 2015 19:47
thanks @abhisekp
CamperBot
@camperbot
Sep 24 2015 19:47
coira sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 466 | @abhisekp | http://www.freecodecamp.com/abhisekp
Coira Ellison
@Coira
Sep 24 2015 19:48
i googled it, but couldn't find the right keyword
navicyclical
@navicyclical
Sep 24 2015 19:48
almost done, I just need to find a way to strip the commas
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:49
@Coira developers are lazy. They just name things matching their shape and size. :P
An => (arrow) is an arrow function. :P LOLz
Ekin Tiras
@IroNEDR
Sep 24 2015 19:52

how can i dynamically change the data-text attribute of a twitter button? I want it to contain the current quote...so far i have tried it like this:

function updateText(response){
  $("#quote").text(response.quoteText);
  $("#author").text(response.quoteAuthor);
  $("#tweet1").attr("data-text",response.quoteText);
  twttr.widgets.load();
};

but it doesn't work :(

Rex Schrader
@SaintPeter
Sep 24 2015 19:56
@IroNEDR You cannot change the contents of the twitter generated button because it is in an iframe. Instead, roll your own button. google twitter intent tweet for the URL format.
Abhisek Pattnaik
@abhisekp
Sep 24 2015 19:56
This message was deleted
Ekin Tiras
@IroNEDR
Sep 24 2015 19:57
thank you!
CamperBot
@camperbot
Sep 24 2015 19:57
if you want to thank someone, put an @ before their name!
Ekin Tiras
@IroNEDR
Sep 24 2015 19:57
thank you! @SaintPeter
CamperBot
@camperbot
Sep 24 2015 19:57
ironedr sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 715 | @saintpeter | http://www.freecodecamp.com/saintpeter
Abhisek Pattnaik
@abhisekp
Sep 24 2015 20:00
bf diff
CamperBot
@camperbot
Sep 24 2015 20:00

:fire:Bonfire: Diff Two Arrays :link:

function diff(arr1, arr2) {
  var newArr = [];
  // Same, same; but different.
  return newArr;
}

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

Compare two arrays and return a new array with any items not found in both of the original arrays.

more info:  bf details | bf links | hint

navicyclical
@navicyclical
Sep 24 2015 20:05
This message was deleted
This message was deleted
I was able to get this to pass all but one of the tests
function palindrome(str) {
  // Good luck!
  str = str.replace(/[.,/\-_:\s]/gi,"").toLowerCase();
  var reverseString = str.split("").reverse().join(separator='');
  if (str === reverseString){
  return true;
  }
  else
    {
      return false;
    }
}



palindrome("eye");
I noticed this at the last test
```
assert(palindrome("0_0 (: /-\ :) 0-0") === true, '"0_0 (: /-\\ :) 0-0" should return true.');"0_0 (: /-\ :) 0-0" should return true.
There's a extra \, anyone catch that?
DTing
@dting
Sep 24 2015 20:08
@navicyclical the first \ escapes the second \
Abhisek Pattnaik
@abhisekp
Sep 24 2015 20:08
@navicyclical you should write a general soln. You've written a specific soln. which will work only for the given test cases.
@navicyclical a general regex should consider only alphanums and discard others.
@navicyclical and in the join method, you should pass a string like you've done for split method.
bf palindrome
CamperBot
@camperbot
Sep 24 2015 20:11

: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

Abhisek Pattnaik
@abhisekp
Sep 24 2015 20:11
bf details
CamperBot
@camperbot
Sep 24 2015 20:11

: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.
A palindrome is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing.
You'll need to remove punctuation and turn everything lower case in order to check for palindromes.
We'll pass strings with varying formats, such as "racecar", "RaceCar", and "race CAR" among others.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
DTing
@dting
Sep 24 2015 20:12
"\"
> Uncaught SyntaxError: Unexpected token ILLEGAL(…)

"\\"
> "\"
Abhisek Pattnaik
@abhisekp
Sep 24 2015 20:15
@dting whr is the error?
DTing
@dting
Sep 24 2015 20:16
\ is how you start an escape sequence
so if you want a string with \ you need to escape it "\\"
Abhisek Pattnaik
@abhisekp
Sep 24 2015 20:17
@navicyclical :point_up: September 25, 2015 1:46 AM
Mike Doubintchik
@allurewebsolutions
Sep 24 2015 20:20
This message was deleted
This message was deleted
CamperBot
@camperbot
Sep 24 2015 20:21
:bulb: to format code use backticks! ``` more info
Mike Doubintchik
@allurewebsolutions
Sep 24 2015 20:21
This message was deleted
function chunk(arr, size) {
  var newarray = [], i, k;
  for (i = 0, k = -1; i < arr.length; i++) {
    if (1 % size === 0) {
      k++;
      newarray[k] = [];
    }
    newarray[k].push(arr[i]);
  }
  return newarray;
}

chunk(["a", "b", "c", "d"], 2, "");
I'm getting "Cannot read property 'push' of undefined"
Any ideas?
tva10
@tva10
Sep 24 2015 20:23
@allurewebsolutions you can use push only for arrays
@allurewebsolutions may be newarray.push(...)
@allurewebsolutions huh, don't see that you put and array there...
Jason Wood
@catapixel
Sep 24 2015 20:25
@allurewebsolutions the push method always "pushes" the value to the end of the array. You can't define the index you are pushing to.
@allurewebsolutions newarray.push(arr[i]);
tva10
@tva10
Sep 24 2015 20:26
@catapixel hm, nope he has [] on newarray[k]
Jason Wood
@catapixel
Sep 24 2015 20:28
@tva10 I know. He declared newarray at the top. Now he's trying to push values to it. you have to drop the index reference when you do that
@tva10 you also have to drop the index reference when you reset it in the if condition
Mike Doubintchik
@allurewebsolutions
Sep 24 2015 20:37
This message was deleted
CamperBot
@camperbot
Sep 24 2015 20:37
if you want to thank someone, put an @ before their name!
Mike Doubintchik
@allurewebsolutions
Sep 24 2015 20:37
@catapixel @tva10 thanks, guys!
CamperBot
@camperbot
Sep 24 2015 20:37
allurewebsolutions sends brownie points to @catapixel and @tva10 :sparkles: :thumbsup: :sparkles:
:star: 249 | @tva10 | http://www.freecodecamp.com/tva10
:star: 386 | @catapixel | http://www.freecodecamp.com/catapixel
Yan Kozlovskiy
@YanKozlovskiy
Sep 24 2015 20:41
is key a special keyword?
Joshua Abu
@Absolutestunna
Sep 24 2015 20:42
Hello world. Is there an advantage to having twitter as a programmer or using FCC?
CamperBot
@camperbot
Sep 24 2015 20:42

welcome to FreeCodeCamp @Absolutestunna!

pex7
@pex7
Sep 24 2015 20:50
I cannot figure out why this bonfire test is failing
if (str.match(/<>/)) {
    return str.replace(/<>/g, "&lt;&gt;");
  }
all of my other regex are matching, but for some reason the '<>' isn't matching
here is the failing test message
assert.match(convert('<>'), /&(lt|LT|#x0003C|#60);&(gt|GT|#x0003E|#62);/, 'should escape characters');should escape characters: expected '<>' to match /&(lt|LT|#x0003C|#60);&(gt|GT|#x0003E|#62);/
Tyler Moeller
@TylerMoeller
Sep 24 2015 20:59

@pex7 Your code works fine for me with a random string containing "<>".

str = "this is text with <> characters."
if (str.match(/<>/)) {
    console.log(str.replace(/<>/g, "&lt;&gt;"));
  }

Output = this is text with &lt;&gt; characters.

Maybe need to see more of the code to identify why it's failing...
Rex Schrader
@SaintPeter
Sep 24 2015 21:00
@Absolutestunna The main advantage is wasting time more effectively. Sometimes if you follow the right people you can get links to interesting articles. That's about it.
@pex7 Note that you have to replace the items individually. You can't just expect it to replace one or the other. Do a test for <, replace with &lt;, do a test for >, replace with &gt;
pex7
@pex7
Sep 24 2015 21:02
@TylerMoeller , this is for the convert html entities bonfire. I'm not sure why it doesn't match either, since if I do it in Rubular it matches. Below is my entire function, all the others are matching
function convert(str) {
  if (str.match(/&/)) {
    return str.replace(/&/g, "&amp;");
  } else if (str.match(/</)) {
    return str.replace(/</g, "&lt;");
  } else if (str.match(/>/)) {
    return str.replace(/>/g, "&gt;");
  } else if (str.match(/"/)) {
    return str.replace(/"/g, "&quot;");
  } else if (str.match(/'/)) {
    return str.replace(/'/g, "&apos;");
  } else if (str.match(/<>/)) {
    return str.replace(/<>/g, "&lt;&gt;");
  } else {
    return str;
  }
}
Rex Schrader
@SaintPeter
Sep 24 2015 21:03
@pex7 You know you don't need to do an if statement at all. just chain all your replaces together. If the item is found, it'll be replaced. If not, nothing changes.
@pex7 OH - Are you passing in one character at a time?
@pex7 or the entire string?
Tyler Moeller
@TylerMoeller
Sep 24 2015 21:04
That fails for me too - let me dig a bit deeper
pex7
@pex7
Sep 24 2015 21:05
@SaintPeter its the entire string. to your first comment, if I chain them all together how will it know what to replace each character with?
@SaintPeter does it go in order?
Rex Schrader
@SaintPeter
Sep 24 2015 21:05
@pex7 Each replace statement is self contained. You're replacing X with Y.
pex7
@pex7
Sep 24 2015 21:06
ex:
str.replace(/&</, "&amp;&tl;")
like that?
Rex Schrader
@SaintPeter
Sep 24 2015 21:06
@pex7 Secondly, the reason why nothing is working right is because return exits your function immediatly. So imagine that you had this string: &<">& - the only thing that will be changed is the & because none of the other entities are replaced.
pex7
@pex7
Sep 24 2015 21:07
@SaintPeter i think I see what you mean, I'm going to give it a try
Rex Schrader
@SaintPeter
Sep 24 2015 21:07
@pex7 No, no - I mean multiple replace statements in a row. IE:
output = str.replace(/&/g, "&amp;").replace(/</g, "&lt;"); // And so on, for each element
@pex7 Each replace statement only replaces a single type of thing.
Nathan Wind
@Nathan-Wind
Sep 24 2015 21:08
HI all wondering if you can help me with this one
function mutation(arr) {  
  var elem0 = arr[0].toLowerCase();
  var elem1 = arr[1].toLowerCase();

  for(var i = 0; i < elem1.length; i++){
    var check = elem0.indexOf(elem1[i]);
    if (check === -1){
      return false;
    }
  }
  return true;
}

mutation(['hello', 'hey']);
I'm trying to understand the line var check = elem0.indexOf(elem1[i]);
Tyler Moeller
@TylerMoeller
Sep 24 2015 21:08
@SaintPeter thanks for explaining that. I was replacing returns with console.log to debug :)
CamperBot
@camperbot
Sep 24 2015 21:08
tylermoeller sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 716 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Sep 24 2015 21:09
@TylerMoeller :D
Nathan Wind
@Nathan-Wind
Sep 24 2015 21:09
specifically the [i]
what does the i refer to?
I thought it had to be a number
oh nevermind derrrr
I just figured it out
Rex Schrader
@SaintPeter
Sep 24 2015 21:10
@Nathan-Wind i is a number. It's a number between 0 and elem1.length -1
Nathan Wind
@Nathan-Wind
Sep 24 2015 21:10
got it
my bad
Rex Schrader
@SaintPeter
Sep 24 2015 21:10
@Nathan-Wind :D
Nathan Wind
@Nathan-Wind
Sep 24 2015 21:10
:P
Rex Schrader
@SaintPeter
Sep 24 2015 21:10
@Nathan-Wind Happy to be your rubber duck
Nathan Wind
@Nathan-Wind
Sep 24 2015 21:12
haha
pex7
@pex7
Sep 24 2015 21:12
thanks!! that works, makes perfect sense, and much shorter than using if statements @SaintPeter
CamperBot
@camperbot
Sep 24 2015 21:12
pex7 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 717 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Sep 24 2015 21:13
@pex7 :D :D
@pex7 You do get bonus points for using your regular expressions. It was a good shot :D
pex7
@pex7
Sep 24 2015 21:16
@SaintPeter I do enjoy regular expressions, even though I have about a kindergarten level understanding of then
Rex Schrader
@SaintPeter
Sep 24 2015 21:19
@pex7 Well, if you like puzzles: http://regexcrossword.com/ Learn more about Regex by breaking your brain on them.
Abhisek Pattnaik
@abhisekp
Sep 24 2015 21:19
:baby_chick:
wiki regex
CamperBot
@camperbot
Sep 24 2015 21:19

:point_right: js regex [wiki]

Links to useful RegEx resources.

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

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

Rex Schrader
@SaintPeter
Sep 24 2015 21:19
:dancer:
Abhisek Pattnaik
@abhisekp
Sep 24 2015 21:19
@pex7 :point_up: September 25, 2015 2:49 AM
pex7
@pex7
Sep 24 2015 21:21
@SaintPeter, nice I'm going to checkout the crosswords
@abhisekp, thanks, I will check out the wiki also
CamperBot
@camperbot
Sep 24 2015 21:22
pex7 sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 468 | @abhisekp | http://www.freecodecamp.com/abhisekp
Rex Schrader
@SaintPeter
Sep 24 2015 21:25
@abhisekp Gah, regex golf = evil.
Abhisek Pattnaik
@abhisekp
Sep 24 2015 21:44
@SaintPeter why?
Rex Schrader
@SaintPeter
Sep 24 2015 21:44
@abhisekp Because it's pure digital crack. Darn you.
Abhisek Pattnaik
@abhisekp
Sep 24 2015 21:44
???
@SaintPeter but i liked it as beginner's practice. :worried:
Rob
@BobsHub
Sep 24 2015 22:13

Hi friends!
Bonfire: No repeats please

as explained here
http://www.trentu.ca/academic/math/bz/460-pie.pdf
I'm trying to calculate a permutation

I've written a summary of how it breaks down:
https://docs.google.com/spreadsheets/d/1WFXV6O866glNR2C1XA2h4NJ-y2YK7D-nTzUpn8G_9bY/edit#gid=0

for string: 123XY#
permutations where no number or letter can be beside each other

a1 -> property where numbers 12 are together
a2 -> 13
a3 -> 23
a4 -> 21
a5 -> 31
a6 -> 32
a7 -> xy
a8 -> yx

N - [ N(a1) + n(a2) + ... + N(a8) ]                   
  + [ N(a1a2) + ... + N(a7a8) ]                    
  - (1^8) * [ N(a1a2a3) + ... + N(a6a7a8) ]   


= 6!            
- (3P2 + 2P2)*5! 
+ 6! * 4!        
+ (-1)^8 * (2 * 6! * 3!)    
720 - 960 + 432 + 72 = 264

if (-1)^r were negative, then I'd get a correct answer
720 - 960 + 432 - 72 = 120

If anyone can see what I'm doing wrong give me a shout.

Rex Schrader
@SaintPeter
Sep 24 2015 22:25
@BobsHub My only comment is that, unlike the mathematical description, this problem treats each item as an independent entity. So aab would be treated as aa'b (a, a-prime, b). As for the math . . . I solved it with brute force.
Rob
@BobsHub
Sep 24 2015 22:27
I can successfully do simpler one, but the longer strings get insanely crazy
Rex Schrader
@SaintPeter
Sep 24 2015 22:28
@BobsHub I found a function online to do the permutations, then wrote a regex to find repeats and brute forced it.
Rob
@BobsHub
Sep 24 2015 22:30
I just wanted to try a different way. The heaps algorithm tends to crash my browser
Perhaps heaps would be the better way
Rex Schrader
@SaintPeter
Sep 24 2015 22:30
@BobsHub More power to ya. I was never very strong at the math.
Rob
@BobsHub
Sep 24 2015 22:31
lol, not me I just spend some time reading that page and wondered if I could do it differently
Coira Ellison
@Coira
Sep 24 2015 22:31
i used a stack based algorithm to create the permutations, no recursion involved
Rex Schrader
@SaintPeter
Sep 24 2015 22:31
@BobsHub I think in the real world the math would be the correct answer. For the purposes of solving these bonfires, Heaps and Regex is more to the point.
Coira Ellison
@Coira
Sep 24 2015 22:32
i really want to see someone solve it using maths, just because!
Rob
@BobsHub
Sep 24 2015 22:32
:D @Coira same here
DTing
@dting
Sep 24 2015 22:49
My no repeats answer is brute force with some pruning:
/** Returns number of permutaions of str without duplicate 
 * consecutive characters. */
function permAlone(s, pre) {
  return s.length ? s.split('').reduce(function(p, c, i) {
    return p + (c !== pre ? 
      permAlone(s.slice(0, i)+s.slice(i+1), s[i]) : 0);
  }, 0) : 1;
}
permAlone('aab');
Phillip Kneeland
@pkneeland78
Sep 24 2015 22:50
Hello all. How can I post the code like above for an issue I'm having with one of the way points?
DTing
@dting
Sep 24 2015 22:50
@pkneeland78
help formatting
CamperBot
@camperbot
Sep 24 2015 22:50

:point_right: code formatting [wiki]

Inline code

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

Code Block

```js ⇦ Type 3 backticks, then type js or html and then press [shift + enter ⏎]

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

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

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

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

Rob
@BobsHub
Sep 24 2015 22:51
thanks @dting I will look through that
CamperBot
@camperbot
Sep 24 2015 22:51
bobshub sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1242 | @dting | http://www.freecodecamp.com/dting
Phillip Kneeland
@pkneeland78
Sep 24 2015 22:51
thanks @dting :)
CamperBot
@camperbot
Sep 24 2015 22:51
pkneeland78 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1243 | @dting | http://www.freecodecamp.com/dting
Rob
@BobsHub
Sep 24 2015 22:52
I'll laugh hard if there's one wacky regex that can solve it all :D
Phillip Kneeland
@pkneeland78
Sep 24 2015 22:53

Hey so I have this problem:
'''html var ourArray = ["Stimpson", "J", ["cat"]];
ourRemoved = ourArray.shift();
// ourArray now equals ["J", ["cat"]].

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

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

// Only change code above this line.

// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & myRemoved = ' + JSON.stringify(z);})(myArray, myRemoved);'''

CamperBot
@camperbot
Sep 24 2015 22:53
:bulb: to format code use backticks! ``` more info
DTing
@dting
Sep 24 2015 22:53
back ticks @pkneeland78 ``` and they need to be on their own line
Phillip Kneeland
@pkneeland78
Sep 24 2015 22:53
oops quess that didn't work...
Rex Schrader
@SaintPeter
Sep 24 2015 22:53
@pkneeland78 You need backticks, not single quotes - also, they need to be on their own line
jaime hidalgo
@fas316
Sep 24 2015 22:54
how I take out the punctuation in regular expressions?
Andrés Cifuentes
@dinga99
Sep 24 2015 22:54
hi!, i have a problem with basejump: running the code to install yeoman, isn't working in my c9. So, there its other command to run?
Michael Guest
@MichaelGuest
Sep 24 2015 22:54
is FreeCodeCamp better than codeacademy?
DTing
@dting
Sep 24 2015 22:54
@fas316 you can use String.replace with regex
@BobsHub regex wont help count the number of permutations. This answer is close but you also need to take into account more than single repeats.
Anthony Albertorio
@tesla809
Sep 24 2015 22:58
@MichaelGuest for most things yes
@MichaelGuest although, I would start with codacademy
Michael Guest
@MichaelGuest
Sep 24 2015 22:59
@tesla809 wow really sweet thanks!
CamperBot
@camperbot
Sep 24 2015 22:59
michaelguest sends brownie points to @tesla809 :sparkles: :thumbsup: :sparkles:
:star: 284 | @tesla809 | http://www.freecodecamp.com/tesla809
Anthony Albertorio
@tesla809
Sep 24 2015 22:59
@MichaelGuest for introduction to CS, cod academy is better explained
Rob
@BobsHub
Sep 24 2015 22:59
@dting your code solves "abracadabra" in under 12 seconds, quite impressive !!
Anthony Albertorio
@tesla809
Sep 24 2015 22:59
@MichaelGuest no problem
Michael Guest
@MichaelGuest
Sep 24 2015 22:59
@how about for javascript?
Rob
@BobsHub
Sep 24 2015 22:59
mine took 5 minutes
Michael Guest
@MichaelGuest
Sep 24 2015 23:00
@tesla809 how about for js
Anthony Albertorio
@tesla809
Sep 24 2015 23:00
@MichaelGuest codacademy is still a better introduction
@MichaelGuest although in the future free code camp will get better.
@MichaelGuest for more advance things, FCC is better
@MichaelGuest there is a curriculum and a logical progress to it
Phillip Kneeland
@pkneeland78
Sep 24 2015 23:00
```js
Michael Guest
@MichaelGuest
Sep 24 2015 23:01
@tesla809 good to know thanks!
CamperBot
@camperbot
Sep 24 2015 23:01
michaelguest sends brownie points to @tesla809 :sparkles: :thumbsup: :sparkles:
:warning: michaelguest already gave tesla809 points
Phillip Kneeland
@pkneeland78
Sep 24 2015 23:01
var ourArray = ["Stimpson", "J", ["cat"]];
ourRemoved = ourArray.shift();
// ourArray now equals ["J", ["cat"]].

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

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

// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & myRemoved = ' + JSON.stringify(z);})(myArray, myRemoved);
DTing
@dting
Sep 24 2015 23:01
This message was deleted
Anthony Albertorio
@tesla809
Sep 24 2015 23:01
@MichaelGuest I say do both, But start with code academy. Do HTML/CSS, then bootstrap, then Javascript
Michael Guest
@MichaelGuest
Sep 24 2015 23:01
@tesla809 ok will do!
Anthony Albertorio
@tesla809
Sep 24 2015 23:01
@MichaelGuest then do the jQuery.
@MichaelGuest Then when you are done with that, do FCC. In the beginning it will be redundant, but practice makes perfect. If you notice somethings are off good, that means you were paying attention.
DTing
@dting
Sep 24 2015 23:02
@pkneeland78
// Only change code below this line.
var myRemoved = myArray; // This line should be changed to shift off first element of myArray and assign that value to myRemoved.
// Only change code above this line.
Anthony Albertorio
@tesla809
Sep 24 2015 23:02
@MichaelGuest when you get to the algorithms part things get really interesting!
Michael Guest
@MichaelGuest
Sep 24 2015 23:02
@sweet thanks for the advice!
CamperBot
@camperbot
Sep 24 2015 23:02
michaelguest sends brownie points to @sweet :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for sweet
Phillip Kneeland
@pkneeland78
Sep 24 2015 23:02
Can someone tell me why this wouldn't work if I put "myRemoved = myArray.shift();" above "var myRemoved = myArray;" ? I did it by putting it above and it didn't work, and wanted to know the logic behind it not working.
Michael Guest
@MichaelGuest
Sep 24 2015 23:03
@tesla809 sweet! thanks for the advice!
CamperBot
@camperbot
Sep 24 2015 23:03
michaelguest sends brownie points to @tesla809 :sparkles: :thumbsup: :sparkles:
:warning: michaelguest already gave tesla809 points
Anthony Albertorio
@tesla809
Sep 24 2015 23:03
@MichaelGuest no problem
@MichaelGuest i suggest you also learn python and ruby, to see how other programming langauages work. It will be redundant, but if you train yourself to learn new tech all the time, the thinking will stick
languages*
@MichaelGuest But don't make the mistake of switching all the time. Stick to JavaScript for now. And what ever you make, take some time later on to re make it in these other languages.
DTing
@dting
Sep 24 2015 23:04

@pkneeland78 if you put your code

myRemoved = myArray.shift();

above the declartion of the local variable, then:

var myRemoved = myArray;

You now have a global variable that has been assigned with the value of the shifted element. and local variable that has been assigned to the value of myArray

Anthony Albertorio
@tesla809
Sep 24 2015 23:04
Any one know how to upload a website to a server via FTP on name cheap?
Haven't done it in a while and i forgot
@tesla809 Total time to google: 7.3 seconds.
@tesla809 search terms: name cheap ftp - top result was the link
Star Cherrix
@Sparklepaws
Sep 24 2015 23:07
Hey guys, I have a question. It looks like I made it to ziplines and while reverse engineering the portfolio website I find myself asking one thing a lot: When is it better to use jQuery over CSS? I mean for the most part I've only been taught enough about jQuery to modify or add existing code, so it seems pointless.
Anthony Albertorio
@tesla809
Sep 24 2015 23:07
@SaintPeter saintPeter Aaaa thanks for the passive aggressive answer ;)
CamperBot
@camperbot
Sep 24 2015 23:07
tesla809 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
Phillip Kneeland
@pkneeland78
Sep 24 2015 23:07
@dting ok I think I got it. It was kind of confusing because in the exaple above in that exercise, there was no "var" in front of the "ourRemoved = ourArray.shift();" I edited the line to "var myRemoved = myArray.shift();" and it worked.
CamperBot
@camperbot
Sep 24 2015 23:07
:star: 718 | @saintpeter | http://www.freecodecamp.com/saintpeter
Phillip Kneeland
@pkneeland78
Sep 24 2015 23:07
@dting thanks :)
Rex Schrader
@SaintPeter
Sep 24 2015 23:07
@tesla809 Glad to be of service ;)
CamperBot
@camperbot
Sep 24 2015 23:07
pkneeland78 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:warning: pkneeland78 already gave dting points
Anthony Albertorio
@tesla809
Sep 24 2015 23:08
@SaintPeter by any chance, should I upload it to the www folder or the public folder? I am first starting to host some fonts
@SaintPeter or the public_html folder
Rex Schrader
@SaintPeter
Sep 24 2015 23:09
@tesla809 If it's like most hosts, one is an alias to the other. The www and public_html should be the same folder.
Alexander Schuneman
@AxSch
Sep 24 2015 23:09
hint bonfire check for palindromes
CamperBot
@camperbot
Sep 24 2015 23:09
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Anthony Albertorio
@tesla809
Sep 24 2015 23:10
Aaa thanks @SaintPeter Blessing be upon you sir
CamperBot
@camperbot
Sep 24 2015 23:10
tesla809 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: tesla809 already gave saintpeter points
Rex Schrader
@SaintPeter
Sep 24 2015 23:10
@tesla809 :D
James Fisher
@jamesfisher314
Sep 24 2015 23:10
@Sparklepaws I use css for anything I want to have styled when the page loads and anything I'm not going to change. I use jQuery when I'm going to get data or input and want to change the state of something later.
Michael Bomholt
@bomholtm
Sep 24 2015 23:11
is there a way to give two overlapping divs a common box shadow? i try to get a shadow just around both and not overlapping where one div overlaps into the other one.
James Fisher
@jamesfisher314
Sep 24 2015 23:11
@Sparklepaws so I basically use the css file as the base state, and then change whatever I want while the page is running
Rex Schrader
@SaintPeter
Sep 24 2015 23:11
@bomholt Pretty sure you cannot. You may be able to fake it with multiple smaller divs, though.
James Fisher
@jamesfisher314
Sep 24 2015 23:12
@bomholt put them both in a larger div and give that div a shadow? :)
Rex Schrader
@SaintPeter
Sep 24 2015 23:12
@bomholt Perhaps you could add two divs under the divs you're showing and give those both a shadow?
Star Cherrix
@Sparklepaws
Sep 24 2015 23:12
@jamesfisher314 So it's more for practical live-editing than anything?
Michael Bomholt
@bomholtm
Sep 24 2015 23:12
@jamesfisher314 the problem is the whole thing isnt a rectangle
@SaintPeter i kinda had that idea but didnt worked
James Fisher
@jamesfisher314
Sep 24 2015 23:13
@Sparklepaws yeah. making changes (add, remove, edit, hide, show) with jQuery should be slightly slower than including it in your html+css; the browser has to read in the html and css before it can get to the jquery
Star Cherrix
@Sparklepaws