These are chat archives for FreeCodeCamp/Help

26th
Oct 2015
Garrett Schultz
@garettschultz
Oct 26 2015 00:21
What would i be doing wrong? myData is supposed to equal the first value of myArray.
// var ourArray = [1,2,3];
// var ourData = ourArray[0]; // equals 1

var myArray = [1,2,3];
// Only change code below this line.
var myData = [0];
Charles Milam
@CharlesMilam
Oct 26 2015 00:22
You are setting myData to a new array with a single element of 0.
Garrett Schultz
@garettschultz
Oct 26 2015 00:22
soooooo just take out the equal sign?
Charles Milam
@CharlesMilam
Oct 26 2015 00:23
Check out the comment, and do what is similar to ourArray0, but your myData.
oops, formatting
ourArray[0]
Garrett Schultz
@garettschultz
Oct 26 2015 00:24
ohh var myData = myArray[0];
Charles Milam
@CharlesMilam
Oct 26 2015 00:24
yes!
Garrett Schultz
@garettschultz
Oct 26 2015 00:25
alrighty i get it thanks @CharlesMilam
CamperBot
@camperbot
Oct 26 2015 00:25
gratschultz2013 sends brownie points to @charlesmilam :sparkles: :thumbsup: :sparkles:
:star: 297 | @charlesmilam | http://www.freecodecamp.com/charlesmilam
Charles Milam
@CharlesMilam
Oct 26 2015 00:25
When used like that you are referencing an element within the array, as you had it, you were assigning a new array.
Garrett Schultz
@garettschultz
Oct 26 2015 00:31
howcome when i type that code into repl.it and run it, it says it wont work?
Chris
@Aoxom
Oct 26 2015 00:32
@gratschultz2013 youre saying Mydata has a property of 0, but youre not telling it to be a property of myArray0
@gratschultz2013 myData* sorry
@gratschultz2013 ahhh scratch that, i didnt see your later message
Garrett Schultz
@garettschultz
Oct 26 2015 00:34
here ill show u what i mean
Chris
@Aoxom
Oct 26 2015 00:34
im still a beginner too but ill try to help
Charles Milam
@CharlesMilam
Oct 26 2015 00:36
did you assign any values to myArray?
Garrett Schultz
@garettschultz
Oct 26 2015 00:36
i cant paste an image in chat like i used to be able to
i tried that same code with different values to try it myself and it says theres errors.
```
var cars = [srt4, scionFRS]; var myCars = cars[0 , 1];
Charles Milam
@CharlesMilam
Oct 26 2015 00:37
I just tested something like that here, and got what I would expect.
ah, you can't reference two elements at the same time like that.
Garrett Schultz
@garettschultz
Oct 26 2015 00:39
what do i have to do to make it work? i took out the 1 and just put 0 and im still gettting an wrror
error
blob
crammatt
@crammatt
Oct 26 2015 00:41
hello all, how do i restart and go through a specific section of the course a second time?
Garrett Schultz
@garettschultz
Oct 26 2015 00:42
@crammatt im doing the same for javascript as we speak. just go to your map and click on the courses you want to redo and just reset the code for each one.
Chris
@Aoxom
Oct 26 2015 00:42
@gratschultz2013 quotes around srt4 and scionFRS
Charles Milam
@CharlesMilam
Oct 26 2015 00:43
@gratschultz2013 are you using srt4 as a variable name? Otherwise, those car names need to be in quotes, so they are strings.
Garrett Schultz
@garettschultz
Oct 26 2015 00:44
aha @Aoxom that was the problem, forgot to use quotes since its like a string.
Charles Milam
@CharlesMilam
Oct 26 2015 00:45
@gratschultz2013 good job!
Garrett Schultz
@garettschultz
Oct 26 2015 00:45
well, see this is my issue. i type that exact thing in my editor outside of FCC and it says errors but in FCC it works!!!!!!!!!!!!!
ahhh outside of FCC the only way the code works and returns my answer is if it looks like this:
var cars = ["srt4","frs"]; myCars = cars[1];
Garrett Schultz
@garettschultz
Oct 26 2015 00:51
meaning i didnt have to use var cars = myCars[1];
Tycondrease
@Tycondrease
Oct 26 2015 01:08

Hello, I am doing the Waypoint Challenge. The instructions say to add a green background to my form element to #cat-photo-element { background-color: green; }

I've tried this many times and I've created a class called .green-background {
background-color: green
}
I'm stuck the form element also has the id=cat-photo-form.

Charles Milam
@CharlesMilam
Oct 26 2015 01:08
what you are using outside of FCC is correct. Not sure why FCC accepts it. Without the quotes Javascript is going to treat srt4 and frs as variables. So unless you did something like:
var srt4 ="SRT4";
then it is going to error out because srt4 has not been defined anywhere.
with the # is saying that it is an id and not a class.
Daniel Chung
@daniel-chung
Oct 26 2015 01:10
Can anyone help me troubleshoot the search functionality in the twitchtv zipline?
Charles Milam
@CharlesMilam
Oct 26 2015 01:10
@Tycondrease with the # is saying that it is an id and not a class.
Daniel Chung
@daniel-chung
Oct 26 2015 01:10
This message was deleted
DJ
@qualitymanifest
Oct 26 2015 01:10
@Tycondrease which waypoint is this
Tycondrease
@Tycondrease
Oct 26 2015 01:13
I appreciate the response, the issue was that I had written cat-photo-form instead of the correct cat-photo-element.
Daniel Chung
@daniel-chung
Oct 26 2015 01:14

Can anyone help me trouble shoot the search functionality of my twitchtv zipline?
I'm using List.js. When I hardcode the links, the functionality works but it breaks when I use the API.
Thanks in advance!

API version:
http://codepen.io/daniel-chung/pen/dYPRjG

Hard coded version:
http://codepen.io/daniel-chung/pen/JYLyVL?editors=101

Charles Milam
@CharlesMilam
Oct 26 2015 01:17
@daniel-chung successF(data, userName, className) where is that defined?
When you say "I use the API" are you talking about the Twitch API? Can you get the Twitch API to do anything for your?
errr for you?
I know I have also seen folks saying you have to use JSONP and not straight JSON when discussing the Twitch API, but not sure if it applies here. I have not yet done that one. You might also want to ask for some help here, which is help chat dedicated to ziplines => https://gitter.im/FreeCodeCamp/HelpZiplines
Daniel Chung
@daniel-chung
Oct 26 2015 01:24

@CharlesMilam thanks for your response!

The successF is a parameter of the getUserStreams() function.

Yes, I'm using the Twitch API and that's working for me. The issue I'm having is that the List.js functionality doesn't seem to be working when I use the Twitch API. My huntch is that jQuery isn't loading fast enough or isn't fully interacting with the list.js.

CamperBot
@camperbot
Oct 26 2015 01:24
daniel-chung sends brownie points to @charlesmilam :sparkles: :thumbsup: :sparkles:
:star: 298 | @charlesmilam | http://www.freecodecamp.com/charlesmilam
Charles Milam
@CharlesMilam
Oct 26 2015 01:30
@daniel-chung what is this, in your head section? Does that actually work? <script src="/path/to/jquery.searcher.js"></script>
Colton Ehrman
@coltonehrman
Oct 26 2015 01:37
http://codetionary.com sortable by name and type now!
Mark Puetz
@Funkybunch2006
Oct 26 2015 01:38
I can't get the following code to return what I want. I know I'm missing a step:
function Person(firstName, lastName, age){
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
}
var myPerson = new Person('Mark', 'Puetz', 27);
Here's what I'm trying to get:
{ firstName: 'Mark', lastName: 'Puetz', age: 27 }
Garrett Schultz
@garettschultz
Oct 26 2015 01:40
@Funkybunch2006 can you paste the exact code you have?
or what challenge is that exactly?
Mark Puetz
@Funkybunch2006
Oct 26 2015 01:41
That's the exact code that I have
Garrett Schultz
@garettschultz
Oct 26 2015 01:41
what waypoint is it from?
Mark Puetz
@Funkybunch2006
Oct 26 2015 01:42
the challenge is imply to output what I printed below. It's not from FreeCodeCamp. I'm just trying to figure it out to facilitate something bigger
m-farooqui
@m-farooqui
Oct 26 2015 01:45
hi i am in module 37 and i am trying to use the property background -color i am able to create a background class but unable to implement in the div element
here is my code
<div class="gray-background" {background-color:gray;}>
</div>
Garrett Schultz
@garettschultz
Oct 26 2015 01:49
@m-farooqui why do you have {background-color:gray;} inside your div?
in your css it would go ``` .gray-background {background-color: gray;}
96street
@96street
Oct 26 2015 02:02
hey guys im in 106 (Waypoint: Target HTML Elements with Selectors Using jQuery). i've completed it but I just want to understand what they mean when they say: Note that we've already included both the jQuery library and the Animate.css library in your code editor. So you are using jQuery to apply the Animate.css bounce class to your button elements.
Charles Milam
@CharlesMilam
Oct 26 2015 02:03
@Funkybunch2006 I copied your code and console logged myPerson and got just what you were looking for. What is not working on your end?
@96street They are saying those two libraries were included for you, and you didn't need to add references to them yourself.
Lê Viết Hoàng Dũng
@nangtrongvuon
Oct 26 2015 02:06
might be a dumb question, but is the actual grey color different from gray?
Mark Puetz
@Funkybunch2006
Oct 26 2015 02:06
@Funkybunch2006 I think the problem must be with my console. I didn't have it setup right. thanks @CharlesMilam @gratschultz2013
CamperBot
@camperbot
Oct 26 2015 02:06
sorry funkybunch2006, you can't send brownie points to yourself! :sparkles: :sparkles:
:star: 195 | @gratschultz2013 | http://www.freecodecamp.com/gratschultz2013
:star: 299 | @charlesmilam | http://www.freecodecamp.com/charlesmilam
Chris Crook
@chrisisacrook
Oct 26 2015 02:06
@96street jQuery is a collection of javascript libraries. Basically when a jQuery library is referenced you are actually referencing a whole bunch of javascript code that has been been created into a method. This allows you to do more things with javascript without writing out as much code. "write less, do more"
Mark Puetz
@Funkybunch2006
Oct 26 2015 02:07
lol oops
96street
@96street
Oct 26 2015 02:07
@CharlesMilam do you know if they show us how to reference them? how would you usually reference them?
h4r1m4u
@h4r1m4u
Oct 26 2015 02:07

@96street what @CharlesMilam says. for example, if you want to use jquery in your web page, you first need to import it in your <head>, e.g. like so:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

same with animate.css. without importing these libraries first, you won't have access to the jquery functions or the animate.css classes

Lê Viết Hoàng Dũng
@nangtrongvuon
Oct 26 2015 02:07
@m-farooqui you don't put a class in a div like that, you style the class in your style section
<style>
.gray-background {
background-color: gray;
}
</style>
96street
@96street
Oct 26 2015 02:09
@h4r1m4u so for every page you use jQuery, do you use that same line of code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
Lê Viết Hoàng Dũng
@nangtrongvuon
Oct 26 2015 02:09
then you just give the div a class:
<div class="gray-background> thingy with grey background </div>
h4r1m4u
@h4r1m4u
Oct 26 2015 02:09
@nangtrongvuon it's just a spelling difference. grey is UK english, gray is American english
96street
@96street
Oct 26 2015 02:09
@h4r1m4u also, what is animate.css exactly? I learned bootstrap, is that related?
Matt Leonard
@matty22
Oct 26 2015 02:09
Can someone help me troubleshoot bonfire where do i belong
CamperBot
@camperbot
Oct 26 2015 02:09
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Lê Viết Hoàng Dũng
@nangtrongvuon
Oct 26 2015 02:10
@h4r1m4u thanks, i was actually wondering if there was an actual color difference between the 2 lol
CamperBot
@camperbot
Oct 26 2015 02:10
nangtrongvuon sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 323 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
h4r1m4u
@h4r1m4u
Oct 26 2015 02:10
@96street yeah, basically. there are other ways to import it. the one i mentioned above leverages google CDN. but you could also download the jquery .js file and link it from your own server
Charles Milam
@CharlesMilam
Oct 26 2015 02:10
@m-farooqui If you wanted to use inline styling it would be something like <div class="gray-background" style="background-color:gray">
</div>
h4r1m4u
@h4r1m4u
Oct 26 2015 02:11
@96street as for animate.css: https://daneden.github.io/animate.css/. it's a collection of CSS classes that use transitions and animations to add effects to your HTML elements
nothing to do with bootstrap
96street
@96street
Oct 26 2015 02:11
@h4r1m4u thankyou.
h4r1m4u
@h4r1m4u
Oct 26 2015 02:11
my pleasure
Matt Leonard
@matty22
Oct 26 2015 02:13
This code passes 4/6 tests. For some reason on this one, it's looping 7 times instead of just arr.length times.
function where(arr, num) {
  // Find my place in this sorted array.

  var count = 0;
  arr.sort(function(comp){

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

      if (num > arr[i]) {
        //console.log(count);
        count++;
        //console.log(count);
        return count;
      } else {

        return count;
      }
    }

  });

  return count;
}

where([10, 20, 30, 40, 50], 30);
Lê Viết Hoàng Dũng
@nangtrongvuon
Oct 26 2015 02:14
don't arrays start at 0?
wait no ignore me
h4r1m4u
@h4r1m4u
Oct 26 2015 02:15
@matty22 try moving count++ out of the if statement:
      if (num > arr[i]) {
        //console.log(count);
        //console.log(count);
        return count;
      } else {

        return count;
      }
      count++;
Herman Fassett
@HermanFassett
Oct 26 2015 02:15
@matty22 not sure why you have a for loop in your sort
Matt Leonard
@matty22
Oct 26 2015 02:15
Does sort() do that for me similar to how .filter() does?
Charles Milam
@CharlesMilam
Oct 26 2015 02:16
yes
Herman Fassett
@HermanFassett
Oct 26 2015 02:16
Something similar
Justin
@JustinHatchett
Oct 26 2015 02:16
Maybe I’m overthinking this, but as I get going with this amazing bootcamp and the waypoint challenges, I feel the need to take notes along the way, is it better just to go for a “practice makes permanent” approach or is there a good way to take coding notes?
Matt Leonard
@matty22
Oct 26 2015 02:16
Ok, let me try that.
Herman Fassett
@HermanFassett
Oct 26 2015 02:16

For instance

arr.sort(function(a, b) {
    return a-b;
});

Will sort an array in numeric order

Matt Leonard
@matty22
Oct 26 2015 02:18
Thanks @HermanFassett @CharlesMilam @h4r1m4u
CamperBot
@camperbot
Oct 26 2015 02:18
matty22 sends brownie points to @hermanfassett and @charlesmilam and @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 300 | @charlesmilam | http://www.freecodecamp.com/charlesmilam
:star: 449 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
:star: 324 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
Chris Crook
@chrisisacrook
Oct 26 2015 02:18
@JustinJ01 Practice is definitely the most important part in my opinion. That being said, if you have no experience in programming it could be useful to take notes. What I have found to be the best is to copy the code into a text editor and comment out what the code is doing. That way I can go back to reference what I have done and how it works
Matt Leonard
@matty22
Oct 26 2015 02:18
I used this logic. Can you guys look at it and tell me if it's ugly even if it does pass?
function where(arr, num) {
  // Find my place in this sorted array.

  var count = 0;
  arr.sort(function(comp){

    if (num > arr[count]) {

        count++;
        return count;

      } else {

        return count;
      }


  });

  return count;
}

where([10, 20, 30, 40, 50], 30);
Charles Milam
@CharlesMilam
Oct 26 2015 02:18
@JustinJ01 What type of notes do you find yourself taking?
Matt Leonard
@matty22
Oct 26 2015 02:19
Seems like I'm returning count a bunch of times?
Herman Fassett
@HermanFassett
Oct 26 2015 02:19
Well another way of doing it @matty22 is pushing num to your array, sorting array numerically, and then getting the index of your num
Matt Leonard
@matty22
Oct 26 2015 02:20
Yeah, I started out that way. It might be a bit cleaner eh?
Justin
@JustinHatchett
Oct 26 2015 02:21
@chrisisacrook thanks! @CharlesMilam I’m just getting started was feeling the need to, but haven’t as of yet. I just wasn’t sure if there was some sort of standard that I might follow, but I like @chrisisacrook’s idea for sure.
CamperBot
@camperbot
Oct 26 2015 02:21
justinj01 sends brownie points to @chrisisacrook and @charlesmilam and @chrisisacrook :sparkles: :thumbsup: :sparkles:
:star: 301 | @charlesmilam | http://www.freecodecamp.com/charlesmilam
:star: 183 | @chrisisacrook | http://www.freecodecamp.com/chrisisacrook
:star: 183 | @chrisisacrook | http://www.freecodecamp.com/chrisisacrook
Charles Milam
@CharlesMilam
Oct 26 2015 02:22
Matt Leonard
@matty22
Oct 26 2015 02:23

