These are chat archives for FreeCodeCamp/Help

23rd
Nov 2015
RoadtoMastery
@RoadtoMastery
Nov 23 2015 00:00
feel free to post if you need help understanding the code. someone will help. i don't know everything or even close to
anthonygallina1
@anthonygallina1
Nov 23 2015 00:00
@jondcoleman changed that and still trowing same error But I feel like I am learning something here
Jonathan Coleman
@jondcoleman
Nov 23 2015 00:00
@anthonygallina1 still getting the module error?
Carson B
@Cdog55
Nov 23 2015 00:00

Font size is controlled by the font-size CSS property, like this:

h1 {

font-size: 30px;

}

Create a second p element with the following kitty ipsum text: Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.

Inside the same <style> tag that we created for your red-text class, set the font-size of all p elements to 16 pixels (16px).

Robert Richey
@0x0936
Nov 23 2015 00:00
@anthonygallina1 also need a local mongodb installed. global won't work
Jonathan Coleman
@jondcoleman
Nov 23 2015 00:01
@0x0936 oh good point. My bad on that @anthonygallina1
Carson B
@Cdog55
Nov 23 2015 00:01
do i put h1 {
font-size: 30px;
}
in the style
0x0936 @0x0936 I may be wrong on that part, as it relates to learnyoumongo. I've found on local apps using mongo, accessing from a script, it needed a local install
brian424
@brian424
Nov 23 2015 00:02
@Cdog55 like this
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

  p {
    font-size: 16px;
    font-family: Monospace;
  }
anthonygallina1
@anthonygallina1
Nov 23 2015 00:02
@0x0936 interesting is that just a general rule I need to accept Or do you know the reason please
Carson B
@Cdog55
Nov 23 2015 00:02
yes
never mind guys i think i got it
Jonathan Coleman
@jondcoleman
Nov 23 2015 00:04
@Cdog55 good job!
Carson B
@Cdog55
Nov 23 2015 00:05
you guys are so supportive
Robert Richey
@0x0936
Nov 23 2015 00:05
@anthonygallina1 can't really say. I'm a beginner in using mongo and my statement is anecdotal at best
Jonathan Coleman
@jondcoleman
Nov 23 2015 00:05
@Cdog55 we've all received help along the way
Carson B
@Cdog55
Nov 23 2015 00:06
bye
Eric
@takethefifth08
Nov 23 2015 00:07
Hey guys. For some reason I cant' figure out why my buttons aren't working to start/pause/reset my Pomodoro Clock. Can someone take a peek? http://codepen.io/ewunderlich/pen/KdbOJW?editors=101
Robert Richey
@0x0936
Nov 23 2015 00:07
I'll try to get through step 3 of learnyoumongo, but that will likely take until tomorrow, as I have other distractions atm
anthonygallina1
@anthonygallina1
Nov 23 2015 00:07
@0x0936 no just file that in my rule file Remote in the cloud mongo needs a local install to use global db connections. Probably saved me years of banging my head on the key board and thousands of searches waaaaay apreciated
Hans van Riet
@hansinla
Nov 23 2015 00:11
@takethefifth08 I don’t see a click function for the bottom buttons. Did you write all the code yourself?
anthonygallina1
@anthonygallina1
Nov 23 2015 00:13
thank you @0x0936
CamperBot
@camperbot
Nov 23 2015 00:13
anthonygallina1 sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
:warning: anthonygallina1 already gave 0x0936 points
Emily
@evmoore94
Nov 23 2015 00:14
hey guys im stuck again
im probably complicating something thats super simple but this is what im given
<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">