@CharlesMilam I thought of doing something like:

```

h4r1m4u
@h4r1m4u
Oct 26 2015 02:23
@JustinJ01 you could also have a look at github gists: https://gist.github.com/. it quickly let's you create and save short code snippets. very useful for creating your own code reference database
Matt Leonard
@matty22
Oct 26 2015 02:24
arr.push(num);
arr.sort();
arr.indexOf(num);
But a problem arose when there were multiples of the same number in the array.
Justin
@JustinHatchett
Oct 26 2015 02:24
@h4r1m4u Great resource, thank you.
CamperBot
@camperbot
Oct 26 2015 02:24
justinj01 sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 325 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
h4r1m4u
@h4r1m4u
Oct 26 2015 02:25
my pleasure
Herman Fassett
@HermanFassett
Oct 26 2015 02:25
You need the numerical sort @matty22
Here's passing code with that method
function where(arr, num) {
  arr.push(num);
  return arr.sort(function(a, b) { 
    return a - b;
  }).indexOf(num);
}
Charles Milam
@CharlesMilam
Oct 26 2015 02:26
@matty22 Isn't the array already sorted for you? The first comment says to find the index in the "sorted array" , giving the impression that the array is already sorted.
I would think you could just do arr.indexOf(num);
Herman Fassett
@HermanFassett
Oct 26 2015 02:27
@CharlesMilam not if you push num
If you push it, you must then sort
Charles Milam
@CharlesMilam
Oct 26 2015 02:28
Why would you push it, is that part of the instructions?
Herman Fassett
@HermanFassett
Oct 26 2015 02:29
No, it's just one way of getting it's position
Mandeep Singh
@MandeepMann
Oct 26 2015 02:29
When this waypoint says "You can add Bootstrap to any app just by including it with <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/> at the top of your HTML. But we've added it for you to this page behind the scenes."
Charles Milam
@CharlesMilam
Oct 26 2015 02:30
They are giving the example of how you would make use of it typically, but in the case of that waypoint they have done it for you, and you do not have to.
Mandeep Singh
@MandeepMann
Oct 26 2015 02:30
I cant see where they added ...and how will i add it in future ? do i need to put the sam elink everywhere? or should i leave it for now and i will come to know in further waypoints
Matt Leonard
@matty22
Oct 26 2015 02:30
The challenge asks you to find its index. So if you push it in, then sort it, you can do indexOf(). The problem being that if there are two "50" then indexOf() doesn't know which to grab the index for.
Lê Viết Hoàng Dũng
@nangtrongvuon
Oct 26 2015 02:30
@MandeepMann it should be in the beginning parts of your HTML
This message was deleted
h4r1m4u
@h4r1m4u
Oct 26 2015 02:31
@MandeepMann
<head>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/>
</head>
Lê Viết Hoàng Dũng
@nangtrongvuon
Oct 26 2015 02:31
yea like that
although i think that link is outdated?
Matt Leonard
@matty22
Oct 26 2015 02:31
@MandeepMann You can't see it. For now, I wouldn't worry about it. When you get further along and you're building websites, you'll definitely run across this and it'll make more sense then.
h4r1m4u
@h4r1m4u
Oct 26 2015 02:32
@nangtrongvuon yeah, current version is 3.3.5 with 4 being in beta
Charles Milam
@CharlesMilam
Oct 26 2015 02:32
@matty22 If you read through that link I gave, it tells you that it grabs the index of the first instance of the search value => "...returns the first index at which a given element can be found in the array..."
Mandeep Singh
@MandeepMann
Oct 26 2015 02:32
thank you @h4r1m4u @nangtrongvuon @CharlesMilam
CamperBot
@camperbot
Oct 26 2015 02:32
mandeepmann sends brownie points to @h4r1m4u and @nangtrongvuon and @charlesmilam :sparkles: :thumbsup: :sparkles:
:star: 302 | @charlesmilam | http://www.freecodecamp.com/charlesmilam
:star: 62 | @nangtrongvuon | http://www.freecodecamp.com/nangtrongvuon
:star: 326 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
Matt Leonard
@matty22
Oct 26 2015 02:34
Well I tried going that route in the bonfire and it didn't pass. For example, this:
function where(arr, num) {
  // Find my place in this sorted array.

/* var count = 0;
  arr.sort(function(comp){

    if (num > arr[count]) {

        count++;
        return count;

      } 


  });

  return count; */


  arr.push(num);
  arr.sort();
  return arr.indexOf(num);


}

where([5, 3, 20, 3], 3);
Returns 1, when it should return 0.
Notice the comments around my actual code.
Charles Milam
@CharlesMilam
Oct 26 2015 02:36
You aren't giving sort a function to actually sort with.
Matt Yamamoto
@MattYamamoto
Oct 26 2015 02:36
@matty22 sort is sorting by unicode code in that example, so 20 is before 3
Charles Milam
@CharlesMilam
Oct 26 2015 02:38
doh, yes @MattYamamoto is correct
Matt Yamamoto
@MattYamamoto
Oct 26 2015 02:39
@CharlesMilam but you are correct, supplying a function to sort would remedy that.
Matt Leonard
@matty22
Oct 26 2015 02:40
Ahh...I see. That could explain my confusion.
Anyhow, I've finished with Basic Bonfires! Woop Woop
Charles Milam
@CharlesMilam
Oct 26 2015 02:41
@matty22 congrats!
Matt Leonard
@matty22
Oct 26 2015 02:42
Thanks @CharlesMilam
CamperBot
@camperbot
Oct 26 2015 02:42
matty22 sends brownie points to @charlesmilam :sparkles: :thumbsup: :sparkles:
:warning: matty22 already gave charlesmilam points
Lê Viết Hoàng Dũng
@nangtrongvuon
Oct 26 2015 02:42
gratz @matty22 !
Charles Milam
@CharlesMilam
Oct 26 2015 02:44
@matty22 Going forward, if they don't tell you to alter the array, say by pushing the compare number, then it is best to leave it alone, as future tests might check if the compare number even exists in the array, or that the array length is the same, stuff like that.
2high2decide
@2high2decide
Oct 26 2015 02:53
changing href to # to turn it into a dead link.. do I just replace 'href' with '#'
Lê Viết Hoàng Dũng
@nangtrongvuon
Oct 26 2015 02:54
a href="#"
2high2decide
@2high2decide
Oct 26 2015 02:54
makes sense. Thank you!
CamperBot
@camperbot
Oct 26 2015 02:54
if you want to thank someone, put an @ before their name!
Anthony
@Guzko
Oct 26 2015 03:16
Hey, juststarted coding how do I make the curly braces?
h4r1m4u
@h4r1m4u
Oct 26 2015 03:17
{ }
Charles Milam
@CharlesMilam
Oct 26 2015 03:20
shift+[
Abhisek Pattnaik
@abhisekp
Oct 26 2015 03:26
// finish this function expression
+function (start) {
Michael Cheung
@m6cheung
Oct 26 2015 03:35
hey guys I set my input direction to be RTL, and it works good, but when I wanted to add a value "+" to the input, it was added LTR
does anyone know why this may be?
Jorge Rodriguez
@rodri0315
Oct 26 2015 03:36
Help guys.. do I need to change this code completely??
```
CamperBot
@camperbot
Oct 26 2015 03:36
no wiki entry for: guys do i need to change this code completely
:pencil: click here to create one now!after creating your page type update to reload it here
Jorge Rodriguez
@rodri0315
Oct 26 2015 03:37
function palindrome(str) {
  // Good luck
  str.toLowerCase().split("").reverse().join("");
  return true;
}



palindrome("eye");
/
Abhisek Pattnaik
@abhisekp
Oct 26 2015 03:38
...continue :point_up: October 26, 2015 8:56 AM
    start = start + 5;
     return start;
}(10);
@rodri0315 yes. Please read the instructions again!
navicyclical
@navicyclical
Oct 26 2015 03:42
So my code works but it adds the ellipsis to any string, not just ones with 3 or more characters, and it won't pass the last test. Do I need to use a if/elseif statement with >=3 in my control flow?
function truncate(str, num) {
  // define local variables
  var stringToTrim = str;
  var trimAt = num;
  //logic below
  if (stringToTrim.length>trimAt){
    stringToTrim = stringToTrim.slice(0, trimAt-3) + ("...");
    //stringToTrim = stringToTrim + ("...");  
  } else{
    stringToTrim.slice(trimAt);
  }
  return stringToTrim;
}

truncate("A-tisket a-tasket A green and yellow basket", 11);
h4r1m4u
@h4r1m4u
Oct 26 2015 03:49

@navicyclical yes. consider what happens for a string 'A-' and num 1 here:

stringToTrim = stringToTrim.slice(0, trimAt-3) + ("...");

this translates to stringToTrim = stringToTrim.slice(0, -2) + ("...");the (0, -2) slice here will be an empty string

Anthony
@Guzko
Oct 26 2015 03:57
I need help using CSS Class to Style an Element.
Matt Leonard
@matty22
Oct 26 2015 03:59
Go for it Guzko!
What's your problem?
navicyclical
@navicyclical
Oct 26 2015 04:08
@h4r1m4u I played around with changing the else into an else if and with setting stringToTrim>=3 but I still can't get this to work
h4r1m4u
@h4r1m4u
Oct 26 2015 04:08
@navicyclical can you post your updated code?
navicyclical
@navicyclical
Oct 26 2015 04:09
function truncate(str, num) {
  // define local variables
  var stringToTrim = str;
  var trimAt = num;
  //logic below
  if (stringToTrim.length>=trimAt){
    stringToTrim = stringToTrim.slice(0, trimAt-3) + ("..."); 
  } else if(stringToTrim.length<=3){
    stringToTrim.slice(0,trimAt);
  }
  console.log(stringToTrim);
}

truncate("A-", 1);
i changed the return to a console.log to see what is happening
h4r1m4u
@h4r1m4u
Oct 26 2015 04:12
@navicyclical with this code, you first if condition executes for the "A-" string because its length is >= num
you need to add another condition into the first if branch with && (which stands for logical AND)
Kevin Brown
@kevindewbrown
Oct 26 2015 04:13
Can someone help me with this code?
http://freecodecamp.com/challenges/waypoint-create-a-javascript-slot-machine#?solution=fccss%0A%20%20function%20runSlots()%7B%0A%20%20%20%20var%20slotOne%3B%0A%20%20%20%20var%20slotTwo%3B%0A%20%20%20%20var%20slotThree%3B%0A%20%20%20%0A%20%20%20%20var%20images%20%3D%20%5B%22http%3A%2F%2Fi.imgur.com%2F9H17QFk.png%22%2C%20%22http%3A%2F%2Fi.imgur.com%2F9RmpXTy.png%22%2C%20%22http%3A%2F%2Fi.imgur.com%2FVJnmtt5.png%22%5D%3B%0A%20%20%20%0A%20%20%20%20%2F%2F%20Only%20change%20code%20below%20this%20line.%0A%20%20%20%0A%20%20Math.floor(Math.random()%20*%20(3%20-%201%20%2B%201))%20%2B%201%3B%20%0A%20%20%20Math.floor(Math.random()%20*%20(3%20-%201%20%2B%201))%20%2B%201%3B%20%0A%20%20%20%20Math.floor(Math.random()%20*%20(3%20-%201%20%2B%201))%20%2B%201%3B%20%0A%20%20%20%20%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20Only%20change%20code%20above%20this%20line.%0A%20%20%20%20%0A%20%20%20%20%24(%22.logger%22).html(%22%22)%3B%0A%20%20%20%20%24(%22.logger%22).html(%22Not%20A%20Win%22)%0A%20%20%20%20%0A%20%20%20%20if(slotOne%20!%3D%3D%20undefined%20%26%26%20slotTwo%20!%3D%3D%20undefined%20%26%26%20slotThree%20!%3D%3D%20undefined)%7B%0A%20%20%20%20%20%20%24(%22.logger%22).html(slotOne%20%2B%20%22%20%22%20%2B%20slotTwo%20%2B%20%22%20%22%20%2B%20slotThree)%3B%0A%20%20%20%20%7D%0A%20%20%20%20return%20%5BslotOne%2C%20slotTwo%2C%20slotThree%5D%3B%0A%20%20%7D%0A%0A%20%20%24(document).ready(function()%7B%0A%20%20%20%20%20%24(%22.go%22).click(function()%7B%0A%20%20%20%20%20%20%20runSlots()%3B%0A%20%20%20%20%20%7D)%3B%0A%20%20%20%7D)%3B%0Afcces%0A%20%0A%3Cdiv%3E%0A%20%3Cdiv%20class%20%3D%20%22container%20inset%22%3E%0A%20%20%20%3Cdiv%20class%20%3D%20%22header%20inset%22%3E%0A%20%20%20%20%20%3Cimg%20src%3D%22https%3A%2F%2Fs3.amazonaws.com%2Ffreecodecamp%2Ffreecodecamp_logo.svg.gz%22%20alt%3D%22learn%20to%20code%20javascript%20at%20Free%20Code%20Camp%20logo%22%20class%3D%22img-responsive%20nav-logo%22%3E%0A%20%20%20%20%20%3Ch2%3EFCC%20Slot%20Machine%3C%2Fh2%3E%0A%20%20%20%3C%2Fdiv%3E%0A%20%20%20%3Cdiv%20class%20%3D%20%22slots%20inset%22%3E%0A%20%20%20%20%20%3Cdiv%20class%20%3D%20%22slot%20inset%22%3E%0A%20%20%20%20%20%20%20%0A%20%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%20%20%3Cdiv%20class%20%3D%20%22slot%20inset%22%3E%0A%20%20%20%20%20%20%20%0A%20%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%20%20%3Cdiv%20class%20%3D%20%22slot%20inset%22%3E%0A%20%20%20%20%20%20%20%0A%20%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%3C%2Fdiv%3E%0A%20%20%20%3Cbr%2F%3E%0A%20%20%20%3Cdiv%20class%20%3D%20%22outset%22%3E%0A%20%20%20%20%20%3Cbutton%20class%20%3D%20%22go%20inset%22%3E%0A%20%20%20%20%20%20%20Go%0A%20%20%20%20%20%3C%2Fbutton%3E%0A%20%20%20%3C%2Fdiv%3E%0A%20%20%20%3Cbr%2F%3E%0A%20%20%20%3Cdiv%20class%20%3D%20%22foot%20inset%22%3E%0A%20%20%20%20%20%3Cspan%20class%20%3D%20%22logger%22%3E%3C%2Fspan%3E%0A%20%20%20%3C%2Fdiv%3E%0A%20%3C%2Fdiv%3E%0A%3C%2Fdiv%3E%0A%0A%3Cstyle%3E%0A%20.container%20%7B%0A%20%20%20background-color%3A%20%234a2b0f%3B%0A%20%20%20height%3A%20400px%3B%0A%20%20%20width%3A%20260px%3B%0A%20%20%20margin%3A%2050px%20auto%3B%0A%20%20%20border-radius%3A%204px%3B%0A%20%7D%0A%20.header%20%7B%0A%20%20%20border%3A%202px%20solid%20%23fff%3B%0A%20%20%20border-radius%3A%204px%3B%0A%20%20%20height%3A%2055px%3B%0A%20%20%20margin%3A%2014px%20auto%3B%0A%20%20%20background-color%3A%20%23457f86%0A%20%7D%0A%20.header%20h2%20%7B%0A%20%20%20height%3A%2030px%3B%0A%20%20%20margin%3A%20auto%3B%0A%20%7D%0A%20.header%20h2%20%7B%0A%20%20%20font-size%3A%2014px%3B%0A%20%20%20margin%3A%200%200%3B%0A%20%20%20padding%3A%200%3B%0A%20%20%20color%3A%20%23fff%3B%0A%20%20%20text-align%3A%20center%3B%0A%20%7D%0A%20.slots%7B%0A%20%20%20display%3A%20flex%3B%0A%20%20%20background-color%3A%20%23457f86%3B%0A%20%20%20border-radius%3A%206px%3B%0A%20%20%20border%3A%202px%20solid%20%23fff%3B%0A%20%7D%0A%20.slot%7B%0A%20%20%20flex%3A%201%200%20auto%3B%0A%20%20%20background%3A%20white%3B%0A%20%20%20height%3A%2075px%3B%0A%20%20%20margin%3A%208px%3B%0A%20%20%20border%3A%202px%20solid%20%23215f1e%3B%0A%20%20%20border-radius%3A%204px%3B%0A%20%7D%0A%20.go%20%7B%0A%20%20%20width%3A%20100%25%3B%0A%20%20%20color%3A%20%23fff%3B%0A%
Kevin Brown
@kevindewbrown
Oct 26 2015 04:21
Nevermind I got it
Herman Fassett
@HermanFassett
Oct 26 2015 04:21
Yay @kevindewbrown
navicyclical
@navicyclical
Oct 26 2015 04:39
now it won't pass the 3rd and 4th validation tests, but everything else works OK
function truncate(str, num) {
  // define local variables
  var stringToTrim = str;
  var trimAt = num;
  //logic below
  if (stringToTrim.length>trimAt&&stringToTrim.length>=3){
    stringToTrim = stringToTrim.slice(0, trimAt-3) + ("..."); 
  } else{
    stringToTrim = stringToTrim.slice(0,trimAt)+("...");
  }
  console.log(stringToTrim);
}
Herman Fassett
@HermanFassett
Oct 26 2015 04:45
@navicyclical make the else statement into else if stringToTrim length is less than 3 and it should work
Anthony
@Guzko
Oct 26 2015 04:48
How do I copy and paste my exact code in the black screen with the colors showing??
navicyclical
@navicyclical
Oct 26 2015 04:49
@Guzko use ``` and hit enter
don't forget to close off with ``` as well
h4r1m4u
@h4r1m4u
Oct 26 2015 04:49
wiki format
CamperBot
@camperbot
Oct 26 2015 04:49