</div>
and im told to Nest two div class="col-xs-6" elements within your div class="row" element.
anthonygallina1
@anthonygallina1
Nov 23 2015 00:15
@jondcoleman must be something else still throwing error with this
Eric
@takethefifth08
Nov 23 2015 00:15
@hansinla I had some help from a buddy. I didn't realize I was missing that. Thanks!
CamperBot
@camperbot
Nov 23 2015 00:15
takethefifth08 sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 623 | @hansinla | http://www.freecodecamp.com/hansinla
Jonathan Coleman
@jondcoleman
Nov 23 2015 00:15
@anthonygallina1 what's the error now?
anthonygallina1
@anthonygallina1
Nov 23 2015 00:16
'''
var mongo = require('mongodb').MongoClient;
var url = 'mongodb://localhost:27017/learnyoumongo';
mongo.connect(url, function(err, db){
if (err) {
console.log(err);
} else {
var param = parseInt(process.argv[2]);
db.collection('parrots').find( { age: { $gt: param } } ).toArray(function(err, documents){
if (err) {
console.log(err);
} else {
//console.log(process.argv[2]);
console.log(documents);
db.close();
}
})
}
}) ''
CamperBot
@camperbot
Nov 23 2015 00:16
:bulb: to format code use backticks! ``` more info
Jonathan Coleman
@jondcoleman
Nov 23 2015 00:16
@evmoore94 what have you tried?
anthonygallina1
@anthonygallina1
Nov 23 2015 00:16
''' Error: Cannot find module 'mongodb'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/ubuntu/workspace/solution.js:1:75)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:475:10)'''
CamperBot
@camperbot
Nov 23 2015 00:16
:bulb: to format code use backticks! ``` more info
iccomq
@iccomq
Nov 23 2015 00:16
<div class='row'>
  <div class='col-xs-6'></div>
   <div class='col-xs-6'></div>
</div>
@evmoore94 i think you mean that?
Jonathan Coleman
@jondcoleman
Nov 23 2015 00:17
are you on c9 @anthonygallina1?
anthonygallina1
@anthonygallina1
Nov 23 2015 00:17
yes
Emily
@evmoore94
Nov 23 2015 00:17
ok i tried that but maybe i put the </div> in the wrong place
i added them all at the end
Jonathan Coleman
@jondcoleman
Nov 23 2015 00:17
can you share your workspace with me? PM me the link rather than posting here
there is a share button in top right hand corner @anthonygallina1
Emily
@evmoore94
Nov 23 2015 00:17
instead of at the end of each line
thanks @iccomq
CamperBot
@camperbot
Nov 23 2015 00:19
evmoore94 sends brownie points to @iccomq :sparkles: :thumbsup: :sparkles:
:star: 52 | @iccomq | http://www.freecodecamp.com/iccomq
iccomq
@iccomq
Nov 23 2015 00:19
your welcome :)
Hans van Riet
@hansinla
Nov 23 2015 00:20
@takethefifth08 should have the form of
$('#start').click(function(){
  run();
});
iccomq
@iccomq
Nov 23 2015 00:21
so guys can someone help with seek and destroy bonfire? what am i missing in here, becouse well it does not work :D
function destroyer(arr) {
   var dest = Array.prototype.slice.call(arguments);
   var rest = dest.slice(1,arguments.length);
   var toDe = dest[0];

   for (var i = 0; i < rest.length; i++) {
           toDe.filter(function(a){
           if (a === rest[i]){
               return false;
           } else{
               return true;
           }
       });

   }

}
CamperBot
@camperbot
Nov 23 2015 00:21
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Hans van Riet
@hansinla
Nov 23 2015 00:23
bonfire destroyer
CamperBot
@camperbot
Nov 23 2015 00:23
Sorry, can't find a bonfire called destroyer. [ Check the map? ]
Hans van Riet
@hansinla
Nov 23 2015 00:23
bonfire seek and destroy
CamperBot
@camperbot
Nov 23 2015 00:23

:fire:Bonfire: Seek and Destroy :link:

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

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

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

more info:  bf details | bf links | hint

m-farooqui
@m-farooqui
Nov 23 2015 00:24
i am in waypoint 165 "Iterate over Arrays with map"
here is my code

var oldArray = [1,2,3,4,5];

// Only change code below this line.

var newArray = oldArray;
var addThree=oldArray.map(function(val){
return val+'3';
});

// Only change code above this line.

(function() {return newArray;})();

i am having a hard time to the numberto each value in the array
Marc Fogleman
@MFogleman
Nov 23 2015 00:25
@m-farooqui should your clothes parent be on your map.function line?
m-farooqui
@m-farooqui
Nov 23 2015 00:25
how can i change the code
Marc Fogleman
@MFogleman
Nov 23 2015 00:26
Im not sure on that btw, just guessing
Carson B
@Cdog55
Nov 23 2015 00:26
i need help
Marc Fogleman
@MFogleman
Nov 23 2015 00:26
wait nm, i misread that
Carson B
@Cdog55
Nov 23 2015 00:26
:worried:
Hans van Riet
@hansinla
Nov 23 2015 00:26
@iccomq You’re not returning anything from the destriyer function, so your code will always fail the tests. The return inside your filter function helps just that function. You need to retun an array with the correct elements.
m-farooqui
@m-farooqui
Nov 23 2015 00:26
no @CangosGit that didn't work
Carson B
@Cdog55
Nov 23 2015 00:27
help pls
CamperBot
@camperbot
Nov 23 2015 00:27
no wiki entry for: pls
:pencil: click here to create one now!after creating your page type update to reload it here
Carson B
@Cdog55
Nov 23 2015 00:27
help please
CamperBot
@camperbot
Nov 23 2015 00:27

:point_right: bonfire no repeats please [wiki]

Problem Explanation:

  • This task requires us to look at each possible permutation of a string. This is best done using a recursion function. Being able to build a function which collects all permutations of a string is a common interview question, so there is no shortage of tutorials out there on how to do this, in many different code languages.
  • This task can still be daunting even after watching a tutorial. You will want to send each new use of the function 3 inputs: 1. a new string (or character array) that is being built, 2. a position in your new string that's going to be filled next, and 3. an idea of what characters (more specifically positions) from the original string have yet to be used. The pseudo code will look something like this:

    ```
    var str = ???;
    perm(current position in original string, what's been used in original string, current string build thus far){
    if(current string is finished) {
    print current string;
    }else{
    for(var i = 0; i < str.length; i++) {

    if(str[i] has not been used) {
      put str[i] into the current position;
      mark str[i] as used
      perm(current position in original string, what's been used in original string, current string build thus far)
      unmark str[i] as used because another branch in the tree for i + 1 will still likely use it;
    }

    }
    }
    }
    :pencil: read more about bonfire no repeats please on the FCC Wiki

Hans van Riet
@hansinla
Nov 23 2015 00:27
@m-farooqui Your answer needs to be in newArray not in an var called addThree
Carson B
@Cdog55
Nov 23 2015 00:28
<style>
  .red-text {
    color: red;
  }
</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>purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
m-farooqui
@m-farooqui
Nov 23 2015 00:28
@hansinla thank you
CamperBot
@camperbot
Nov 23 2015 00:28
m-farooqui sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 624 | @hansinla | http://www.freecodecamp.com/hansinla
Marc Fogleman
@MFogleman
Nov 23 2015 00:29
@m-faroqui You made newArray = oldArray. Then you made addThree. Then you asked it to return NewArray
RoadtoMastery
@RoadtoMastery
Nov 23 2015 00:29
@Cdog55 which waypoint is that?
Carson B
@Cdog55
Nov 23 2015 00:30
how do i change font size
Waypoint: Change the Font Size of an Element
RoadtoMastery
@RoadtoMastery
Nov 23 2015 00:30
didn't you figure that one out?
Carson B
@Cdog55
Nov 23 2015 00:30
yeah
no
no
Marc Fogleman
@MFogleman
Nov 23 2015 00:31
cdog .red-text is a class, the lines in the {} is where you are telling the program what that class means
Carson B
@Cdog55
Nov 23 2015 00:31
sorry i didn't figure it out
Marc Fogleman
@MFogleman
Nov 23 2015 00:31
when you type class="red-text" on an element, you are calling it to apply that descriptions from that class to that element
RoadtoMastery
@RoadtoMastery
Nov 23 2015 00:32
^ that
Carson B
@Cdog55
Nov 23 2015 00:32
I need to change font size
Marc Fogleman
@MFogleman
Nov 23 2015 00:32
yes
Do you want to change the font size of your entire class, or just that one element?
Carson B
@Cdog55
Nov 23 2015 00:33
i dont know
Marc Fogleman
@MFogleman
Nov 23 2015 00:33
is ALL your red-text going to be a new font size, or just one of your pieces of text ( you have 2, the cat photo app, and, and the block of text below it)
Carson B
@Cdog55
Nov 23 2015 00:33
All red
Marc Fogleman
@MFogleman
Nov 23 2015 00:34
Okay, so you want all your red text to be a new font size
Carson B
@Cdog55
Nov 23 2015 00:34
yes
Marc Fogleman
@MFogleman
Nov 23 2015 00:35
you understand that .red-text is your class right, and everything in the {} after .red-text is what that class does
so where do you need to tell it what you want the font size to be
Carson B
@Cdog55
Nov 23 2015 00:35
16px
Marc Fogleman
@MFogleman
Nov 23 2015 00:35
ok, thats the size you want
but you need to figure out where to tell it that
Carson B
@Cdog55
Nov 23 2015 00:35
yes
Marc Fogleman
@MFogleman
Nov 23 2015 00:36
if you wanted to change all of your red text to blue, what would change
Carson B
@Cdog55
Nov 23 2015 00:36
the style
Marc Fogleman
@MFogleman
Nov 23 2015 00:36
yes
you could make a new class, or you can edit a class you have
each class can have multiple options
Carson B
@Cdog55
Nov 23 2015 00:37
how
Marc Fogleman
@MFogleman
Nov 23 2015 00:37
just add a new line below color, and make sure the } stays below it
Ian Walker
@tonesfrommars
Nov 23 2015 00:37
maybe beter to call them properties
Carson B
@Cdog55
Nov 23 2015 00:37
ok
Marc Fogleman
@MFogleman
Nov 23 2015 00:37
if you wanted to change all of your red text to a Monospace font, you would just add the line font-family: Monospace
Ian Walker
@tonesfrommars
Nov 23 2015 00:38
and don't forget the semicolon at the end ;-)
Carson B
@Cdog55
Nov 23 2015 00:38
what is that
Ian Walker
@tonesfrommars
Nov 23 2015 00:38
;
Carson B
@Cdog55
Nov 23 2015 00:39
@CangosGit what is that
Marc Fogleman
@MFogleman
Nov 23 2015 00:39
it was an example
all you need to do is add one line below your line that says color: red;
Carson B
@Cdog55
Nov 23 2015 00:40
@CangosGit i havent learnd that
Marc Fogleman
@MFogleman
Nov 23 2015 00:40
but it has to be above the }
Carson B
@Cdog55
Nov 23 2015 00:40
thanks :smile:
Marc Fogleman
@MFogleman
Nov 23 2015 00:40
Cdog, play around with it, give it a shot, dont be afraid to make a mistake or be wrong. Its going to happen alot
Carson B
@Cdog55
Nov 23 2015 00:41
Your awesome :smile:
Marc Fogleman
@MFogleman
Nov 23 2015 00:41
Googling the answer isnt cheating as long as you can figure out why it works. Copy and pasting lines of code not knowing what they do is bad. Reading examples of other peoples code to figure out what you did wrong, and why it was wrong, is good.
Carson B
@Cdog55
Nov 23 2015 00:43
I got it!!!!!!!!!!!!!!!!!!!! :smile:
RoadtoMastery
@RoadtoMastery
Nov 23 2015 00:45
yay :smile: :clap: :clap:
Marc Fogleman
@MFogleman
Nov 23 2015 00:50
The phone-screen on the right that shows the compiled code is displaying everything twice, on all exercises. Is there something messed up in my settings, or is this just a bug in FCC?
iccomq
@iccomq
Nov 23 2015 00:51
guys im so stuck at seek and destroy bonfire i think im hallucinating, can someone walk me through this code and tell me why it doesnt work and how to make it all good and shiny? and why the hell does it tell me to not do functions within loops?
function destroyer(arr) {
    var dest = Array.prototype.slice.call(arguments);
    var rest = dest.slice(1,arguments.length);
    var toDe = dest[0];
    var ok = []; 

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

            toDe.filter(function(a){
            if (a = rest[i]){
                return false;
            } else{
                ok.push(a);
                                return true;
            }
        });

    }
    return ok;
    }
RoadtoMastery
@RoadtoMastery
Nov 23 2015 00:52
@CangosGit what do you mean? try refreshing the page. that usually works
Marc Fogleman
@MFogleman
Nov 23 2015 00:56
@iccomq im still new to js, ive done some python. on your toDe.filter line
You do not have an equal number of open and clothes parenthesis
is that entire loop a function arguement?
Hans van Riet
@hansinla
Nov 23 2015 00:57
This message was deleted
iccomq
@iccomq
Nov 23 2015 00:58
i just checked, parethesis seem ok, are you sure?
Marc Fogleman
@MFogleman
Nov 23 2015 00:58
no
Anthony Guru
@mrguru2016
Nov 23 2015 00:58

Im stuck here with adding Font change <p></p> {

font-size: 16px;

}

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




</style>

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

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

<p> Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

Marc Fogleman
@MFogleman
Nov 23 2015 00:58
just throwing it out there
Rory Smith
@alanbuchanan
Nov 23 2015 01:00
@mrguru2016 surely that font-size selector should be in your style tags?
Anthony Guru
@mrguru2016
Nov 23 2015 01:00
Am i placing the Font script in the Header or the In between the Style to call it? looking for understanding of proper call actions
Hans van Riet
@hansinla
Nov 23 2015 01:00
@iccomq What are you’re trying to accomplish with your for loop?
Anthony Guru
@mrguru2016
Nov 23 2015 01:00
I figured and placed it there incorrect error still
Rory Smith
@alanbuchanan
Nov 23 2015 01:00
@mrguru2016 well it's not attached to an element
Patrick San Juan
@pdotsani
Nov 23 2015 01:01
@mrguru2016 it seems like ‘’’font-size’’’ is not attached to an element
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:01
This message was deleted
Patrick San Juan
@pdotsani
Nov 23 2015 01:01
you might want to do something like this:
```
h2 {
  font-size: 16px;
}
iccomq
@iccomq
Nov 23 2015 01:02
for loop is for iterating through elements in an array 'rest', each of the element is supposed to go as an argument into the filter method which should filter out every occurance of that element in a given array 'toDe' @hansinla
Patrick San Juan
@pdotsani
Nov 23 2015 01:03
@mrguru2016 put that code, or something simmilar in-between your style tags.
brian424
@brian424
Nov 23 2015 01:03

please help me, new task ask me to "Replace the value of your a element's href attribute with a #", also known as a hash symbol, to turn it into a dead link.

<p>Click here for <a href="http://www.freecatphotoapp.com">cat photos</a>.</p>

i tried, but failed, what' the purpose then, i don't get it

Anthony Guru
@mrguru2016
Nov 23 2015 01:03
WhatI placed that inside Style tag already as far as the element it should be attached to that's the part of the script im stuck at
Rory Smith
@alanbuchanan
Nov 23 2015 01:04
@brian424 it just wants you to swap 'http://www.freecatphotoapp.com' for '#'
Hans van Riet
@hansinla
Nov 23 2015 01:04
This message was deleted
Anthony Guru
@mrguru2016
Nov 23 2015 01:05
What am I missing to attach it to the element?
Hans van Riet
@hansinla
Nov 23 2015 01:05
@iccomq Let’s start at the top. We can replace var rest = dest.slice(1,arguments.length); with var rest = dest.slice(1); and now rest is an array with vars that we don’t want to appear in the final array. With me so far?
Rory Smith
@alanbuchanan
Nov 23 2015 01:05
@brian424 see here for a good explanation to its purpose
brian424
@brian424
Nov 23 2015 01:05
@alanbuchanan i tried to delet href and replace with# but no result, they don't let me pass
Patrick San Juan
@pdotsani
Nov 23 2015 01:05
@mrguru2016 which element are you trying to attach it to?
Anthony Guru
@mrguru2016
Nov 23 2015 01:06
To ALL <p> elements
Rory Smith
@alanbuchanan
Nov 23 2015 01:06
@brian424 don't delete href. that's the important part. you want to replace the value of href
iccomq
@iccomq
Nov 23 2015 01:06
@hansinla i think so,
Patrick San Juan
@pdotsani
Nov 23 2015 01:06
then your code should look like this:
Chris
@Aoxom
Nov 23 2015 01:06
p{
font-size: 16px;
}
@mrguru2016 it should be in this format, and this should all be between the <style> tags
Patrick San Juan
@pdotsani
Nov 23 2015 01:07
p {
 font-size:16px;
}
Anthony Guru
@mrguru2016
Nov 23 2015 01:07
@Aoxom @pdotsani Thanks a ton
CamperBot
@camperbot
Nov 23 2015 01:07
mrguru2016 sends brownie points to @aoxom and @pdotsani :sparkles: :thumbsup: :sparkles:
:star: 118 | @pdotsani | http://www.freecodecamp.com/pdotsani
:star: 244 | @aoxom | http://www.freecodecamp.com/aoxom
brian424
@brian424
Nov 23 2015 01:07
@alanbuchanan if i don't delet how do i replace it
Carson B
@Cdog55
Nov 23 2015 01:07
I need help again
Anthony Guru
@mrguru2016
Nov 23 2015 01:07
Simple mistake one must remember
Chris
@Aoxom
Nov 23 2015 01:07
@mrguru2016 yeah, just need to get used to the basic syntax of css vs html. pretty easy once you do it a few times
Rory Smith
@alanbuchanan
Nov 23 2015 01:07
@brian424 change the text after href
Hans van Riet
@hansinla
Nov 23 2015 01:08
@iccomq Delete this line var toDe = dest[0]; you don’t need that. and let’s give var ok = []; this array a more explanatory name for example var answer = [];
Carson B
@Cdog55
Nov 23 2015 01:08
<style>
  .red-text {
    color: red;
  }
  h2 {
    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>
Anthony Guru
@mrguru2016
Nov 23 2015 01:08
Def will look for more activities to drill it in
Marc Fogleman
@MFogleman
Nov 23 2015 01:08
Whats the prob @Cdog55
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:08
in need of help. Waypoint: Generate Random Fractions with Javascript
iccomq
@iccomq
Nov 23 2015 01:08
@hansinla still with you
brian424
@brian424
Nov 23 2015 01:08
@alanbuchanan how? could you show me? i don't understand
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:09
@KingEarlieDee what do you have so far?
Carson B
@Cdog55
Nov 23 2015 01:09
how do i import lobster font
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:09

Random numbers are useful for creating random behavior.

JavaScript has a Math.random() function that generates a random decimal number.

Change myFunction to return a random number instead of returning 0.

Note that you can return a function, just like you would return a variable or value.

Marc Fogleman
@MFogleman
Nov 23 2015 01:09
look at the left side
it should tell you
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:09

function myFunction() {

// Only change code below this line.

return 0;

// Only change code above this line.
}

(function(){return myFunction();})();

Marc Fogleman
@MFogleman
Nov 23 2015 01:09
lobster font isnt built into HTML5/CSS , you gotta get it from google. Just copy and paste the code
Hans van Riet
@hansinla
Nov 23 2015 01:09
@iccomq Now we’re going to filter dest[0] like this
dest[0].filter(function(){
// something here
});
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:10

@RoadtoMastery function myFunction() {

// Only change code below this line.

return 0;

// Only change code above this line.
}

(function(){return myFunction();})();

Carson B
@Cdog55
Nov 23 2015 01:10

this is what it says Now, let's import and apply a Google font (note that if Google is blocked in your country, you will need to skip this challenge).

First, you'll need to make a call to Google to grab the Lobster font and load it into your HTML.

Copy the following code snippet and paste it into the top of your code editor:

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

Now you can set Lobster as a font-family value on your h2 element.

Apply the font-family of Lobster to your h2 element.

Robert Richey
@0x0936
Nov 23 2015 01:10
@KingEarlieDee change return 0; to returning a random number
Rory Smith
@alanbuchanan
Nov 23 2015 01:10
@brian424
<a href="linkgoeshere">
in this case you would just change the bit that says 'linkgoeshere' for #
Marc Fogleman
@MFogleman
Nov 23 2015 01:10
Cdog, you just posted the answer
copy and paste that code snippet into the top of the editor
Peter W Ross
@PeterWRoss
Nov 23 2015 01:10
var firstNameLength = 0;
var lastNameLength = 0;
var firstName = "Ada";

firstNameLength = firstName.length;

var lastName = "Lovelace";

// Only change code below this line.

lastNameLength = lastName;



// Only change code above this line.

if(typeof(lastNameLength) !== "undefined"){(function(){return lastNameLength;})();}
Carson B
@Cdog55
Nov 23 2015 01:10
what is that
Peter W Ross
@PeterWRoss
Nov 23 2015 01:10

Data structures have properties. For example, strings have a property called .length that will tell you how many characters are in the string.

For example, if we created a variable var firstName = "Charles", we could find out how long the string "Charles" is by using the firstName.length property.

Use the .length property to count the number of characters in the lastName variable.

Marc Fogleman
@MFogleman
Nov 23 2015 01:11
the editor is the thing you type in
Peter W Ross
@PeterWRoss
Nov 23 2015 01:11
anyone?/ im sure its SUPER simple
Fredy-Aguilar
@Fredy-Aguilar
Nov 23 2015 01:11
@mrguru2016 Can you show me what you have written? I too am stuck with this. p {
font-size:16px;
}
Marc Fogleman
@MFogleman
Nov 23 2015 01:11
do you know what copy and paste is?
Carson B
@Cdog55
Nov 23 2015 01:11
yes
iccomq
@iccomq
Nov 23 2015 01:11
@hansinla so we arent using any loop right?
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:11
@0x0936 its says you should be using Math.random to generate the random decimal number
brian424
@brian424
Nov 23 2015 01:11
@alanbuchanan so if i add# what will it look like?
Marc Fogleman
@MFogleman
Nov 23 2015 01:11
copy and paste the line it says to copy and paste into the top of your code
Rory Smith
@alanbuchanan
Nov 23 2015 01:12
@brian424 <a href="#">
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:12
@PeterWRoss that one is very simple actually. reread the instructions on left and do exactly as it says
Carson B
@Cdog55
Nov 23 2015 01:12

were Now, let's import and apply a Google font (note that if Google is blocked in your country, you will need to skip this challenge).

First, you'll need to make a call to Google to grab the Lobster font and load it into your HTML.

Copy the following code snippet and paste it into the top of your code editor:

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

Now you can set Lobster as a font-family value on your h2 element.

Apply the font-family of Lobster to your h2 element.

Rory Smith
@alanbuchanan
Nov 23 2015 01:12
@brian424 i'll refer you again to this helpful thread
Robert Richey
@0x0936
Nov 23 2015 01:12
@KingEarlieDee yes, that's right. return the result of calling Math.random() instead of return 0. I'm trying to avoid giving a copy paste answer
Marc Fogleman
@MFogleman
Nov 23 2015 01:12

Copy the following code snippet and paste it into the top of your code editor:

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

Carson B
@Cdog55
Nov 23 2015 01:13
like this
Anthony Guru
@mrguru2016
Nov 23 2015 01:13
Thanks to all here helping making this a ongoing easier process Code God knows if you guys wee not around id lose every nerve almost lol Thanks a ton
Carson B
@Cdog55
Nov 23 2015 01:14
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }
  h2 {
    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>
Marc Fogleman
@MFogleman
Nov 23 2015 01:14
Exactly
Carson B
@Cdog55
Nov 23 2015 01:14
thanks
:smile:
Marc Fogleman
@MFogleman
Nov 23 2015 01:14
@Cdog55 what that did is make the program get the all the info on that font from google, so it can use it on your app
Carson B
@Cdog55
Nov 23 2015 01:14
:+1:
Hans van Riet
@hansinla
Nov 23 2015 01:15

@iccomq No loop. Let now dessign what we’re going to filter we had

dest[0].filter(function(){
// something here
});

let's expand on that you used e as filter argument. We want to filter all elements that are in your var rest, so we keep everything that’s not in rest

dest[0].filter(function(e){
return (rest.indexOf(e) == -1);
});
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:15
@0x0936 thanks i figured it out i feel a little slow
CamperBot
@camperbot
Nov 23 2015 01:15
kingearliedee sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
Carson B
@Cdog55
Nov 23 2015 01:15
i got it
CamperBot
@camperbot
Nov 23 2015 01:15
:star: 381 | @0x0936 | http://www.freecodecamp.com/0x0936
brian424
@brian424
Nov 23 2015 01:15
@alanbuchanan thx every time i am in trouble you always give me a hand. i am speechless for the task though. that's what they meant
CamperBot
@camperbot
Nov 23 2015 01:15
brian424 sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 513 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
Robert Richey
@0x0936
Nov 23 2015 01:15
@KingEarlieDee great job! we all have humble beginnings. don't feel bad at all
Rory Smith
@alanbuchanan
Nov 23 2015 01:16
@brian424 it's no problem. did you get the answer then?
brian424
@brian424
Nov 23 2015 01:16
@alanbuchanan i passed
Rory Smith
@alanbuchanan
Nov 23 2015 01:16
good
:thumbsup:
brian424
@brian424
Nov 23 2015 01:16
@alanbuchanan ya because of your help
LizzieLaShark
@LizzieLaShark
Nov 23 2015 01:17
hello. does anyone know much about the .length property? I've only just begun and a little stuck on this waypoint
Hans van Riet
@hansinla
Nov 23 2015 01:17
@iccomq finally you have to make sure you return the result of this filter operation out of your destroyer function by prepending return
return dest[0].filter(function(e){
return (rest.indexOf(e) == -1);
});
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:17
@0x0936 so i be feeling like sometimes i don't understand how these tutorials help
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:17
@LizzieLaShark hi. feel free to post where you are stuck.
someone will help you
LizzieLaShark
@LizzieLaShark
Nov 23 2015 01:19
thanks. Just trying to figure out what code will give me how many characters are in the lastName string here.

var firstNameLength = 0;
var lastNameLength = 0;
var firstName = "Ada";

firstNameLength = firstName.length;

var lastName = "Lovelace";

// Only change code below this line.

lastNameLength = lastName;
lastName.length;

Mine doesnt seem to be working at all :/
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:19
@LizzieLaShark that one requires adding .length. just that easy really :)
Chris
@Aoxom
Nov 23 2015 01:19
@LizzieLaShark use "firstNameLength = firstName.length;" as your example
Robert Richey
@0x0936
Nov 23 2015 01:19
@KingEarlieDee they help to get you familiar with syntax, problem solving, and you're doing the right thing by asking for help when you need it. Eventually, you'll be comfortable with using Google (or your favorite search engine) to ask questions and read answers from all over the internet, including language documentation
Hans van Riet
@hansinla
Nov 23 2015 01:20
@iccomq Still there?
iccomq
@iccomq
Nov 23 2015 01:20
@hansinla yes
LizzieLaShark
@LizzieLaShark
Nov 23 2015 01:20
oh, that was easy! Thank you so much @Aoxom :D
CamperBot
@camperbot
Nov 23 2015 01:20
lizzielashark sends brownie points to @aoxom :sparkles: :thumbsup: :sparkles:
Robert Richey
@0x0936
Nov 23 2015 01:20
@KingEarlieDee it really starts clicking when you want to create something for yourself and you're forced to piece together the parts on your own.
CamperBot
@camperbot
Nov 23 2015 01:20
:star: 245 | @aoxom | http://www.freecodecamp.com/aoxom
iccomq
@iccomq
Nov 23 2015 01:21
so far we have
    function destroyer(arr) {
    var dest = Array.prototype.slice.call(arguments);
    var rest = dest.slice(1);
    var answer = []; 

    dest[0].filter(function(e){
    return (rest.indexOf(e) == -1);
    });

    return answer;
    }
Chris
@Aoxom
Nov 23 2015 01:21
@LizzieLaShark yup. always easy after you figure it out, lol. :)
Hans van Riet
@hansinla
Nov 23 2015 01:21
@iccomq What do you think, all clear?
iccomq
@iccomq
Nov 23 2015 01:21
well it does not work so far
Hans van Riet
@hansinla
Nov 23 2015 01:22
This message was deleted
iccomq
@iccomq
Nov 23 2015 01:23
    function destroyer(arr) {
    var dest = Array.prototype.slice.call(arguments);
    var rest = dest.slice(1);


    var answer = dest[0].filter(function(e){
    return (rest.indexOf(e) == -1);
    });

    return answer;
    }
just noticed that
works wonders, just one more question
Hans van Riet
@hansinla
Nov 23 2015 01:23
@iccomq sure
Ian Walker
@tonesfrommars
Nov 23 2015 01:24
Hey all: just completed "BBonfire: Factorialize a Number". I had to go find out why 0! == 1, and learned that it's something of a convention (similar to why x^0 == 1). So in my solution, I just ran a check against my array of numbers and if ( array.length > 0 ) proceed, otherwise return 1. While the challenge was accepted, I wondered if there might be a more elegant solution.
DJ
@qualitymanifest
Nov 23 2015 01:25
@tonesfrommars post your code
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:25
@0x0936 whats wrong with this code if The result of myFunction should be a whole number.
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:25
@KingEarlieDee post your code.
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:25

@0x0936 return Math.random();

Math.floor(Math.random() * 10);

Ian Walker
@tonesfrommars
Nov 23 2015 01:26
```
Robert Richey
@0x0936
Nov 23 2015 01:26
@KingEarlieDee nothing wrong with what you posted. post all your code
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:26
@RoadtoMastery
iccomq
@iccomq
Nov 23 2015 01:26
about dest.slice(1) which targets what is supposed to be removed from first array. It seems for me it should target only first element after first element. How is it able to select lets say 2 or 3 numbers. No iteration, through that elements, no calling with different arguments... @hansinla
CamperBot
@camperbot
Nov 23 2015 01:26
:star: 624 | @hansinla | http://www.freecodecamp.com/hansinla
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:27
This message was deleted
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:27

var randomNumberBetween0and19 = Math.floor(Math.random() * 20);

function myFunction() {

// Only change code below this line.

return Math.random();

Math.floor(Math.random() * 20);
// Only change code above this line.
}

Robert Richey
@0x0936
Nov 23 2015 01:28
@KingEarlieDee the function exits after evaluating a return statement, so Math.floor(Math.random() * 20) never executes
iccomq
@iccomq
Nov 23 2015 01:28
oh boy i think i know, theres no second argument in slice, iit just slices all after first one @hansinla
Hans van Riet
@hansinla
Nov 23 2015 01:28
@iccomq because inside the filter function you look at each element e of the dest array dest and see if that element is absent in the rest of the arguments with indexOf. If indexOf returns -1 you know if can’t be found, so we should return true to the filter to keep it.
Ian Walker
@tonesfrommars
Nov 23 2015 01:28

@qualitymanifest `function factorialize(num) {
array = [];
for (var i = 0; i < num; i++) {
array[i] = i+1;
}
console.log(array);

if (array.length > 0) return array.reduce(function(previousVal, currentVal){
return previousVal * currentVal;
});
else return 1;
}

factorialize(0);`

RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:29
@tonesfrommars hi. nice solution there. you can also use recursion using a for loop
Robert Richey
@0x0936
Nov 23 2015 01:29
@KingEarlieDee and I think the challenge wants you to return a whole number from 0 - 9. So, that would be Math.floor(Math.random() * 10);
Carson B
@Cdog55
Nov 23 2015 01:29
how do i make an image smaller
<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;
  }
</style>

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

<img 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>
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:30
@0x0936 I have that but it says the result of myFunction should be a whole number
Ian Walker
@tonesfrommars
Nov 23 2015 01:30
Oooh @KingEarlieDee , I'll try that now. Will it handle the 0! == 1 quandry? (I guess I'll find out in a minute)
Robert Richey
@0x0936
Nov 23 2015 01:31
@KingEarlieDee right. in the code you posted, your function is returning Math.random() which is not a whole number
Ian Walker
@tonesfrommars
Nov 23 2015 01:32
Ah! It just occurred to me to use the initialValue argument of reduce()
iccomq
@iccomq
Nov 23 2015 01:32
@hansinla i got how the filter and indexOf worked, what confused me was that , it seemed for me that at the begining we sliced out just one element, but slice method actually sliced all after first one(no second argument in there). I guess i confused myself. However i really appreciate help.
thanks @hansinla
CamperBot
@camperbot
Nov 23 2015 01:32
iccomq sends brownie points to @hansinla and @hansinla :sparkles: :thumbsup: :sparkles:
:star: 625 | @hansinla | http://www.freecodecamp.com/hansinla
:star: 625 | @hansinla | http://www.freecodecamp.com/hansinla
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:32
@0x0936 how do you make it a whole number
Carson B
@Cdog55
Nov 23 2015 01:32
@iccomq how do i make an image smaller
Hans van Riet
@hansinla
Nov 23 2015 01:32
@iccomq no problem
DJ
@qualitymanifest
Nov 23 2015 01:32
@tonesfrommars that's one i haven't seen before. the most typical way i've seen is to initialize a total variable at 1, then loop over num and do total *= iterator;
and in the case of 0, just return 1
Robert Richey
@0x0936
Nov 23 2015 01:33
@KingEarlieDee instead of return Math.random(); it should be return Math.floor(Math.random() * 10);
iccomq
@iccomq
Nov 23 2015 01:33
@Cdog55 you can set width and height parameters in your style tags to make it how big or small you want.
Ian Walker
@tonesfrommars
Nov 23 2015 01:33
check this out @qualitymanifest
function factorialize(num) {
  array = [];
  for (var i = 0; i < num; i++) {
    array[i] = i+1;
  }

  return array.reduce(function(previousVal, currentVal){
    return previousVal * currentVal;
  }, 1);
}

factorialize(0);
Daniel Bledsoe
@danielbledsoe
Nov 23 2015 01:34
I'm new, is it just me or does anyone else find themselves reading the coding instructions and scratching their heads saying wtf?
DJ
@qualitymanifest
Nov 23 2015 01:34
@tonesfrommars nice
Carson B
@Cdog55
Nov 23 2015 01:34
<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;
  }
</style>

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

<img 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>
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:34
@0x0936 thanks. I did that but dont understand why it worked
CamperBot
@camperbot
Nov 23 2015 01:34
kingearliedee sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
:warning: kingearliedee already gave 0x0936 points
iccomq
@iccomq
Nov 23 2015 01:34
@danielbledsoe im hallucinating already after trying to solve one problem... so no its not just you :)
Ian Walker
@tonesfrommars
Nov 23 2015 01:35
thanks @qualitymanifest
CamperBot
@camperbot
Nov 23 2015 01:35
tonesfrommars sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 409 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
Carson B
@Cdog55
Nov 23 2015 01:35
@iccomq how
DJ
@qualitymanifest
Nov 23 2015 01:35
@Cdog55
img {
  width and height here
}
Daniel Bledsoe
@danielbledsoe
Nov 23 2015 01:35
@iccomq Oh good, I'm glad I'm not the only one.
Carson B
@Cdog55
Nov 23 2015 01:36
ok
Robert Richey
@0x0936
Nov 23 2015 01:36
@KingEarlieDee Math.random() gives you a number from 0 - 0.999~, so if we multiply this by 10, our random number will be from 0 - 9.999~. Then, calling Math.floor() with this result will round down to the nearest whole number, resulting in a number from 0 - 9
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:36
@danielbledsoe they can be confusing sometimes. you are not alone :smile:
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:36
ok cool when would you use that
@0x0936 ok cool when would you use that
Robert Richey
@0x0936
Nov 23 2015 01:37
@KingEarlieDee I don't understand the question
like, when is that practical?
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:37
@0x0936 yes
Robert Richey
@0x0936
Nov 23 2015 01:38
@KingEarlieDee to get a random index to an element in an array.
Earlie Dee
@KingEarlieDee
Nov 23 2015 01:38
ok cool @0x0936
Robert Richey
@0x0936
Nov 23 2015 01:39
var arr = ['apple', 'bacon', 'cheese'];

var randomIndex = Math.floor(Math.random() * 3);

var whatsForDinner = arr[randomIndex];
iccomq
@iccomq
Nov 23 2015 01:39
yey we are randomizing food
mmm apple wrapped in bacon with cheese, deep fried and stuff
Robert Richey
@0x0936
Nov 23 2015 01:39
:)
or a random color is not uncommon. rgb values range from 0 - 255. Any time you see an animation with random colors, Math.floor(Math.random() * 256) is being called
Peter W Ross
@PeterWRoss
Nov 23 2015 01:42
```
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:42
This message was deleted
@0x0936 interesting
Atiya
@Atiya
Nov 23 2015 01:43
Hey, how can I change the background color of a form element but don't give the form any class or style attributes?
Hans van Riet
@hansinla
Nov 23 2015 01:43
@Atiya wrap it in a div with an id
Atiya
@Atiya
Nov 23 2015 01:44
I tried that in it said it was incorrect
Robert Richey
@0x0936
Nov 23 2015 01:44
@Atiya what problem are you working on
Atiya
@Atiya
Nov 23 2015 01:45
the div I used showed up with a green background like I was looking for but it still said my form element background color neede to be changed
39
I had wrapped the form in a div
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:46
@Atiya this one?
Waypoint: Use an ID Attribute to Style an Element
Atiya
@Atiya
Nov 23 2015 01:47
Yep
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:47
@Atiya post your code using wiki format and someone will help
Atiya
@Atiya
Nov 23 2015 01:47
thanks
apekearo
@apekearo
Nov 23 2015 01:47

hey yall, I'm having trouble making my image smaller to a 100 px i put the .smaller-image in the style brackets.. <style>
.red-text {
color: red;
}
.smaller-image {
width: 100px;
}
</style>

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

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

Peter W Ross
@PeterWRoss
Nov 23 2015 01:47
var firstNameLength = 0;
var lastNameLength = 8;
var firstName = "Ada";

firstNameLength = firstName.length;

var lastName = "Lovelace";

// Only change code below this line.

lastNameLength = 8;



// Only change code above this line.
iccomq
@iccomq
Nov 23 2015 01:47
@Atiya you should
<style>
#cat-photo-form {
background-color: coloryouwant;
}
</style>
Peter W Ross
@PeterWRoss
Nov 23 2015 01:47
Use the .length property to count the number of characters in the lastName variable.
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:47
proving the number of the waypoint does not really help pass a certain point.
Peter W Ross
@PeterWRoss
Nov 23 2015 01:47
still struggling @RoadtoMastery
iccomq
@iccomq
Nov 23 2015 01:48
@Atiya you should target an element by its id which is specified in its tag and style it how you are told in exercise
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:48
@PeterWRoss follow the example and add. length to the second one. really. it's that easy. they just what you to see how .length works to give you the length of a variable
Peter W Ross
@PeterWRoss
Nov 23 2015 01:48
i did that!
lol
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:49
@PeterWRoss this is the example: firstNameLength = firstName.length. now make the second one look like it :smile:
Atiya
@Atiya
Nov 23 2015 01:49
This message was deleted
Isaac BD
@HelloIsaac
Nov 23 2015 01:49
If anyone has a moment, could they ELI5 an example use-case for 'constructor functions'? From the lesson, it just seems like they're a superfluous step in defining objects, but I'm sure that they just have a use I don't know :) Thanks!
Atiya
@Atiya
Nov 23 2015 01:50
how do I post in wiki mode?
Peter W Ross
@PeterWRoss
Nov 23 2015 01:50
var firstNameLength = 0;
var lastNameLength = 8;
var firstName = "Ada";

firstNameLength = firstName.length;
lastNameLength = lastName.length;

var lastName = "Lovelace";

// Only change code below this line.

lastNameLength = lastNameLength;
brian424
@brian424
Nov 23 2015 01:50

can someone help me? this is my task : Waypoint: Create a Bulleted Unordered List
this is my code
</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>

<u1>
<1i>cheese</1i>
<1i>milk</1i>
<1i>fisk</1i>
</u1>
```

Peter W Ross
@PeterWRoss
Nov 23 2015 01:50

iccomq
@iccomq
Nov 23 2015 01:51
@PeterWRoss think of length as a function you should specify a variable and then take and input which is lastname and use length on it. You make that happen by adding '.length' where the DOT is very important
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:51
@PeterWRoss change lastNameLength to lastName.length. The case matters
iccomq
@iccomq
Nov 23 2015 01:51
that dot tells browser to use length as a function to count characters in a given string
brian424
@brian424
Nov 23 2015 01:52
can someone help me? this is my task : Waypoint: Create a Bulleted Unordered List
</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>
<u1>
<1i>cheese</1i>
<1i>milk</1i>
<1i>fisk</1i>
</u1>
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:53
@Atiya see this link. also saying just wiki format summons campbot with the same article
Atiya
@Atiya
Nov 23 2015 01:53
thanks
Peter W Ross
@PeterWRoss
Nov 23 2015 01:53

Program Execution Failure
keep getting this error
iccomq
@iccomq
Nov 23 2015 01:54
check your parenthesis @PeterWRoss
Atiya
@Atiya
Nov 23 2015 01:54
This message was deleted
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:54
@PeterWRoss the last line should say lastNameLength = lastName.length; no more no less. make sure you understand what is happening in the code before going on to the next one.
apekearo
@apekearo
Nov 23 2015 01:55
i need help on really simple stuff but I don't know what i'm doing,,, yall have a whole lot going on for my first grader problem, is ther another chat room for beginners?
Peter W Ross
@PeterWRoss
Nov 23 2015 01:55
// Only change code below this line.

lastName.length = lastName.length;

// Only change code above this line.
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:56
@apekearo just this one and the main one. what's up?
Peter W Ross
@PeterWRoss
Nov 23 2015 01:56
it is saying.. make last name equal to 8
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:56
day 5 coding here :)
Peter W Ross
@PeterWRoss
Nov 23 2015 01:56
i do not get that..
apekearo
@apekearo
Nov 23 2015 01:56

I'm having trouble making my image smaller to a 100 px i put the .smaller-image in the style brackets.. <style>
.red-text {
color: red;
}
.smaller-image {
width: 100px;
}
</style>

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

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

RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:56
@PeterWRoss read my comment above.
repost : @PeterWRoss the last line should say lastNameLength = lastName.length; no more no less. make sure you understand what is happening in the code before going on to the next one.
repost : @PeterWRoss the last line should say lastNameLength = lastName.length; no more no less. make sure you understand what is happening in the code before going on to the next one.
apekearo
@apekearo
Nov 23 2015 01:57
i'm afraid i'll need more assistance than I can ask of this chat room, as the free code camp goes on.
Robert Richey
@0x0936
Nov 23 2015 01:57
@brian424 I don't see anything wrong with what you posted.
iccomq
@iccomq
Nov 23 2015 01:57
@PeterWRoss you are on a right track but you just need half of that line, on the left side of equals sign should be a variable in which you will assign value of lastName.length
brian424
@brian424
Nov 23 2015 01:58
but i can not pass @0x0936
Peter W Ross
@PeterWRoss
Nov 23 2015 01:58

lastNameLength should be equal to eight.
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:58
@apekearo which waypoint is that? I did all of them.
Peter W Ross
@PeterWRoss
Nov 23 2015 01:58
ok i got it right... thanks @RoadtoMastery ...
CamperBot
@camperbot
Nov 23 2015 01:58
peterwross sends brownie points to @roadtomastery :sparkles: :thumbsup: :sparkles:
:star: 214 | @roadtomastery | http://www.freecodecamp.com/roadtomastery
Peter W Ross
@PeterWRoss
Nov 23 2015 01:58
but.. WHY!?
lol
Robert Richey
@0x0936
Nov 23 2015 01:58
@brian424 click the reset button, try again. if it still fails, post all of your code.
Patrick San Juan
@pdotsani
Nov 23 2015 01:59
@apekearo you need to add the .smaller-image class to your img tag
RoadtoMastery
@RoadtoMastery
Nov 23 2015 01:59
@PeterWRoss lol. make sure you understand why or you will be asking for every waypoint lol
brian424
@brian424
Nov 23 2015 01:59
@0x0936 okay
Atiya
@Atiya
Nov 23 2015 01:59
This message was deleted
iccomq
@iccomq
Nov 23 2015 01:59

@apekearo

.smaller-image {
width: 100px;
hight: 100px;
}

then you apply that class to an image in opening tag.
basically you add class='smaller-image'in <img>

Peter W Ross
@PeterWRoss
Nov 23 2015 01:59
how does that command make sense? "lastNameLength should be equal to 8" why?
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:00
@PeterWRoss read the instructions on left. it explains how .length works.
apekearo
@apekearo
Nov 23 2015 02:00
@iccomq thank you man,, i'll give it a shot
CamperBot
@camperbot
Nov 23 2015 02:00
apekearo sends brownie points to @iccomq :sparkles: :thumbsup: :sparkles:
:star: 54 | @iccomq | http://www.freecodecamp.com/iccomq
Peter W Ross
@PeterWRoss
Nov 23 2015 02:00
If its a function.. its saying.. lastNameLength = lastName.length;
Atiya
@Atiya
Nov 23 2015 02:02
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

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

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

  .smaller-image {
    width: 100px;
  }

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

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

  #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>
<div class=" green-background">
<form action="/submit-cat-photo" id="cat-photo-form">
  <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
  <label><input type="radio" name="indoor-outdoor"> Outdoor</label>
  <label><input type="checkbox" name="personality" checked> Loving</label>
  <label><input type="checkbox" name="personality"> Lazy</label>
  <label><input type="checkbox" name="personality"> Energetic</label>
  <input type="text" placeholder="cat photo URL" required>
  <button type="submit">Submit</button>
</form>
</div>
Using this code I get the green background but don't pass when I do the run tests.
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:02
@PeterWRoss basically lastNameLength = lastName.length tells you the length of the "lastName" or how many letters it contains. that's why the answer is 8.
iccomq
@iccomq
Nov 23 2015 02:02
@PeterWRoss lets walk you through that
.length is a method that when assigned to that string returns a value; how long it is
you apply it to variable that stores a string ---> lastName.length (lastName stores a string "Lovelace")
so lastName.length = 8
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:03
^ that
^ that
iccomq
@iccomq
Nov 23 2015 02:04
and now you have a variable, lastNameLength and you make it equal to a value returned by lastName.length
so lastName = lastName.length = 8
Robert Richey
@0x0936
Nov 23 2015 02:04
@iccomq small correction, .length is a property on strings, it's not a function
iccomq
@iccomq
Nov 23 2015 02:05
@0x0936 is right its a property, but it helped me to understand it as a function that returns length
Peter W Ross
@PeterWRoss
Nov 23 2015 02:05
lastname =string value 8 (numeric data)..
so lastNameLength =lastName.length
so.. the words laseNameLength literally mean.. lol.. (8)..
the length of the last name
is that all this is here?
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:06
@PeterWRoss yes lol for that specific waypoint
Robert Richey
@0x0936
Nov 23 2015 02:06
@PeterWRoss yes
Peter W Ross
@PeterWRoss
Nov 23 2015 02:07
*hangs self
@RoadtoMastery thanks. @iccomq thanks. @0x0936 thanks
CamperBot
@camperbot
Nov 23 2015 02:07
peterwross sends brownie points to @roadtomastery and @iccomq and @0x0936 :sparkles: :thumbsup: :sparkles:
:warning: peterwross already gave roadtomastery points
:star: 382 | @0x0936 | http://www.freecodecamp.com/0x0936
:star: 55 | @iccomq | http://www.freecodecamp.com/iccomq
apekearo
@apekearo
Nov 23 2015 02:08

@iccomq hey yall, I'm having trouble making my image smaller to a 100 px i put the .smaller-image in the style brackets.. <style>
.smaller-image {
width: 100px;
}
</style>

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

iccomq
@iccomq
Nov 23 2015 02:08
yes a variable is made of two parts, its name and the value, name can be whatever you make it, you also assign a data to that name, thata can change and you can doo all fancy stuff to it. thats why you call it a variable, not a constant(which is used in some other languages)
@apekearo you forgot to set a height property in you styles
Robert Richey
@0x0936
Nov 23 2015 02:08
js is getting constants with ES6
apekearo
@apekearo
Nov 23 2015 02:09
yeah , but height wasn't working either
iccomq
@iccomq
Nov 23 2015 02:09
@apekearo at which point are you at?
apekearo
@apekearo
Nov 23 2015 02:10
waypoint Size your images
Robert Richey
@0x0936
Nov 23 2015 02:10
@apekearo your style rule is for smaller-image but the class name given to img is smaller-text
Carson B
@Cdog55
Nov 23 2015 02:10
how do i add a second class to an image
apekearo
@apekearo
Nov 23 2015 02:10
woo haa, thats the ticket
Hans van Riet
@hansinla
Nov 23 2015 02:11
@Cdog55 class=“class1 class2"
apekearo
@apekearo
Nov 23 2015 02:11
yeah, i kept putting the work text instead of image
I'll eventually get the hang of this and start asking yall smart questions instead of typo stuff, damn i totally didnt see that.
iccomq
@iccomq
Nov 23 2015 02:12
thats that!
Robert Richey
@0x0936
Nov 23 2015 02:13
@apekearo we all do it. and I have yet to ask a 'smart' question, so I just avoid asking questions :p
iccomq
@iccomq
Nov 23 2015 02:13
@apekearo dont worry, asking about stuff and hearing about an answer will alsways seem like that :D
wait for a moment when someone will post an answer to your question and it will work, but you will have no idea why
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:14
@apekearo i just follow the format of the example and try to understand the code before moving on to the next one. :smile:
iccomq
@iccomq
Nov 23 2015 02:14
that feeling will eat you from inside :P
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:14
yea. sometimes your code is right but it won't work without a refresh. don't know why =)
Robert Richey
@0x0936
Nov 23 2015 02:16
that's how I felt when reading code on how to swap the value of two variables, without using a third temporary variable
Isaac BD
@HelloIsaac
Nov 23 2015 02:16
var array = [4,5,6,7,8];

// Only change code below this line.

var singleVal = array.reduce(function(previousVal, currentVal){
     return previousVal+currentVal;
});

// Only change code above this line.

(function() {return singleVal;})();
Could someone give me an ELI5 of what previousVal and currentVal mean here :)
Chris Prieto
@catfish68
Nov 23 2015 02:17
Hello All, I am new here.
Isaac BD
@HelloIsaac
Nov 23 2015 02:17
Hi, @catfish68 :)
brian424
@brian424
Nov 23 2015 02:17
@0x0936 i wil be busy. i will try it when i am free thx anyways
CamperBot
@camperbot
Nov 23 2015 02:17
brian424 sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
:star: 383 | @0x0936 | http://www.freecodecamp.com/0x0936
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:17
@catfish68 Welcome
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:18
i feel dumb like I'm missing something obvious
$(document).ready(function() {
$("#target1").css("color", "red");
$(document).ready(function(){
$("#target4").css("italic");
})
});
Chris Prieto
@catfish68
Nov 23 2015 02:18
Thanks
Robert Richey
@0x0936
Nov 23 2015 02:18
swap code is wrong. deleting for now. #mistakesWereMade
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:19
oh I just spotted one huge mistake
Hans van Riet
@hansinla
Nov 23 2015 02:20
@gordondavidescu only have one document.ready function and wrap (or nest) the rest inside =it
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:20
yeah that was the doof I just fixed
iccomq
@iccomq
Nov 23 2015 02:20
@HelloIsaac this values are temporary ones that just this one function uses, not from the outside. Reduce method needs variabl to get from the callback function which it is. They are needed in this function to make calculations on becouse it is required by reduce function to return a value which is made up from two other values
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:20
still isn't making target4 italic
<script>
$(document).ready(function() {
$("#target1").css("color", "red");
$("#target4").css("italic");
});
</script>
Isaac BD
@HelloIsaac
Nov 23 2015 02:21
@iccomq Ah, I sort of see, thanks! So they're not arbitrary names, which is why they aren't defined anywhere—the reduce method already knows what those things mean and they'll always be called previousVal etc.?
CamperBot
@camperbot
Nov 23 2015 02:21
helloisaac sends brownie points to @iccomq :sparkles: :thumbsup: :sparkles:
:star: 56 | @iccomq | http://www.freecodecamp.com/iccomq
Hans van Riet
@hansinla
Nov 23 2015 02:21
@gordondavidescu .css( "font-style”, “italic”)
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:22
thank you
that makes so much sense
iccomq
@iccomq
Nov 23 2015 02:22
@HelloIsaac no, its just that you make calculations on two, you make up that names, you can sub them for a nd b
Robert Richey
@0x0936
Nov 23 2015 02:22
// working swap code, for those curious

var a = 2;
var b = 1;

if (a > b) {
  a = [b, b = a][0];
}

// a === 1
// b === 2
iccomq
@iccomq
Nov 23 2015 02:22
@HelloIsaac just remember to also return a+b
Chris Prieto
@catfish68
Nov 23 2015 02:23
@danielbledsoe i do but work through it, finding that im putting to much thought in it.
Isaac BD
@HelloIsaac
Nov 23 2015 02:23
Right, thanks :)
iccomq
@iccomq
Nov 23 2015 02:23
@HelloIsaac they are named that in example to let you know that it takes values from array and sums them. Sorta shows how its made :)
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:24
the text is italic, it still has an X
Andrew Bechini
@powhunter158
Nov 23 2015 02:24
Screen Shot 2015-11-11 at 9.44.25 PM.png
Hans van Riet
@hansinla
Nov 23 2015 02:24
@gordondavidescu show all your coe and where’s the X?
Andrew Bechini
@powhunter158
Nov 23 2015 02:24
Screen Shot 2015-11-22 at 9.23.47 PM.png
Sorry second is the one i need help with.
Not sure what i'm doing wrong here
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:25
is there an easy way to show you my screen, hee hee
the x says "Italicize the text in your target4 button by adding HTML tags."
Hans van Riet
@hansinla
Nov 23 2015 02:25
@powhunter158 you don’t have a closing div tag at the end of your code </div>
Peter W Ross
@PeterWRoss
Nov 23 2015 02:26
var firstLetterOfFirstName = "";
var firstLetterOfLastName = "";

var firstName = "Ada";

firstLetterOfFirstName = firstName[0];

var lastName = "Lovelace";

firstLetterOfLastName = lastName[0];


// Only change code above this line.
Essentially, this is really saying L is the first letter of the last name.. and l is = lastName[0]... the [0] indicates that L is at 0 position in the character index..but why would we need to define that?
Ademola Adegbuyi
@ooade
Nov 23 2015 02:26
@powhunter158 you didnt call the myDog object
Hans van Riet
@hansinla
Nov 23 2015 02:26
@gordondavidescu so you should have done
.html(“<i>#target4</i>”);
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:27
Huh. Oh!
Sharon
@srinky4730
Nov 23 2015 02:28
Need assistance with Waypoint: Use a CSS Class Style to an Element. I have the following, but it's not working.
iccomq
@iccomq
Nov 23 2015 02:28
@PeterWRoss you dont define that its already defined, every letter has its index. You just assign that one letter from a string to a variable.
Sharon
@srinky4730
Nov 23 2015 02:28

<style>

.red-text; {color: red;}

</style>

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

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

RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:28
@PeterWRoss finding the index of a variable is useful for changing letters without actually rewriting the new word.
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:29

$("#target4").html(“<i>#target4</i>”);

??

that can't be right
Hans van Riet
@hansinla
Nov 23 2015 02:29
@gordondavidescu you tried?
iccomq
@iccomq
Nov 23 2015 02:29
@PeterWRoss just hang on with that exercises and future ones will show you how you put all that into more usefull stuff.
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:30
yes now it says unexpected token ILLEGAL
it's angry
Hans van Riet
@hansinla
Nov 23 2015 02:30
@gordondavidescu what waypoint are you on?
Robert Richey
@0x0936
Nov 23 2015 02:30
@PeterWRoss there's a bonfire that will have you title case a string, so this waypoint is getting you used to thinking about strings as letters with an indexed position that you can reference. 'apple'[0] === 'a'
Peter W Ross
@PeterWRoss
Nov 23 2015 02:30
thats what I was just hoping @iccomq ... because it does not really explain at all how it is applied
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:30
Change Text Inside an Element Using jQuery
Peter W Ross
@PeterWRoss
Nov 23 2015 02:30
okay.... ill keep chipping away
Andrew Bechini
@powhunter158
Nov 23 2015 02:30
thanks @marhyorh
CamperBot
@camperbot
Nov 23 2015 02:30
powhunter158 sends brownie points to @marhyorh :sparkles: :thumbsup: :sparkles:
:star: 342 | @marhyorh | http://www.freecodecamp.com/marhyorh
Chris Prieto
@catfish68
Nov 23 2015 02:30
@srinky4730 add to the h2 class="red-text"
Hans van Riet
@hansinla
Nov 23 2015 02:31
@gordondavidescu $("#target4").html("<i>#target4</i>”);
Sharon
@srinky4730
Nov 23 2015 02:31
Where?
Chris Prieto
@catfish68
Nov 23 2015 02:31
in the h2 tag
iccomq
@iccomq
Nov 23 2015 02:31
@PeterWRoss just make sure you understand all that. Also try to read up on what the help gives you, you dont need to nderstand all of that from links but itll be somewhere there in your head. Will make things "click" at some point
Chris Prieto
@catfish68
Nov 23 2015 02:32
@srinky4730 <h2 class="red-text">CatPhotoApp</h2>
Sharon
@srinky4730
Nov 23 2015 02:32
I've already got that.
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:32
illegal
Hans van Riet
@hansinla
Nov 23 2015 02:33
@gordondavidescu no it’s not show all of your code
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:33
<script>
$(document).ready(function() {

$("#target4").html("<i>#target4</i>”);
});
</script>
Chris Prieto
@catfish68
Nov 23 2015 02:33
which waypoint are you on?
Sharon
@srinky4730
Nov 23 2015 02:34
Waypoint: Use a CSS Class to Style an Element
Hans van Riet
@hansinla
Nov 23 2015 02:34
@gordondavidescu if you didn’t change anything below that, you’ll need to reset the code with the button and retype. That code is correct (except for the fact that you’re missing the .css line).
Arifuzzaman-Arif
@Arifuzzaman-Arif
Nov 23 2015 02:34
Hi everyone
Chris Prieto
@catfish68
Nov 23 2015 02:35
@srinky4730 it should look like this

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

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

Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:35
<script>
$(document).ready(function() {
$("#target1").css("color", "red");
$("#target4").html("<i>#target4</i>”);
});
</script>
broken again
have to go get my kid to sleep br
Chris Prieto
@catfish68
Nov 23 2015 02:35

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

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

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

Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:35
brb
Carson B
@Cdog55
Nov 23 2015 02:36
i need help
Hans van Riet
@hansinla
Nov 23 2015 02:36
@gordondavidescu did you reset? If so, you’ll need to delete the FCC coockie in your browser, that’ll give you a fresh start'
Sharon
@srinky4730
Nov 23 2015 02:36
That's exactly what I have.
Carson B
@Cdog55
Nov 23 2015 02:36
i need help
Arifuzzaman-Arif
@Arifuzzaman-Arif
Nov 23 2015 02:36
I have a problem in JS.
Hans van Riet
@hansinla
Nov 23 2015 02:36
@Cdog55 what with
@Arifuzzaman-Arif what is the problem
Carson B
@Cdog55
Nov 23 2015 02:37
nesting
Chris Prieto
@catfish68
Nov 23 2015 02:37
take out the ; after .red-text
Hans van Riet
@hansinla
Nov 23 2015 02:37
@Cdog55 can you be a bit more specific
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:37
@gordondavidescu redoing that one. I see now how the instructions can be confusing. probably broke it when trying to help people without fixing it afterwards.
Chris Prieto
@catfish68
Nov 23 2015 02:37
@srinky4730 take out the ; after .red-text
Carson B
@Cdog55
Nov 23 2015 02:37
<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 herf="http://www.freecatphotoapp.com"> cats</a> to check out more cats </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>
Your a element should be nested within your new p element.
Arifuzzaman-Arif
@Arifuzzaman-Arif
Nov 23 2015 02:38

add 3 to each value in the array using map()
here is my code:
var array = [1,2,3,4,5];

// Only change code below this line.

var newArray = array.map(function(array){
return 3;
});

// Only change code above this line.

(function() {return newArray;})();

but it's not working
Sharon
@srinky4730
Nov 23 2015 02:38
Thank you!
Chris Prieto
@catfish68
Nov 23 2015 02:38
@srinky4730 you are welcome
Robert Richey
@0x0936
Nov 23 2015 02:39
Carson B
@Cdog55
Nov 23 2015 02:39
i need help
Hans van Riet
@hansinla
Nov 23 2015 02:40
@Cdog55 you have multiple <a> elements it should like like this
<p>
<a></a>
</p>
apekearo
@apekearo
Nov 23 2015 02:40
<a #="http://www.freecatphotoapp.com">cat photos</a> why isn't this anchor link dead yet? I replaced href with a hashtag
Carson B
@Cdog55
Nov 23 2015 02:41
i did that i didnt work
Robert Richey
@0x0936
Nov 23 2015 02:41
@gordondavidescu I'd say skip that waypoint, or submit a bug report. That's a nutty waypoint.
Arifuzzaman-Arif
@Arifuzzaman-Arif
Nov 23 2015 02:41
@apekearo <a href="#"> cat photo </a>
Ademola Adegbuyi
@ooade
Nov 23 2015 02:41
@Arifuzzaman-Arif you returned only 3
Hans van Riet
@hansinla
Nov 23 2015 02:41
@Arifuzzaman-Arif The map function feeds the elements one by one so your var should not be named array but could be x. You want to return x+3
var newArray = array.map(function(x){
return x + 3;
});
@0x0936 There’s no bug
iccomq
@iccomq
Nov 23 2015 02:42

@0x0936 just instert

$("#target4").html("<i>#target4</i>")

in script tags

Robert Richey
@0x0936
Nov 23 2015 02:42
@hansinla the bug is complete confusion on what to do
Hans van Riet
@hansinla
Nov 23 2015 02:43
@Cdog55 show your code properly formatted
@0x0936 take a breath and reread it
iccomq
@iccomq
Nov 23 2015 02:43

@gordondavidescu

$("#target4").html("<i>#target4</i>")

works

Arifuzzaman-Arif
@Arifuzzaman-Arif
Nov 23 2015 02:43
thanks @marhyorh and @hansinla
CamperBot
@camperbot
Nov 23 2015 02:43
arifuzzaman-arif sends brownie points to @marhyorh and @hansinla :sparkles: :thumbsup: :sparkles:
:star: 343 | @marhyorh | http://www.freecodecamp.com/marhyorh
:star: 626 | @hansinla | http://www.freecodecamp.com/hansinla
iccomq
@iccomq
Nov 23 2015 02:44
@gordondavidescu when you use html method, it inserts text in targeted elements html tags, you can insert other tags in there to be interpreted by browser
not in styles just in script
by in tags i mean <tag> in here </tag>
Robert Richey
@0x0936
Nov 23 2015 02:46
@hansinla firstly, thanks. also, this line 'jQuery also has a similar function called .text() that only alters text without adding tags.' should probably be removed entirely and the title reworded as 'Change HTML Inside an Element Using jQuery'
CamperBot
@camperbot
Nov 23 2015 02:46
0x0936 sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 627 | @hansinla | http://www.freecodecamp.com/hansinla
Peter W Ross
@PeterWRoss
Nov 23 2015 02:46
Can someone explain what "nth" means ...
nth to last
in layman's
lol
Hans van Riet
@hansinla
Nov 23 2015 02:46
@0x0936 probably true
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:46
@0x0936 trying it right now and I completely agree :smile: . its incomplete now
Gordon Davidescu
@gordondavidescu
Nov 23 2015 02:46
yay thank you @iccomq
CamperBot
@camperbot
Nov 23 2015 02:46
gordondavidescu sends brownie points to @iccomq :sparkles: :thumbsup: :sparkles:
:star: 57 | @iccomq | http://www.freecodecamp.com/iccomq
iccomq
@iccomq
Nov 23 2015 02:47
nth stands for number you will be given so they give you 5 so it will be from 5th to last @PeterWRoss
Hans van Riet
@hansinla
Nov 23 2015 02:47
@PeterWRoss n as in the ‘so-manied’ nth 2th 3th 4th, it’s not English, I know
iccomq
@iccomq
Nov 23 2015 02:48
@gordondavidescu youre welcome :)
as you could expect @hansinla describes stuff better :D
Robert Richey
@0x0936
Nov 23 2015 02:49
also, thanks @iccomq just noticed your help on that
CamperBot
@camperbot
Nov 23 2015 02:49
0x0936 sends brownie points to @iccomq :sparkles: :thumbsup: :sparkles:
:star: 58 | @iccomq | http://www.freecodecamp.com/iccomq
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:49
@iccomq thanks. I think i missed that one or it was recently added .
Peter W Ross
@PeterWRoss
Nov 23 2015 02:49
thank you @hansinla and @0x0936 and @iccomq
CamperBot
@camperbot
Nov 23 2015 02:49
peterwross sends brownie points to @hansinla and @0x0936 and @iccomq :sparkles: :thumbsup: :sparkles:
:warning: peterwross already gave 0x0936 points
:warning: peterwross already gave iccomq points
:star: 628 | @hansinla | http://www.freecodecamp.com/hansinla
Peter W Ross
@PeterWRoss
Nov 23 2015 02:49
so after 6th position.. its nth
0x0936 @0x0936 goes to bed to have nightmares dreams about jquery
Hans van Riet
@hansinla
Nov 23 2015 02:50
@PeterWRoss for n you fill in the cardinal number of the position nth-child(6)
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:52
officially did all the waypoints now. will be studying that one closely.
Peter W Ross
@PeterWRoss
Nov 23 2015 02:52
Whoever created this stuff... could have made it A LOT simpler
lol
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:52
@PeterWRoss how so? just a thought :smile:
Peter W Ross
@PeterWRoss
Nov 23 2015 02:52
Im meaning the coding language.. not the waypoints..
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:53
i see. well coding is not easy. so maybe you can invent a better code once you have the skills :smile:
Hans van Riet
@hansinla
Nov 23 2015 02:53
@PeterWRoss Just doing it over and over again will make it clearer over time
iccomq
@iccomq
Nov 23 2015 02:54
@hansinla oh god i hope so so much for it to be true, i feel like every step i make here just puts glass shards in my brain
Peter W Ross
@PeterWRoss
Nov 23 2015 02:54
yeah right @RoadtoMastery ..
lol
who knows though..
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:55
@iccomq which part are you on? just wondering
iccomq
@iccomq
Nov 23 2015 02:55
right now on procratinating waypoint
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:55
@PeterWRoss first some guy makes C. then some guy makes C++. it's definitely possible :smile:
Peter W Ross
@PeterWRoss
Nov 23 2015 02:55
i mean for example though.. they say the index starts counting at 0.. why not make it start counting from one semblance purposes
for semblance purposes..
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:56
i think 0 makes sense. for example how would you count from -1 in code?
Peter W Ross
@PeterWRoss
Nov 23 2015 02:57
but zero has zero value.. in real language ..
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:57
@iccomq i see. up to bonfires now. taking my time. they are not easy at all.
@PeterWRoss zero actually is quite useful.
Teyanna Johnson
@teyanna
Nov 23 2015 02:57
Nee help. Cannot read property 'length' of null
iccomq
@iccomq
Nov 23 2015 02:58
well i actually have last bonfire to complete, i just looked through it though, i atleast have some ideas how to handle that
Peter W Ross
@PeterWRoss
Nov 23 2015 02:58
so when you start to associate the position 0.. with the word zero.. it can be confusing and end up being something that you have to process and translate into a language of position instead of value..
Teyanna Johnson
@teyanna
Nov 23 2015 02:58
<script>
$(document).ready(function() {
$("button").addClass("animated shake");
$(".btn").addClass("btn btn-primary");
$("#target1").addClass("animated shake btn btn-primary");
});
</script>
what am i missing ?
Peter W Ross
@PeterWRoss
Nov 23 2015 02:58
i guess there will be more uses of for 0 in the future..
let me asnwer this one
@teyanna whats the question
RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:58
@PeterWRoss makes sense. didn't think about that
@PeterWRoss sure. go right ahead. you can do it :smile:
Sharon
@srinky4730
Nov 23 2015 02:59

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

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


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

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

RoadtoMastery
@RoadtoMastery
Nov 23 2015 02:59
Good night all 10pm est here lol
iccomq
@iccomq
Nov 23 2015 02:59
night night
Peter W Ross
@PeterWRoss
Nov 23 2015 03:00
thanks again @RoadtoMastery
CamperBot
@camperbot
Nov 23 2015 03:00
peterwross sends brownie points to @roadtomastery :sparkles: :thumbsup: :sparkles:
:star: 216 | @roadtomastery | http://www.freecodecamp.com/roadtomastery
Varun Upadhyay
@varunu28
Nov 23 2015 03:00
Hi friends
I am reading Eloquent Javascript book along with te FCC courseware
Is there any JS compiler where I can run my scripts like we do in bonfires and see the output?
Hans van Riet
@hansinla
Nov 23 2015 03:00
@srinky4730 take font-family out from between you <h2> tags and put it in your style sheet
Isaac BD
@HelloIsaac
Nov 23 2015 03:00
So.
These bonfires are a massive step-up in difficulty
Hans van Riet
@hansinla
Nov 23 2015 03:00
@HelloIsaac yes they are
Isaac BD
@HelloIsaac
Nov 23 2015 03:01
Should I avoid googling things like 'palindrome check +javascript', or would that fall under the 'search' bit? :)
Peter W Ross
@PeterWRoss
Nov 23 2015 03:01
thanks for that conforting bit of information @HelloIsaac
CamperBot
@camperbot
Nov 23 2015 03:01
peterwross sends brownie points to @helloisaac :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for helloisaac
Teyanna Johnson
@teyanna
Nov 23 2015 03:01
@PeterWRoss I have added everything for this lesson but it will not pass this part. Cannot read property 'length' of null everything else is checked im trying to Target the same element with multiple jQuery Selectors
Isaac BD
@HelloIsaac
Nov 23 2015 03:01
I feel like I'm going to be unable to work them out based on the knowledge I've gleaned solely from the Waypoints
@PeterWRoss :)
DJ
@qualitymanifest
Nov 23 2015 03:01
@HelloIsaac if you look for solutions you likely won't learn much
Isaac BD
@HelloIsaac
Nov 23 2015 03:01
Mmm :(
But I don't remember enough of the syntax yet to be able to just pull it out of nowhere, so do you think googling syntax for 'for loops' etc. would be okay?
I assume the goal is understanding rather than memorising at this stage
DJ
@qualitymanifest
Nov 23 2015 03:02
that's a-okay
Peter W Ross
@PeterWRoss
Nov 23 2015 03:02
can you send the link @teyanna to the waypoint
Isaac BD
@HelloIsaac
Nov 23 2015 03:02
Hooray
Teyanna Johnson
@teyanna
Nov 23 2015 03:04
@PeterWRoss new to the site unsure of how to do that?
iccomq
@iccomq
Nov 23 2015 03:04
@HelloIsaac remember that description of exercise also feeds you links! Snoop around that sites they are goldmines. Have arbitrary examples and you can look for whatever you want and learn even more!
Peter W Ross
@PeterWRoss
Nov 23 2015 03:04
just copy the url of the way point
and paste it
@teyanna
Teyanna Johnson
@teyanna
Nov 23 2015 03:05
http://www.freecodecamp.com/challenges/waypoint-target-the-same-element-with-multiple-jquery-selectors?solution=fccss%0A%20%20%24(document).ready(function()%20%7B%0A%20%20%20%20%24(%22button%22).addClass(%22animated%20shake%22)%3B%0A%20%20%20%20%24(%22.btn%22).addClass(%22btn%20btn-primary%22)%3B%0A%20%20%20%20%24(%22%23target1%22).addClass(%22animated%20shake%20btn%20btn-primary%22)%3B%0A%20%7D)%3B%0Afcces%0A%0A%3C!--%20Only%20change%20code%20above%20this%20line.%20--%3E%0A%0A%3Cdiv%20class%3D%22container-fluid%22%3E%0A%20%20%3Ch3%20class%3D%22text-primary%20text-center%22%3EjQuery%20Playground%3C%2Fh3%3E%0A%20%20%3Cdiv%20class%3D%22row%22%3E%0A%20%20%20%20%3Cdiv%20class%3D%22col-xs-6%22%3E%0A%20%20%20%20%20%20%3Ch4%3E%23left-well%3C%2Fh4%3E%0A%20%20%20%20%20%20%3Cdiv%20class%3D%22well%22%20id%3D%22left-well%22%3E%0A%20%20%20%20%20%20%20%20%3Cbutton%20class%3D%22btn%20btn-default%20target%22%20id%3D%22target1%22%3E%23target1%3C%2Fbutton%3E%0A%20%20%20%20%20%20%20%20%3Cbutton%20class%3D%22btn%20btn-default%20target%22%20id%3D%22target2%22%3E%23target2%3C%2Fbutton%3E%0A%20%20%20%20%20%20%20%20%3Cbutton%20class%3D%22btn%20btn-default%20target%22%20id%3D%22target3%22%3E%23target3%3C%2Fbutton%3E%0A%20%20%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%20%3Cdiv%20class%3D%22col-xs-6%22%3E%0A%20%20%20%20%20%20%3Ch4%3E%23right-well%3C%2Fh4%3E%0A%20%20%20%20%20%20%3Cdiv%20class%3D%22well%22%20id%3D%22right-well%22%3E%0A%20%20%20%20%20%20%20%20%3Cbutton%20class%3D%22btn%20btn-default%20target%22%20id%3D%22target4%22%3E%23target4%3C%2Fbutton%3E%0A%20%20%20%20%20%20%20%20%3Cbutton%20class%3D%22btn%20btn-default%20target%22%20id%3D%22target5%22%3E%23target5%3C%2Fbutton%3E%0A%20%20%20%20%20%20%20%20%3Cbutton%20class%3D%22btn%20btn-default%20target%22%20id%3D%22target6%22%3E%23target6%3C%2Fbutton%3E%0A%20%20%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%20%3C%2Fdiv%3E%0A%20%20%3C%2Fdiv%3E%0A%3C%2Fdiv%3E%0A
Isaac BD
@HelloIsaac
Nov 23 2015 03:05
That's a hell of a link :)
iccomq
@iccomq
Nov 23 2015 03:05
that links are the killer man.
Teyanna Johnson
@teyanna
Nov 23 2015 03:05
@PeterWRoss Pretty cool trick
Isaac BD
@HelloIsaac
Nov 23 2015 03:05
Thanks for the tip, @iccomq^ :)
CamperBot
@camperbot
Nov 23 2015 03:05
helloisaac sends brownie points to @iccomq :sparkles: :thumbsup: :sparkles:
:warning: helloisaac already gave iccomq points
DJ
@qualitymanifest
Nov 23 2015 03:06
@teyanna

Add the animated class to all elements with type button.

Add the shake class to all the buttons with class .btn.

Add the btn-primary class to the button with id #target1.

iccomq
@iccomq
Nov 23 2015 03:07
@HelloIsaac also there is that mozilla/developer part. (just google that) There are articles on basic and intermediate javascript. Nicely put and pretty easy to understand, i highly recommend reading those articles under this sections.
Isaac BD
@HelloIsaac
Nov 23 2015 03:08
Great, I'll take a look at those, thank you :)
Teyanna Johnson
@teyanna
Nov 23 2015 03:08
@qualitymanifest i tried that it didnt work
DJ
@qualitymanifest
Nov 23 2015 03:09
@teyanna you're only supposed to add one specific class to each one.
you have added multiple classes to each
Peter W Ross
@PeterWRoss
Nov 23 2015 03:10
you have too many class attributes in each selector
(don't know if i said that right) @teyanna
Hans van Riet
@hansinla
Nov 23 2015 03:10
@teyanna all you need to do is this
<!--
Add the animated class to all elements with type button.

Add the shake class to all the buttons with class .btn.

Add the btn-primary class to the button with id #target1.
—>
Peter W Ross
@PeterWRoss
Nov 23 2015 03:11

 Use the $("button") selector.
 Use the $(".btn") selector.
 Use the $("#target1") selector.
 Only add one class with each of your three selectors.
 Your #target1 element should have the classes animated‚ shake and btn-primary.
 Only use jQuery to add these classes to the element.
iccomq
@iccomq
Nov 23 2015 03:11
@teyanna i can post you an answer, but highly recommend just reading description and tips carefuly.
Peter W Ross
@PeterWRoss
Nov 23 2015 03:12
a hint @teyanna
  $("button").addClass("animated");
m-farooqui
@m-farooqui
Nov 23 2015 03:14
In array 167 "Filter array with filter" . i am having trouble with removing the values from the array that are greater than 5
DJ
@qualitymanifest
Nov 23 2015 03:14
This message was deleted
m-farooqui
@m-farooqui
Nov 23 2015 03:14
here is my code

var oldArray = [1,2,3,4,5,6,7,8,9,10];

// Only change code below this line.

var newArray = oldArray;

oldArray=oldArray.filter(function(val)
{
return val % 0===5;
});

(function() { return newArray; })();

Hans van Riet
@hansinla
Nov 23 2015 03:15
@m-farooqui This return val % 0===5; tests not for value <=5
DJ
@qualitymanifest
Nov 23 2015 03:15
This message was deleted
Hans van Riet
@hansinla
Nov 23 2015 03:16
@m-farooqui % is for modulo, the remainder after a division
iccomq
@iccomq
Nov 23 2015 03:20
i just checked what would return a val % 0===5, 0===5 is false, so what do you get out of val % false? a NaN! so if anyone was curious about that but too lazy to check, i got your back.
Teyanna Johnson
@teyanna
Nov 23 2015 03:20
@qualitymanifest I got it! Thank you
CamperBot
@camperbot
Nov 23 2015 03:20
teyanna sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 410 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
Hans van Riet
@hansinla
Nov 23 2015 03:21
@iccomq You’re dividing by zero...
iccomq
@iccomq
Nov 23 2015 03:22
is a boolean treated as a number when i use it in modulo? i was thinking more like.... trying to divide by false :D
it was curiosity, i actually knew that statement did not make sense. wanted to know what it owuld spit out
Hans van Riet
@hansinla
Nov 23 2015 03:23
@iccomq val divided by zero and check if the remainder is equal to 5. That is what it means.
iccomq
@iccomq
Nov 23 2015 03:25
so i guess i failed at basic stuff by checking what val%false would be.
god help me
Hans van Riet
@hansinla
Nov 23 2015 03:25
@iccomq haha
iccomq
@iccomq
Nov 23 2015 03:25
i just literally put console.log(5%false); in a console
becouse i was curious
so let me rephrase
if anyone was curious what val%false spits out, its NaN, youre welcome
Hans van Riet
@hansinla
Nov 23 2015 03:27
@iccomq thanks
CamperBot
@camperbot
Nov 23 2015 03:27
hansinla sends brownie points to @iccomq :sparkles: :thumbsup: :sparkles:
:star: 59 | @iccomq | http://www.freecodecamp.com/iccomq
iccomq
@iccomq
Nov 23 2015 03:28
always got your back with complicated stuff you know, not that simple trivial filtering arrays, you know.. important stuff
Peter W Ross
@PeterWRoss
Nov 23 2015 03:31
var array = ["John", 23];

// Only change code below this line.

var myArray = ["jump", 2];

// Only change code above this line.

(function(z){return z;})(myArray);
Anyone that can explain this further?
iccomq
@iccomq
Nov 23 2015 03:31
what waipoint is that?
Peter W Ross
@PeterWRoss
Nov 23 2015 03:32

Waypoint: Store Multiple Values in one Variable using JavaScript Arrays
With JavaScript array variables, we can store several pieces of data in one place.

You start an array declaration with an opening square bracket, end it with a closing square bracket, and put a comma between each entry, like this: var sandwich = ["peanut butter", "jelly", "bread"].

Now let's create a new array called myArray that contains both a string and a number (in that order).

Refer to the commented code in the text editor if you get stuck.

Ademola Adegbuyi
@ooade
Nov 23 2015 03:32
@PeterWRoss var array contains two element, same as myArray
Peter W Ross
@PeterWRoss
Nov 23 2015 03:32
lol.. what does that mean though @marhyorh
it carries two elements for what?
Hans van Riet
@hansinla
Nov 23 2015 03:33
@PeterWRoss code looks good to me
Peter W Ross
@PeterWRoss
Nov 23 2015 03:33
Yes the answer is right.. i am trying to just understand the "why"
Ademola Adegbuyi
@ooade
Nov 23 2015 03:33
@PeterWRoss you know what an array is?
Peter W Ross
@PeterWRoss
Nov 23 2015 03:33
no this was the first array question
and it didnt really explain what it was
Hans van Riet
@hansinla
Nov 23 2015 03:34
@PeterWRoss It’s a container to store pieces of data, as described in the first line. You just stored a string and an integer in it.
Ademola Adegbuyi
@ooade
Nov 23 2015 03:35
Yeah
Peter W Ross
@PeterWRoss
Nov 23 2015 03:35
I mean it says what it is... but it didnt say "why it is"
I guess Ill get there
iccomq
@iccomq
Nov 23 2015 03:35
@PeterWRoss you remember how you could access a letter in a string with an index? Think of a word like an array where every letter has an index. Every index in there has a letter. (keep in mind its explanation to keep things simple)
So an array is actually a list where you put your data (which can be almost anything) and assign a number to it.
Peter W Ross
@PeterWRoss
Nov 23 2015 03:37
Why am i doing that though? What will i need it for later is my question
Hans van Riet
@hansinla
Nov 23 2015 03:37
@PeterWRoss You could use an array to store membership information if you’re working on a database var member = [“firstName”, “lastName”, memberId, telephoneNumber]; although there are better ways to do that.
iccomq
@iccomq
Nov 23 2015 03:37
So you can access a data in an array by its index. It lets you change just one or just some fragments of an array. That system lest you make calculations on a lot of data, or filter data to get what you want.
@hansinla you mean objects right?
Peter W Ross
@PeterWRoss
Nov 23 2015 03:39
so..
```
myArray = ["firstname", "lastname", "city", "etc", 9]... and the numeric is the numbers it listed in the database? or, just my number that i give it for my data organizing purposes
and thank you @hansinla and @iccomq and @marhyorh by the way
CamperBot
@camperbot
Nov 23 2015 03:39
peterwross sends brownie points to @hansinla and @iccomq and @marhyorh :sparkles: :thumbsup: :sparkles:
:warning: peterwross already gave hansinla points
:star: 344 | @marhyorh | http://www.freecodecamp.com/marhyorh
:star: 60 | @iccomq | http://www.freecodecamp.com/iccomq
Hans van Riet
@hansinla
Nov 23 2015 03:39
@iccomq Yes, that would be a better way to go. But we fisrt have to learn how to deal with indexing in an array.
iccomq
@iccomq
Nov 23 2015 03:39
in your example a variable myArray, is a little database where every piece of data has its index
@hansinla i actually started a lecture on objects, constructors, prototypes and things around that.
m-farooqui
@m-farooqui
Nov 23 2015 03:41
i am still stuck with the code
here is my code

var oldArray = [1,2,3,4,5,6,7,8,9,10];

var newArray = oldArray;

oldArray=oldArray.filter(function(val)
{
return val > 5===6;
val
});

(function() { return newArray; })();

Peter W Ross
@PeterWRoss
Nov 23 2015 03:41
so.. are you saying.. like "charles" the first letter is 0 on the index.. when you build an array, and string text and numbers together... you are kind of "nesting" all of that data into its own index number.. just like the first letter would be 0... you are saying , "all of that stuff i Just wrong in those brackets will exist on index 9"?
Robert Richey
@0x0936
Nov 23 2015 03:42
trying to go through learnyoumongo - what a mess, but trying to bulldoze through it. has anyone here tried this? did you ever figure out how to get a 'parrots' collection?
m-farooqui
@m-farooqui
Nov 23 2015 03:42
in waypoint 167
Ademola Adegbuyi
@ooade
Nov 23 2015 03:44
@0x0936 yeah.. var collectionName = db.collection("parrots"); then you can call collectioName.find({}) or whatever db stuffs you wanna do
iccomq
@iccomq
Nov 23 2015 03:45

@PeterWRoss yes its like that. Lest make an array.

var awesomeArray  = ['this', 1, 'ís', 'good', true];

you have 2 strings, a number and a boolean in here.
'this' has index 0, 1 has index 1, 'is' has index 2, and true has index 4.
you can access all of this by its indexes

Sharon
@srinky4730
Nov 23 2015 03:47

Need help with sizing images. I can't get it to work. I'm not sure where to put the 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;
}
</style>

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

<style> .smaller-image {width: 100px;}
<img src="https://bit.ly/fcc-relaxing-cat"></style>

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

iccomq
@iccomq
Nov 23 2015 03:47

so lets say you want to print out 'good' in the console. You can write

console.log(awesomeArray[3]);

@PeterWRoss

Robert Richey
@0x0936
Nov 23 2015 03:48

@marhyorh I get undefined when printing out the result from .find()

var parrots = db.collection("parrots");
parrots.find().toArray(function(err, docs) {
  console.log(docs);
});

Does this look OK so far?

with no arg to find, it should retrieve all documents
Hans van Riet
@hansinla
Nov 23 2015 03:49
@m-farooqui are you okay or do you still have problems
Ademola Adegbuyi
@ooade
Nov 23 2015 03:53
@0x0936 yeah, looks good
Robert Richey
@0x0936
Nov 23 2015 03:55
alright, thanks @marhyorh . were you able to complete learnyoumongo?
CamperBot
@camperbot
Nov 23 2015 03:55
0x0936 sends brownie points to @marhyorh :sparkles: :thumbsup: :sparkles:
:star: 345 | @marhyorh | http://www.freecodecamp.com/marhyorh
iccomq
@iccomq
Nov 23 2015 03:57
good night guys!
Robert Richey
@0x0936
Nov 23 2015 03:57
good night @iccomq
Ademola Adegbuyi
@ooade
Nov 23 2015 03:58
@0x0936 Yeah
@iccomq its 4:58 AM here, LOL
Robert Richey
@0x0936
Nov 23 2015 03:59
@marhyorh did you have any trouble with step 3, 'Find'? Any idea why when printing docs, it's undefined?
Ademola Adegbuyi
@ooade
Nov 23 2015 04:03
@0x0936 No, do u av mongo process running on a separate terminal?
Robert Richey
@0x0936
Nov 23 2015 04:03
@marhyorh fixed the issue. db.close() must be inside a callback, like toArray, because opening the db is async. console.log is now logging the one document I need
Ademola Adegbuyi
@ooade
Nov 23 2015 04:04
Okay, cool
Peter W Ross
@PeterWRoss
Nov 23 2015 04:15

Had to grab a brew sorry @iccomq ... In this code you posted earlier

var awesomeArray  = ['this', 1, 'ís', 'good', true];

Why does true = index of four

Ademola Adegbuyi
@ooade
Nov 23 2015 04:16
@PeterWRoss indexes start from the count of 0
So, the fifth element, the fourth index
hewhomust
@hewhomust
Nov 23 2015 04:30
Hey could someone please tell me how to paste the formatted code.
Ademola Adegbuyi
@ooade
Nov 23 2015 04:30
wiki format
CamperBot
@camperbot
Nov 23 2015 04:30

:point_right: code format [wiki]

Inline code

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 ⏎]

How to Code

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

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

hewhomust
@hewhomust
Nov 23 2015 04:30
ok thanks
Peter W Ross
@PeterWRoss
Nov 23 2015 04:33
makes sense @marhyorh
thanks @marhyorh
CamperBot
@camperbot
Nov 23 2015 04:33
peterwross sends brownie points to @marhyorh :sparkles: :thumbsup: :sparkles:
:warning: peterwross already gave marhyorh points
Lynette
@Spitfire999
Nov 23 2015 04:34
Can anyone help me correct a problem on Waypoint: Use an ID Attribute to Style an Element
Coby Benveniste
@daVinciCEB
Nov 23 2015 04:36
@Spitfire999 What part of the Waypoint are you having trouble with?
Lynette
@Spitfire999
Nov 23 2015 04:37
Use an ID Attribute to Style an Element
hewhomust
@hewhomust
Nov 23 2015 04:37
I'm solving Waypoint: Filter Arrays with filter and have no idea why the code below does is not accepted. I have to remove all elements of oldArray greater than 5.
var oldArray = [1,2,3,4,5,6,7,8,9,10];

// Only change code below this line.

var newArray = oldArray.filter(function(val) {
  return val < 5;  
});
// Only change code above this line.

(function() { return newArray; })();
Ademola Adegbuyi
@ooade
Nov 23 2015 04:38
@Spitfire999 for id , we use the # symbol like #myDiv
Lynette
@Spitfire999
Nov 23 2015 04:38

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

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


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

.smaller-image {
width: 100px;
}

.gray-background {
background-color: gray;
}
</style>

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

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

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

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

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

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

Coby Benveniste
@daVinciCEB
Nov 23 2015 04:39
@Spitfire999 You need to define the img with an id attribute
Peter W Ross
@PeterWRoss
Nov 23 2015 04:39
var ourArray = [1,2,3];

ourArray[1] = 3; // ourArray now equals [1,3,3].

var myArray = [1,2,3];

// Only change code below this line.

myArray = 

// Only change code above this line.
Any help on this one?
Coby Benveniste
@daVinciCEB
Nov 23 2015 04:39
@Spitfire999 sorry not the image the form
hewhomust
@hewhomust
Nov 23 2015 04:40
PeterWRoss what are you doing?
What's the task?
Coby Benveniste
@daVinciCEB
Nov 23 2015 04:40
@Spitfire999 Your id in the CSS is defined as #cat-photo-element, but in the form, it’s id is cat-photo-form
Ademola Adegbuyi
@ooade
Nov 23 2015 04:40
@hewhomust return val < 5; should be return val <= 5;
hewhomust
@hewhomust
Nov 23 2015 04:41
weird it didn't specify equality, thanks.
Lynette
@Spitfire999
Nov 23 2015 04:42
oh... great!
@daVinciCEB thanks!
CamperBot
@camperbot
Nov 23 2015 04:42
spitfire999 sends brownie points to @davinciceb :sparkles: :thumbsup: :sparkles:
:star: 75 | @davinciceb | http://www.freecodecamp.com/davinciceb
Ademola Adegbuyi
@ooade
Nov 23 2015 04:42
@PeterWRoss ourArray[1] changes the value of ourArray index of 1 to 3 so do the same for myArray
Peter W Ross
@PeterWRoss
Nov 23 2015 04:42

@hewhomust Waypoint: Modify Array Data With Indexes
We can also modify the data stored in arrays by using indexes.

For example:

var ourArray = [3,2,1];

ourArray[0] = 1; // equals [1,2,1]

Now modify the data stored at index 0 of myArray to the value of 3.

for got about that part
Ademola Adegbuyi
@ooade
Nov 23 2015 04:43
Yeah
@PeterWRoss call myArray 0 index and set the value to 3
MIN
@una720302
Nov 23 2015 04:45
question====>The firstLetterOfLastName variable should have the value of L. how should i do with this? help and please. Thank you.
Peter W Ross
@PeterWRoss
Nov 23 2015 04:45
@una720302 post task
and the rest of code
@marhyorh i need to understand it in a simpler way.. maybe I should say this..
Waypoint: Access Array Data with Indexes
We can access the data inside arrays using indexes.

Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array.

For example:

var array = [1,2,3];

array[0]; //equals 1

var data = array[1];

Create a variable called myData and set it to equal the first value of myArray.

  Run tests (ctrl + enter)
  Reset      Help      Bug

"myArray = [1,2,3], myData = 1"

The variable myData should equal the first value of myArray.


1
var ourArray = [1,2,3];
2
​
3
var ourData = ourArray[0]; // equals 1
4
​
5
var myArray = [1,2,3];
6
​
7
// Only change code below this line.
89
myData = myArray[0];
10
// Only change code above this line.
1112
if(typeof(myArray) !== "undefined" && typeof(myData) !== "undefined"){(function(y,z){return 'myArray = ' + JSON.stringify(y) + ', myData = ' + JSON.stringify(z);})(myArray, myData);}
13
​
Ademola Adegbuyi
@ooade
Nov 23 2015 04:46
@una720302 "Marhyorh"[0] returns "M"
Peter W Ross
@PeterWRoss
Nov 23 2015 04:46
why is var array= 1,4,4
Logan Bickmore
@loganbickmore
Nov 23 2015 04:47
@PeterWRoss where do you see that?
Peter W Ross
@PeterWRoss
Nov 23 2015 04:48
one second
im sorry type... var array= 1,3,3
Shinis
@Shinis
Nov 23 2015 04:49
Hey, I'm new here could some one explain bonfire truncate a string proble, I dont understand why "A-tisket a-tasket A green and yellow basket" returns "A-tisket..." which is one word to my understanding but "Peter Piper picked a peck of pickled peppers" returns "Peter Piper..." two words?
Anne Swedberg
@sweann
Nov 23 2015 04:49
Problem: Waypoint: Change Text Inside an Element Using jQuery. I cannot get past this onel My code: $("#target4").html("<i>target4</i>"); Keep getting error: Make sure the text is otherwise unchanged.
MIN
@una720302
Nov 23 2015 04:51

where should i put===>var firstLetterOfFirstName = "";
var firstLetterOfLastName = "L";

var firstName = "Ada";

firstLetterOfFirstName = firstName[0];

var lastName = "Lovelace";

firstLetterOfLastName = lastName;

// Only change code above this line.

(function(v){return v;})(firstLetterOfLastName);

Peter W Ross
@PeterWRoss
Nov 23 2015 04:51
missing css class @sweann
Ademola Adegbuyi
@ooade
Nov 23 2015 04:51
@PeterWRoss look at this
<script type="text/javascript">
/** lets say we have an array called anime **/
var anime = ["Naruto","One Piece","Death Note","Bleach"];
anime[2] // returns Death Note
//At the same time, we can change that value to something else, for instance i wanna change it to Soul Eater 
anime[2] = "Soul Eater"; 
//so when anime is called it prints out  ["Naruto","One Piece","Soul Eater","Bleach"]; 
</script>
Peter W Ross
@PeterWRoss
Nov 23 2015 04:52
@una720302 first letter goes in between the comments (only change above this)(only change below)
what does the // returns mean again.. lol
I thought it was //equals
its a comment
Ademola Adegbuyi
@ooade
Nov 23 2015 04:54
@PeterWRoss yeah u got it
Peter W Ross
@PeterWRoss
Nov 23 2015 04:55
but what is // returns?
Ademola Adegbuyi
@ooade
Nov 23 2015 04:55
its a comment, typo
@PeterWRoss a comment wont execute
Peter W Ross
@PeterWRoss
Nov 23 2015 05:19
@marhyorh over thinking
var ourArray = [1,2,3];

ourArray[1] = 3; // ourArray now equals [1,3,3].

var myArray = [1,2,3];

// Only change code below this line.

myArray[0] =3; 
// Only change code above this line.
Now modify the data stored at index 0 of myArray to the value of 3.
myArray= [3,2,3] (now). then myArray[0].. the index value of myArray = 3
but last question.. (that is the right answer btw)... but, why does it say.. myArray "now equals 3,2,3"
hewhomust
@hewhomust
Nov 23 2015 05:27
Are you asking why it changed or why it's not in brackets?
The reason it's equal to [3,2,3] is because you changed the first element of the array to 3
Peter W Ross
@PeterWRoss
Nov 23 2015 05:30
ourArray1 first equaled 3.. .. Because ourArray1= 3;// ourArray now equals [1,3,3]?
ourArray[1]=3
type o
Mags Prescott
@magsprescott
Nov 23 2015 05:31
please
i need help with Waypoint: Style Text Inputs as Form Controls
Peter W Ross
@PeterWRoss
Nov 23 2015 05:31
whats the question and code?
Mags Prescott
@magsprescott
Nov 23 2015 05:32
can you tell me how to send the code here
hewhomust
@hewhomust
Nov 23 2015 05:32
wait what? ourArray used to equal [1,2,3] you then changed it to [1,3,3,] by replacing the second element of the array.
Ademola Adegbuyi
@ooade
Nov 23 2015 05:32
@PeterWRoss have u gotten it??
Mags Prescott
@magsprescott
Nov 23 2015 05:32
Waypoint: Style Text Inputs as Form Controls
Give the text input in your form the class form-control.
hewhomust
@hewhomust
Nov 23 2015 05:33
wiki format
CamperBot
@camperbot
Nov 23 2015 05:33

:point_right: code format [wiki]

Inline code

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 ⏎]

How to Code

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

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

James
@Andrale
Nov 23 2015 05:33
I have a question if anyone has a second
hewhomust
@hewhomust
Nov 23 2015 05:33
do the three ticks then copy the code
Mags Prescott
@magsprescott
Nov 23 2015 05:33
...
hewhomust
@hewhomust
Nov 23 2015 05:33
and paste inside
Mags Prescott
@magsprescott
Nov 23 2015 05:34
'''
CamperBot
@camperbot
Nov 23 2015 05:34
:bulb: to format code use backticks! ``` more info
Mags Prescott
@magsprescott
Nov 23 2015 05:34
...
Jatudrei
@Jatudrei
Nov 23 2015 05:34
I have a question about margins, if I may.
MIN
@una720302
Nov 23 2015 05:34
question===>
myArray should be an array.
The first item in myArray should be a string.
The second item in myArray should be a number.
hewhomust
@hewhomust
Nov 23 2015 05:35
press shift + enter then paste
@magsprescott
@una720302 do you know what a string is?
Mags Prescott
@magsprescott
Nov 23 2015 05:36
doesnt work..............
Peter W Ross
@PeterWRoss
Nov 23 2015 05:36
@hewhomust a group of words that make up data
string of data
Mags Prescott
@magsprescott
Nov 23 2015 05:36
guys help me with
Waypoint: Style Text Inputs as Form Controls
MIN
@una720302
Nov 23 2015 05:36
@hewhomust no
Mags Prescott
@magsprescott
Nov 23 2015 05:36
Give the text input in your form the class form-control.
Peter W Ross
@PeterWRoss
Nov 23 2015 05:36
@magsprescott the keyboard ,.. underneath your esc button top left
Jatudrei
@Jatudrei
Nov 23 2015 05:36
In Waypoint: Add Different Margins to Each Side of an Element, I am instructed to give a different margin to each side of a green box--surely by coincidence, these are the same margins that FCC has already given a red box in the same code. As I understand it, a margin instructs the computer how far to put the element with the margin (the green box, say) from the edge of the element in which it is nested (the yellow box, in this instance). Since the green and red boxes now have the same margins, I would expect them to take up the same space, with one obscuring the other. This does not happen. Why not?
Peter W Ross
@PeterWRoss
Nov 23 2015 05:36
hit that three times..
copy your code..
hit shit return
then hit it three more times ```
 from the edge of the element in which it is nested (the yellow box, in this instance). Since the green and red boxes now have the same margins, I would expect them to take up the same space, with one obscuring the other. This does not happen. Why not?
Mags Prescott
@magsprescott
Nov 23 2015 05:37
and then wat
Peter W Ross
@PeterWRoss
Nov 23 2015 05:37
then hit command enter
post the problem your having trouble with
Mags Prescott
@magsprescott
Nov 23 2015 05:38
    <button type="submit" class="btn btn-primary">Submit<i class="fa fa-paper-plane"></i></button>
Peter W Ross
@PeterWRoss
Nov 23 2015 05:38
what about it?
Mags Prescott
@magsprescott
Nov 23 2015 05:38
it says to "Give the text input in your form the class form-control."
hewhomust
@hewhomust
Nov 23 2015 05:38
@una720302 a string is an array of characters you enclose it in double quotes , "dog" is a string
Ademola Adegbuyi
@ooade
Nov 23 2015 05:39
@magsprescott didnt see a text input there
but this is how its done: <input type="text" class="form-control">
hewhomust
@hewhomust
Nov 23 2015 05:40
@una720302 so an example of an array where the first element is a string and the second element is a number is ["dog",4"]
woops ["dog",4]
Mags Prescott
@magsprescott
Nov 23 2015 05:41
thanks marhyorh you're a life saver
Ademola Adegbuyi
@ooade
Nov 23 2015 05:42
You're welcome
ravi-sai
@ravi-sai
Nov 23 2015 05:42

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

for(var i=0;i<array.length;i++){
var temp=array[i].toLowerCase();
temp[0]=temp.charAt(0).toUpperCase();
array[i]=temp;
}
str=array.join(' ');
return str;
}