:point_right: code formatting [wiki]

Inline code

alt text

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

Code Block

``` ⇦ Type 3 backticks and then press [shift + enter ⏎]

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

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

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

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

h4r1m4u
@h4r1m4u
Oct 26 2015 04:49
:point_up:
Anthony
@Guzko
Oct 26 2015 04:49
Thank you.
CamperBot
@camperbot
Oct 26 2015 04:49
if you want to thank someone, put an @ before their name!
Anthony
@Guzko
Oct 26 2015 04:50
How do I get my h2 element to have the class red-text. This is what I have so far. code
<style>
  h2 {
    color: red;
  }
</style>

<h2>CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
h4r1m4u
@h4r1m4u
Oct 26 2015 04:54
@Guzko
<style>
 .white-text {
 color: white;
}
</style>
<h2 class="white-text">Some heading text</h2>
now adjust it for your own case
navicyclical
@navicyclical
Oct 26 2015 05:00
ok
Anthony
@Guzko
Oct 26 2015 05:04
Thanks @h4r1m4u
CamperBot
@camperbot
Oct 26 2015 05:04
guzko sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 327 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
navicyclical
@navicyclical
Oct 26 2015 05:06
@HermanFassett I tried that and it still returns A-
can't seem to get 5.0
Herman Fassett
@HermanFassett
Oct 26 2015 05:08

@navicyclical

function truncate(str, num) {
  var stringToTrim = str;
  var trimAt = num;
  if (stringToTrim.length>trimAt&&stringToTrim.length>=3)
    stringToTrim = stringToTrim.slice(0, trimAt-3) + ("..."); 
  else if (stringToTrim.length < 3)
    stringToTrim = stringToTrim.slice(0,trimAt)+("...");
  return stringToTrim;
}

works though it could be shortened

justindobbs
@justindobbs
Oct 26 2015 05:09
what have you tried @techlab23
Shirish
@techlab23
Oct 26 2015 05:13
I need to replace 0.0 in below code to make it equal to 5.0 var product = 2.0 * 0.0; // equals 5.0
not sure how to do that
justindobbs
@justindobbs
Oct 26 2015 05:14
so what would you multiply 2.0 by to make 5?
Shirish
@techlab23
Oct 26 2015 05:14
yes
justindobbs
@justindobbs
Oct 26 2015 05:14
i'm asking you
Shirish
@techlab23
Oct 26 2015 05:15
hehe i thought about 2.99 so overall result would be 4.99 or rounded off to 5.0
but that's not working
justindobbs
@justindobbs
Oct 26 2015 05:17
i can tell you that 5/2 is 2.5...
Shirish
@techlab23
Oct 26 2015 05:18
i tried changing the operator too like var product = 2.0 + 3.0; // equals 5.0
but still not being able to clear the challenge
justindobbs
@justindobbs
Oct 26 2015 05:19
well the * operator is for multiplication
Shirish
@techlab23
Oct 26 2015 05:20
solved the problem
Luis Filipe Forra
@forral
Oct 26 2015 05:20

Does anyone knows if the correct answer for the Object Oriented and Functional Programming 3.Waypoint is

var myCar = { "engines": 1, "wheels": 4 };

It says that is correct but I feel like I cheated!!! :P

Shirish
@techlab23
Oct 26 2015 05:20
creative way to do it
var quotient = 4.4 / 2.0; // equals 2.2
var product = 2.0 * quotient + 0.6; // equals 5.0


// 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){return 'product='+y;})(product);
DTing
@dting
Oct 26 2015 05:21
var myCar = new Car();
myCar.engines = 1;
abhisekp @abhisekp drives myCar :car:
SojournerOctocat
@SojournerOctocat
Oct 26 2015 05:21
Anyone familiar with lambda calculus and can help explain something I'm having trouble understanding?
DTing
@dting
Oct 26 2015 05:21
the way you did it myCar isnt an instance of Car
Luis Filipe Forra
@forral
Oct 26 2015 05:22
ofc - thank you @dting
CamperBot
@camperbot
Oct 26 2015 05:22
forral sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1467 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Oct 26 2015 05:22
@forral you should file a bug
to have the tests check if myCar is a Car object
im pretty sure the intention is for it to be a car object and not just an object with those 2 properties
@techlab23 why couldnt you just replace the 0.0 with 2.5?
or just change it to var product = 5.0;
Shirish
@techlab23
Oct 26 2015 05:26
oh didn't think that far.
i think changing to 2.5 is right solution
thank you @justindobbs for the pointer.
CamperBot
@camperbot
Oct 26 2015 05:28
techlab23 sends brownie points to @justindobbs :sparkles: :thumbsup: :sparkles:
:star: 322 | @justindobbs | http://www.freecodecamp.com/justindobbs
DTing
@dting
Oct 26 2015 05:30
c=a×bc = a \times b then b=cab = \frac{c}{a}
so
5.0=2.0x5.0 = \frac{2.0}{x}
then
x=5.02.0x = \frac{5.0}{2.0}
or
x=2.5x = 2.5
navicyclical
@navicyclical
Oct 26 2015 05:31
@HermanFassett looks like you forgot the second stringToTrim.length, i got it to work
thanks @HermanFassett @h4r1m4u
CamperBot
@camperbot
Oct 26 2015 05:31
navicyclical sends brownie points to @hermanfassett and @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 453 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
:star: 328 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
Shirish
@techlab23
Oct 26 2015 05:32
that explains thank you @dting
CamperBot
@camperbot
Oct 26 2015 05:32
techlab23 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1468 | @dting | http://www.freecodecamp.com/dting
Reegan
@ReeganArockiasmy
Oct 26 2015 05:48
hi
h4r1m4u
@h4r1m4u
Oct 26 2015 05:51
@navicyclical great job
Vivek
@vivek28111992
Oct 26 2015 06:05
Please somebody tell me answer for this question Waypoint: Make Object Properties Private
Vivek
@vivek28111992
Oct 26 2015 06:19
hi dting
can you tell me answer of Make Object Properties Private
h4r1m4u
@h4r1m4u
Oct 26 2015 06:20
@vivek28111992 please post the code you have so far
Vivek
@vivek28111992
Oct 26 2015 06:20

//Let's create an object with two functions. One attached as a property and one not.
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};

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

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

};

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

if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};

actually I didn't get the concept of this
h4r1m4u
@h4r1m4u
Oct 26 2015 06:22
i see. in the object constructor function if you use the word 'this', it will make the property of function public. if you don't use 'this', the property/function will be private
private properties and functions cannot be accessed from the outside of the object, whereas public ones can
Vivek
@vivek28111992
Oct 26 2015 06:23
ok
h4r1m4u
@h4r1m4u
Oct 26 2015 06:25
so in the Car() constructor function, 'gear' is a public property because it uses the word 'this'. whereas the function addStyle() is private - you cannot call it on the created object: myCar.addStyle() won't work
but you can use the getGear() function from the outside, because it's public: myCar.getGear() is completely valid
Abby
@abbymorssy
Oct 26 2015 06:32

Guys I have a question about jQuery's event delegation. I have a hover event for the parent element $('.grid') that will fire for all $('.cell') and change the background colour of every .cell. Now I also have another element $clearBtn with a .click even that will fire for all .cell. However, when the button is clicked, it doesn't have any effect on .cell.

Here's a code sample if it helps.

$grid.on('mouseenter mouseleave', '.cell', function(event) {
    // Fill the cell
    $(this).css('background-color', '#666');
}); // end hover


var $clearBtn = $('.btn-clear');
// When user clicks on clear button
$clearBtn.on('click', '.cell', function() {
    // Reset cells' bg colour to white.
    $(this).css('background-color', '#fff');
}); // end click
h4r1m4u
@h4r1m4u
Oct 26 2015 06:33

@abeermorssy

$clearBtn.on('click', '.cell', function() {
    // Reset cells' bg colour to white.
    $(this).css('background-color', '#fff');
}); // end click

'this' in this part refers to clearBtn, not .cell

this should work:
$clearBtn.on('click', '.cell', function() {
    // Reset cells' bg colour to white.
    $(".cell").css('background-color', '#fff');
}); // end click
Vivek
@vivek28111992
Oct 26 2015 06:35
@h4r1m4u can you write solution for me?
Abby
@abbymorssy
Oct 26 2015 06:35
@h4r1m4u, I changed it as you suggested, but the click event on the button doesn't have any effect still on .cell.
h4r1m4u
@h4r1m4u
Oct 26 2015 06:36
@abeermorssy do you have the code in codepen?
Vivek
@vivek28111992
Oct 26 2015 06:36
for myBike.speed should be undefined
h4r1m4u
@h4r1m4u
Oct 26 2015 06:36
@vivek28111992 i could, but it won't help you learn
Vivek
@vivek28111992
Oct 26 2015 06:36
ok
h4r1m4u
@h4r1m4u
Oct 26 2015 06:36
@vivek28111992 post your code or what you tried and i can give you pointers
Vivek
@vivek28111992
Oct 26 2015 06:37

//Let's create an object with two functions. One attached as a property and one not.
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};

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

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

};

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

if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};

h4r1m4u
@h4r1m4u
Oct 26 2015 06:39
@vivek28111992
var Bike = function() {
  // Only change code below this line.
  this.speed = 100; // the 'this' here makes the property public, while it should be private
  function addUnit(value) {
    return value + "KM/H";
  }

  getSpeed = function () {
    return addUnit(speed);
  };
};
Abby
@abbymorssy
Oct 26 2015 06:41

@h4r1m4u, I think I figured out where I was going wrong.

$clearBtn.on('click', '.cell', function() {
    // Reset cells' bg colour to white.
    $('.cell').css('background-color', '#fff');
}); // end click

I didn't need to pass .cell to the .on click. The button click now resets the cells when I removed the selector.

h4r1m4u
@h4r1m4u
Oct 26 2015 06:41
@abeermorssy yeah, was just about to say that :)
Reegan
@ReeganArockiasmy
Oct 26 2015 06:42
Hi
Abby
@abbymorssy
Oct 26 2015 06:42
thanks for the help @h4r1m4u. It's 7am in the morning and I was just staring at the code for an hour. Silly mistake. :D
CamperBot
@camperbot
Oct 26 2015 06:42
abeermorssy sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 329 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
h4r1m4u
@h4r1m4u
Oct 26 2015 06:42
my pleasure
Ronald Jarin
@ronaldjarin
Oct 26 2015 06:43
hi, isn't 5 the lcm of 1 n 5?
Abhishek
@Abhi493
Oct 26 2015 06:43
qaidr u should use indexof try it
Qadir Pervez
@qadirpervez
Oct 26 2015 06:44
thanks @Abhi493 for your help
CamperBot
@camperbot
Oct 26 2015 06:44
qadirpervez sends brownie points to @abhi493 :sparkles: :thumbsup: :sparkles:
:star: 250 | @abhi493 | http://www.freecodecamp.com/abhi493
William
@waruiz
Oct 26 2015 07:06
Can someone help me with this? I've been racking my brain for an hour now lol. 'students' refers to an array containing objects and the issue is I'm getting undefined as my first result when I console.log for example
for (var i=0; i<students.length; i++) {
    currentStudent = students[i];
    for (var key in currentStudent) {
        if (key === 'name') {
            HTML += '<h2>Student: ' + currentStudent[key] + '</h2>';
        } else {
            HTML += '<p>' + key + ' : ' + currentStudent[key] + '</p>';
        }
    }
}
h4r1m4u
@h4r1m4u
Oct 26 2015 07:09
@waruiz getting undefined only for the first result, but the consequent results are fine?
William
@waruiz
Oct 26 2015 07:09
yeah
h4r1m4u
@h4r1m4u
Oct 26 2015 07:09
what does 'students' look like?
if you console.log it
also, are you getting the undefined first result as part of the outer or inner for loop?
William
@waruiz
Oct 26 2015 07:13

it checks out as an array

basically looks like

var students = [
{name:'string',
grades:num},
{name:'string',
grades:num}]

I can't tell on the last question :/

h4r1m4u
@h4r1m4u
Oct 26 2015 07:15
can't tell because you don't understand what i'm asking or you're not sure based on your code? @waruiz
William
@waruiz
Oct 26 2015 07:17
@h4r1m4u I'm not sure how to find out which loop it belongs to, probably why I shouldn't have gone this route but now I want to figure where the undefined is coming from
I know when I print to the page undefined appears before any of the <h2>'s and <p>'s if that's any indication....I'm not sure what I'm not seeing
h4r1m4u
@h4r1m4u
Oct 26 2015 07:20
i suspect it happens as part of the inner loop. the 'for in' loop iterates over all object properties, including those inherited from prototypes. you can use hasOwnProperty() to make sure that it iterates over the properties attached to the object only. see this for reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in
    for (var key in currentStudent) {
      if (currentStudent.hasOwnProperty(key)) {
        if (key === 'name') {
            HTML += '<h2>Student: ' + currentStudent[key] + '</h2>';
        } else {
            HTML += '<p>' + key + ' : ' + currentStudent[key] + '</p>';
        }
      }
    }
try to adjust the inner for loop like this
see if you still get the undefined output
@waruiz
Ngaosathe
@ThekhoN
Oct 26 2015 07:22
Guys can someone tell me why this recursive function doesn't run as intended?
var i = 10;

function printNum(){
    console.log(i + "<br>");
 while(i-->1){
     printNum();
 }
}

printNum();
William
@waruiz
Oct 26 2015 07:23
thanks @h4r1m4u I'll try and read up on hasOwnProperty()
CamperBot
@camperbot
Oct 26 2015 07:23
waruiz sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 330 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
Ngaosathe
@ThekhoN
Oct 26 2015 07:24
It runs fine when i run it with document.write though :worried:
var i = 10;

function printNum(){
    document.write(i + "<br>");
 while(i-->1){
     printNum();
 }
}

printNum();
Qadir Pervez
@qadirpervez
Oct 26 2015 07:25
do you know the difference between console.log() and document.write();
@ThekhoN
Ngaosathe
@ThekhoN
Oct 26 2015 07:25
yes
never mind it's working fine now...Weird!
Qadir Pervez
@qadirpervez
Oct 26 2015 07:26
the code is good.. why it will not work
h4r1m4u
@h4r1m4u
Oct 26 2015 07:26
@ThekhoN did you forget to call the function after the code block with console.log?
i noticed there wasn't printNum() at the bottom initially
Ngaosathe
@ThekhoN
Oct 26 2015 07:27
blob
hah..it returns undefined again
@h4r1m4u i called the function
h4r1m4u
@h4r1m4u
Oct 26 2015 07:40

@ThekhoN ok. you're seeing 'undefined' because the function doesn't return anything. it just logs to the console. same will happen with any other function without 'return':

function test() {
 console.log('test');
}
test();
// console will display:
// 'test'
// undefined

it's a default javascript behavior, nothing wrong with your code per se

Abhishek
@Abhi493
Oct 26 2015 07:41
@qadirpervez thanks
CamperBot
@camperbot
Oct 26 2015 07:41
abhi493 sends brownie points to @qadirpervez :sparkles: :thumbsup: :sparkles:
:star: 179 | @qadirpervez | http://www.freecodecamp.com/qadirpervez
Ngaosathe
@ThekhoN
Oct 26 2015 07:45
blob
@h4r1m4u i've figured out that it's the "environment" that prevented my function from console.logging any values
the first screen shot was when i ran it via benchwarmer (dribbble plugin for chrome)
the second one was when i ran it in the console of https://developer.mozilla.org/en-US/docs/Web/JavaScript
h4r1m4u
@h4r1m4u
Oct 26 2015 07:48
oh, ok. i thought you were asking about the 'undefined' bit rather than the lack of the console.logs :) my bad
Ngaosathe
@ThekhoN
Oct 26 2015 07:48
i guess the benchwarmer has some varible resets etc or prevents custom js from running certain vars
thanks for taking the time tho :D
CamperBot
@camperbot
Oct 26 2015 07:48
if you want to thank someone, put an @ before their name!
h4r1m4u
@h4r1m4u
Oct 26 2015 07:48
no problem
deaninous
@deaninous
Oct 26 2015 07:49
anyone can help with this angular js problem? I linked it but the ouput in my browser shows braces
<!--facebook.html contents below-->

<html ng-app = "facebook">
<head>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css" />
<script type="text/javascript" src="angular.min.js"></script>
 <script type="text/javascript" src="Ang.js"></script>

</head>
<body>
<h1>{{"Thank you for visiting. What is new today?"}}<h1>
</body>
</html>


<--Ang.js contents-- below>
var app = angular.module("facebook", []);
CamperBot
@camperbot
Oct 26 2015 07:49
if you want to thank someone, put an @ before their name!
deaninous
@deaninous
Oct 26 2015 07:50
my browser outputs the braces from h1. I might be wrong but I expected it to show clean text
h4r1m4u
@h4r1m4u
Oct 26 2015 07:52
@deaninous your JS fails because of the incorrect comment syntax: <--Ang.js contents-- below>
change it to: // Ang.js contents-- below
deaninous
@deaninous
Oct 26 2015 07:54
I put those in the same file to show here. they are in two different files
the comments are not in the code ad I run it @h4r1m4u
h4r1m4u
@h4r1m4u
Oct 26 2015 07:57
@deaninous that's strange then. it works for me.
do you have angular.min.js in the same directory as all the other files?
in other words, is it imported correctly?
deaninous
@deaninous
Oct 26 2015 07:59
I have it in my html file and the directives are being stored in the javascript
now I am wondering if importing the angular .min.js in a script tag like here is enouhg
h4r1m4u
@h4r1m4u
Oct 26 2015 08:00
understood. but did you download angular.min.js and put it in the same directory as the facebook.html file?
deaninous
@deaninous
Oct 26 2015 08:00
or if I should download it hahah
h4r1m4u
@h4r1m4u
Oct 26 2015 08:00
if not, you've not imported the angular JS library
deaninous
@deaninous
Oct 26 2015 08:00
nope, i did not
h4r1m4u
@h4r1m4u
Oct 26 2015 08:00
lol. alright, so that's your issue
deaninous
@deaninous
Oct 26 2015 08:01
I thought it would be like I do with css and the others
loll
h4r1m4u
@h4r1m4u
Oct 26 2015 08:01
no, it's the same as jquery or bootstrap. you need to import it first
you can import it from the google CDN instead of downloading it, though:
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
use this instead of your original import line and you should be fine
deaninous
@deaninous
Oct 26 2015 08:02
<script type="text/javascript" src="angular.min.js"></script>
this is what is in my code
h4r1m4u
@h4r1m4u
Oct 26 2015 08:03
yeah. delete this, put in what i wrote
deaninous
@deaninous
Oct 26 2015 08:03
lol
thanks
CamperBot
@camperbot
Oct 26 2015 08:03
if you want to thank someone, put an @ before their name!
h4r1m4u
@h4r1m4u
Oct 26 2015 08:04
with your code, the page is looking for the angular.min.js file in the same directory and since it can't find it, it won't import it and hence any of the angular js functionalities won't work for you
deaninous
@deaninous
Oct 26 2015 08:04
worked like a cham
h4r1m4u
@h4r1m4u
Oct 26 2015 08:04
;)
deaninous
@deaninous
Oct 26 2015 08:04
thank you ahhaha.
CamperBot
@camperbot
Oct 26 2015 08:04
if you want to thank someone, put an @ before their name!
h4r1m4u
@h4r1m4u
Oct 26 2015 08:04
you're welcome
deaninous
@deaninous
Oct 26 2015 08:04
thanks @h4r1m4u
CamperBot
@camperbot
Oct 26 2015 08:04
deaninous sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 331 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
IgnisCerebrum
@IgnisCerebrum
Oct 26 2015 08:11
Can someone tell me if I'm wrong on a Bonfire? I need to know if it's my browser that is the issue.
deaninous
@deaninous
Oct 26 2015 08:12
which bonfire are you working on?
IgnisCerebrum
@IgnisCerebrum
Oct 26 2015 08:12
Factorialize a number, so early on.
function factorialize(num) {
  return num;
  5! = 1 * 2 * 3 * 4 * 5 
}

factorialize(5);
This is what I have. Is it wrong, or is it my browser being screwy?
deaninous
@deaninous
Oct 26 2015 08:13
I see
you are returning num
IgnisCerebrum
@IgnisCerebrum
Oct 26 2015 08:14
I don't know what that means.
deaninous
@deaninous
Oct 26 2015 08:14
after that, it would exit the function
IgnisCerebrum
@IgnisCerebrum
Oct 26 2015 08:15
I added the 5! through 5, the rest was what was already there before I started.
deaninous
@deaninous
Oct 26 2015 08:15
you could use variables instead
let me pm you
IgnisCerebrum
@IgnisCerebrum
Oct 26 2015 08:16
Either it's right or it's not....
deaninous
@deaninous
Oct 26 2015 08:17
i sent you a pm
you ll need to use variables so that any number that is plugged into your function can be resolved @IgnisCerebrum
Kevin Diem
@kgdiem
Oct 26 2015 08:18
Working on learnyounode "Jugging Async", can anyone help me figure out why this isn't working? Seems to always print out 2, 3, 1 even though 2 and three are nested inside of the get request for 1:
var http = require('http');
var bl = require('bl');

var one = process.argv[2], two = process.argv[3], three = process.argv[4];

function req(urlOne, urlTwo, urlThree){

 var first = http.get(urlOne, function(response){
     response.pipe(bl(function(err, data){
     console.log(data.toString())
     }))})

 first.on('finish', function(){
     var second = http.get(urlTwo, function(responseTwo){
        responseTwo.pipe(bl(function(err, data){
         console.log(data.toString())
     }))})
    second.on('finish', function(){
        var third = http.get(urlThree, function(responseThree){
            responseThree.pipe(bl(function(err,data){
                console.log(data.toString())
            }))
        })
    })
 })
}

req(one, two, three);
Nir Ben-Yair
@NirBenya
Oct 26 2015 08:20
hey guys, can someone explain me in simple words what bootstrap is?
Kevin Diem
@kgdiem
Oct 26 2015 08:20
@NirBenya a bunch of pre-written CSS rules
instead of you having to come up with styles they are already written and you just add the corresponding class name
ie instead of styling a button you add class='btn btn-primary' and it will make a bootstrap blue button
h4r1m4u
@h4r1m4u
Oct 26 2015 08:21
@NirBenya it's a CSS framework that enables you to rapidly prototype and develop pages, so you don't have to write all the CSS from scratch yourself
Kevin Diem
@kgdiem
Oct 26 2015 08:22
@NirBenya they also have a javascript framework for animations and other page elements like image slider
Nir Ben-Yair
@NirBenya
Oct 26 2015 08:28
@kgdiem and @h4r1m4u thanks a lot ! got it
CamperBot
@camperbot
Oct 26 2015 08:28
nirbenya sends brownie points to @kgdiem and @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 267 | @kgdiem | http://www.freecodecamp.com/kgdiem
:star: 333 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
Kevin Diem
@kgdiem
Oct 26 2015 08:35
BTW I figured mine out, I needed to use close instead of finish
even though the docs said to use finish??
IgnisCerebrum
@IgnisCerebrum
Oct 26 2015 08:36
Thanks @deaninous
CamperBot
@camperbot
Oct 26 2015 08:36
igniscerebrum sends brownie points to @deaninous :sparkles: :thumbsup: :sparkles:
:star: 241 | @deaninous | http://www.freecodecamp.com/deaninous
deaninous
@deaninous
Oct 26 2015 08:39
no problem @IgnisCerebrum
Alexander Bayoh
@Abayoh
Oct 26 2015 09:22
hello FCC
Alexander Bayoh
@Abayoh
Oct 26 2015 09:25
im stuck on this exercise (Bonfire: Where art thou) and i cant seem to wrap my head around it
h4r1m4u
@h4r1m4u
Oct 26 2015 09:25
Font size is controlled by the font-size CSS property, like this: h1 { font-size: 30px; }. // this sets the font-size for HTML element <h1>

See if you can figure out how to give both of your p elements the font-size of 16 pixels (16px).
@ReeganArockiasmy
CamperBot
@camperbot
Oct 26 2015 09:25
:trollface: troll problems? notify admins here
Alexander Bayoh
@Abayoh
Oct 26 2015 09:26
function where(collection, source) {  
  var arr = [];
  var key = Object.keys(source);
  var hasProperty;


  collection.forEach(function(value){
     hasProperty = true;
    for(var i =0, propLen = key.length; hasProperty && i < propLen; i++)
      hasProperty = value.hasOwnProperty(key[x]);

    if(hasProperty){
       arr.push(value);
    }
  });
  return arr;
}

where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });
some requirements are checked
here is a snap shot
Capture.PNG
SIKHEANG
@SIKHEANG
Oct 26 2015 09:37
Hi
Eliza Chatzigeorgiadou
@Eliza89
Oct 26 2015 09:38
bootstrapbug.png
h4r1m4u
@h4r1m4u
Oct 26 2015 09:40
@Eliza89 you need to do what the failed test tells you: add class form-control on the <input> in the form
Hassan
@gitinino
Oct 26 2015 09:44
Can someone tell me what's wrong with this radio button element?
<form action="/submit-cat-photo">
<input type="text" placeholder="cat photo URL" required>
<label><input type="radio" name:"indoor-outdoor">Indoor</label>
<label><input type="radio" name:"indoor-outdoor">Outdoor</label>
<button type="submit">Submit</button>
</form>
the error : Give your radio buttons the name attribute of indoor-outdoor.
h4r1m4u
@h4r1m4u
Oct 26 2015 09:45
@gitinino name="indoor-outdoor" not name:
Eliza Chatzigeorgiadou
@Eliza89
Oct 26 2015 09:45
@gitinino name= not name:
Hassan
@gitinino
Oct 26 2015 09:45
Thank you very much Eliza
CamperBot
@camperbot
Oct 26 2015 09:45
if you want to thank someone, put an @ before their name!
Landon
@landonbas
Oct 26 2015 10:31
I need help making a p element
h4r1m4u
@h4r1m4u
Oct 26 2015 10:31
@landonbas <p>some text</p>
Reegan
@ReeganArockiasmy
Oct 26 2015 11:08
I need help Create a new p element around your a element.
Your a element should be nested within your new p element.
h4r1m4u
@h4r1m4u
Oct 26 2015 11:09

@ReeganArockiasmy this is a <p> element nested inside <div> element:

<div>
  <p>some text</p>
</div>

try to adapt this example for <p> and <a>

Reegan
@ReeganArockiasmy
Oct 26 2015 11:10
This message was deleted
@h4r1m4u i get two error
h4r1m4u
@h4r1m4u
Oct 26 2015 11:12
post your code
lnuic
@lnuic
Oct 26 2015 11:21
<p>View more
<a href="http://www.freecatphotoapp.com">cat photos</a>
</p>
@h4r1m4u :up:
h4r1m4u
@h4r1m4u
Oct 26 2015 11:22
?
Kasun Weerasinghe
@kasunw310
Oct 26 2015 11:30

hi guys.. i need help on a way point : see below for prompt:
Waypoint: Manipulate Arrays With pop

Another way to change the data in an array is with the .pop() function.

.pop()is used to "pop" a value off of the end of an array. We can retrieve this value by performing pop() in a variable declaration.

Any type of variable can be "popped" off of an array.

Use the .pop() function to remove the last item from myArray.

here's the code :
var myArray = ["John", 23, ["cat", 2]];
how do i use the pop() method to remove the last item from myArray?

h4r1m4u
@h4r1m4u
Oct 26 2015 11:32
myArray.pop();
lnuic
@lnuic
Oct 26 2015 11:38
myArray=myArray.pop(); @kasunw310
Aleksander Gębicki
@Takumar
Oct 26 2015 11:41
@kasunw310 please don't aks the same question on different channels. You question has been answered on "FreeCodeCamp" channel.
By asking several times you make more people busy, so they cannot help other people! Remember about that.
If you still need help, ask again but on the same channel.
h4r1m4u
@h4r1m4u
Oct 26 2015 11:42
well said @Takumar thanks
CamperBot
@camperbot
Oct 26 2015 11:42
h4r1m4u sends brownie points to @takumar :sparkles: :thumbsup: :sparkles:
:star: 565 | @takumar | http://www.freecodecamp.com/takumar
Reegan
@ReeganArockiasmy
Oct 26 2015 11:45
@lnuic @h4r1m4u this my code

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

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

h2 {
font-family: Lobster, Monospace;
}

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

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

.smaller-image {
width: 100px;
}
</style>

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

<a href="http://www.freecatphotoapp.com">cat photos</a>

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

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
<p>"View more"</p>

h4r1m4u
@h4r1m4u
Oct 26 2015 11:46
@ReeganArockiasmy you need to nest the <a> element inside <p>. please see our previous replies on how to nest elements
Markus Kiili
@Masd925
Oct 26 2015 11:47
To make above examples clear, myArray.pop() manipulates the array stored in myArray by removing the last item. myArray.pop() also returns the removed element, but because it is not stored in a variable, it vanishes. myArray=myArray.pop() first evaluates the right side, which returns the last item ["cat", 2] and sets it as value of myArray.
Qadir Pervez
@qadirpervez
Oct 26 2015 11:47
thanks @Abhi493
CamperBot
@camperbot
Oct 26 2015 11:47
qadirpervez sends brownie points to @abhi493 :sparkles: :thumbsup: :sparkles:
:star: 252 | @abhi493 | http://www.freecodecamp.com/abhi493
Qadir Pervez
@qadirpervez
Oct 26 2015 11:48
@Takumar is right
Reegan
@ReeganArockiasmy
Oct 26 2015 11:49
@h4r1m4u now get this point error Your p element should have the text "View more " (with a space after it).
Qadir Pervez
@qadirpervez
Oct 26 2015 11:49
thanks @Abhi493
CamperBot
@camperbot
Oct 26 2015 11:49
qadirpervez sends brownie points to @abhi493 :sparkles: :thumbsup: :sparkles:
:warning: qadirpervez already gave abhi493 points
Aleksander Gębicki
@Takumar
Oct 26 2015 11:50
@ReeganArockiasmy so just add this space after "more". It is only needed to divide words like in real story.
Oh I see that you put your paragraph at the end of your code instead of put the paragraph around your <a href="...">...</a> tags.
Qadir Pervez
@qadirpervez
Oct 26 2015 11:52
i already thanked you for this concern
Abhishek
@Abhi493
Oct 26 2015 11:52
lol
Reegan
@ReeganArockiasmy
Oct 26 2015 11:52
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

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

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

  .smaller-image {
    width: 100px;
  }
</style>

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

<a href="http://www.freecatphotoapp.com">cat photos</a>

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

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
<p>View more
<a href="http://www.freecatphotoapp.com">cat photos</a>
</p>
Qadir Pervez
@qadirpervez
Oct 26 2015 11:52
now don't do over acting
Aleksander Gębicki
@Takumar
Oct 26 2015 11:53
@ReeganArockiasmy ok but now you have links to "cat photos" two times in your code. Leave only one, but this after: "CatPhotoApp"
You did it right but at the end of code.
Qadir Pervez
@qadirpervez
Oct 26 2015 11:53
@ReeganArockiasmy what is your concern
Reegan
@ReeganArockiasmy
Oct 26 2015 11:53
@qadirpervez i will get this error
Your p element should have the text "View more " (with a space after it).
Abhishek
@Abhi493
Oct 26 2015 11:53
@Takumar , sign uped for screen hero
Aleksander Gębicki
@Takumar
Oct 26 2015 11:54
@Abhi493 brave man! :-) Have you paired yesterday?
Abhishek
@Abhi493
Oct 26 2015 11:54
yeah thats very unusual error @ReeganArockiasmy
Qadir Pervez
@qadirpervez
Oct 26 2015 11:55
the p tag should be nested after cat photos @ReeganArockiasmy
Reegan
@ReeganArockiasmy
Oct 26 2015 11:55
@Abhi493 how to resolve this error
Abhishek
@Abhi493
Oct 26 2015 11:55
@Takumar paired with whom, only i signed up
DTing
@dting
Oct 26 2015 11:55
@ReeganArockiasmy your View more has a line break after it
put a space after instead of a new line
Aleksander Gębicki
@Takumar
Oct 26 2015 11:56

@ReeganArockiasmy you have this link two times!

<a href="http://www.freecatphotoapp.com">cat photos</a>

and

<p>View more
<a href="http://www.freecatphotoapp.com">cat photos</a>
</p>
Qadir Pervez
@qadirpervez
Oct 26 2015 11:56
@ReeganArockiasmy nest your p tag after the cat photos
DTing
@dting
Oct 26 2015 11:56
@qadirpervez it is nested
it is just on a new line
Reegan
@ReeganArockiasmy
Oct 26 2015 11:56
@qadirpervez send code i am newly
Qadir Pervez
@qadirpervez
Oct 26 2015 11:56
ok
DTing
@dting
Oct 26 2015 11:56
@ReeganArockiasmy the code is being checked using string matching. so you need to have the code as described.
Abhishek
@Abhi493
Oct 26 2015 11:57
its a strange error i just cant figure out @ReeganArockiasmy
DTing
@dting
Oct 26 2015 11:58
you just need a space after the word "more"
Aleksander Gębicki
@Takumar
Oct 26 2015 11:58
@Abhi493 it's not strange it's very clear, but he added not necessary second time the same link, and FCC is looking at first occupation of the link.
DTing
@dting
Oct 26 2015 11:58
<p>View more 
  <a href="http://www.freecatphotoapp.com">cat photos</a>
</p>
Abhishek
@Abhi493
Oct 26 2015 11:58
@ReeganArockiasmy whats the name of the waypoint?
Ankit Panwar
@coderNoob
Oct 26 2015 11:58
Intermediate Algorithm Scripting
  1. Bonfire: Search and Replace
    function myReplace(str, before, after) {
    var rStr = str.split(" ");
    for(var i=0; i<rStr.length; i++){
     if(rStr[i]===before){
       rStr.splice(i,1,after);
     }
    }
    return rStr.join(" ");
    }
    It is working for case number 1 and 3 but not for the rest. Why?
DTing
@dting
Oct 26 2015 11:58
oh
@Takumar is correct. the p element needs to come before the img tag and after the h2 tag
bf replace
CamperBot
@camperbot
Oct 26 2015 12:01

:fire:Bonfire: Search and Replace :link:

function replace(str, before, after) {
 return str;
}

replace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");

Perform a search and replace on the sentence using the arguments provided and return the new sentence.

more info:  bf details | bf links | hint

Aleksander Gębicki
@Takumar
Oct 26 2015 12:01
@dting thanks I thought that I'm invisible. I was jumping up and shouting: "Listen to me, listen to me..." but noone has seen this ;-)
CamperBot
@camperbot
Oct 26 2015 12:01
takumar sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1469 | @dting | http://www.freecodecamp.com/dting
Jason Wood
@catapixel
Oct 26 2015 12:01
@coderNoob I'm not looking at it right now but my memory is that you have to match the casing of "after" to "before" (upper to upper, lower to lower). My guess is that this is your problem since I don't see anything in your code to handle it.
DTing
@dting
Oct 26 2015 12:02
@coderNoob you didnt change the case of the first letter of "after" to the case of the "before" first letter case
lol
Aleksander Gębicki
@Takumar
Oct 26 2015 12:02

@catapixel you are right: "NOTE: Preserve the case of the original word when you are replacing it. For example if you mean to replace the word "Book" with the word "dog", it should be replaced as "Dog""

@coderNoob check for upper and lower case.

DTing
@dting
Oct 26 2015 12:03
dang im like half awake
@Takumar @catapixel thanks
CamperBot
@camperbot
Oct 26 2015 12:03
dting sends brownie points to @takumar and @catapixel :sparkles: :thumbsup: :sparkles:
:star: 567 | @takumar | http://www.freecodecamp.com/takumar
:star: 521 | @catapixel | http://www.freecodecamp.com/catapixel
Jason Wood
@catapixel
Oct 26 2015 12:03
@dting :coffee:
Aleksander Gębicki
@Takumar
Oct 26 2015 12:04
:cake: and :coffee:
Reegan
@ReeganArockiasmy
Oct 26 2015 12:06
    <p>View more 
  <a href="http://www.freecatphotoapp.com">cat photos</a>
</p>
add this line but i get this error Your p element should have the text "View more " (with a space after it). how to go next lesson
@ReeganArockiasmy replace the first a element with the code you have above
Aleksander Gębicki
@Takumar
Oct 26 2015 12:12

@ReeganArockiasmy do you have only one link in your code? Or still you have two links?
Replace first occurence of:

<a href="http...  </a>

with code provided by @dting

Ankit Panwar
@coderNoob
Oct 26 2015 12:12
@catapixel @dting Thanks.
CamperBot
@camperbot
Oct 26 2015 12:12
codernoob sends brownie points to @catapixel and @dting :sparkles: :thumbsup: :sparkles:
Reegan
@ReeganArockiasmy
Oct 26 2015 12:16
@Takumar @dting thanks
CamperBot
@camperbot
Oct 26 2015 12:16
reeganarockiasmy sends brownie points to @takumar and @dting :sparkles: :thumbsup: :sparkles:
:star: 568 | @takumar | http://www.freecodecamp.com/takumar
:star: 1471 | @dting | http://www.freecodecamp.com/dting
Sameen Anna Belle
@sambadillo96
Oct 26 2015 12:56
I was wondering if someone could help me with :Waypoint: Check Radio Buttons and Checkboxes by Default i am having trouble
normalactivity
@normalactivity
Oct 26 2015 12:58
Hi can anybody tell me how to retrieve the .pop() value in a variable declaration in java script?
Ho Chin Chee
@stranger26
Oct 26 2015 12:58
what trouble are you facing?
@normalactivity assign var x = y.pop();
normalactivity
@normalactivity
Oct 26 2015 12:59

var myArray = ["John", 23, ["cat", 2]];
// Only change code below this line.
myArray.pop();

var removed = myArray;

Matt Leonard
@matty22
Oct 26 2015 13:00
I can help @sambadillo.
normalactivity
@normalactivity
Oct 26 2015 13:02
var myArray = ["John", 23, ["cat", 2]];
// Only change code below this line.
var removed = myArray.pop();
In this code i need to remove cat and 2 from myArray and retrieve it in remove using pop()
@stranger26 its not retrieving cat and 2.its only removing john from my array
Ho Chin Chee
@stranger26
Oct 26 2015 13:05
err weird..
its .shift() that removes john
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:05
@matty22 thanks. i am just not sure how write the code . do i put default in "type-name
Matt Leonard
@matty22
Oct 26 2015 13:05
That code looks exactly like what I used to pass that waypoint. I know this sounds like a strange request, but could you delete your code and retype it the exact same?
CamperBot
@camperbot
Oct 26 2015 13:05
sambadillo96 sends brownie points to @matty22 :sparkles: :thumbsup: :sparkles:
:star: 209 | @matty22 | http://www.freecodecamp.com/matty22
normalactivity
@normalactivity
Oct 26 2015 13:05
ya i ll do that
Ho Chin Chee
@stranger26
Oct 26 2015 13:06
@normalactivity try copy your code and reset then paste and submit
Matt Leonard
@matty22
Oct 26 2015 13:06
@sambadillo96 No, just right after `name="test-name"'
Sorry name="test-name"
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:07
@matty22 so type <input type="radio" name="test-name default>?
Matt Leonard
@matty22
Oct 26 2015 13:08
<input type="radio" name="test-name" checked>
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:08
i type that and it didn't work
normalactivity
@normalactivity
Oct 26 2015 13:08
@stranger26 i did that
Ho Chin Chee
@stranger26
Oct 26 2015 13:08
@normalactivity did it work?
normalactivity
@normalactivity
Oct 26 2015 13:08
its still not working
Matt Leonard
@matty22
Oct 26 2015 13:09
@sambadillo96 did you make sure that you wrapped your name in "" ?
normalactivity
@normalactivity
Oct 26 2015 13:09
this is the code i wrote