titleCase("I'm a little tea pot");
What is the error?

The aim is to capitalize the first letter of every word and let the remaining letters be in lower case
hewhomust
@hewhomust
Nov 23 2015 05:45
@ravi-sai what result do you get?
Emily
@evmoore94
Nov 23 2015 05:45
Hey quick question, in the Javascript section should I be paying attention to the other parts of the code it doesn’t want me to change? Will it come in handy later or will i be taught it later?
Peter W Ross
@PeterWRoss
Nov 23 2015 05:46
var ourArray = [1,2,3];

var removedFromOurArray = ourArray.pop(); // removedFromOurArray now equals 3, and ourArray now equals [1,2]

var myArray = ["John", 23, ["cat", 2]];

// Only change code below this line.

var removedFromMyArray; .pop()[1];
// Only change code above this line.

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


the struggle is real with this one
Use the .pop() function to remove the last item from myArray, assigning the "popped off" value to removedFromMyArray.
ravi-sai
@ravi-sai
Nov 23 2015 05:46
all the test-cases have failed @hewhomust Only the return type of the function is correct.
Peter W Ross
@PeterWRoss
Nov 23 2015 05:47
var ourArray = [1,2,3];

var removedFromOurArray = ourArray.pop(); // removedFromOurArray now equals 3, and ourArray now equals [1,2]