var myArray = ["John", 23, ["cat", 2]];
myArray.pop();

var removed = myArray.pop();

(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z);})(myArray, removed);

Matt Leonard
@matty22
Oct 26 2015 13:10
Oh! remove that second line.
@normalactivity
normalactivity
@normalactivity
Oct 26 2015 13:10
ok
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:10
@matty22 yes i typed "type-name"
normalactivity
@normalactivity
Oct 26 2015 13:10
yes its working.i got it now. thanks @stranger26 and @matty22
CamperBot
@camperbot
Oct 26 2015 13:10
normalactivity sends brownie points to @stranger26 and @matty22 :sparkles: :thumbsup: :sparkles:
:star: 210 | @matty22 | http://www.freecodecamp.com/matty22
:star: 184 | @stranger26 | http://www.freecodecamp.com/stranger26
Ho Chin Chee
@stranger26
Oct 26 2015 13:11
no problem @normalactivity
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:11
@matty22 unless i am supose to type something in place of the type-name
Matt Leonard
@matty22
Oct 26 2015 13:11
those are separate things @sambadillo96. type="radio" name="testname" Don't put them in the same set of ""
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:12
so type this: <input type="radio" name="test-name" checked>
Ho Chin Chee
@stranger26
Oct 26 2015 13:12
my code for it is <input type="radio" name="indoor-outdoor" checked>
Matt Leonard
@matty22
Oct 26 2015 13:13
@normalactivity What was happening was the first .pop() popped off ["cat", 2], then you set var removed = to a second pop(), so it stuck 23 in removed.
@sambadillo96 Yep, just like that
Valient47
@Valient47
Oct 26 2015 13:13
how do i nest the labels in the labels O_O
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:14
@matty22 it's still not working
Matt Leonard
@matty22
Oct 26 2015 13:14
Ok, paste all of your code here using this format.
explain format
CamperBot
@camperbot
Oct 26 2015 13:14