var myArray = ["John", 23, ["cat", 2]];

// Only change code below this line.

var removedFromMyArray;

// Only change code above this line.

(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);
original code..
Use the .pop() function to remove the last item from myArray, assigning the "popped off" value to removedFromMyArray.
hewhomust
@hewhomust
Nov 23 2015 05:48
@evmoore94 you're probably going to learn about it at some point just keep going. If you're really interested you might want to look the stuff up though.
Peter W Ross
@PeterWRoss
Nov 23 2015 05:48
myArray[0] = .pop()
?
hewhomust
@hewhomust
Nov 23 2015 05:49
@PeterWRoss do you have an equals sign or a ; sign?
Peter W Ross
@PeterWRoss
Nov 23 2015 05:49
ahhh
ravi-sai
@ravi-sai
Nov 23 2015 05:49
@hewhomust Please tell the error in my code snippet
Matt Leonard
@matty22
Nov 23 2015 05:50
@PeterWRoss What's the question?
Peter W Ross
@PeterWRoss
Nov 23 2015 05:50
thanks @matty22 one second
CamperBot
@camperbot
Nov 23 2015 05:50
peterwross sends brownie points to @matty22 :sparkles: :thumbsup: :sparkles:
:star: 244 | @matty22 | http://www.freecodecamp.com/matty22
Peter W Ross
@PeterWRoss
Nov 23 2015 05:50
```
hewhomust
@hewhomust
Nov 23 2015 05:50
oh whoops sorry @PeterWRoss and pop() is a method so you do myArray.pop(0
pop()
Peter W Ross
@PeterWRoss
Nov 23 2015 05:50
var ourArray = [1,2,3];

var removedFromOurArray = ourArray.pop(); // removedFromOurArray now equals 3, and ourArray now equals [1,2]

var myArray = ["John", 23, ["cat", 2]];

// Only change code below this line.

var removedFromMyArray;

// Only change code above this line.

(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);
Matt Leonard
@matty22
Nov 23 2015 05:50
Yeah, make sure you are calling .pop() on an array like this myArray.pop();
Peter W Ross
@PeterWRoss
Nov 23 2015 05:50
Use the .pop() function to remove the last item from myArray, assigning the "popped off" value to removedFromMyArray.
\imi trying to get rid of the cat value
Matt Leonard
@matty22
Nov 23 2015 05:51
Whenever you see the word 'assign' you can be pretty sure that means to set something equal to
So we want to make removedFromMyArray equal to the last value of myArray. How might you do that?
Peter W Ross
@PeterWRoss
Nov 23 2015 05:52
you're a genius thanks
lol
removedFromMyarray=pop.();
Matt Leonard
@matty22
Nov 23 2015 05:53
The first half is ok var removedFromMyArray =
Peter W Ross
@PeterWRoss
Nov 23 2015 05:53
var removedFromMyArray= myArray.pop();
Ademola Adegbuyi
@ooade
Nov 23 2015 05:53
This message was deleted
Matt Leonard
@matty22
Nov 23 2015 05:53
There ya go!
Peter W Ross
@PeterWRoss
Nov 23 2015 05:53
@thanks again
CamperBot
@camperbot
Nov 23 2015 05:53
peterwross sends brownie points to @thanks :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for thanks
Ademola Adegbuyi
@ooade
Nov 23 2015 05:53
Yeah
Matt Leonard
@matty22
Nov 23 2015 05:54
Just remember that you can't call a method (things like .pop()) on nothing. They have to be called on a string, array, object, etc.
hewhomust
@hewhomust
Nov 23 2015 05:57
@ravi-sai strings are immutable in javascript
ravi-sai
@ravi-sai
Nov 23 2015 05:57
@hewhomust thank you
CamperBot
@camperbot
Nov 23 2015 05:57
ravi-sai sends brownie points to @hewhomust :sparkles: :thumbsup: :sparkles:
:star: 183 | @hewhomust | http://www.freecodecamp.com/hewhomust
Peter W Ross
@PeterWRoss
Nov 23 2015 05:58
when you say "call a mehtod on nothing" what do you mean exactly.. what would be an example of "calling a method on nothing"..
MIN
@una720302
Nov 23 2015 06:01
@hewhomust thank you so much.
CamperBot
@camperbot
Nov 23 2015 06:01
una720302 sends brownie points to @hewhomust :sparkles: :thumbsup: :sparkles:
:star: 184 | @hewhomust | http://www.freecodecamp.com/hewhomust
MIN
@una720302
Nov 23 2015 06:01
question=====>The variable myData should equal the first value of myArray.
Ademola Adegbuyi
@ooade
Nov 23 2015 06:01
This message was deleted
Matt Leonard
@matty22
Nov 23 2015 06:03
Calling a method on nothing might be like var removedFromMyArray = .pop(); That isn't valid code because you have called a method incorrectly.
Peter W Ross
@PeterWRoss
Nov 23 2015 06:03
lol.. which is what i am doing as we speak
```
var ourArray = ["Stimpson", "J", ["cat"]];