:point_right: code formatting [wiki]

Inline code

alt text

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

Code Block

``` ⇦ Type 3 backticks and then press [shift + enter ⏎]

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

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

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

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

Byron Lagrone
@byronic
Oct 26 2015 13:15

@Valient47 speaking generally, nesting in HTML just involves placing any tag inside the opening and closing tags for another:

<div id="outside">
  <div id="nested">
  </div>
</div>

^ So in that we would call the inner div nested

Is there a specific question you had on nesting?
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:16

@matty22 <input type="radio" name="test-name" checked>

<input type="checkbox" nem="test-name" checked>

<input type="radio" name="test-name" checked>

<input type="checkbox" name="test-name" checked>

the first one was wrong
Valient47
@Valient47
Oct 26 2015 13:17
Im stuck on 39, i really dont have any idea how to do this, @byronic yeah i know that but
Matt Leonard
@matty22
Oct 26 2015 13:17
I'm thinking you name is wrong? Did you change it from what it was in the prior waypoint?
Yeah, the name should be "indoor-outdoor"
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:18
oh okay thanks @matty22
CamperBot
@camperbot
Oct 26 2015 13:18
sambadillo96 sends brownie points to @matty22 :sparkles: :thumbsup: :sparkles:
:warning: sambadillo96 already gave matty22 points
Matt Leonard
@matty22
Oct 26 2015 13:18
Did that pass?
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:19
no
Matt Leonard
@matty22
Oct 26 2015 13:20
What is the test that doesn't pass say?
Abhishek
@Abhi493
Oct 26 2015 13:20
explain js res
Ho Chin Chee
@stranger26
Oct 26 2015 13:21
@sambadillo96 did you nest your input in labels?
Matt Leonard
@matty22
Oct 26 2015 13:21
Ahh, good point.
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:22

@matty22 @stranger26 this is the code i put in: <input type="radio" name="indoor-outdoor" checked>

<input type="checkbox" name="indoor-outdoor" checked>

Ho Chin Chee
@stranger26
Oct 26 2015 13:22
nest <input> within <label></label>
Matt Leonard
@matty22
Oct 26 2015 13:23

@stranger26 is right. you need to wrap those inputs with labels like this:

<label><input type="checkbox" name="indoor-outdoor" checked></label>

Do that for both.
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:23
okay thanks
CamperBot
@camperbot
Oct 26 2015 13:23
if you want to thank someone, put an @ before their name!
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:23
@stranger26 thank you
CamperBot
@camperbot
Oct 26 2015 13:23
sambadillo96 sends brownie points to @stranger26 :sparkles: :thumbsup: :sparkles:
:star: 185 | @stranger26 | http://www.freecodecamp.com/stranger26
Ho Chin Chee
@stranger26
Oct 26 2015 13:23
welcome :)
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:35
@stranger26 hey it still won't go through
Ho Chin Chee
@stranger26
Oct 26 2015 13:36
paste your code here again?
Byron Lagrone
@byronic
Oct 26 2015 13:36
@sambadillo96 paste your code please
lol, beaten by @stranger26
<3
Ho Chin Chee
@stranger26
Oct 26 2015 13:37
:P
Eliza Chatzigeorgiadou
@Eliza89
Oct 26 2015 13:39
boot.png
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:40

@stranger26 @byronic : <label><input type="radio" name="indoor-outdoor" checked></label>

<label><input type="checkbox" name="indoor-outdoor" checked></label>

Herman Fassett
@HermanFassett
Oct 26 2015 13:40
@Eliza89 text goes between the tags
Ho Chin Chee
@stranger26
Oct 26 2015 13:40
<label><input type="radio" name="indoor-outdoor" checked>indoor</label>
<label><input type="checkbox" name="personality" checked>loving</label>
Herman Fassett
@HermanFassett
Oct 26 2015 13:40
<button>Text here</button>
Ho Chin Chee
@stranger26
Oct 26 2015 13:40
try this
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:42
it didn't work
Ho Chin Chee
@stranger26
Oct 26 2015 13:43
hold on
i check my code
Eliza Chatzigeorgiadou
@Eliza89
Oct 26 2015 13:43
@HermanFassett thank you !
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:43
ok
CamperBot
@camperbot
Oct 26 2015 13:43
eliza89 sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 455 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Jaykishan Kacha
@jaykishan10
Oct 26 2015 13:44

function mutation(arr) {
     arr[0] == arr[0].toLowerCase();
       arr[1] = arr[1].toLowerCase();

  for(var i=0;i<arr[1].length;i++){
      var index = arr[0].indexOf(arr[1].charAt(i));
      if(index == -1){
          return false;
      }
  }
  return true;
}

mutation(["Mary", "Army"]);
not working??
what shouls i do?/
Ho Chin Chee
@stranger26
Oct 26 2015 13:45
<label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality" checked> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Energetic</label>
Jaykishan Kacha
@jaykishan10
Oct 26 2015 13:45
should?
Herman Fassett
@HermanFassett
Oct 26 2015 13:46

@jaykishan10 you have

arr[0] == arr[0].toLowerCase()

it should be only 1 =

So

arr[0] = arr[0].toLowerCase();

Then it should work

Jaykishan Kacha
@jaykishan10
Oct 26 2015 13:52
@HermanFassett thanks
CamperBot
@camperbot
Oct 26 2015 13:52
jaykishan10 sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 456 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Ho Chin Chee
@stranger26
Oct 26 2015 13:53
@sambadillo96 did it work
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:53
@stranger26 no
Ho Chin Chee
@stranger26
Oct 26 2015 13:54
can you screenshot or copy your entire code?
Byron Lagrone
@byronic
Oct 26 2015 13:54
and don't forget to use backticks! They're typically above the left tab key on most keyboards
makes it easier for us to read ;)
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:56
@stranger26 : <label><input type="radio" name="indoor-outdoor"> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality"> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Energetic</label>
Ho Chin Chee
@stranger26
Oct 26 2015 13:56
is that your entire answer?
Sameen Anna Belle
@sambadillo96
Oct 26 2015 13:56
Yhes
yes
Ho Chin Chee
@stranger26
Oct 26 2015 13:57
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

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

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

  .smaller-image {
    width: 100px;
  }
</style>

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

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

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

<p>Things cats love:</p>
<ul>
  <li>cat nip</li>
  <li>laser pointers</li>
  <li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
  <li>flea treatment</li>
  <li>thunder</li>
  <li>other cats</li>
</ol>
<form action="/submit-cat-photo">
  <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
  <label><input type="radio" name="indoor-outdoor"> Outdoor</label>
  <label><input type="checkbox" name="personality" checked> Loving</label>
  <label><input type="checkbox" name="personality"> Lazy</label>
  <label><input type="checkbox" name="personality"> Energetic</label>
  <input type="text" placeholder="cat photo URL" required>
  <button type="submit">Submit</button>
</form>
this is mine @sambadillo96
Serhii Borovskyi
@serhiicss
Oct 26 2015 14:01
This message was deleted
Yoav Farkash
@yfarkash
Oct 26 2015 14:15
Hi, is anyone here familiar with NetBeans IDE?
Dibyea
@Dibyea
Oct 26 2015 14:17

I'm having a problem with use an ID Attribute to style an element. the background of the form suppose to be green here's the code I wrote can anyone help? <style>
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

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

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

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

cat-photo-element {

background-color: green;

}
</style>

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

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

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

<div class="gray-background">
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
</div>

<form action="/submit-cat-photo" id="cat-photo-form" class="cat-photo-element">

KofiAkorli
@KofiAkorli
Oct 26 2015 14:19
@Dibyea put a # before the cat-photo-element like this
#cat-photo-element {
}
that is how to select ID in css
Dibyea
@Dibyea
Oct 26 2015 14:21
@KofiAkorli I did and it still won't work. Is it a problem within the code you think?
KofiAkorli
@KofiAkorli
Oct 26 2015 14:21
@Dibyea hold on, let me read through it again
@Dibyea you made the class cat-photo-element and the id cat-photo-form
change the name of the ID to cat-photo-form in the css
Dibyea
@Dibyea
Oct 26 2015 14:26
@KofiAkorli thanks; but now it's saying don't give your form any class or style attributes.
CamperBot
@camperbot
Oct 26 2015 14:26
dibyea sends brownie points to @kofiakorli :sparkles: :thumbsup: :sparkles:
:star: 205 | @kofiakorli | http://www.freecodecamp.com/kofiakorli
KofiAkorli
@KofiAkorli
Oct 26 2015 14:27
@Dibyea well then i guess it's not allowed in that waypoint, you'll have to remove it if it's not in the instructions
Dibyea
@Dibyea
Oct 26 2015 14:29
@KofiAkorli Thx a million. It worked.
CamperBot
@camperbot
Oct 26 2015 14:29
dibyea sends brownie points to @kofiakorli :sparkles: :thumbsup: :sparkles:
:warning: dibyea already gave kofiakorli points
KofiAkorli
@KofiAkorli
Oct 26 2015 14:31
@Dibyea you're welcome
Elizabeth Hatleli
@TheHighPriestess
Oct 26 2015 14:56
Has anyone here completed the Simon game? I'm having trouble figuring out how to ADD to the human player created array...because after the first click...it's MULTIPLE clicks. How do I do that?
Elizabeth Hatleli
@TheHighPriestess
Oct 26 2015 15:05
The problem with what I have now is that it doesn't allow for the human player to input any more than 1 click.
Somehow...that part of it needs to be re-worked to allow for that. However, I'm drawing a blank as to how to do it.
a loop?
Muhammed Gamal
@JimyAllam
Oct 26 2015 15:47
blob
help guys
CamperBot
@camperbot
Oct 26 2015 15:47
no wiki entry for: guys
:pencil: click here to create one now!after creating your page type update to reload it here
Muhammed Gamal
@JimyAllam
Oct 26 2015 15:49
??
lnuic
@lnuic
Oct 26 2015 15:52
@JimyAllam which waypoint is that
Coira Ellison
@Coira
Oct 26 2015 15:53
@JimyAllam btn-info rather than btn-Info (i.e. lower case 'i') ?
lnuic
@lnuic
Oct 26 2015 15:54
@JimyAllam <button class="btn btn-block btn-info">Info</button>
This message was deleted
Muhammed Gamal
@JimyAllam
Oct 26 2015 15:55
thanks guys it was the capital ( i)
CamperBot
@camperbot
Oct 26 2015 15:55
if you want to thank someone, put an @ before their name!
Tyler Moeller
@TylerMoeller
Oct 26 2015 15:55
What am I doing wrong with this callback? It won't log once per second...runs the entire for loop and then passes it all to writeContent and logs it all at once after waiting a second.
// parse data and simulate 1 second to write to the file
// goal is to get the console to log once per second
var data = [1, 2, 3, 4, 5, 6, 7, 8, 9];
getData(writeContent);

function getData(callback) {
  for (var i = 0; i < data.length; i++) {
    solution = data[i];
    callback();
  }
}

function writeContent() {
  setTimeout(function logWriting() {
    console.log('writing solution - 1sec: ' + solution);
  }, 1000);
}
Coira Ellison
@Coira
Oct 26 2015 16:04
@TylerMoeller i'm not sure using setTimeout will work like that. perhaps look at setInterval, and you won't need your for-loop
Nick Dearing
@nickdearing88
Oct 26 2015 16:06
I'm stuck on the Bring your JavaScript Slot Machine to Life waypoint. Any ideas?
// Only change code below this line.
$($(".slot")
[0]).html(slotOne);
$($(".slot")
[1]).html(slotTwo);
$($(".slot")
[2]).html(slotThree);
// Only change code above this line.
Tyler Moeller
@TylerMoeller
Oct 26 2015 16:06
@Coira Yes, I could do that instead to solve the goal, but I'm trying to have getData() send each piece of data one at a time.
@nickdearing88 change your solution to three lines rather than 6
Coira Ellison
@Coira
Oct 26 2015 16:09
@TylerMoeller hmm. maybe setInterval should be in getdata?
Tyler Moeller
@TylerMoeller
Oct 26 2015 16:10
@Coira yes, that would work too, but the setInterval is just simulating a file write. I'm trying to get this to work with callback functions.
Coira Ellison
@Coira
Oct 26 2015 16:13
ah, i'm lost as to what you want :p as callback() is in a for loop, setTimeout is being called x times simultaneously, rather than once every second
Roma
@NPrayder
Oct 26 2015 16:14
hello everyone
iamlimo
@iamlimo
Oct 26 2015 16:14
Hello guys
how do u
Hod
oops sorry for the typos
Roma
@NPrayder
Oct 26 2015 16:15
good, how u?
Nick Dearing
@nickdearing88
Oct 26 2015 16:15
@TylerMoeller I'm assuming you mean I should nest them somehow? Why does this make a difference and how do I do so. I tried this but something in the syntax is now wrong:
$($(".slot")[0]).html(slotOne),[1]).html(slotTwo),[2]).html(slotThree);
iamlimo
@iamlimo
Oct 26 2015 16:16
@NPrayder i'm greta

great

Tyler Moeller
@TylerMoeller
Oct 26 2015 16:16

@nickdearing88 I mean to do this:

// Only change code below this line.
$($(".slot")[0]).html(slotOne);
$($(".slot")[1]).html(slotTwo);
$($(".slot")[2]).html(slotThree);
// Only change code above this line.

Instead of:

// Only change code below this line.
$($(".slot")
[0]).html(slotOne);
$($(".slot")
[1]).html(slotTwo);
$($(".slot")
[2]).html(slotThree);
// Only change code above this line.
Roma
@NPrayder
Oct 26 2015 16:16
@iamlimo how you write big letters?
Elizabeth Hatleli
@TheHighPriestess
Oct 26 2015 16:18
can someone give me a hint about how to record multiple clicks using jquery?
i'm working on the simon game
Nick Dearing
@nickdearing88
Oct 26 2015 16:18
@TylerMoeller Thank you that worked but I why do the lines make a difference? I thought white space was ignored? Some of these things make me feel so stupid.
CamperBot
@camperbot
Oct 26 2015 16:18
nickdearing88 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star: 246 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
iamlimo
@iamlimo
Oct 26 2015 16:19
@NPrayder add hashtag to the word
How do I create a button element in Html using bootstrap method
Roma
@NPrayder
Oct 26 2015 16:19

ok, thank

CamperBot
@camperbot
Oct 26 2015 16:19
if you want to thank someone, put an @ before their name!
iamlimo
@iamlimo
Oct 26 2015 16:20
@NPrayder #You're welcome
Tyler Moeller
@TylerMoeller
Oct 26 2015 16:20

@nickdearing88 Newlines and whitespaces are different. You can do something like this to make it work on two lines each:

$($(".slot")[0])
                .html(slotOne);
$($(".slot")[1])
                .html(slotTwo);
$($(".slot")[2])
                .html(slotThree);

need to make your new line at the dot.

iamlimo
@iamlimo
Oct 26 2015 16:23
How do I create a button element ?
Nick Dearing
@nickdearing88
Oct 26 2015 16:23
Ok, that's good to know. thank you
CamperBot
@camperbot
Oct 26 2015 16:23
if you want to thank someone, put an @ before their name!
Tyler Moeller
@TylerMoeller
Oct 26 2015 16:27
Cody Bouscaren
@codybousc
Oct 26 2015 16:29
find drop it
CamperBot
@camperbot
Oct 26 2015 16:29

find drop it

:zero: bonfire drop it

Alex
@agarcia3872
Oct 26 2015 16:31
I am having trouble with waypoint 4 on HTML5 and CSS (Uncomment HTML). Everything I did in the previous step is gone, and it is telling me to "Make your h1 element visible on your page by uncommenting it." How do I do this if everything from the previous step is gone. Do I have to type everything again?
Tyler Moeller
@TylerMoeller
Oct 26 2015 16:32
@agarcia3872 Try pressing the reset button to clear the code.
Alex
@agarcia3872
Oct 26 2015 16:34
Thanks @TylerMoeller . That worked.
CamperBot
@camperbot
Oct 26 2015 16:34
agarcia3872 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star: 247 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
Louis Swaans
@SenpaiMechtronix
Oct 26 2015 16:39
hi, i'm having problems with waypont 4 of object oriented and functional programming. I can't get how to add that engine instance.

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

Rex Schrader
@SaintPeter
Oct 26 2015 16:41
@SenpaiMechtronix You can access the property of an object like this:
myObject.propertyName = value;
Your instance of the object is called myCar
Louis Swaans
@SenpaiMechtronix
Oct 26 2015 16:43
thanks @SaintPeter . It worked
CamperBot
@camperbot
Oct 26 2015 16:43
senpaimechtronix sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 1208 | @saintpeter | http://www.freecodecamp.com/saintpeter
saeed246
@saeed246
Oct 26 2015 17:03
How do we do the comment out an Html??
They are saying that they cannot read property length of null
very confused
Rex Schrader
@SaintPeter
Oct 26 2015 17:04
@saeed246 <!-- Comment Here -->
mattg425
@mattg425
Oct 26 2015 17:17
Question about "Waypoint: Use the Bootstrap Grid to Put Elements Side By Side
Rex Schrader
@SaintPeter
Oct 26 2015 17:18
@mattg425 kk, what's the trouble?
mattg425
@mattg425
Oct 26 2015 17:19
<button class="btn btn-block btn-primary">Like</button>
<button class="btn btn-block btn-info">Info</button>
<button class="btn btn-block btn-danger"delete"</button>
and here are the instructions.

Put the Like, Info and Delete buttons side-by-side by nesting all three of them within one <div class="row"> element, then each of them within a <div class="col-xs-4"> element.

The row class is applied to a div, and the buttons themselves can be nested within it.

Im not sure I know how to do this.
Rex Schrader
@SaintPeter
Oct 26 2015 17:21
@mattg425 Ok, do you know how to "Wrap" something in a div?
@mattg425 IT would look like this:
<div><someElement></someElement></div>
@mattg425 So, in this case, you need to wrap all 3 buttons in a div each with a class of col-xs-4, and then you need to wrap all 3 divs/buttons in a div with a class of row
@mattg425 Does that make sense?
mattg425
@mattg425
Oct 26 2015 17:24
Ok. If my code already has an existing DIV, do I need to use Div1 ?
h4r1m4u
@h4r1m4u
Oct 26 2015 17:25
@mattg425 no, you can have as many <div>s in your page as you like
gjoko1
@gjoko1
Oct 26 2015 17:26
No, you don't have to @mattg425 <div> is a tag similary as <a> <img> Check this link http://www.w3schools.com/tags/tag_div.asp
mattg425
@mattg425
Oct 26 2015 17:27
OK. think I got it. thanks for the help.
CamperBot
@camperbot
Oct 26 2015 17:27
if you want to thank someone, put an @ before their name!
mattg425
@mattg425
Oct 26 2015 17:31
ok. thanks @camperbot @gjoko1 @SaintPeter @h4r1m4u
CamperBot
@camperbot
Oct 26 2015 17:31
mattg425 sends brownie points to @camperbot and @gjoko1 and @saintpeter and @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 423 | @camperbot | http://www.freecodecamp.com/camperbot
:star: 1211 | @saintpeter | http://www.freecodecamp.com/saintpeter
:star: 335 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
:star: 246 | @gjoko1 | http://www.freecodecamp.com/gjoko1
Patrick
@JohnnyMarcone
Oct 26 2015 17:34
$($(".slot")[0]).html(slotOne);
$($(".slot")[1]).html(slotTwo);
$($(".slot")[2]).html(slotThree);
I'm on waypoint: Bring you JavaScript Slot Machine to Life. I'm confused about accessing each slot with bracket notation. Are they stored in an array somewhere?
Patrick
@JohnnyMarcone
Oct 26 2015 17:40
This message was deleted
Sarai Flowers
@MadreDeLobos
Oct 26 2015 17:58
How do i get my P lines to be a monospace font
 <link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"> 
<style>
   .red-text {
    color: red;
    font-family: lobster;
  }

  P {
    font-size: 16px;
    font-family: Monospace;
  }
</style>

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

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
Tyler Moeller
@TylerMoeller
Oct 26 2015 18:00
@c0d9x lower-case 'p' and lower-case 'm' in monospace?
h4r1m4u
@h4r1m4u
Oct 26 2015 18:01
@TylerMoeller that doesn't matter
@c0d9x in your example, the .red-text class with the font-family: lobster overrides the monospace font-family on p
Arnis Jaundzeikars
@SangSatori
Oct 26 2015 18:01
<style>
  .red-text {
   color: red;
   font-family: lobster;
 }

 p {
   font-size: 16px;
   font-family: Monospace !important;
 }
</style>
Which is not great, but--
h4r1m4u
@h4r1m4u
Oct 26 2015 18:01
if i remember the waypoint correctly, you're supposed to comment out the <link> lobster import
no, don't do what @SangSatori says. generally you want to avoid the !important declarations at all costs
Arnis Jaundzeikars
@SangSatori
Oct 26 2015 18:02
I agree. I was just tinkering with this; it's not good practice.
h4r1m4u
@h4r1m4u
Oct 26 2015 18:02
okey dokey
Chris
@ChrisB50
Oct 26 2015 18:03
I'm having a problem with the create a slot machine waypoint, i have added the code to generate three random numbers but when i try to run it is saying "cannot find variables" any ideas?
h4r1m4u
@h4r1m4u
Oct 26 2015 18:04
@c0d9x there are multiple ways to resolve it: a) delete/comment out the .red-text class from the CSS, b) delete/comment out its font-family property, c) comment out the lobster font import at the top of the code pane
Arnis Jaundzeikars
@SangSatori
Oct 26 2015 18:09
As far as general practice goes, I'm sure 'red text' should make text red without any other side-effects - the font-family doesn't really belong there. I'd remove that, but it's good to understand what works how - and yes, don't use !important - it's a last resort to override everything else and gets out of hand quickly.
h4r1m4u
@h4r1m4u
Oct 26 2015 18:15
actually, generally you want to avoid unsemantic class names like .red-text altogether. what if at some point of your project the stakeholders decide that the text should be green? suddenly you have a .red-text class with color: green which is really confusing. if the project is big, it may be really difficult to change all the .red-text classes to .green-classes. if you use a semantic class name instead, say .priority-1, you can freely change its CSS rules in the future without creating confusion or having to change your HTML code.
Thomson Muriyadan
@thedigitalmonk
Oct 26 2015 18:20
!important is a backend developer’s way of saying- "there I fixed it! Easy peasy”. :P
Shots fired.
Rex Schrader
@SaintPeter
Oct 26 2015 18:21
@thedigitalmonk lol
Arnis Jaundzeikars
@SangSatori
Oct 26 2015 18:23
I think I'm guilty of using this once or twice in an actual project because of "we must finish this and 15 other features today". It was horrible. I no longer work there, at least. :P
Sarai Flowers
@MadreDeLobos
Oct 26 2015 18:23
@h4r1m4u THAT WAS IT! THANK YOU!
CamperBot
@camperbot
Oct 26 2015 18:23
c0d9x sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 337 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
h4r1m4u
@h4r1m4u
Oct 26 2015 18:24
@c0d9x my pleasure
@SangSatori sometimes it's unavoidable. or trying to avoid it is not worth the time / cost
Arnis Jaundzeikars
@SangSatori
Oct 26 2015 18:24
Yep.
Thomson Muriyadan
@thedigitalmonk
Oct 26 2015 18:25
@SangSatori where was your last job? Was it at an agency or a product company?
Arnis Jaundzeikars
@SangSatori
Oct 26 2015 18:27
@thedigitalmonk: Ah, to be honest, last one was also my first one. They needed in-house devs for doing e-commerce (their primary business, so... a product company?) and it didn't work out for plenty of different reasons.
Chris
@ChrisB50
Oct 26 2015 18:27
2
  function runSlots(){
3
    var slotOne;
4
    var slotTwo;
5
    var slotThree;
6

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

9
    // Only change code below this line.
10
    slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
11
    slotTwo = Math.floor(Math.random() * (3-1+1)) + 1;
12
    slotThree = Math.floor(math.random() * (3-1+1)) + 1;
gauravbharadwajm
@gauravbharadwajm
Oct 26 2015 18:29
Hi guys, I need some help in solving a task for palindrome using javascript
Can anyone help me out ?
Rex Schrader
@SaintPeter
Oct 26 2015 18:30
@gauravbharadwajm Sure
Jason
@Skiippa
Oct 26 2015 18:32
Any idea why this doesnt work(probably something obvious)
function titleCase(str) {
  var length = str.length;

   for(i = 0;i < length + 1;i++){

     return str.split(' ').charAt(0).toUpperCase;
   }




}

titleCase("I'm a little tea pot");
Thomson Muriyadan
@thedigitalmonk
Oct 26 2015 18:33
@SangSatori : Ah I see. Well I’ve worked at 2 agencies before and I am pretty sure they are a lot worse. If they let you get away with that in a product company then the senior devs or leads are probably not as good as they claimed to be while getting hired. But then again not a lot of developers take CSS seriously. It’s almost harmless. Poor thing.
h4r1m4u
@h4r1m4u
Oct 26 2015 18:34
@Skiippa str.split(' ') returns array. charAt() is not an array method, it works on a string
Thomson Muriyadan
@thedigitalmonk
Oct 26 2015 18:35
@Skiippa the console is a good place to see what your script is doing. Have you been using it?
Byron Lagrone
@byronic
Oct 26 2015 18:36
@Skiippa In addition, .toUpperCase() is a function, not a variable, and so needs parentheses (when you re-fiddle your function)
gauravbharadwajm
@gauravbharadwajm
Oct 26 2015 18:37
@SaintPeter
```

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