removedFromOurArray = ourArray.shift(); // removedFromOurArray now equals "Stimpson" and ourArray now equals ["J", ["cat"]].

var myArray = ["John", 23, ["dog", 3]];

// Only change code below this line.

var removedFromMyArray;

// Only change code above this line.

pop() always removes the last element of an array. What if you want to remove the first?

That's where .shift() comes in. It works just like .pop(), except it removes the first element instead of the last.

Use the .shift() function to remove the first item from myArray, assigning the "shifted off" value to removedFromMyArray.

Matt Leonard
@matty22
Nov 23 2015 06:05
So you want to remove the first item from myArray, so that's the variable you want to call the method on.
Peter W Ross
@PeterWRoss
Nov 23 2015 06:05
var removedFromMyArray[0]= .shift();
we want to move out John
Matt Leonard
@matty22
Nov 23 2015 06:05
No need for the [0]
Peter W Ross
@PeterWRoss
Nov 23 2015 06:05
which is index 0
Matt Leonard
@matty22
Nov 23 2015 06:05
.shift() takes out index 0 already, you don't have to tell it what to take out
You want to remove the first index from myArray, so you should call .shift() on myArray
Peter W Ross
@PeterWRoss
Nov 23 2015 06:06
do i have to "assign" var removedFromMyArray to .dshift
myArray= .shift();
?
Matt Leonard
@matty22
Nov 23 2015 06:07
Hmm...trying to think of a way to make this clearer.
Peter W Ross
@PeterWRoss
Nov 23 2015 06:07
right because removedFromMyArray is just asking it to list what was already removed
Matt Leonard
@matty22
Nov 23 2015 06:07
removedFromMyArray is empty at the moment.
myArray contains ["John", 23, ["dog", 3]]
Peter W Ross
@PeterWRoss
Nov 23 2015 06:08
it shoudl be though... because the action is shift right?
im listening
lol
Matt Leonard
@matty22
Nov 23 2015 06:08
Forget about assigning the value at the moment. We want to call shift on myArray. How do we do that?
Peter W Ross
@PeterWRoss
Nov 23 2015 06:09
myArray= .shift();
?
Matt Leonard
@matty22
Nov 23 2015 06:09
No equal sign
Peter W Ross
@PeterWRoss
Nov 23 2015 06:09
why one for pop but not for shift
?
Matt Leonard
@matty22
Nov 23 2015 06:10
There wasn't one for .pop() there
Mags Prescott
@magsprescott
Nov 23 2015 06:10
hello
need help
Matt Leonard
@matty22
Nov 23 2015 06:10
So you have myArray.shift(); right?
Mags Prescott
@magsprescott
Nov 23 2015 06:10
i dont know what im doing wrong
Krzysiek
@krzyszczep
Nov 23 2015 06:10
hello :smile:
David Hignett
@hignatious
Nov 23 2015 06:10
@magsprescott whats up?
Mags Prescott
@magsprescott
Nov 23 2015 06:10
<div class="container-fluid">
  <h3 class="text-primary text-center">jQuery Playground</h3>
  <div class="row">