palindrome("eye");
```

Jason
@Skiippa
Oct 26 2015 18:38
@thedigitalmonk My console doesnt really output anything all the website console says is " str.split(...).charAt is not a function"
@h4r1m4u Not sure if i understand can you reword that for me ? :)
Chris
@ChrisB50
Oct 26 2015 18:39
Thanks for the help, I've sorted it
CamperBot
@camperbot
Oct 26 2015 18:39
if you want to thank someone, put an @ before their name!
Byron Lagrone
@byronic
Oct 26 2015 18:39
@Skiippa what @h4r1m4u is saying is that when you call str.split(' '); the result of that function is an array of strings, i.e. ["This", "was", "recently", "a", "string"]
h4r1m4u
@h4r1m4u
Oct 26 2015 18:40
@Skiippa str.split(' ') returns an array, eg. the result of (My dog likes food).split(' ') will be ['My', 'dog', 'likes', 'food']. charAt() is a function you call on a string, not array
Byron Lagrone
@byronic
Oct 26 2015 18:41
arrays do not have a .charAt(index) function (what would it call?). However, if you store the array in a variable, i.e. var myStringArray = str.split(' '); you can access the individual strings within the resultant array with myStringArray[0], myStringArray[1], etc -- and each of those will have access to the .charAt(0) function
Jason
@Skiippa
Oct 26 2015 18:41
So i would have to make the substring their own strings for charAt to work?
Byron Lagrone
@byronic
Oct 26 2015 18:41
I hope that makes sense
Jason
@Skiippa
Oct 26 2015 18:41
yea
Byron Lagrone
@byronic
Oct 26 2015 18:41
@Skiippa You don't have a substring, you have an array of strings ;)
Thomson Muriyadan
@thedigitalmonk
Oct 26 2015 18:41
That says a lot actually. It means the issue is with that particular line. Now why don’t you try and unchain it and do it one step at a time and see what happens when you call each function? Use console.log after each step you are not sure of the output. You’ll get a clearer error in your console. Once you fix it than you chain it up and make it look pretty. @Skiippa
h4r1m4u
@h4r1m4u
Oct 26 2015 18:41
you cannot call a string function on an array of strings. but you can iterate over the array elements (individual strings) and apply the charAt() function on them individually. *hint, hint
gauravbharadwajm
@gauravbharadwajm
Oct 26 2015 18:41
@SaintPeter
function palindrome(str) {
  // Good luck!
  return true;
}



palindrome("eye");
Can anyone help me with this ?
Rex Schrader
@SaintPeter
Oct 26 2015 18:42
@gauravbharadwajm Yes, I am aware of the palindrome definition
gauravbharadwajm
@gauravbharadwajm
Oct 26 2015 18:42
I wrote a function which is working for all the scenarios but I donno how to return false for once scenario
Rex Schrader
@SaintPeter
Oct 26 2015 18:43
@gauravbharadwajm Have you considered what steps you will need to take to check if something is a palinrome or not?
h4r1m4u
@h4r1m4u
Oct 26 2015 18:43
@gauravbharadwajm why don't you take a stab at it first and then come back with your code for feedback / advice?
Rex Schrader
@SaintPeter
Oct 26 2015 18:43
@gauravbharadwajm Can you please share YOUR code?
Myroslav
@werber
Oct 26 2015 18:43
@gauravbharadwajm Just compare with itself reversed.
gauravbharadwajm
@gauravbharadwajm
Oct 26 2015 18:43
yeah sure
function palindrome(str) {
  // Good luck!
   str = str.toLowerCase().replace(/[^a-z]+/g,""); 
  return str === str.split("").reverse().join(""); }
}



palindrome("eye");
Its working for all the scenarios but failing for 1
This error is being shown: palindrome("1 eye for of 1 eye.") should return false.
Thomson Muriyadan
@thedigitalmonk
Oct 26 2015 18:44

@Skiippa here’s what I mean -

var splitString = str.split(‘ ‘);
console.log(splitString);

Now when you will try to do .charAt(0) on this you will get a clearer error on why it won’t work. Even before that you would have noticed that the splitString is an array and if you remembered from the previous challenges charAt() is a string method.

Then apply the next method and so on…

Step by step first man. You’ll learn a lot that way.

Rex Schrader
@SaintPeter
Oct 26 2015 18:45
@gauravbharadwajm You need to keep numbers, not just letters.
gauravbharadwajm
@gauravbharadwajm
Oct 26 2015 18:46
@SaintPeter so that should go in the second line of the function ?
Rex Schrader
@SaintPeter
Oct 26 2015 18:47
@gauravbharadwajm Your regular expression should be modified to not just keep a-z, but also 0-9
Yoav Farkash
@yfarkash
Oct 26 2015 18:48
@gauravbharadwajm it is /[^a-z0-9]
I have a question regarding the use of the .map function with arrays. Can anyone here help?
Rex Schrader
@SaintPeter
Oct 26 2015 18:49
@yfarkash Sure
Yoav Farkash
@yfarkash
Oct 26 2015 18:50
so, I am working on the bonefire for finding the longest word in a string. I figured the steps are 1) convert the string to an array of words, 2) find the longest word
Lisa
@ldbs68
Oct 26 2015 18:50
Basic javaScript ;
Waypoint: Manipulate Arrays With pop()
gauravbharadwajm
@gauravbharadwajm
Oct 26 2015 18:50
@SaintPeter @yfarkash :clap: :+1:
Rex Schrader
@SaintPeter
Oct 26 2015 18:50
@yfarkash That seems reasonable :D
gauravbharadwajm
@gauravbharadwajm
Oct 26 2015 18:50
Thanks guys
CamperBot
@camperbot
Oct 26 2015 18:50
if you want to thank someone, put an @ before their name!
gauravbharadwajm
@gauravbharadwajm
Oct 26 2015 18:50
it worked
Rex Schrader
@SaintPeter
Oct 26 2015 18:50
@gauravbharadwajm :thumbsup:
Yoav Farkash
@yfarkash
Oct 26 2015 18:51
so now I have my array. I can either write a loop to go over the array and for each position check the length of the string in this position but I want to use the .map function , which is supposed to iterate over an array and perform a fuinction on each position.
Muhammed Gamal
@JimyAllam
Oct 26 2015 18:51
guys
Yoav Farkash
@yfarkash
Oct 26 2015 18:51
for some reason I find the .map function with arrays very confusing...
Rex Schrader
@SaintPeter
Oct 26 2015 18:52
@yfarkash You could kinda use .map . . . it's not really ideal. .reduce would be better, but it's even more confusing. Better to use a simple for loop instead.
Yoav Farkash
@yfarkash
Oct 26 2015 18:52
:-) ok, I was trying to learn the new functions while doing it, but I guess good old fashioned loops work.
when would I usually use the .map function?
h4r1m4u
@h4r1m4u
Oct 26 2015 18:54
@yfarkash usually you would use map if you want to manipulate the array elements in some way (map returns a new array with elements from the original array after you applied the function on them). in this case, you don't need to manipulate the strings in any way. you just need to find the longest one
Yoav Farkash
@yfarkash
Oct 26 2015 18:56
@h4r1m4u yes, I was just hoping to practice the use of the .map function and create a new array with the lengths of the words in it, and then find the largest number in this array, just to practice.
but I cant seem to be able to do it, I dont know how to call the string.length function on each cell in the array....
This is what I tried: lengthsArray = array.map(str.length());
Rex Schrader
@SaintPeter
Oct 26 2015 18:57
@yfarkash .reduce would be better in this case because it returns a single value for an array.
@yfarkash That won't quite work. You would need:
lengthsArray = array.map(function(item) { return item.length(); });
Yoav Farkash
@yfarkash
Oct 26 2015 18:58
@SaintPeter .reduce is something I find even more confusing than .map! :-D I will try to figure out the ,map and then I'll try the .reduce, with some help from you guys if possible. btw, how do you format your code to look different than the usual text?
h4r1m4u
@h4r1m4u
Oct 26 2015 18:58
@yfarkash
var arr = ['My', 'dog', 'loves', 'cookies'];

var newArr = arr.map(function(element) {
  return element.length; 
});

console.log(newArr);
Rex Schrader
@SaintPeter
Oct 26 2015 18:58
@yfarkash But the issue with getting an array of numbers is then you STILL need to determine which one is the longest.
Byron Lagrone
@byronic
Oct 26 2015 18:58
@yfarkash wiki format
h4r1m4u
@h4r1m4u
Oct 26 2015 18:59
@yfarkash newArr is now [2, 3, 5, 7]
Byron Lagrone
@byronic
Oct 26 2015 18:59
apparently I am bad at links
Rex Schrader
@SaintPeter
Oct 26 2015 18:59
wiki format
CamperBot
@camperbot
Oct 26 2015 18:59

:point_right: code formatting [wiki]

Inline code

alt text

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

Code Block

``` ⇦ Type 3 backticks and then press [shift + enter ⏎]

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

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

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

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