<div class="col-xs-6">
 <div class="col-xs-6">

  </div>
</div>
  </div>
</div>
"Nest two div class="col-xs-6" elements within your div class="row" element."
Peter W Ross
@PeterWRoss
Nov 23 2015 06:11
still listening @matty22 \
Mags Prescott
@magsprescott
Nov 23 2015 06:11
what am i doing wrong..
Rex Schrader
@SaintPeter
Nov 23 2015 06:11
@magsprescott They need to be siblings, not children of one another
Matt Leonard
@matty22
Nov 23 2015 06:11
We want var removedFromMyArray to be assigned the value of myArray.shift() so how can you do that?
Rex Schrader
@SaintPeter
Nov 23 2015 06:11
@magsprescott
<div class="col-xs-6"></div>
<div class="col-xs-6"></div>
MIN
@una720302
Nov 23 2015 06:11
help please.========>The variable myData should equal the first value of myArray.
CamperBot
@camperbot
Nov 23 2015 06:11
no wiki entry for: pleasethe variable mydata should equal the first value of myarray
:pencil: click here to create one now!after creating your page type update to reload it here
Rex Schrader
@SaintPeter
Nov 23 2015 06:12
@magsprescott The columns, that is
Krzysiek
@krzyszczep
Nov 23 2015 06:12