Byron Lagrone
@byronic
Oct 26 2015 18:59
@SaintPeter has my back
Rex Schrader
@SaintPeter
Oct 26 2015 18:59
@byronic It's gotta be the first thing on the line :D
Byron Lagrone
@byronic
Oct 26 2015 18:59
So I see
"Syntax is important!"
Rex Schrader
@SaintPeter
Oct 26 2015 18:59
:D
Yoav Farkash
@yfarkash
Oct 26 2015 19:00
@SaintPeter thats true, im not going for efficiency here, im using this exercise to understand the use of the ' .map' and '.reduce'.
Rex Schrader
@SaintPeter
Oct 26 2015 19:00
"Computer, do the thing I mean, not the thing I say"
@yfarkash Any way you slice it, you're going to have to compare the length of the current word against the length of the longest word you've seen.
Ionut Grigore
@slymshady70
Oct 26 2015 19:00

<p>View more <a href="http://freecatphotoapp.com">cat photos</a></p>

Whaty is wrong,i cant pass ....its nesting or something

Rex Schrader
@SaintPeter
Oct 26 2015 19:00
@yfarkash You can do that with a for loop just about as effeciently as with reduce
@slymshady70 That looks right - is that the first <p> in the list of <p> tags?
LM
@s3cur3n3t
Oct 26 2015 19:02
doing the waipoint add font awesome icons
h4r1m4u
@h4r1m4u
Oct 26 2015 19:02
@yfarkash check the code i posted above for the map function which returns the lengths of strings in an array
LM
@s3cur3n3t
Oct 26 2015 19:02

ain't this right? <button><i class="fa fa-trash"> Delete</i></button>

<button><i class="fa fa-info-circle"> Info</i></button>
<button><i class="fa fa-thumbs-up"> Like</i></button>