how can i understand this?

Your p element should contain the first few words of the provided additional kitty ipsum text.

Mags Prescott
@magsprescott
Nov 23 2015 06:12
ok got it
thanks Peter
SaintPeter @SaintPeter bows
David Hignett
@hignatious
Nov 23 2015 06:12
@una720302 you haven't really provided enough information for anyone to help you
Peter W Ross
@PeterWRoss
Nov 23 2015 06:12
let me talk it out @matty22
Matt Leonard
@matty22
Nov 23 2015 06:13
Sure, go for it!
Peter W Ross
@PeterWRoss
Nov 23 2015 06:13
so.. we're saying . var removedFromMyArray=(John) which equals the index of [0]
correct?
MIN
@una720302
Nov 23 2015 06:13
@hignatious question======>The variable myData should equal the first value of myArray.
Matt Leonard
@matty22
Nov 23 2015 06:13
Yeah, that's what we want.
Krzysiek
@krzyszczep
Nov 23 2015 06:14
ok, got it
David Hignett
@hignatious
Nov 23 2015 06:14
@una720302 that's not a question
Peter W Ross
@PeterWRoss
Nov 23 2015 06:14
when the shift method occurs.. do we want to define the new value of 0? which would be..
[23]
MIN
@una720302
Nov 23 2015 06:14
========>Create a variable called myData and set it to equal the first value of myArray.
Matt Leonard
@matty22
Nov 23 2015 06:14
Nope. When you shift() an array, it automatically moves everything done 1 index. So you don't have to worry about that at all.
down*
down 1 index*
Peter W Ross
@PeterWRoss
Nov 23 2015 06:15
so now [0]=23
i understand the concept.. just not sure what I am supposed to write in code
Matt Leonard
@matty22
Nov 23 2015 06:15
Correct
Peter W Ross
@PeterWRoss
Nov 23 2015 06:16
There is a code that you write that is basically telling Javascript to omit the first data value of the index and replace it with the second one (bump everything down)
(to the left)... just not sure how you write the command
MIN
@una720302
Nov 23 2015 06:16
@hignatious question=======> Create a variable called myData and set it to equal the first value of myArray. my code======> var myData = myArray1;
Matt Leonard
@matty22
Nov 23 2015 06:16
It isn't omitting the value, it's removing it from the array.
David Hignett
@hignatious
Nov 23 2015 06:16
@una720302 var myData = myArray[0]
array indexes start counting at zero
Matt Leonard
@matty22
Nov 23 2015 06:17
So let me write up an example: hold tight for a few seconds.
Peter W Ross
@PeterWRoss
Nov 23 2015 06:17
omit ... subtraction ?
go ahead
MIN
@una720302
Nov 23 2015 06:17
i got it and thank you @hignatious
CamperBot
@camperbot
Nov 23 2015 06:17
una720302 sends brownie points to @hignatious :sparkles: :thumbsup: :sparkles:
:star: 28 | @hignatious | http://www.freecodecamp.com/hignatious
David Hignett
@hignatious
Nov 23 2015 06:18
cool
Matt Leonard
@matty22
Nov 23 2015 06:18
var mattysArray = [1, 2, 3, 4, 5];

var takeOneAway = mattysArray.shift();

After this code runs:

mattysArray would contain [2, 3, 4, 5] and takeOneAway would contain [1]

Peter W Ross
@PeterWRoss
Nov 23 2015 06:19
i totally get it..
Mason Shin
@minsooshin
Nov 23 2015 06:19
this link will help you to understand how the javascript shiftworks
Peter W Ross
@PeterWRoss
Nov 23 2015 06:20
i definitely get it.. just not sure what its asking me to write..
wait a second
Matt Leonard
@matty22
Nov 23 2015 06:21
Look at my example code and just overlay it to the question's code. It should make sense.
Mags Prescott
@magsprescott
Nov 23 2015 06:22
please dont judge me but how do you do button elements....
you guyss
i forgot okayy
Peter W Ross
@PeterWRoss
Nov 23 2015 06:23
punctuation error... i had that answer 20 minutes ago
Mason Shin
@minsooshin
Nov 23 2015 06:23
@magsprescott your question is not clear...
Peter W Ross
@PeterWRoss
Nov 23 2015 06:23
lol
thanks @minsooshin and @matty22
CamperBot
@camperbot
Nov 23 2015 06:24
peterwross sends brownie points to @minsooshin and @matty22 :sparkles: :thumbsup: :sparkles:
:warning: peterwross already gave matty22 points
:star: 273 | @minsooshin |