Ionut Grigore
@slymshady70
Oct 26 2015 19:02
@SaintPeter last i think
Rex Schrader
@SaintPeter
Oct 26 2015 19:03
@slymshady70 It needs to be the first or it won't pass
Ionut Grigore
@slymshady70
Oct 26 2015 19:03
@SaintPeter i try now
Rex Schrader
@SaintPeter
Oct 26 2015 19:03
@slymshady70 I believe the link was originally right below the <h2> element?
h4r1m4u
@h4r1m4u
Oct 26 2015 19:03
@s3cur3n3t <button><i class="fa fa-trash"></i> Delete</button>
LM
@s3cur3n3t
Oct 26 2015 19:03
well I used like and then info and then delete and it won't pass again
Ionut Grigore
@slymshady70
Oct 26 2015 19:03
@SaintPeter one more error i have :
Your a element should be nested within your new p element.
LM
@s3cur3n3t
Oct 26 2015 19:04
@h4r1m4u did not understood what you mean... :(
h4r1m4u
@h4r1m4u
Oct 26 2015 19:05
@s3cur3n3t the <i> element is not supposed to enclose the button text
Rex Schrader
@SaintPeter
Oct 26 2015 19:05
@slymshady70 Humm, what you wrote looks correct. does it occur just after the <h2> element?
LM
@s3cur3n3t
Oct 26 2015 19:05
I do not have a h2 element there
Rex Schrader
@SaintPeter
Oct 26 2015 19:06
@s3cur3n3t Good thing I'm not talking to you ;)
h4r1m4u
@h4r1m4u
Oct 26 2015 19:06
@s3cur3n3t <button><i ...></i> button text</button>not <button><i ...>button text</i></button>
LM
@s3cur3n3t
Oct 26 2015 19:06
sorry
ok, ok understood
h4r1m4u
@h4r1m4u
Oct 26 2015 19:06
also, that waypoint is asking you to add the icon only into the Like button. not the other 2
Yoav Farkash
@yfarkash
Oct 26 2015 19:06
@h4r1m4u thank you, that works perfectly. I guess what is confusing to me is knowing which kind of functions I can just write directly as the .map first argument and which ones I need to write myself like your example did.
CamperBot
@camperbot
Oct 26 2015 19:06
yfarkash sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 338 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
LM
@s3cur3n3t
Oct 26 2015 19:07
@h4r1m4u same still not pass from there
<button><i class="fa fa-trash"></i>Delete</button>
<button><i class="fa fa-info-circle"></i>Info</button>
<button><i class="fa fa-thumbs-up"></i>Like</button>
Ionut Grigore
@slymshady70
Oct 26 2015 19:08
@SaintPeter not working,its after h2
Rex Schrader
@SaintPeter
Oct 26 2015 19:09
@slymshady70 Can you please post your code, starting with the h2 element?
h4r1m4u
@h4r1m4u
Oct 26 2015 19:10
@s3cur3n3t any errors? aren't you supposed to add the icon only into the Like button?
LM
@s3cur3n3t
Oct 26 2015 19:10
nop
You should add a <i class="fa fa-trash"></i> within your delete button element.
You should add a <i class="fa fa-info-circle"></i> within your info button element.
Make sure each of your i elements has a closing tag and <i class="fa fa-thumbs-up"></i> is in your like button element.
Ionut Grigore
@slymshady70
Oct 26 2015 19:12

@slymshady70 Can you please post your code, s <link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

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

h2 {
font-family: Lobster, Monospace;
}

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

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

.smaller-image {
width: 100px;
}
</style>

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

<p>View more <a href="http://freecatphotoapp.com">cat photos</a></p>
<a href="http://www.freecatphotoapp.com">cat photos</a>

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

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

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

h4r1m4u
@h4r1m4u
Oct 26 2015 19:13
@s3cur3n3t you have to keep the original button classes: <button class="btn btn-block btn-primary"> ... </button> you can't remove them like you did: <button>... </button>
Rex Schrader
@SaintPeter
Oct 26 2015 19:13
@slymshady70 ok, the problem is you have an extra link: <a href="http://www.freecatphotoapp.com">cat photos</a> under the <p> with the nested link
@slymshady70 Just delete that second link and you should be golden
Ionut Grigore
@slymshady70
Oct 26 2015 19:14
@SaintPeter deleted still not work...
Rex Schrader
@SaintPeter
Oct 26 2015 19:14
blob
Michael Bomholt
@bomholtm
Oct 26 2015 19:14
@slymshady70 can you post the link to the fcc task?
PrisWalt
@PrisWalt
Oct 26 2015 19:14

On Responsively Style Radio Buttons, nesting as instructed but run test keeps failing. Code as follows:

<div class="row">
<div class="col-xs-6">
<button class="btn btn-block btn-primary"><i class="fa fa-thumbs-up"></i> Like</button>
</div>
<div class="col-xs-6">
<button class="btn btn-block btn-info"><i class="fa fa-info-circle"></i> Info</button>
</div>
<div class="col-xs-6">
<button class="btn btn-block btn-danger"><i class="fa fa-trash"></i> Delete</button>
</div>
</div>

Ionut Grigore
@slymshady70
Oct 26 2015 19:15
@slymshady70 can you post the link to the fcc task?http://freecodecamp.com/challenges/waypoint-nest-an-anchor-element-within-a-paragraph#?solution=%3Clink%20href%3D%22http%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DLobster%22%20rel%3D%22stylesheet%22%20type%3D%22text%2Fcss%22%3E%0A%3Cstyle%3E%0A%20%20.red-text%20%7B%0A%20%20%20%20color%3A%20red%3B%0A%20%20%7D%0A%0A%20%20h2%20%7B%0A%20%20%20%20font-family%3A%20Lobster%2C%20Monospace%3B%0A%20%20%7D%0A%0A%20%20p%20%7B%0A%20%20%20%20font-size%3A%2016px%3B%0A%20%20%20%20font-family%3A%20Monospace%3B%0A%20%20%7D%0A%0A%20%20.thick-green-border%20%7B%0A%20%20%20%20border-color%3A%20green%3B%0A%20%20%20%20border-width%3A%2010px%3B%0A%20%20%20%20border-style%3A%20solid%3B%0A%20%20%20%20border-radius%3A%2050%25%3B%0A%20%20%7D%0A%0A%20%20.smaller-image%20%7B%0A%20%20%20%20width%3A%20100px%3B%0A%20%20%7D%0A%3C%2Fstyle%3E%0A%0A%3Ch2%20class%3D%22red-text%22%3ECatPhotoApp%3C%2Fh2%3E%0A%0A%3Cp%3EView%20more%20%3Ca%20%0Ahref%3D%22http%3A%2F%2Ffreecatphotoapp.com%22%3Ecat%20photos%3C%2Fa%3E%3C%2Fp%3E%0A%0A%0A%3Cimg%20class%3D%22smaller-image%20thick-green-border%22%20src%3D%22https%3A%2F%2Fbit.ly%2Ffcc-relaxing-cat%22%3E%0A%0A%0A%0A%3Cp%20class%3D%22red-text%22%3EKitty%20ipsum%20dolor%20sit%20amet%2C%20shed%20everywhere%20shed%20everywhere%20stretching%20attack%20your%20ankles%20chase%20the%20red%20dot%2C%20hairball%20run%20catnip%20eat%20the%20grass%20sniff.%3C%2Fp%3E%0A%3Cp%20class%3D%22red-text%22%3EPurr%20jump%20eat%20the%20grass%20rip%20the%20couch%20scratched%20sunbathe%2C%20shed%20everywhere%20rip%20the%20couch%20sleep%20in%20the%20sink%20fluffy%20fur%20catnip%20scratched.%3C%2Fp%3E%0A%0A%0A
i guess is not a link ...
LM
@s3cur3n3t
Oct 26 2015 19:16
I got it
nice nice
thanks for your help
CamperBot
@camperbot
Oct 26 2015 19:16
if you want to thank someone, put an @ before their name!
Moisés Man
@moigithub
Oct 26 2015 19:17
@PrisWalt a RADIO button the the one with a circle to one side... (multiple options but allow only pick 1 at time, for each group)
<intput type="radio">pick me
h4r1m4u
@h4r1m4u
Oct 26 2015 19:17
@PrisWalt you're supposed to be nesting the radio buttons (e.g. <label><input type="radio" name="indoor-outdoor"> Indoor</label>), not the regular buttons
Rex Schrader
@SaintPeter
Oct 26 2015 19:17
@slymshady70 Your URL is wrong: you have http://www.freecatphotos and it should be http://freecatphotos - no www
Yoav Farkash
@yfarkash
Oct 26 2015 19:17
ok, can I ask a question about the .reduce function?
h4r1m4u
@h4r1m4u
Oct 26 2015 19:17
@s3cur3n3t you're welcome
Rex Schrader
@SaintPeter
Oct 26 2015 19:17
@yfarkash NO! You've used up your question quota for the day!
@yfarkash I kid, I kid.
@yfarkash Please, ask away, no need to ask for permission ;)
Moisés Man
@moigithub
Oct 26 2015 19:17
was gonna say NO too :P
Yoav Farkash
@yfarkash
Oct 26 2015 19:18
:-D
Ionut Grigore
@slymshady70
Oct 26 2015 19:18
@SaintPeter i have and still this error : Your a element should be nested within your new p element.
Rex Schrader
@SaintPeter
Oct 26 2015 19:18
@slymshady70 Did you correct the URL?
PrisWalt
@PrisWalt
Oct 26 2015 19:18
@moigithub Ah, thanks...so focused on code, I wasn't reading instructions thoroughly
CamperBot
@camperbot
Oct 26 2015 19:18
priswalt sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star: 391 | @moigithub | http://www.freecodecamp.com/moigithub
Arnis Jaundzeikars
@SangSatori
Oct 26 2015 19:18
Hey, I have a quick non-technical question on the side -- do you think it's worth taking notes while going through the course? Or is just doing and applying fine?
Ionut Grigore
@slymshady70
Oct 26 2015 19:18
@SaintPeter i did
Yoav Farkash
@yfarkash
Oct 26 2015 19:19

So, I used the .map to get my array of numbers, each is the length of the word in the array. Now I want to use .reduce to get the largest numbers. here is my code:
```
longestWord = lengthsArray.reduce(function(previousValue, currentValue, index, array) {
if currentValue > previousValue {
return currentValue;
} else {
return previousValue;
}

}
);

Michael Bomholt
@bomholtm
Oct 26 2015 19:19
@slymshady70 <p>View More <a href="http://www.freecatphotoapp.com">cat photos</a></p>
Moisés Man
@moigithub
Oct 26 2015 19:19
@SangSatori whatever helps u learn n remember is good :)
Michael Bomholt
@bomholtm
Oct 26 2015 19:19
@slymshady70 try to reset the code and do it again
Yoav Farkash
@yfarkash
Oct 26 2015 19:19
oops, not formated properly...
Michael Bomholt
@bomholtm
Oct 26 2015 19:19
@slymshady70 maybe its just a bug if you corrected the link.. so reset the code and put the <p>View More <a href="http://www.freecatphotoapp.com">cat photos</a></p> in again
Rex Schrader
@SaintPeter
Oct 26 2015 19:20
@slymshady70 Try this: Reset your code and use this:
<p>View More <a href="http://www.freecatphotoapp.com">cat photos</a></p>
@bomholt oops, jinx :D
Michael Bomholt
@bomholtm
Oct 26 2015 19:20
@SaintPeter :P
Rex Schrader
@SaintPeter
Oct 26 2015 19:20
@yfarkash That looks like it should work.
Ionut Grigore
@slymshady70
Oct 26 2015 19:20
@SaintPeter @bomholt ty alot finnaly working
Michael Bomholt
@bomholtm
Oct 26 2015 19:21
no problem at all
Yoav Farkash
@yfarkash
Oct 26 2015 19:21
it gives me this erroor:
"SyntaxError: Unexpected identifier
    at https://static.jsbin.com/js/prod/runner-3.35.2.min.js:1:13616
    at https://static.jsbin.com/js/prod/runner-3.35.2.min.js:1:10537"
Rex Schrader
@SaintPeter
Oct 26 2015 19:21
@yfarkash Oh, wait - are you itterating over words or length?
Yoav Farkash
@yfarkash
Oct 26 2015 19:21
over lengths.
Arnis Jaundzeikars
@SangSatori
Oct 26 2015 19:21
So far I haven't felt a need yet; I'm at Waypoint 25 of HTML/CSS. But I've got a text editor running just case - just wondering about avoiding forgetting stuff, etc, etc.
Yoav Farkash
@yfarkash
Oct 26 2015 19:21
this is my array:[4, 2, 1, 9, 4]
ok, here is my whole code: :-)
h4r1m4u
@h4r1m4u
Oct 26 2015 19:22
@yfarkash just add parentheses around the if condition:
longestWord = lengthsArray.reduce(function(previousValue, currentValue, index, array) {
  if (currentValue > previousValue) {
    return currentValue;
  } else {
    return previousValue;
 }
});
it's a syntax error, nothing else
Yoav Farkash
@yfarkash
Oct 26 2015 19:23
@h4r1m4u Thank you! Its amazing how many times I can stare at it and not notice!
CamperBot
@camperbot
Oct 26 2015 19:23
yfarkash sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:warning: yfarkash already gave h4r1m4u points
Rex Schrader
@SaintPeter
Oct 26 2015 19:23
Man, I am not fast enough to keep up with you, @h4r1m4u
h4r1m4u
@h4r1m4u
Oct 26 2015 19:24
@SaintPeter ahahaha. it's a friendly competition :)
Yoav Farkash
@yfarkash
Oct 26 2015 19:24
Thank you @SaintPeter and @h4r1m4u , it really helped me understand the .map and .reduce. They are pretty damn awesome functions.
CamperBot
@camperbot
Oct 26 2015 19:24
yfarkash sends brownie points to @saintpeter and @h4r1m4u :sparkles: :thumbsup: :sparkles:
Arnis Jaundzeikars
@SangSatori
Oct 26 2015 19:24
Talk about going agile.
CamperBot
@camperbot
Oct 26 2015 19:24
:warning: yfarkash already gave h4r1m4u points
:star: 1214 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Oct 26 2015 19:24
@yfarkash BTW, test your code at http://repl.it - it highlight syntax errors
@yfarkash I developed all of my bonfires there.
h4r1m4u
@h4r1m4u
Oct 26 2015 19:24
brownies, nom, nom, nom
SaintPeter @SaintPeter is almost full. Couldn't eat another bite.
h4r1m4u
@h4r1m4u
Oct 26 2015 19:25
:D
how did you do that?
Yoav Farkash
@yfarkash
Oct 26 2015 19:25
Thanks, I didnt know about it. I am using JSbin for doing it, but I see the need to syntax checking.
CamperBot
@camperbot
Oct 26 2015 19:25
if you want to thank someone, put an @ before their name!
SangSatori @SangSatori ponders.
Arnis Jaundzeikars
@SangSatori
Oct 26 2015 19:26
Use /me <describe action>.
h4r1m4u @h4r1m4u thanks @SangSatori
Yoav Farkash
@yfarkash
Oct 26 2015 19:27
I have a general question: are the .map and .reduce functions, generally speaking, much faster than using a for loop?
CamperBot
@camperbot
Oct 26 2015 19:27
sorry h4r1m4u, you can't send brownie points to yourself! :sparkles: :sparkles:
:star: 34 | @sangsatori | http://www.freecodecamp.com/sangsatori
h4r1m4u
@h4r1m4u
Oct 26 2015 19:27
lol. sweet, thanks @SangSatori
CamperBot
@camperbot
Oct 26 2015 19:27
h4r1m4u sends brownie points to @sangsatori :sparkles: :thumbsup: :sparkles:
:warning: h4r1m4u already gave sangsatori points
Rex Schrader
@SaintPeter
Oct 26 2015 19:27
@yfarkash Nope - they are functionally identical. If you look on the MDN site for the "polyfill" you will see that they have for loops inside
@yfarkash They just generally make code easier to read and (sometimes) to write
REENUMOHAN
@REENUMOHAN
Oct 26 2015 19:29
Hello World!
CamperBot
@camperbot
Oct 26 2015 19:29

welcome to FreeCodeCamp @REENUMOHAN!

Rex Schrader
@SaintPeter
Oct 26 2015 19:29
@yfarkash So, dig this:
var longest = wordList.reduce(function(prev, curr) {
    if(prev < curr.length) {
         return curr.length;
    }
    return prev;
}, 0);  // <-- The magic happens here
Yoav Farkash
@yfarkash
Oct 26 2015 19:31
@SaintPeter awesome, very elegant. I do find it hard to read this kind of code though. I lreaned coding first some 20 yeara ago, before this extensive use of object-oriented programming, and this nested-style of functions.
@SaintPeter it takes me a while to decipher what each function does, and then trace it (mentaly) to where the output goes to, etc.
Rex Schrader
@SaintPeter
Oct 26 2015 19:32
@yfarkash Oh, yeah, me too. Functional Programming has been my biggest challenge in FCC. Kinda blew my mind at first, but once I "got it", I went back and redid a bunch of Bonfires to cement it. Now I kinda speak it naturally.
@yfarkash They're really just "a loop by other means"
Michael Bomholt
@bomholtm
Oct 26 2015 19:32
guys
Rex Schrader
@SaintPeter
Oct 26 2015 19:32
@yfarkash I taught myself C/C++ back in the late 80s, early 90s
Michael Bomholt
@bomholtm
Oct 26 2015 19:33
does @camperbot is here?
Yoav Farkash
@yfarkash
Oct 26 2015 19:33
@SaintPeter so, for the .redcue function, you dont have to pass the index and array variables?
Rex Schrader
@SaintPeter
Oct 26 2015 19:33
@bomholt Camperbot seems to be broken in some rooms today
Michael Bomholt
@bomholtm
Oct 26 2015 19:33
:) yea in helpbonfires he does not respond
CamperBot
@camperbot
Oct 26 2015 19:33
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Rex Schrader
@SaintPeter
Oct 26 2015 19:33
@yfarkash Correct. Remember, it's a function DEFINITION. You don't have to use all of the variables that will be passed in.
Michael Bomholt
@bomholtm
Oct 26 2015 19:34
@camperbot hey come back to the other channels :heart: :P
Rex Schrader
@SaintPeter
Oct 26 2015 19:34
@bomholt I'm trying to ping the owner to see if he can kick the bot ;)
Michael Bomholt
@bomholtm
Oct 26 2015 19:35
@SaintPeter what would fcc be without you :)
Rex Schrader
@SaintPeter
Oct 26 2015 19:35
@bomholt :D
Richard Morgan
@Richard-Morgan-UK
Oct 26 2015 19:35
hey guys, I'm a total noob and need some help...
why won't my photo widht change?
Rex Schrader
@SaintPeter
Oct 26 2015 19:36
@Richard-Morgan-UK We're totaly noob helpers and we're here to help :)
@Richard-Morgan-UK Got some code to share?
Richard Morgan
@Richard-Morgan-UK
Oct 26 2015 19:36

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

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

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}
.smaller-image {
width: 100px;
}
</style>

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

<img src="https://bit.ly/fcc-relaxing-cat">

<img class="smaller-image">

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

Do I just copy and paste like that?
Michael Bomholt
@bomholtm
Oct 26 2015 19:36
help code
CamperBot
@camperbot
Oct 26 2015 19:36

:point_right: -----

undefined
:pencil: -----
Michael Bomholt
@bomholtm
Oct 26 2015 19:37
you can post code with
code
Richard Morgan
@Richard-Morgan-UK
Oct 26 2015 19:37
i dont understand
Arnis Jaundzeikars
@SangSatori
Oct 26 2015 19:37
Hmpf. Use ``` to start code section and the same 3-backtick sequence to close the section.
Agh.
Rex Schrader
@SaintPeter
Oct 26 2015 19:37
@Richard-Morgan-UK ok, the problem is that you need to apply the class to the EXISTING img element, not add a new img element
Arnis Jaundzeikars
@SangSatori
Oct 26 2015 19:37
``` at the start and end of code.
Michael Bomholt
@bomholtm
Oct 26 2015 19:38
@SangSatori like he said i messed it up
Rex Schrader
@SaintPeter
Oct 26 2015 19:38
@Richard-Morgan-UK
<img src="https://bit.ly/fcc-relaxing-cat">
<img class="smaller-image">   <!-- <-- Don't need this here, put it in the piror line -->
Jorge Rodriguez
@rodri0315
Oct 26 2015 19:38
quick question guys, BONFIREs are supposed to makes us look for answers or are we supposed to know this stuff ??
Rex Schrader
@SaintPeter
Oct 26 2015 19:38
@bomholt wiki format gets you what you want. In this case it's probably not worth the time to get him squared away
@rodri0315 You're supposed to look for answers.
@rodri0315 It's part of the process, to learn new tools and apply them
Michael Bomholt
@bomholtm
Oct 26 2015 19:39
@SaintPeter thanks =) as i said... what would fcc be without you
CamperBot
@camperbot
Oct 26 2015 19:39
bomholt sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 1215 | @saintpeter | http://www.freecodecamp.com/saintpeter