These are chat archives for FreeCodeCamp/Help

17th
Jan 2016
DevPoetsSociety
@DevPoetsSociety
Jan 17 2016 00:04
@Spatzerny Try us
Preston Porter
@code7777
Jan 17 2016 00:08
@ItsMuse yea Im thinking about redoing jQuery maybe ... I'm having trouble with one of my ziplines im working on right now
i would suggest making a codepen and practicing even before the ziplines
Avery Lucas
@ItsMuse
Jan 17 2016 00:09
@code7777 I would, but I have no idea what it would be sadly. :(
Devin Alvaro
@devinalvaro
Jan 17 2016 00:10
@cannelflow thanks for your help, but background-size: cover is what I need
CamperBot
@camperbot
Jan 17 2016 00:10
devinalvaro sends brownie points to @cannelflow :sparkles: :thumbsup: :sparkles:
:star: 429 | @cannelflow | http://www.freecodecamp.com/cannelflow
Devin Alvaro
@devinalvaro
Jan 17 2016 00:10
@marhyorh thank you it works!
CamperBot
@camperbot
Jan 17 2016 00:10
devinalvaro sends brownie points to @marhyorh :sparkles: :thumbsup: :sparkles:
:star: 533 | @marhyorh | http://www.freecodecamp.com/marhyorh
Richard
@RichardGTech
Jan 17 2016 00:11
I need a bit of help

<<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 font-family: 'Lobster'; 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>

I imported the Lobster font but my font is not working so I can't proceed
Spatz
@Spatzerny
Jan 17 2016 00:13
@DevPoetsSociety i'm trying to create this ribbon-like header, but i'm struggling with the height of the background ribbons
because im tring to do it without js
Jia Shern Tan
@saffront
Jan 17 2016 00:13
@ProfessorMagus you can't style h2 like that, you have to put it in your style tag like your p tag
Richard
@RichardGTech
Jan 17 2016 00:13
ok, and how would I approach that, it's been a little bit since I've done this stuff
Jia Shern Tan
@saffront
Jan 17 2016 00:14
@ProfessorMagus do what you did for p but replace with h2, remove font size and replace monospace with lobster. remove the font-family part in your html
R.Raul
@Lalux
Jan 17 2016 00:15
So i need a bit of help here... I watched it for like 10 minutes i don't get what i do wrong

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

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

h2 {
font-family: Lobster, Monospace;
}

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

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

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

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

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

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

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

---> (point) :Your p element should have the text "View more " (with a space after it).
that point i can't do it
DevPoetsSociety
@DevPoetsSociety
Jan 17 2016 00:16
@Spatzerny Yeah, I haven't tackled that one yet.
Spatz
@Spatzerny
Jan 17 2016 00:17
@DevPoetsSociety i imagine i'll be using queries anyway, but it's something i dont know how to do and it bothers me and i believe it should bother me and grrrrrr
Richard
@RichardGTech
Jan 17 2016 00:19
It says the p element should still use the font Monospace
R.Raul
@Lalux
Jan 17 2016 00:21
This message was deleted
Jia Shern Tan
@saffront
Jan 17 2016 00:21
@ProfessorMagus yes.. don't delete the p part in your style, just add h2 in that section
Richard
@RichardGTech
Jan 17 2016 00:23
I got it! :D

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

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

Conrad Bogus
@ConradBo
Jan 17 2016 00:30
Question: if I want to index an array an array minus the first item [0], what do I type? i.e. [1-]
Jia Shern Tan
@saffront
Jan 17 2016 00:31
@ConradBo you want to remove the first element of an array? use .shift();
ObradovicM
@ObradovicM
Jan 17 2016 00:33
Hello all! One question: I want to nest text input element within a form element
<form action="/submit-cat-photo">
<input type="text" placeholder="cat photo URL">
</form>
but this doesn't work
Conrad Bogus
@ConradBo
Jan 17 2016 00:33
I meant something like: everything except the first element in the array.
Cathy
@Cortellc
Jan 17 2016 00:34
Hey everyone! I have been trying to find the error in my code but I can't seem to find it. The image previewed is effected by my code and is small but the assignment wont check off that the image is actually 100 px.
Conrad Bogus
@ConradBo
Jan 17 2016 00:34
@saffront
Cathy
@Cortellc
Jan 17 2016 00: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;
}
.smaller-image {
width: 100px;
}
</style>

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

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

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

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

peluhovskiy
@peluhovskiy
Jan 17 2016 00:34
@ConradBo add 1 to all indexes
Avery Lucas
@ItsMuse
Jan 17 2016 00:34
Nice! I wont say how I solved the 'Find the Longest Word in a String' bondfire
But I will say it felt good to use something I hadnt used yet. haha
Jia Shern Tan
@saffront
Jan 17 2016 00:35
Avery Lucas
@ItsMuse
Jan 17 2016 00:36
@saffront thats a neat method. Does it work on fcc too?
peluhovskiy
@peluhovskiy
Jan 17 2016 00:36
@ConradBo or start the loop from 1, not 0
Jia Shern Tan
@saffront
Jan 17 2016 00:36
@ItsMuse yeah, it's a js method, nothing external
Conrad Bogus
@ConradBo
Jan 17 2016 00:37
@saffront @peluhovskiy thnx
CamperBot
@camperbot
Jan 17 2016 00:37
conradbo sends brownie points to @saffront and @peluhovskiy :sparkles: :thumbsup: :sparkles:
:star: 260 | @saffront | http://www.freecodecamp.com/saffront
:star: 286 | @peluhovskiy | http://www.freecodecamp.com/peluhovskiy
Avery Lucas
@ItsMuse
Jan 17 2016 00:37
@saffront awesome. Reminds me of the C# command... substring(0, 3)
Jia Shern Tan
@saffront
Jan 17 2016 00:37
@ItsMuse ye, there's the substr method as well which works similar
@ObradovicM it's already nested. What're you trying to achieve?
Avery Lucas
@ItsMuse
Jan 17 2016 00:41
@saffront yep.. Will def go there more often.
Cathy
@Cortellc
Jan 17 2016 00:47
NVM my code was right, I just needed to open it in a new browser.
Conrad Bogus
@ConradBo
Jan 17 2016 00:52
how do I index and remove a letter from a string? (without turning the string into an array)
Elifaz Filho
@Elifaz
Jan 17 2016 00:54
Who wants to do pair Programing for the intermediate Bonfires?
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 00:57
Hi All anyone can help me how to check the property of an object?
blob
So far I have written only the first if statement of this challenge to check the firstName.
//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    },
];


function lookUp(firstName, prop){
// Only change code below this line

  if(firstName === "firstName"){

    return contacts.firstName;

  }else if(prop === "prop"){

    return contacts.
  }

// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");
Avery Lucas
@ItsMuse
Jan 17 2016 01:03
hasOwnProperty(arg 1);
@HaroonGhawsi
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 01:04
ok
Nick Robson
@nickrobson
Jan 17 2016 01:06
What you want to do is to iterate through each one, and check if the firstName property is the same as the firstName variable. Then you just need to return that contact's prop property.
And you don't want Object#hasOwnProperty. That doesn't get the property; it gets if it has that property.
You've already been shown how to retrieve an object's property: object["property name"] or object.property
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 01:11
@nickrobson the property name will be invoked by the function call, so I can't specify the property name in my function.
This is how I have done yet.
//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    },
];


function lookUp(firstName, prop){
// Only change code below this line

  if(firstName === "firstName"){

    return contacts[0];

  }else if(prop === "prop"){

    for(i=0; i<contacts.length; i++){
      return contacts[i].hasOwnProperty(prop);
    }
  }


// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");
i think for loop is needed for this challenge.
Nick Robson
@nickrobson
Jan 17 2016 01:19
You do need a for-loop but not there.
Try iterating over the contacts array before you go into any if-statements, and put your if-statements in there.
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 01:22
sure.
tommy
@tommygebru
Jan 17 2016 01:26
@HaroonGhawsi
Your code above shows that it may pass true for the sample test
lookUp("Akira","likes");
however you wont be able to access other contacts and pass other sample test
placing the loop on the outside of the if statement solves this
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 01:27
function lookUp(firstName, prop){
// Only change code below this line

 for(i = 0; i < contacts.length; i++){
   for(j = 0; j < contacts.length; j++){
     firstName = contacts.firstName[i];
     prop = contacts[j];
   }

   if(firstName === contacts.firstName){
       return contacts.firstName;

   }else if(prop === contacts{}){
     return prop;
   }
 }


// Only change code above this line
}
@tommygebru I have tried this code until now
tommy
@tommygebru
Jan 17 2016 01:28
@HaroonGhawsi for now lets try using one for loop
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 01:28
ok
@tommygebru, I am trying the code below ```
function lookUp(firstName, prop){
// Only change code below this line

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

   firstName = contacts.firstName[i];
 }


// Only change code above this line
}
tommy
@tommygebru
Jan 17 2016 01:33

@HaroonGhawsi
lets put this code in an if statement

firstName = contacts.firstName[i];

@ConradBo How are you doing :satisfied:
@Elifaz is intermediate different from the first bonfires :smile:
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 01:37
@tommygebru
function lookUp(firstName, prop){
// Only change code below this line

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

   if(firstName === contacts.firstName[i]){

     return contacts[firstName];
 }

}
Rae
@cs-knight
Jan 17 2016 01:38
trying to add pink text to h1 element
<style>
  body {
    background-color: black;
    font-family: Monospace;
    color: green;
    color: pink;
  }
</style>
<h1>Hello World!</h1>
tommy
@tommygebru
Jan 17 2016 01:39
@csrae I imagine that they want a pink text class?
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 01:40
@csrae you have to write in your code as h1 { color: pink;}
Nick Robson
@nickrobson
Jan 17 2016 01:41
@HaroonGhawsi You need to return contacts[i][prop].
Currently you're trying to get the value in the array that is at index firstName (which obviously doesn't exist since firstName is a string, not a number).
Rae
@cs-knight
Jan 17 2016 01:42
like this?
<style>
  body {
    background-color: black;
    font-family: Monospace;
    color: green;    
  }
  h1 {
    color: pink;
  }
</style>

<h1>Hello World!</h1>
Nick Robson
@nickrobson
Jan 17 2016 01:42

Likewise, you're wanting the first name of the i-th contact, so you want to check against

contacts[i].firstName

Instead of what you've currently got.

Yes, that should do it. :shipit:
Unless they want a class called pink-text or similar, in which case you want to change h1 to
.pink-text
Rae
@cs-knight
Jan 17 2016 01:44
@nickrobson thanks
CamperBot
@camperbot
Jan 17 2016 01:44
csrae sends brownie points to @nickrobson :sparkles: :thumbsup: :sparkles:
:star: 265 | @nickrobson | http://www.freecodecamp.com/nickrobson
Nick Robson
@nickrobson
Jan 17 2016 01:45
np
tommy
@tommygebru
Jan 17 2016 01:45
@HaroonGhawsi
your if condition should check if
firstName===contacts[i].firstName
parameter is equal to (array's index for the objects property firstName)
Rae
@cs-knight
Jan 17 2016 01:45
like this?
<style>
  body {
    background-color: black;
    font-family: Monospace;
    color: green;    
  }
  .pink-text {
    color: pink;
  }
</style>

<h1>Hello World!</h1>
Nick Robson
@nickrobson
Jan 17 2016 01:45
@HaroonGhawsi @tommygebru
i.e.
if (firstName === contacts[i].firstName)
Yeah. That should do it.
Rae
@cs-knight
Jan 17 2016 01:46
the h1 element didn't change color though
Nick Robson
@nickrobson
Jan 17 2016 01:46
In CSS and JQuery, the syntax for class selection is:
.[class-name]
tommy
@tommygebru
Jan 17 2016 01:46
@HaroonGhawsi
then you want to return
the same thing in the if condition
Nick Robson
@nickrobson
Jan 17 2016 01:46
You need to add the pink-text class to it.
tommy
@tommygebru
Jan 17 2016 01:46

@csrae in brackets tho {}
css
.something{property:value;}
html references css

<html class="something"> this is something else</html>

Nick Robson
@nickrobson
Jan 17 2016 01:46
i.e.
<h1 class="pink-text">Hello World!</h1>
That tells the browser that your h1 element is of class pink-text so it will apply the pink-text CSS to it.
tommy
@tommygebru
Jan 17 2016 01:49
@HaroonGhawsi how are you doing?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 01:49
Hey guys, would array[0-9} work to select the 1st to 10th index of an array?
Chris
@Aoxom
Jan 17 2016 01:50
@CodingDucky no i dont think so
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 01:51
How would I 'select' (not sure if that's the right word for it) everything in an array except for the first element of it?
tommy
@tommygebru
Jan 17 2016 01:51
@CodingDucky {0-9} or [0-9] also what are you working on regex?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 01:52
also thanks @Aoxom
CamperBot
@camperbot
Jan 17 2016 01:52
codingducky sends brownie points to @aoxom :sparkles: :thumbsup: :sparkles:
:star: 392 | @aoxom | http://www.freecodecamp.com/aoxom
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 01:52
And I'm working on the Title Case a Sentence waypoint
Chris
@Aoxom
Jan 17 2016 01:53
i imagine youd do a for(var i = 1; i < array.length; i++) loop, which will start at the second item in the array, and keep going to the end of the array
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 01:53
So I've already done the capitalisation of every letter in the sentence
tommy
@tommygebru
Jan 17 2016 01:53
@CodingDucky If you are looking to remove the first element or value form an array remember that an array begins at 0 not 1
Nick Robson
@nickrobson
Jan 17 2016 01:53
@CodingDucky To get the first 10 elements, use array.slice(0, 9)
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 01:53

function titleCase(str) {
str = str.split(' ');
for (var i = 0; i <= str.length - 1; i++){
str[i] = str[i].split('');
str[i][0] = str[i][0].toUpperCase();
str[i] = str[i].join('');
}

return str.join(' ');
}

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

Nick Robson
@nickrobson
Jan 17 2016 01:53
That will give you a new array with the first 10 elements.
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 01:53
and thanks @nickrobson
CamperBot
@camperbot
Jan 17 2016 01:53
codingducky sends brownie points to @nickrobson :sparkles: :thumbsup: :sparkles:
:star: 266 | @nickrobson | http://www.freecodecamp.com/nickrobson
Chris Zuber
@shgysk8zer0
Jan 17 2016 01:53
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 01:54
@tommygebru still struglling. just tried contacts.firstName.
Chris
@Aoxom
Jan 17 2016 01:54
ohh i misunderstood what you were trying to do @CodingDucky , so forget what i said
Nick Robson
@nickrobson
Jan 17 2016 01:54
@shgysk8zer0 No! slice, not splice! Slice gets a section, splice adds and removes items!
@CodingDucky Sorry, I meant array.slice(0, 10). (0, 9) will only get the first 9.
Chris Zuber
@shgysk8zer0
Jan 17 2016 01:56
Not what I meant to put. What I get for mild carelessness.
Nick Robson
@nickrobson
Jan 17 2016 01:57
Hehe :)
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 01:58
function titleCase(str) {
  str = str.split(' ');
  for (var i = 0; i <= str.length - 1; i++){
    str[i] = str[i].split('');
    str[i][0] = str[i][0].toUpperCase();
    for (var o = 1; i < str.length; i++){
      str[i][o] = str[i][o].toLowerCase();
    }
    str[i] = str[i].join('');
  }

  return str.join(' ');
}

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

This returns the TypeError: undefined is not an object (evaluating 'str[i][o].toLowerCase;'

What does that even mean?

NormalWare
@Centuriom
Jan 17 2016 01:58
Hello guys! it's just me or FCC changed it's background color ?
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 01:58
@nickrobson ```
function lookUp(firstName, prop){
// Only change code below this line

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

   if(firstName === contacts[i].firstName){

     return contacts.firstName;
 }

}


// Only change code above this line
}
There is no error. it seems it worked.
Abdul Awali
@awalthefirst
Jan 17 2016 01:59
@Centuriom not u
Nick Robson
@nickrobson
Jan 17 2016 01:59
The return statement is wrong. You need to return the prop property of the contacts[i] object.
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 01:59
@nickrobson but there is no indication
Nick Robson
@nickrobson
Jan 17 2016 01:59
(and if that doesn't exist, you need to return "No such property")
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 02:00
@nickrobson yup. it worked. One error solved.
@nickrobson I think I have to do the same thing for prop.
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:01
someone help
cannelflow
@cannelflow
Jan 17 2016 02:01
@Centuriom yes
Nick Robson
@nickrobson
Jan 17 2016 02:02
@HaroonGhawsi Inside the if-statement, you want to return
if (contacts[i].hasOwnProperty(prop))
    return contacts[i][prop];
else
    return "No such property";
That will check if the contact has the given property, and:
  • if it does, return the value at that property
  • if it doesn't, return "No such property"
tommy
@tommygebru
Jan 17 2016 02:02

@nickrobson :+1:
oops the instructions were

If both are true, then return the "value" of that property.

Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 02:05
@nickrobson
function lookUp(firstName, prop){
// Only change code below this line

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

   if(firstName === contacts[i].firstName){

     return contacts[i];

   }else{

   return "No such contact";
 }
   if(contacts[i].hasOwnProperty(prop)){

     return contacts[i][prop];

   }else{

     return "No such property";
   }

}
Nick Robson
@nickrobson
Jan 17 2016 02:06

That if-else statement that I sent needs to go inside your

if(firstName === contacts[i].firstName){

statement.

i.e.
if(firstName === contacts[i].firstName){
    if (contacts[i].hasOwnProperty(prop)) {
         return contacts[i][prop];
    } else {
         return "No such property";
    }
}
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:07
function titleCase(str) {
  str = str.split(' ');
  for (var i = 0; i <= str.length - 1; i++){
    str[i] = str[i].split('');
    str[i][0] = str[i][0].toUpperCase();
    for (var o = 1; i < str.length; i++){
      str[i][o] = str[i][o].toLowerCase();
    }
    str[i] = str[i].join('');
  }

  return str.join(' ');
}

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

This returns the TypeError: undefined is not an object (evaluating 'str[i][o].toLowerCase;'

What does that even mean?

Nick Robson
@nickrobson
Jan 17 2016 02:07

Then outside of the for-loop, you put

return "No such contact";

Since that code will only ever execute if no contact was found with the given name.

@CodingDucky It means that str[i][o] is undefined.
That means that str[i] has no property or index of value o.
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:08
But I set o as a var, so it should be 1, then 2, then 3, and so on?
Nick Robson
@nickrobson
Jan 17 2016 02:08
So if str[i] is an object, it means that there's no property o.
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:08
str[i] is an array
I used str[i] = stri[i].split('')
Nick Robson
@nickrobson
Jan 17 2016 02:09
Ah, I see.
You don't want str.length in your for-loop. There's the problem. :)
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 02:10
@nickrobson Awsome Man. the whole challenge resolved. Thanks a ton.
CamperBot
@camperbot
Jan 17 2016 02:10
haroonghawsi sends brownie points to @nickrobson :sparkles: :thumbsup: :sparkles:
:star: 267 | @nickrobson | http://www.freecodecamp.com/nickrobson
Nick Robson
@nickrobson
Jan 17 2016 02:10
No worries @HaroonGhawsi . :)
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:10
What should I put instead?
str[i].length doesn't seem to work
Elifaz Filho
@Elifaz
Jan 17 2016 02:11
@tommygebru quite a bit harder..
Nick Robson
@nickrobson
Jan 17 2016 02:11
Oh, you know what.
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:11
Oh wait I should be using o++
Nick Robson
@nickrobson
Jan 17 2016 02:11
Your inner for-loop is using "while i < str.length" as well as "i++"
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:11
Yep
just corrected both of those about two seconds before you said it
You're a legend
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 02:12
@nickrobson Just to understand this challenge well, How did you manage to implement this solution?
Nick Robson
@nickrobson
Jan 17 2016 02:12
Fix those and it should(?) be good? xD
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:12
Thanks @nickrobson
CamperBot
@camperbot
Jan 17 2016 02:12
codingducky sends brownie points to @nickrobson :sparkles: :thumbsup: :sparkles:
:warning: codingducky already gave nickrobson points
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:12
What.
Nick Robson
@nickrobson
Jan 17 2016 02:12
Haha, np @CodingDucky
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 02:12
When did I give you points?
Nick Robson
@nickrobson
Jan 17 2016 02:12
lol, stingy bot is stingy xD
I pointed out Array#slice(a,b)
@HaroonGhawsi
function lookUp(firstName, prop) {
    for (var i = 0; i < contacts.length; i++) {
        if (contacts[i].firstName == firstName) {
            return contacts[i][prop] || "No such property";
        }
    }
    return "No such contact";
}
tommy
@tommygebru
Jan 17 2016 02:13
@Elifaz :+1: im gonna have to wait try the bonfire chatroom!
https://gitter.im/orgs/FreeCodeCamp/rooms/
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 02:14
@nickrobson Great
James Bush
@jamesbvsh
Jan 17 2016 02:22
nice
Raincode
@Raincode
Jan 17 2016 02:24
want an easy way to test your code? want some output with console.log? go to https://repl.it/languages/JavaScript. thank me later
or any other js online interpreter of your choice
Yasin Yusuf
@YasinYA
Jan 17 2016 02:27
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for(var i = 0; i < arr.length; i++) {
    for(var j = 0; j< arr[i].length; j++) {
      product * arr[i][j];
    }
  }

  // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
can any one tell why this is not working
Dabachi
@Dabachi
Jan 17 2016 02:28
Screenshot (32).png
I'm a newbie
John Cerpa
@johncerpa
Jan 17 2016 02:28
@YasinYA product should be in a variable
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 02:28
@YasinYA product *= arr[i][j];
John Cerpa
@johncerpa
Jan 17 2016 02:28
product = product * arr[i][j];
same thing haha
Susan
@SusanGrattan
Jan 17 2016 02:29
@Dabachi you need to wrap your <a> element in a <p> element
Yasin Yusuf
@YasinYA
Jan 17 2016 02:29
yeah i got thanks guys @johncerpa @HaroonGhawsi
CamperBot
@camperbot
Jan 17 2016 02:29
yasinya sends brownie points to @johncerpa and @haroonghawsi :sparkles: :thumbsup: :sparkles:
:star: 267 | @johncerpa | http://www.freecodecamp.com/johncerpa
:star: 229 | @haroonghawsi | http://www.freecodecamp.com/haroonghawsi
John Cerpa
@johncerpa
Jan 17 2016 02:29
@YasinYA :+1:
Susan
@SusanGrattan
Jan 17 2016 02:30
So <p> <a href></a> </p> @Dabachi
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 02:30
@YasinYA Good
Dabachi
@Dabachi
Jan 17 2016 02:31
@SusanGrattan I will do
<p> click here for <a href="http://www.catphotoapp.com">cat photos</a></p>
??
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 02:44
Hi all
can somebody help me out here
with algorithms
function palindrome(str) {

 str = str.replace(/[,.\s+\d+]+/g,'');
 str = str.toLowerCase();
  if (str == str.split('').reverse().join('')) {
        return str + ' is palindrome.';
    }
    else {
        return str + ' is not palindrome.';
    }
}



palindrome("My age is 0, 0 si ega ym.");
Hello somebody help me out here pls
Dabachi
@Dabachi
Jan 17 2016 02:49
12544240_878389502281580_1667875773_o.jpg
12557656_878391148948082_35667818_o.jpg
Kevin
@kw7oe
Jan 17 2016 02:50
@sukumarkutagulla you should return true or false
Dabachi
@Dabachi
Jan 17 2016 02:51
Screenshot (31).png
Screenshot (4).png
Helo What is the most beautiful Do you hecker or programmer or programmer Hacker
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 02:51
@kw7oe ok let me give a try again
thanks
Dabachi
@Dabachi
Jan 17 2016 02:51
Screenshot (22).png
Rafael J. Rodriguez
@Rafase282
Jan 17 2016 02:51
Hello, does anyone knows a good way to validate urls?
Dabachi
@Dabachi
Jan 17 2016 02:53
Screenshot (33).png
@Rafase282 Thank you
CamperBot
@camperbot
Jan 17 2016 02:53
dabachi sends brownie points to @rafase282 :sparkles: :thumbsup: :sparkles:
:star: 874 | @rafase282 | http://www.freecodecamp.com/rafase282
Rafael J. Rodriguez
@Rafase282
Jan 17 2016 02:53
youa re welcome
jmesa92
@jmesa92
Jan 17 2016 02:55
Issues with Nesting For Loops
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i = 0; i < arr.length; i * product){
    for(var j = 0; j < arr.length; j * product){
  // Only change code above this line
  return product;
    }
  }
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Dabachi
@Dabachi
Jan 17 2016 02:55
@camperbot Beautiful
Yasin Yusuf
@YasinYA
Jan 17 2016 02:57
This message was deleted

function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i = 0; i < arr.length; i++){
    for(var j = 0; j < arr.length; j++){
          product =* arr[i][j];
    }
}
  // Only change code above this line
  return product;
    }
  }
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Dabachi
@Dabachi
Jan 17 2016 02:59
Dear programmers I will go to sleep
<3
Yasin Yusuf
@YasinYA
Jan 17 2016 02:59
@jmesa92 you were close enough but this little changes
night @Dabachi
tommy
@tommygebru
Jan 17 2016 03:01
@YasinYA check out your second for loop :smile: what do you want it to do?
JSantoyo
@JSantoyo
Jan 17 2016 03:02
@YasinYA what are you testing for in your second loop?
Yasin Yusuf
@YasinYA
Jan 17 2016 03:02
@tommygebru iterating the nested array
JSantoyo
@JSantoyo
Jan 17 2016 03:02
@YasinYA it's good to draw a picture and go through your loop step by step.
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:04
@kw7oe hi
there
function palindrome(str) {

 str = str.replace(/[,.\s\d]+/g,'');
 str = str.toLowerCase();
  if (str == str.split('').reverse().join('')) {
        return true;
    }
    else {
        return false;
    }
}
it is not working for 2 palindromes
Kevin
@kw7oe
Jan 17 2016 03:04
@sukumarkutagulla which 2?
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:04
can you pls suggest it
palindrome("1 eye for of 1 eye.") should return false.
palindrome("0_0 (: /-\ :) 0-0") should return true.
Yasin Yusuf
@YasinYA
Jan 17 2016 03:06
@JSantoyo ok the first loop will loop the parent array and since the problem was to multiply the product value to every number inside the nested array i have to loop the parent array first . the second loop is the solution of the problem i loop the elements of the nested arrays and multiply the product value by it
tommy
@tommygebru
Jan 17 2016 03:06
@YasinYA if the first loop iterates the outer arrays ? how would we determine that the second loop iterates through the sub arrays/ first iteration/first loop? :smile:
JSantoyo
@JSantoyo
Jan 17 2016 03:06
@YasinYA Exactly, so why do you think your second loop is not doing that?
Yasin Yusuf
@YasinYA
Jan 17 2016 03:07
i didn't @JSantoyo
Kevin
@kw7oe
Jan 17 2016 03:07
@sukumarkutagulla it is the regex expression that you need to modify.
tommy
@tommygebru
Jan 17 2016 03:07
@sukumarkutagulla the last sample test for doing palindromes is the correct string!
They want you to remove the _ and the - :smile:
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:07
how
@tommygebru how can you explain
tommy
@tommygebru
Jan 17 2016 03:08
@sukumarkutagulla did I answer your question?
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:08
how to remove
Kevin
@kw7oe
Jan 17 2016 03:08
@sukumarkutagulla /[,.\s\d]+/g < your current regex will replace the numbers
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:09
yes
Kevin
@kw7oe
Jan 17 2016 03:09
so it doesnt work for the last two since it involves numbers in the test
tommy
@tommygebru
Jan 17 2016 03:09
@sukumarkutagulla to remove think about .replace() and/or using regex expressions
http://www.w3schools.com/jsref/jsref_obj_regexp.asp
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:10
ok thanks bro
tommy
@tommygebru
Jan 17 2016 03:11
@sukumarkutagulla nice :+1:
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:11
Is there a way to shift out the first 'n' elements in an array, given n? And then turn those shifted out elements into an array of their own?
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:11
:smile: :+1:
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:11

I am not able to solve an error.

myBike.getGear() should return 4 after myBike.setGear(4).

I have tried the below code till now,


var Bike = function() {

  // Only change code below this line.

  var gear;

  this.getGear = function(){

    gear = 4;
  };
  this.setGear = function(){

    gear = 4;
  };
  return gear;

};
var myBike = new Bike();
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:12
hi @HaroonGhawsi
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:12
@sukumarkutagulla hi
tommy
@tommygebru
Jan 17 2016 03:12
@HaroonGhawsi please share link or name of the challenge :smile:
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:12
in getGear declare gear
this.gear
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:13
@tommygebru Make Object Properties Private
@sukumarkutagulla ok
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:13
in setGear declare this.gear = speed;
@HaroonGhawsi let me know your code after changes
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:15
@sukumarkutagulla it didn't work
I got one extra error.
Avery Lucas
@ItsMuse
Jan 17 2016 03:16
hello guys
tommy
@tommygebru
Jan 17 2016 03:17
@ItsMuse welcome
JSantoyo
@JSantoyo
Jan 17 2016 03:19
@sukumarkutagulla did you figure out your regex?
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:20
@JSantoyo nope
JSantoyo
@JSantoyo
Jan 17 2016 03:20
@sukumarkutagulla Would you like a hint?
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:20
it would be better if you
JSantoyo
@JSantoyo
Jan 17 2016 03:21
@sukumarkutagulla first, what are alpha-numeric characters?
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:22
@HaroonGhawsi
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:27
@JSantoyo
??
JSantoyo
@JSantoyo
Jan 17 2016 03:27
@sukumarkutagulla ??
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:27
alphbets with numerals
JSantoyo
@JSantoyo
Jan 17 2016 03:28
@sukumarkutagulla How is that represented in regex syntax?
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:28
/[a-z0-9]
JSantoyo
@JSantoyo
Jan 17 2016 03:28
@sukumarkutagulla also there is a range token with regex "-" so if you have........ a-d it will match a b c d
@sukumarkutagulla what about upper case characters?
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:28
A-Z
tommy
@tommygebru
Jan 17 2016 03:29
@sukumarkutagulla I could also use a hint :smile: i reset my code%20%7B%0A%20%20%2F%2F%20this%20is%20a%20private%20variable%0A%20%20var%20speed%20%3D%2010%3B%0A%0A%20%20%2F%2F%20these%20are%20public%20methods%0A%20%20this.accelerate%20%3D%20function(change)%20%7B%0A%20%20%20%20speed%20%2B%3D%20change%3B%0A%20%20%7D%3B%0A%0A%20%20this.decelerate%20%3D%20function()%20%7B%0A%20%20%20%20speed%20-%3D%205%3B%0A%20%20%7D%3B%0A%0A%20%20this.getSpeed%20%3D%20function()%20%7B%0A%20%20%20%20return%20speed%3B%0A%20%20%7D%3B%0A%7D%3B%0A%0Avar%20Bike%20%3D%20function()%20%7B%0A%0A%20%20%2F%2F%20Only%20change%20code%20below%20this%20line.%0Avar%20gear%20%3D%20%22%22%3B%0A%20%20%0A%20%20this.setGear%20%3D%20function(change)%7B%0A%20%20%20%20gear%20%3D%20change%3B%0A%20%20%7D%3B%0A%20%20this.getGear%3D%20function()%7Breturn%20Bike.setGear%3B%7D%3B%0A%0A%7D%3B%0A%0Avar%20myCar%20%3D%20new%20Car()%3B%0A%0Avar%20myBike%20%3D%20new%20Bike()%3B%0AmyBike.setGear(4)%3B%0AmyBike.getGear()%3B%0A)
JSantoyo
@JSantoyo
Jan 17 2016 03:29
@sukumarkutagulla okay so put that all together.
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:29
@tommygebru i didn't understand
ok @JSantoyo
Kevin
@kw7oe
Jan 17 2016 03:30
alpha-numeric consists of letters and numbers only.
JSantoyo
@JSantoyo
Jan 17 2016 03:30
@sukumarkutagulla tell me the regex when you've put it together.
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:30
@JSantoyo str = str.replace(/[,.a-z0-9A-Z\s\d]+/g,'')
Todd Blankenship
@TBlank72
Jan 17 2016 03:31
Any ideas/hints on the Pomodoro Exercise?????? I've tried about 20 combinations of the following + many others and all efforts seem to produce weird results or errors. when i correct errors, the functions don't seem to run at all. Been working on this for almost 3 hours with no success.!!!
var breakInitial = 5;
var sessionInitial = 25;
var min = 25;
var sec = 00;
var timerCounter = min + " : " + sec;

function callTimeDec() {
    while (min > 0) {
        setTimeout( function() {timeDec();}, 1000);
    }
};
function timeDec() {
    if (sec == 0){
        min = min - 1;
        sec = 60;
    };
    sec = sec - 1;
    console.log(min + ' ' + sec)
    timerCounter = min + " : " + sec;
    timer.innerHTML = timerCounter
};
jmesa92
@jmesa92
Jan 17 2016 03:31
Finally made it to "Profile Lookup!" but now I'm having problems there
//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    },
];


function lookUp(firstName, prop){
// Only change code below this line
if (firstName == "firstName" && prop == "likes" || "number" || "lastName"){
  return contacts;
} else if (firstName !== "firstName"){
  return "No such contact";
}else if (prop !== "likes" || "number" || "lastName"){
  return "No such contact";
}
// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");
tommy
@tommygebru
Jan 17 2016 03:32
@TBlank72 have you tried the bonfire room?
https://gitter.im/orgs/FreeCodeCamp/rooms/
JSantoyo
@JSantoyo
Jan 17 2016 03:32

@sukumarkutagulla very close....let me put it to you this way

/[A-Za-z0-9]/g matches all characters that ARE alphanumeric and replaces them with '' right? so if you had

hello world it would just be ' ' because we are replacing every alphanumeric character with blank and since space is not alphanumeric it's the only character left BUT we want the opposite, so how do you represent characters that are NOT alphanumeric?

hint: There is a regex symbol for NOT.

tommy
@tommygebru
Jan 17 2016 03:32
@jmesa92 good effort :+1: however your first if is checking if the parameters is equal to a string we want it to compare specifically with the data within contacts
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:32
@jmesa92 you have to use for loop for this challenge
jmesa92
@jmesa92
Jan 17 2016 03:32
@HaroonGhawsi ohhhhhh
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:33
ok @JSantoyo let me give a shot again
JSantoyo
@JSantoyo
Jan 17 2016 03:33
@sukumarkutagulla show me what you get.
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:33
@jmesa92 then nested if statements
yah
Todd Blankenship
@TBlank72
Jan 17 2016 03:33
@tommygebru I'll try there, thanks
CamperBot
@camperbot
Jan 17 2016 03:33
tblank72 sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 356 | @tommygebru | http://www.freecodecamp.com/tommygebru
jmesa92
@jmesa92
Jan 17 2016 03:33
@HaroonGhawsi makes sense given the waypoints
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:34
for(i=0; i<contacts.length;i++)
yup
then after that just put nested if statements
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:35
@JSantoyo str = str.replace(/[,.\s\d0-9a-zA-Z]+/g,'');
its not working
tommy
@tommygebru
Jan 17 2016 03:35
@HaroonGhawsi have you been able to pass the challenge ? I am stuck on the last sample test
Make Object Properties Private
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:35
function chunk(arr, size) {
  var newArray = [];
  for (var i = 0; i < arr.length; i += size) {
    newArray.push(arr.slice(i, i + size));
  }
  return newArr;
}

chunk(["a", "b", "c", "d"], 2);
Why doesn't this work? It's supposed to cut up 'arr' into chunks the length of 'size'
tommy
@tommygebru
Jan 17 2016 03:36
@sukumarkutagulla
variable str.replace(/[,.\s\d0-9a-zA-Z]+/g,'');
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:36
@tommygebru yes
JSantoyo
@JSantoyo
Jan 17 2016 03:36
@sukumarkutagulla all you need is what we discussed (/[A-Za-z0-9]/g, '') but you are missing one final token because [A-Za-z0-9] represents alphanumeric but we want to represent NOT alphanumeric...
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:36
please share your code
JSantoyo
@JSantoyo
Jan 17 2016 03:36
i.e. !== [A-Za-z0-9] and right now we have === [A-Za-z0-9] but there is a special symbol in regular expressions that represents NOT
tommy
@tommygebru
Jan 17 2016 03:37
@HaroonGhawsi
var Bike = function() {

  // Only change code below this line.
var gear = "";

  this.setGear = function(change){
    gear = change;
  };
  this.getGear= function(){return Bike.setGear;};

};

var myCar = new Car();

var myBike = new Bike();
myBike.setGear(4);
myBike.getGear();
JSantoyo
@JSantoyo
Jan 17 2016 03:37
@sukumarkutagulla i.e. !== [A-Za-z0-9] and right now we have === [A-Za-z0-9] but there is a special symbol in regular expressions that represents NOT find out what that symbol is
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:37
you have assign 4 to variable gear
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:37
function chunk(arr, size) {
  var newArray = [];
  for (var i = 0; i < arr.length; i += size) {
    newArray.push(arr.slice(i, i + size));
  }
  return newArr;
}

chunk(["a", "b", "c", "d"], 2);
Why doesn't this work? It's supposed to cut up 'arr' into chunks the length of 'size'
Kevin
@kw7oe
Jan 17 2016 03:37
@sukumarkutagulla take a look at the special characters meaning in RegEx
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:38
and in setGear and getGear you have to return gear variable.
JSantoyo
@JSantoyo
Jan 17 2016 03:38

@sukumarkutagulla [xyz]
A character set. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen.

For example, [abcd] is the same as [a-d]. They match the "b" in "brisket" and the "c" in "chop".

[^xyz]
A negated or complemented character set. That is, it matches anything that is not enclosed in the brackets. You can specify a range of characters by using a hyphen.

For example, [^abc] is the same as [^a-c]. They initially match "o" in "bacon" and "h" in "chop".

tommy
@tommygebru
Jan 17 2016 03:38
@CodingDucky is it supposed to be splice or slice?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:38
Not sure.
What's the difference?
Kevin
@kw7oe
Jan 17 2016 03:39
@CodingDucky newArr is not defined
@CodingDucky noticed you defined the variable as newArray on the top
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:39
thanks @kw7oe
CamperBot
@camperbot
Jan 17 2016 03:39
codingducky sends brownie points to @kw7oe :sparkles: :thumbsup: :sparkles:
:star: 294 | @kw7oe | http://www.freecodecamp.com/kw7oe
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 03:39
It just worked.
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:39
@jmesa92 ```
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:40
@JSantoyo
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:40
@jmesa92
This is what you want
for(i=0;i<contacts[i];i++){
    if(firstName === contacts[i].firstName){
        if(prop === contacts[i].hasOwnProperty()){
            return "No such property";
        }
    }
}
    return "No such contact";
Kevin
@kw7oe
Jan 17 2016 03:40
@CodingDucky you're welcome
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:40
function palindrome(str) {

 str = str.replace(/[^A-Za-z0-9]/g,'');
 str = str.toLowerCase();
  if (str == str.split('').reverse().join('')) {
        return true;
    }
    else {
        return false;
    }
}


palindrome("0_0 (: /-\ :) 0-0");
JSantoyo
@JSantoyo
Jan 17 2016 03:40
@sukumarkutagulla yes?
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:40
@JSantoyo
tommy
@tommygebru
Jan 17 2016 03:40
@CodingDucky don't know thought i saw something in the forum earlier :+1:
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:40
thanks bro
JSantoyo
@JSantoyo
Jan 17 2016 03:40
@sukumarkutagulla You're welcome.
tommy
@tommygebru
Jan 17 2016 03:40
@sukumarkutagulla :+1:
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:40
@tommygebru :fire:
on :fire: with your support bros
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 03:41

Just when I thought I was getting it… Can someone help me with this. It is the Counting Cards Lesson

var count = 0;

function cc(card) {
// Only change code below this line
switch (card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count += count;
break;
case 7:
case 8:
case 9:
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count -= count;
}

var betOrHold;

if (count <= 0 ) {
betOrHold = "Hold";
} else {
betOrHold = "Bet";
}

outPut = count + " " + betOrHold;

return outPut;
// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc("K");
console.log(cc("K"));
'

`
var count = 0;

function cc(card) {
// Only change code below this line
switch (card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count += count;
break;
case 7:
case 8:
case 9:
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count -= count;
}

var betOrHold;

if (count <= 0 ) {
betOrHold = "Hold";
} else {
betOrHold = "Bet";
}

outPut = count + " " + betOrHold;

return outPut;
// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc("K");
console.log(cc("K"));

`

var count = 0;

function cc(card) {
  // Only change code below this line
  switch (card) {
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      count += count;
      break;
    case 7:
    case 8:
    case 9:
      break;
    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":
      count -= count;
  }

  var betOrHold;

  if (count <= 0 ) {
    betOrHold = "Hold";
  } else {
    betOrHold = "Bet";
  }

  outPut = count + " " + betOrHold;

  return outPut;
  // Only change code above this line
}



// Add/remove calls to test your function.
// Note: Only the last will display
cc("K");
console.log(cc("K"));
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:42
12345 count++: @ericwhittakerjr
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 03:42
Sorry figuring out the markdown
Todd Blankenship
@TBlank72
Jan 17 2016 03:42
count = count + 1
count = count - 1
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 03:43
Oh dang thats right. thanks @sukumarkutagulla
CamperBot
@camperbot
Jan 17 2016 03:43
ericwhittakerjr sends brownie points to @sukumarkutagulla :sparkles: :thumbsup: :sparkles:
:star: 253 | @sukumarkutagulla | http://www.freecodecamp.com/sukumarkutagulla
tommy
@tommygebru
Jan 17 2016 03:43
@sukumarkutagulla thanks
my challenge has been reset, am i on the right track?%20%7B%0A%20%20%2F%2F%20this%20is%20a%20private%20variable%0A%20%20var%20speed%20%3D%2010%3B%0A%0A%20%20%2F%2F%20these%20are%20public%20methods%0A%20%20this.accelerate%20%3D%20function(change)%20%7B%0A%20%20%20%20speed%20%2B%3D%20change%3B%0A%20%20%7D%3B%0A%0A%20%20this.decelerate%20%3D%20function()%20%7B%0A%20%20%20%20speed%20-%3D%205%3B%0A%20%20%7D%3B%0A%0A%20%20this.getSpeed%20%3D%20function()%20%7B%0A%20%20%20%20return%20speed%3B%0A%20%20%7D%3B%0A%7D%3B%0A%0Avar%20Bike%20%3D%20function()%20%7B%0A%0A%20%20%2F%2F%20Only%20change%20code%20below%20this%20line.%0Avar%20gear%20%3D%20%22%22%3B%0A%20%20%0A%20%20this.setGear%20%3D%20function(change)%7B%0A%20%20%20%20gear%20%3D%20change%3B%0A%20%20%7D%3B%0A%20%20this.getGear%3D%20function()%7Breturn%20Bike.setGear%3B%7D%3B%0A%0A%7D%3B%0A%0Avar%20myCar%20%3D%20new%20Car()%3B%0A%0Avar%20myBike%20%3D%20new%20Bike()%3B%0AmyBike.setGear(4)%3B%0AmyBike.getGear()%3B%0A)
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:43
@ericwhittakerjr :clap:
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:43
@tommygebru

var gear = 4;

this.setGear = function(change){
    return gear;
}
this.getGear = function(){
    return gear;
}
var myBike = new Bike();
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:43
@tommygebru just restart the browser and relogin
thats it some times if you keep it on idle it behaves like that i dont now the reason
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:44
@ericwhittakerjr you have to increment count before count += count;
@ericwhittakerjr case 6: count++ then......
tommy
@tommygebru
Jan 17 2016 03:45
@HaroonGhawsi I think that is one way to do it
I believe i did it differently the last time
var gear ="";
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 03:46
Thanks @HaroonGhawsi
CamperBot
@camperbot
Jan 17 2016 03:46
ericwhittakerjr sends brownie points to @haroonghawsi :sparkles: :thumbsup: :sparkles:
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 03:46
@tommygebru Ok
CamperBot
@camperbot
Jan 17 2016 03:46
:star: 234 | @haroonghawsi | http://www.freecodecamp.com/haroonghawsi
Jason Lee
@JsonLitz
Jan 17 2016 03:48

Can someone explain why the following is not a valid declaration:

<style>
h2 {color: blue}
</style>

<h2>CatPhotoApp</h2>

Much appreciated
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 03:49
you need to put a ;
Jason Lee
@JsonLitz
Jan 17 2016 03:49
After color?
Ohh after the color
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 03:50
@JsonLitz use .h2
Jason Lee
@JsonLitz
Jan 17 2016 03:50
Thanks eric!
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 03:50
<style>
h2 {
  color: blue;
}
</style>
Jason Lee
@JsonLitz
Jan 17 2016 03:51
What does .h2 do?
@sukumarkutagulla
Avery Lucas
@ItsMuse
Jan 17 2016 03:51
ok.. I've reached my limit. I need help
typeerror cannot read property 'split' of undefined
what gives. D:
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 03:52
@JsonLitz no problem. I think he was saying you should put the “.” so that you would be calling to a “class” but I think he just missunderstood
@JsonLitz so don’t worry about using the “.”
Avery Lucas
@ItsMuse
Jan 17 2016 03:52
heres my code
function titleCase(str) {
  loopWord = '';
  lowerCaseStr = str.toLowerCase();
  stringArr = lowerCaseStr.split(' ');

  for (var i = 0; i < stringArr.length + 1; i++){
    seperateWord = stringArr[i].split('');
    seperateWord[0].toUpperCase();
    seperateWord.join();
    stringArr[i] = seperateWord;
  }
  return test;
}
Jason Lee
@JsonLitz
Jan 17 2016 03:52
Much thanks!
Avery Lucas
@ItsMuse
Jan 17 2016 03:52
html? thats fun
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 03:53
also it would be great if you could call out my username when you say thanks it gives me more points (: no problem
@JsonLitz thank you <<<< see (:
Avery Lucas
@ItsMuse
Jan 17 2016 03:53
anyways... I am like.. so lost over here.
Jason Lee
@JsonLitz
Jan 17 2016 03:54
@ericwhittakerjr Thanks for the help!
CamperBot
@camperbot
Jan 17 2016 03:54
jsonlitz sends brownie points to @ericwhittakerjr :sparkles: :thumbsup: :sparkles:
:star: 207 | @ericwhittakerjr | http://www.freecodecamp.com/ericwhittakerjr
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 03:54
whats up @ItsMuse whats your question
Avery Lucas
@ItsMuse
Jan 17 2016 03:54
typeerror cannot read property 'split' of undefined
Javascript
ashish singh
@ashish1729
Jan 17 2016 03:54
guys any one have any idea when sass, react and d3 challenges will be available . they are just coming soon for very long :(
cbats
@cbats
Jan 17 2016 03:54
Not sure why I cannot get this test to pass...
Kevin
@kw7oe
Jan 17 2016 03:55
@ItsMuse you did not declare your variable, using var
var loopwords = ''; < something like this
Avery Lucas
@ItsMuse
Jan 17 2016 03:55
@kw7oe thats it?
Andrey Kaipov
@andreykaipov
Jan 17 2016 03:55
@ItsMuse for (var i = 0; i < stringArr.length + 1; i++)
@ItsMuse Make it i < stringArr.length
Avery Lucas
@ItsMuse
Jan 17 2016 03:56
I thought the var keyword only made the variable private.
oh! right! that makes sense
Andrey Kaipov
@andreykaipov
Jan 17 2016 03:56
On the last iteration of the for-loop, you're accessing stringArr[length], which is undefined.
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 03:56
@ItsMuse it is where the var is declared that determines if it is private or global
Kevin
@kw7oe
Jan 17 2016 03:56
@ItsMuse you're right... forget about that
Avery Lucas
@ItsMuse
Jan 17 2016 03:57
It was the for loop iterations
too many of em to be frank
alright. I will solve from here. thanks @ericwhittakerjr @kw7oe @andreykaipov for your time.
CamperBot
@camperbot
Jan 17 2016 03:57
itsmuse sends brownie points to @ericwhittakerjr and @kw7oe and @andreykaipov :sparkles: :thumbsup: :sparkles:
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 03:57
@ItsMuse If you define a var outside of a function then it will be declared glabally if you declare a var inside a var then it will only be seen within that function.
CamperBot
@camperbot
Jan 17 2016 03:57
:star: 296 | @kw7oe | http://www.freecodecamp.com/kw7oe
:star: 208 | @ericwhittakerjr | http://www.freecodecamp.com/ericwhittakerjr
:star: 267 | @andreykaipov | http://www.freecodecamp.com/andreykaipov
Andrey Kaipov
@andreykaipov
Jan 17 2016 03:57
You're almost done!
Avery Lucas
@ItsMuse
Jan 17 2016 03:58
that makes sense. In a sense its like C#.
ps Two senses... half life 3 confirmed
cbats
@cbats
Jan 17 2016 04:01

<style>
h2 {color: blue;}
</style>

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

i dont see why the test won't pass for the CSS being "blue"
what simple thing am i missing?
John Cerpa
@johncerpa
Jan 17 2016 04:02
paste the entire code
please
Manish Giri
@Manish-Giri
Jan 17 2016 04:02
@cbats you don’t have an h2 element in your code
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:02
@cbats you need to select the p tag not the h2
cbats
@cbats
Jan 17 2016 04:03
ok, i knew it was something silly ! thanks @Manish-Giri and @ericwhittakerjr
CamperBot
@camperbot
Jan 17 2016 04:03
cbats sends brownie points to @manish-giri and @ericwhittakerjr :sparkles: :thumbsup: :sparkles:
:star: 592 | @manish-giri | http://www.freecodecamp.com/manish-giri
:star: 210 | @ericwhittakerjr | http://www.freecodecamp.com/ericwhittakerjr
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:03
<style>
p {
  color: blue;
}
</style>
anytime!
Avery Lucas
@ItsMuse
Jan 17 2016 04:04
:D I beat the bondfire! GOD that was satisfying. :D :D :D this deserves some milk and cereal!
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 04:04
d means digits in regex @ItsMuse
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:04
hahaha I am about there too
Herman Fassett
@HermanFassett
Jan 17 2016 04:04
@ItsMuse great work! :D it does feel good
Abhishek
@AbhiChachan
Jan 17 2016 04:05
Hi, need some help in counting cards exercise - not able to print count and "Bet or Hold" decision together
Avery Lucas
@ItsMuse
Jan 17 2016 04:05
yep! feeling pretty confident now. I guess I will tackle one more before I start animating for the night.
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 04:05
your code pls
@AbhiChachan
James Bush
@jamesbvsh
Jan 17 2016 04:05
Hey guys I'm pretty sure the "Change the Font Size of an Element" is broken.
  .red-text {
    color: red;
  }

  p {
    font-size: 16px;
  }

</style>
Abhishek
@AbhiChachan
Jan 17 2016 04:05

var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count += 1;
break;
case 7:
case 8:
case 9:
count += 0;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count -= 1;

}
var decision = "";

if (count >= 0){
  decision= "Hold";

}else {
   decision ="Bet";

}

return count, decison;

// Only change code above this line
}

sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 04:06
@AbhiChachan in place count+=1; use count++;
Herman Fassett
@HermanFassett
Jan 17 2016 04:06
@jamesbvsh you have the opening style tag, yes? If so, then it should pass. What's the output?
James Bush
@jamesbvsh
Jan 17 2016 04:06
"Give elements with the p tag a font-size of 16px.')"
  .red-text {
    color: red;
  }
  p {
    font-size: 16px;
  }
</style>
Abhishek
@AbhiChachan
Jan 17 2016 04:06
but i am able to get correct count number

}

if (count >= 0){
  return count, "Hold";
}else {
  return count, "Bet";
}

// Only change code above this line
}

changed the last part of the code
James Bush
@jamesbvsh
Jan 17 2016 04:07
It does not copy the opening style tag
Abhishek
@AbhiChachan
Jan 17 2016 04:07
the output is coming to only "Hold" or "Bet" based on the count
James Bush
@jamesbvsh
Jan 17 2016 04:07
but I its there on screen
Herman Fassett
@HermanFassett
Jan 17 2016 04:07
Ah well if you have it it should work, what does fcc say @jamesbvsh ?
James Bush
@jamesbvsh
Jan 17 2016 04:07
FCC?
The output shows a font size of 16
But it won't pass tests
Abhishek
@AbhiChachan
Jan 17 2016 04:08

var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count += 1;
break;
case 7:
case 8:
case 9:
count += 0;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count -= 1;

}

if (count >= 0){
  return count, "Hold";
}else {
  return count, "Bet";
}

// Only change code above this line
}

James Bush
@jamesbvsh
Jan 17 2016 04:08
So I'm thinking it's broken, but maybe I;m just missing something?
Abhishek
@AbhiChachan
Jan 17 2016 04:08
the above is the new code and the output is Hold for cc(2); cc(3); cc(7); cc('K'); cc('A');
Herman Fassett
@HermanFassett
Jan 17 2016 04:08
@jamesbvsh maybe reload the page and try to run again
Abhishek
@AbhiChachan
Jan 17 2016 04:09
@sukumarkutagulla please help
James Bush
@jamesbvsh
Jan 17 2016 04:09
  .red-text {
    color: red;
  }
  p {
    font-size: 16px;
  }
</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>
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 04:10
@AbhiChachan give some time
having breakfast
Abhishek
@AbhiChachan
Jan 17 2016 04:10
ohk. sure
Logan Hampton
@loganch
Jan 17 2016 04:10
@AbhiChachan Try placing a space in front of Hold and Bet in the strings, I believe that exercise is expecting it output like that
James Bush
@jamesbvsh
Jan 17 2016 04:10
reload didn't fix. There is defiantly a <style> on my screen...
Abhishek
@AbhiChachan
Jan 17 2016 04:11
@loganch can you please mention the exact code?
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:11
@AbhiChachan you need to concatenate the count and the “hold” or “bet” together and return that.
holdOrBet = count + “ “ + “HOLD OR BET"
Logan Hampton
@loganch
Jan 17 2016 04:12
@AbhiChachan Instead of "Hold" and "Bet", try " Hold" and " Bet"
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 04:12

How to iterate over array with Map.

How can add 3 to each value in the array?

I have tried the below code till now

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

// Only change code below this line.

var newArray = oldArray.map(function(index){

       return index * 3;
  });

newArray = oldArray;
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:13
for deciding on bet or hold
var betOrHold;

if (count <= 0 ) {
    betOrHold = "Hold";
  } else {
    betOrHold = "Bet";
  }
@AbhiChachan
@AbhiChachan then you can take that variable’s content and concatenate a string for the correct output to return.
outPut = count + " " + betOrHold;
James Bush
@jamesbvsh
Jan 17 2016 04:14
Does this website not work on Safari? asdfkldsf
Abhishek
@AbhiChachan
Jan 17 2016 04:14

}
var holdorbet;
if (count >= 0){
holdorbet = count + " " + "Hold";
}else {
holdorbet = count + " " + "Bet";
}

return holdorbet;

// Only change code above this line
}

is this fine?
Manish Giri
@Manish-Giri
Jan 17 2016 04:14
@HaroonGhawsi remove these lines
var newArray = [];
newArray = oldArray;
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:15
This is what it would look like at the end after the switch statment
var betOrHold;

  if (count <= 0 ) {
    betOrHold = "Hold";
  } else {
    betOrHold = "Bet";
  }

  outPut = count + " " + betOrHold;

  return outPut;
yes that part looks good @AbhiChachan
Andrey Kaipov
@andreykaipov
Jan 17 2016 04:16
@HaroonGhawsi Map is a function that applies its input onto every element in an array. So let's first define the function var addThree = function(x) {return x+3;};. Now we can execute oldArray.map(addThree), which will add three onto every element in the array.
Abhishek
@AbhiChachan
Jan 17 2016 04:16
@ericwhittakerjr but the output is not coming for Cards Sequence 2, 3, 4, 5, 6
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:16
you have to change your > to a <
@AbhiChachan
tommy
@tommygebru
Jan 17 2016 04:17
@HaroonGhawsi
also you should remove this
newArray = oldArray;
it says let the old variable newArray be assigned a value of oldArray(at the top) :smile:
Abhishek
@AbhiChachan
Jan 17 2016 04:18
@ericwhittakerjr worked. thank you so much
CamperBot
@camperbot
Jan 17 2016 04:18
abhichachan sends brownie points to @ericwhittakerjr :sparkles: :thumbsup: :sparkles:
:star: 212 | @ericwhittakerjr | http://www.freecodecamp.com/ericwhittakerjr
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 04:18
@tommygebru alright.
Abhishek
@AbhiChachan
Jan 17 2016 04:18
@loganch @sukumarkutagulla thank you for replying
CamperBot
@camperbot
Jan 17 2016 04:18
abhichachan sends brownie points to @loganch and @sukumarkutagulla :sparkles: :thumbsup: :sparkles:
:star: 353 | @loganch | http://www.freecodecamp.com/loganch
:star: 256 | @sukumarkutagulla | http://www.freecodecamp.com/sukumarkutagulla
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:18
@AbhiChachan anytime (: glad to help
Logan Hampton
@loganch
Jan 17 2016 04:19
@AbhiChachan You're welcome.
tommy
@tommygebru
Jan 17 2016 04:19
@jamesbvsh gitter or FCC, it looks like its working on safari :smile:
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 04:22
@tommygebru I tried this one but not working.
var oldArray = [1,2,3,4,5];
var newArray = [];

// Only change code below this line.

var addTree = function(x){
  return x+3;

};
oldArray.map(addTree);

newArray = oldArray;
Manish Giri
@Manish-Giri
Jan 17 2016 04:22
@HaroonGhawsi at the last line you’re messing things up, remove it
tommy
@tommygebru
Jan 17 2016 04:23
@HaroonGhawsi lol that was you :satisfied:
remove the last line
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 04:23
I have comment it but still its not working
ok
Manish Giri
@Manish-Giri
Jan 17 2016 04:23
@HaroonGhawsi your first code was fine, remove the lines I mentioned
tommy
@tommygebru
Jan 17 2016 04:26
This message was deleted
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:30
var someProp = "propName";
var myObj = {
  propName: "Some Value"
}
myObj[someProp]; // "Some Value"
I do not understand this concept
tommy
@tommygebru
Jan 17 2016 04:30
@HaroonGhawsi how are you doing?
@ericwhittakerjr please share the challenge's link :smile:
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 04:32
@tommygebru its not working
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:32
so we have to remember to not put any of the objects properties in quotations if we want to access them via a variable?
not sure how to get you a smaller link to that challenge sorry.
tommy
@tommygebru
Jan 17 2016 04:33
@ericwhittakerjr the variable has the same name as the function ... this can be confusing
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:34
yeah so like if I want to access a property of an object then I have to not put the name of the property in quotations and then make a variable that has the same string of the name of that property?
tommy
@tommygebru
Jan 17 2016 04:36
@ericwhittakerjr lol hard to read
var someProp = "propName";//we use someProp to access it's string
var myObj = {//the object has  value we want to access
  propName: "Some Value"
}
myObj[someProp]; // "Some Value"//we use someProp with string value
//to access the function's object property and finally access the value "Some Value"
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 04:36
@Manish-Giri how to replace the array values with 3?
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:36
it just makes it confusing when defining an object because you have to decide whether you are going to access the object with a variable or with an array or whether you want the name of that property to be with or without a space because one way of accessing it limits you to not being able to put it in quotes with doesn’t allow you to name that property with a space x
@tommygebru
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 04:37
@Manish-Giri Here is my try
var oldArray = [1,2,3,4,5];
var newArray = [];

// Only change code below this line.

newArray = oldArray.map(function(x){

  return x + 3;
});

newArray = oldArray;
two errors are solved only one error is pending
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:38
@tommygebru as long as I am understanding it correctly I will accept it but I just want to make sure I am understanding the concept here
Haroon Ghawsi
@HaroonGhawsi
Jan 17 2016 04:38
@Manish-Giri [Error] You should add three to each value in the array
tommy
@tommygebru
Jan 17 2016 04:40

@ericwhittakerjr lol hard to read , I commented your code :smile:

var someProp = "propName";//we use someProp to access it's string
var myObj = {//the object has  value we want to access
  propName: "Some Value"
}
myObj[someProp]; // "Some Value"//we use someProp with string value
//to access the function's object property and finally access the value "Some Value"

the function's parameter someProp has a string value which can access the object literal

Avery Lucas
@ItsMuse
Jan 17 2016 04:41
aawww... just made a sad discovery... the sort function does not work in loops because of its return nature... bummer. :( I thought my solution was SO clever... :( I guess I will find a new way.. without the sort function... :(
tommy
@tommygebru
Jan 17 2016 04:43
@ericwhittakerjr did I help at all?
@ItsMuse what are you working on? you're only clever if you keep going :thumbsup:
Avery Lucas
@ItsMuse
Jan 17 2016 04:44
Return Largest Numbers in Arrays bonfire.
trying to figure out how to sort arrays atm, and Im still going. :+1:
tommy
@tommygebru
Jan 17 2016 04:45
I am on Return Largest Numbers in String bonfire, do you want to work on it together?
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:45

So what happends in this situation.
Original

var someProp = "propName";
var myObj = {
  propName: "Some Value"
}
myObj[someProp];

alternate situation // this way of declaring an objects property won’t allow you to access that property right?

var someProp = “propName”;
var myObj = {
  “PropName”: “Some Value”
}
myObj[somePropt];

@tommygebru

Andrey Kaipov
@andreykaipov
Jan 17 2016 04:46
What do you mean it doesn't work in loops? @ItsMuse
DJ
@qualitymanifest
Jan 17 2016 04:47
@ItsMuse wanna post your code? you can sort inside a loop
Avery Lucas
@ItsMuse
Jan 17 2016 04:48
Because most functions have to return something in order for intended value to get across to wherever. It dosnt work. Returns cancel out loops. I tried lots of ways to put the function in, but the loop would just cancel itself.. It might just be the fcc ide, and if it isnt, Im sure there are ways to use functions in loops I just dont know of.
ok. will post code
DJ
@qualitymanifest
Jan 17 2016 04:48
@ItsMuse the return goes inside the sort function so doesn't effect the outer loop
tommy
@tommygebru
Jan 17 2016 04:48
@ericwhittakerjr do what I did :smile:
https://repl.it/languages/javascript
paste your code here on the left side panel & PRESS PLAY
Avery Lucas
@ItsMuse
Jan 17 2016 04:49
function largestOfFour(arr) {
  copyArr = arr;
  for (var i = 0; i < largestOfFour; i++){
     sortArray(i);
  }
  return copyArr;
}

function sortArray (val){
  copyArr[val].sort(function(a, b){
    return b - a;
  });
}
This was my big Idea I figured... wait a minute.. why dont i just make a NEW function. :D
CamperBot
@camperbot
Jan 17 2016 04:49
:bulb: to format code use backticks! ``` more info
Andrey Kaipov
@andreykaipov
Jan 17 2016 04:49
@ItsMuse Before you start looping, declare an output variable. Once you've sorted something an array in the loop, add the largest member into your output variable. Then once you've finished the loop, return the output variable.
tommy
@tommygebru
Jan 17 2016 04:50
@ericwhittakerjr DONT FORGET your second scenario has spelling-error :smile:
myObj[somePropt];
Avery Lucas
@ItsMuse
Jan 17 2016 04:51
@andreykaipov what...
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:51
@tommygebru I think I understand it alright and thanks for sending that example. And yeah that is a spelling error but I was wondering what happend when I put the object property in “” I wont be able to access that from the variable right?
CamperBot
@camperbot
Jan 17 2016 04:51
ericwhittakerjr sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 357 | @tommygebru | http://www.freecodecamp.com/tommygebru
Andrey Kaipov
@andreykaipov
Jan 17 2016 04:52
Sorry, I typed that out before I noticed you posted your code.
Neal Caffery
@neal1991
Jan 17 2016 04:52
The check point :stand in line
Andrey Kaipov
@andreykaipov
Jan 17 2016 04:52
I thought you had a different problem.
Avery Lucas
@ItsMuse
Jan 17 2016 04:52
np.
Neal Caffery
@neal1991
Jan 17 2016 04:52
stand in line
I implement like this:
function queue(arr, item) {
  // Your code here
  arr.push(item);  
  arr.shift();
  return arr;  // Change this line
}
Avery Lucas
@ItsMuse
Jan 17 2016 04:53
@qualitymanifest you said that the sort function shouldnt negate loops? can you elaborate on that? is there something I have to do to make it like that?
Neal Caffery
@neal1991
Jan 17 2016 04:53
I don't think there is a problem.
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:54
this is the note that they tell you in the challange. Note that we do not use quotes around the variable name when using it to access the property because we are using the value of the variable, not the name
Note that we do not use quotes around the variable name when using it to access the property because we are using the value of the variable, not the name
DJ
@qualitymanifest
Jan 17 2016 04:54
@ItsMuse you could have your sort function inside your first for loop. and that loop shouldn't end at largestOfFour since that's just the function name
@ItsMuse basically just have your sort function sort each subarray and then do something with the result you get from that...
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:55
@tommygebru ohhhhhh they mean do not put the variable in quote when using it not that we are not able to make a property. So we can make a property in an opject by saying “propName” or propName or “Prop Name” as long as the variable is exactly the same as the property
Avery Lucas
@ItsMuse
Jan 17 2016 04:56
@qualitymanifest ok. I will try that. thanks for your time. :)
CamperBot
@camperbot
Jan 17 2016 04:56
itsmuse sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 805 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
Jason Lee
@JsonLitz
Jan 17 2016 04:56

Hi, quick question:

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

DJ
@qualitymanifest
Jan 17 2016 04:56
@ItsMuse no problem. i can be a little more specific if you like but it seems like you just want vague ideas
Jason Lee
@JsonLitz
Jan 17 2016 04:56
The question calls for creating a smaller-size class
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 04:57
@JsonLitz so what is the question
framework24
@framework24
Jan 17 2016 04:57
where can i post this .smaller-image {on "resize your images" lesson?
Jason Lee
@JsonLitz
Jan 17 2016 04:57
@ericwhittakerjr Im unsure where to embed the new class
tommy
@tommygebru
Jan 17 2016 04:58
@ericwhittakerjr okay now I think you lost me are we talking about the function parameter or the property inside of an object?
var myObject(property:value);
or
function name(parameter){}:
When you are referencing propName :smile:
framework24
@framework24
Jan 17 2016 04:58
where can i post this .smaller-image { width: 100px; } on "resize your images" lesson?
tommy
@tommygebru
Jan 17 2016 04:59
@framework24 between the style tags :smile: because it is css language
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 05:00
@JsonLitz hi
can you help me with Title Case a Sentence
tommy
@tommygebru
Jan 17 2016 05:00
This message was deleted
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 05:00
Title Case a Sentence 255
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 05:01
@tommygebru I was trying to understand the property because they allow you to define the property like this >>> “propName” or propName and I wanted to make sure that as long as the property is the same as the variable then it will work. But was unclear if the “” around a property would make a difference. But now I understand it that you can define the property with quotes or without quotes but the time you have to use quotes are only if the property name is going to contain a space in it. sorry this one is really confusing to explain
Jason Lee
@JsonLitz
Jan 17 2016 05:02
@tommygebru "Size your images" I don't know where I'm supposed to insert the new class for img size
@sukumarkutagulla Hello
@sukumarkutagulla not sure what that is
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 05:03
@JsonLitz basic algorithm scripting
Teleisha Hall
@hallnt
Jan 17 2016 05:04
@hallnt
im doin my portforlio for my zipline. Can anyone tell me how to save it externally so I dont have to view in codepen.io
?
Teleisha Hall
@hallnt
Jan 17 2016 05:05
Also, how do i add background images? Normally I would put them in a folder and reference their url, but dont know how to do that with codepen
Eric Whittaker Jr
@ericwhittakerjr
Jan 17 2016 05:05
@tommygebru gotta run now I hope what I said made sense about what I was confused on. Thank you agian for all the help!
CamperBot
@camperbot
Jan 17 2016 05:05
ericwhittakerjr sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:warning: ericwhittakerjr already gave tommygebru points
tommy
@tommygebru
Jan 17 2016 05:06
@ericwhittakerjr thanks for being patient :+1:
CamperBot
@camperbot
Jan 17 2016 05:06
tommygebru sends brownie points to @ericwhittakerjr :sparkles: :thumbsup: :sparkles:
:star: 215 | @ericwhittakerjr | http://www.freecodecamp.com/ericwhittakerjr
Manish Giri
@Manish-Giri
Jan 17 2016 05:07
@hallnt put your images in dropbox, right click on the image in dropbox to get a shareable url, then put that url into codepen
tommy
@tommygebru
Jan 17 2016 05:08

@JsonLitz

<html class="something"></html>//this is html
.class{property:value;}//this is css
hope this helps :smile:

Franco Zapata
@Francozt01
Jan 17 2016 05:08
hey there!!
check it pls :D
tommy
@tommygebru
Jan 17 2016 05:09
@tommygebru How are you doing ?
Lisa
@lthai18
Jan 17 2016 05:11
Having trouble figuring out the whole "create a form element" challenge. How do I "nest" the text field in a form element?
Avery Lucas
@ItsMuse
Jan 17 2016 05:11
looks nice @Francozt01 ui could be cleaner thou. ;)
Franco Zapata
@Francozt01
Jan 17 2016 05:11
@ItsMuse Thanks :+1: i know just wanted to see it working :D
CamperBot
@camperbot
Jan 17 2016 05:11
francozt01 sends brownie points to @itsmuse :sparkles: :thumbsup: :sparkles:
:star: 260 | @itsmuse | http://www.freecodecamp.com/itsmuse
Avery Lucas
@ItsMuse
Jan 17 2016 05:12
Take up one idea. Make that one idea your life - think of it, dream of it, live on that idea. Let the brain, muscles, nerves, every part of your body, be full of that idea, and just leave every other idea alone. This is the way to success.
good quote.. got it from the machine. lol
Swami Vivekananda
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 05:13
@JsonLitz you got it??
Jason Lee
@JsonLitz
Jan 17 2016 05:13
@sukumarkutagulla sorry I'm not familiar with that exercise material
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 05:14
ok @JsonLitz np
Franco Zapata
@Francozt01
Jan 17 2016 05:14
@ItsMuse got it from http://www.brainyquote.com/ cuz i am not a big fan of quotes :D
Avery Lucas
@ItsMuse
Jan 17 2016 05:15
@Francozt01 whatever works right? :)
Jason Lee
@JsonLitz
Jan 17 2016 05:15

I can't get the following code to resize my image. Can anyone spot the problem?

<style>

.smaller-image {
width: 100px;

}

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

The challenge is to create a css class that resizes the img width to 100px

Franco Zapata
@Francozt01
Jan 17 2016 05:16
yeah! :D
Avery Lucas
@ItsMuse
Jan 17 2016 05:16
@JsonLitz can you send a link the the waypoint?
just so I can see original code n all that jazz
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 05:16
anybody there who can help me with 255
challenge
Jason Lee
@JsonLitz
Jan 17 2016 05:16
@ItsMuse yeah, should I just copy the URL?
Avery Lucas
@ItsMuse
Jan 17 2016 05:17
@JsonLitz yep. that'll do.
tommy
@tommygebru
Jan 17 2016 05:17
@ItsMuse sum it up in one word
Avery Lucas
@ItsMuse
Jan 17 2016 05:17
@tommygebru sum what up in one word.
Jason Lee
@JsonLitz
Jan 17 2016 05:17
First day trying this out. Thanks for all of the help everyone!
tommy
@tommygebru
Jan 17 2016 05:18

@JsonLitz you are not referencing your css with your html remember:

<html class="something"></html>//this is html
.class{property:value;}//this is css
hope this helps :smile:

@ItsMuse the quote you read :smile:
Avery Lucas
@ItsMuse
Jan 17 2016 05:19
@tommygebru first off... you just stole my brownies.. :(
tommy
@tommygebru
Jan 17 2016 05:19
@JsonLitz :thumbsup:
Avery Lucas
@ItsMuse
Jan 17 2016 05:19
@tommygebru as for the quote..
Jason Lee
@JsonLitz
Jan 17 2016 05:19
@tommygebru I'm sorry but I don't understand the statement...
Avery Lucas
@ItsMuse
Jan 17 2016 05:19
If I had to some it up to one word.. It would be...
@tommygebru Discipline.
tommy
@tommygebru
Jan 17 2016 05:21
@ItsMuse whhaat !
@JsonLitz glad to hear you are with us ! keep it up :+1:
Avery Lucas
@ItsMuse
Jan 17 2016 05:21
@JsonLitz you have to apply the class to the image.
tommy
@tommygebru
Jan 17 2016 05:21
@ItsMuse yeah that works I was thinking mantra or resilience
@ItsMuse as for the brownies...
@ItsMuse take all my brownies
@ItsMuse nvm gif doesnt work here is some points instead : thanks
CamperBot
@camperbot
Jan 17 2016 05:24
tommygebru sends brownie points to @itsmuse :sparkles: :thumbsup: :sparkles:
:star: 261 | @itsmuse | http://www.freecodecamp.com/itsmuse
tommy
@tommygebru
Jan 17 2016 05:25
@JsonLitz you passed the challenge right!?!?
Jason Lee
@JsonLitz
Jan 17 2016 05:26
@tommygebru no, I'm still stuck
@tommygebru I still dont understand how that command is supposed to affect my img
tommy
@tommygebru
Jan 17 2016 05:28

@JsonLitz whaaat do you not see that this is the same as previous exercise?

<h2 class="red-text">CatPhotoApp</h2>
&
.red-text {
color: red;
}
there is a pattern here follow it :smile:
<img src="https://bit.ly/fcc-relaxing-cat">//missing something
&
.smaller-image {
width: 100px;
}

@lthai18 have you been helped?
@sukumarkutagulla What is the challenge link :smile:
also don't post numbers anymore because the FCC site redesign does not include them..... I would have to count each challenge to get to where you are
Jason Lee
@JsonLitz
Jan 17 2016 05:32
@tommygebru Got it, thanks for the help!
CamperBot
@camperbot
Jan 17 2016 05:32
jsonlitz sends brownie points to @tommygebru :sparkles: :thumbsup: :sparkles:
:star: 358 | @tommygebru | http://www.freecodecamp.com/tommygebru
tommy
@tommygebru
Jan 17 2016 05:32
@JsonLitz NICE :+1:
christopher dewhurst
@christopher-dewhurst
Jan 17 2016 05:43
these courses are pretty nice
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 05:49
@lthai18 yes its ridiculous
FCC is changing
its not user friendly as like before
Herman Fassett
@HermanFassett
Jan 17 2016 05:51
@sukumarkutagulla yeah but they're working on fixing :/
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 05:52
will see how it will be later @HermanFassett
DevPoetsSociety
@DevPoetsSociety
Jan 17 2016 06:04
They had to rush through the changes for reasons. They're working on them as they go.
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 06:05
@JsonLitz i completed my 255
cannelflow
@cannelflow
Jan 17 2016 06:09
tried cloning w3school example theme but scroll spy is not working on codepen any idea working on my ide tough http://codepen.io/cannelflow/full/adLRJy/
Piyush Danej
@piyushdanej
Jan 17 2016 06:21
hi guys ! I am on bonfire ceaser's cipher , but i wanna know if where do i belong can be done by reduce() ?
has anybody done where do i belong using reduce() ?
JR Moreau
@jrmoreau
Jan 17 2016 06:22
can someone take a look at this and tell me if I'm missing anything? I the result seems to be correct but it's not passing

```
var myCar = new Car();
{
this.wheels = 4;
this.engines = 1;
this.seats = 1;
myCar.turboType = "twin";

}

```\

var myCar = new Car();
{
    this.wheels = 4;
  this.engines = 1;
  this.seats = 1;
myCar.turboType = "twin";


}
Zinga
@zingahart
Jan 17 2016 06:23
God evening? Was this ever resolved FreeCodeCamp/FreeCodeCamp#4177 because this Waypoint is a a lot to grasp.
Piyush Danej
@piyushdanej
Jan 17 2016 06:24
@jrmoreau this.turbotype.
JR Moreau
@jrmoreau
Jan 17 2016 06:25

@piyushdanej that's not what the instructions want though
"In the editor, use the Car constructor to create a new instance and assign it to myCar.

Then give myCar a nickname property with a string value."

Piyush Danej
@piyushdanej
Jan 17 2016 06:25
if you wanna declare "twin" value to all the cars's turbotype , then simply declare
turbotype = 'twin';
JR Moreau
@jrmoreau
Jan 17 2016 06:26
@zingahart I don't think it changed
@piyushdanej that doesn't work either.
Piyush Danej
@piyushdanej
Jan 17 2016 06:27
@jrmoreau yes so you should be declaring car() separately and then assign
var mycar =  new car();
Ken Murphy
@ken-murphy
Jan 17 2016 06:28
Hello World! Can someone help with the Title Case Bonfire?
CamperBot
@camperbot
Jan 17 2016 06:28

welcome to FreeCodeCamp @ken-murphy!

JR Moreau
@jrmoreau
Jan 17 2016 06:29
@piyushdanej this is the whole code snip
var Car = function() {
  this.wheels = 4;
  this.engines = 1;
  this.seats = 1;
};

// Only change code below this line.

var myCar =  new Car();
{
    this.wheels = 4;
  this.engines = 1;
  this.seats = 1;
myCar.turboType = "twin";


}
Ken Murphy
@ken-murphy
Jan 17 2016 06:29
function titleCase(str) {

  str = str.toLowerCase();
  var arr = new Array([]);

  arr = str.split(" ");

  var len = arr.length;

  for ( i = 0; i < len; i++ ) {

    arr[i][0].toUpperCase();

  }

  str = arr.join(" ");


  return str;
}

titleCase("I'm a little tea pot");
JR Moreau
@jrmoreau
Jan 17 2016 06:29
@piyushdanej i thought I did what you said already before.
Ken Murphy
@ken-murphy
Jan 17 2016 06:29
I'm getting back the string as all lower so my for loop isn't working...
I have read the documentation regarding toLowerCase and it isn't helping. Anyone?
help toLowerCase
CamperBot
@camperbot
Jan 17 2016 06:32

:point_right: js string prototype tolowercase [wiki]

String.prototype.toLowerCase()

The JavaScript method .toLowerCase() returns the same string it was called on, but in all lower case.

Syntax

str.toLowerCase()

:pencil: read more about js string prototype tolowercase on the FCC Wiki

Luis Sanchez
@sanchezl391
Jan 17 2016 06:34
@ken-murphy Seems I deleted my code on mine so I'll re-do it. I'll help if I can
Ken Murphy
@ken-murphy
Jan 17 2016 06:37
@sanchezl391 Cool. Thanks!
CamperBot
@camperbot
Jan 17 2016 06:37
ken-murphy sends brownie points to @sanchezl391 :sparkles: :thumbsup: :sparkles:
:star: 269 | @sanchezl391 | http://www.freecodecamp.com/sanchezl391
Piyush Danej
@piyushdanej
Jan 17 2016 06:39
@jrmoreau oh then , you dont need to again use this.wheels = 4 because you've used it the first time to define the car() constructor
the only additional property you are adding to mycar is the turbotype.
you just need to write
mycar.turbotype =
mycar.turbotype = "twin";
let me know whats the result .
JR Moreau
@jrmoreau
Jan 17 2016 06:41

@piyushdanej like this?
```var Car = function() {
this.wheels = 4;
this.engines = 1;
this.seats = 1;
};

// Only change code below this line.

var myCar = new Car();
myCar.turbotype = "twin";
```

Piyush Danej
@piyushdanej
Jan 17 2016 06:41
yess
@jrmoreau
JR Moreau
@jrmoreau
Jan 17 2016 06:42
var Car = function() {
  this.wheels = 4;
  this.engines = 1;
  this.seats = 1;
};

// Only change code below this line.

var myCar = new Car();
myCar.turbotype = "twin";
@piyushdanej it doesn't work
Piyush Danej
@piyushdanej
Jan 17 2016 06:42
is that so.
JR Moreau
@jrmoreau
Jan 17 2016 06:42

I get this in the output
```var Car = function() {
this.wheels = 4;
this.engines = 1;
this.seats = 1;
};

// Only change code below this line.

var myCar = new Car();
myCar.turbotype = "twin";
```

Piyush Danej
@piyushdanej
Jan 17 2016 06:42
what waypoint are you one ?
tell me the name of the waypoint .
JR Moreau
@jrmoreau
Jan 17 2016 06:42
Make Instances of Objects with a Constructor Function
@piyushdanej Make Instances of Objects with a Constructor Function
Piyush Danej
@piyushdanej
Jan 17 2016 06:44
@jrmoreau lemme have a look
JR Moreau
@jrmoreau
Jan 17 2016 06:45
thanks @piyushdanej
CamperBot
@camperbot
Jan 17 2016 06:45
jrmoreau sends brownie points to @piyushdanej :sparkles: :thumbsup: :sparkles:
:star: 270 | @piyushdanej | http://www.freecodecamp.com/piyushdanej
Piyush Danej
@piyushdanej
Jan 17 2016 06:47
@jrmoreau yepp , you gotta use 'turboType" with a capital T in type
and you also gotta add the nickname prop
JR Moreau
@jrmoreau
Jan 17 2016 06:48
@piyushdanej what do you mean add the nickname prop?
Piyush Danej
@piyushdanej
Jan 17 2016 06:49
in the description of the waypoint doesen't it say to also add a nickname property just like turboType ?
JR Moreau
@jrmoreau
Jan 17 2016 06:49
I thought that the turbotype line was the nickname line too
@piyushdanej like this?
var Car = function() {
  this.wheels = 4;
  this.engines = 1;
  this.seats = 1;
};

// Only change code below this line.

var myCar = new Car();
myCar.Turbotype = "twin";
myCar.Nickname = "cherry";
@piyushdanej ok... just passed
@piyushdanej thank you man... that wasn't SO hard haha
Yasin Yusuf
@YasinYA
Jan 17 2016 07:00
can anybody try to explain what this code is doing
var string = str.toLowerCase().split(/[^A-Za-z0-9]/gi).join('');  
  var aux = string.split('');  
  if (aux.join('') === aux.reverse().join('')){    
  return true; 
  }  
  return false;
  }
Brittany Harmon
@harmon520
Jan 17 2016 07:01
How do you copy your code into the chat? If I just copy/paste and send will it show up with the dark background?
Yasin Yusuf
@YasinYA
Jan 17 2016 07:03
@harmon520 first type{```} and then press {enter key + shift key} then paste your code and then press enter
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 07:03
JR Moreau
@jrmoreau
Jan 17 2016 07:05
@harmon520 use 3 backticks at the beginning and 3 backticks at the end.
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 07:05
@YasinYA which waypoint it is
??
Yasin Yusuf
@YasinYA
Jan 17 2016 07:05
Check for Palindromes Incomplete   *
@sukumarkutagulla
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 07:06
you have to split first then reverse then join
@y
@YasinYA
Yasin Yusuf
@YasinYA
Jan 17 2016 07:07
ok @sukumarkutagulla thanks
CamperBot
@camperbot
Jan 17 2016 07:07
yasinya sends brownie points to @sukumarkutagulla :sparkles: :thumbsup: :sparkles:
:star: 258 | @sukumarkutagulla | http://www.freecodecamp.com/sukumarkutagulla
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 07:08
@first replace
then do rest
Piyush Danej
@piyushdanej
Jan 17 2016 07:09
@jrmoreau you're welcome
Luis Sanchez
@sanchezl391
Jan 17 2016 07:09
@ken-murphy were you able to solve it?
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 07:10
@YasinYA see order replace, toLowerCase, split, reverse and join
Yasin Yusuf
@YasinYA
Jan 17 2016 07:10
ok @sukumarkutagulla
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 07:11
just try and ping me if you cannot
brb
Piyush Danej
@piyushdanej
Jan 17 2016 07:11
@YasinYA the first line is a regex expression ,which is splitting the string at all the characters which are NOT A-Za-z0-9
and then its splitting the updated string at every character
then its checking if the regular joined string is equal to reverse-joined-string.
and if it is then it returns true .
Yasin Yusuf
@YasinYA
Jan 17 2016 07:14
@piyushdanej i got it thanks bro
CamperBot
@camperbot
Jan 17 2016 07:14
yasinya sends brownie points to @piyushdanej :sparkles: :thumbsup: :sparkles:
:star: 271 | @piyushdanej | http://www.freecodecamp.com/piyushdanej
James
@dev15firkin
Jan 17 2016 07:18
oh boy, record collection
how do you link code to the chatroom?
Luis Sanchez
@sanchezl391
Jan 17 2016 07:24
@dev15firkin ``` then Shift+Enter
then past code there and Ctrl+Enter
James
@dev15firkin
Jan 17 2016 07:25

// Setup
var collection = {
2548: {
album: "Slippery When Wet",
artist: "Bon Jovi",
tracks: [
"Let It Rock",
"You Give Love a Bad Name"
]
},
2468: {
album: "1999",
artist: "Prince",
tracks: [
"1999",
"Little Red Corvette"
]
},
1245: {
artist: "Robert Palmer",
tracks: [ ]
},
5439: {
album: "ABBA Gold"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function update(id, prop, value) {

if (value !== "" && prop == "tracks"){
collection[id][prop].push(value);
}
else if (value !== "" && prop == "artists"){
collection[id][artist] = [value];
}
else if (value === ""){
delete collection.prop[value];
}

return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");

hmm not quite like that huh?
'''
CamperBot
@camperbot
Jan 17 2016 07:26
:bulb: to format code use backticks! ``` more info
Luis Sanchez
@sanchezl391
Jan 17 2016 07:27
@dev15firkin no lol. first type ``` then hit Shift+Enter then paste code. Then Ctrl+Enter :smile:
James
@dev15firkin
Jan 17 2016 07:28
```
// Setup
var collection = {
    2548: {
      album: "Slippery When Wet",
      artist: "Bon Jovi",
      tracks: [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    2468: {
      album: "1999",
      artist: "Prince",
      tracks: [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    1245: {
      artist: "Robert Palmer",
      tracks: [ ]
    },
    5439: {
      album: "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function update(id, prop, value) {

  if (value !== "" && prop == "tracks"){
    collection[id][prop].push(value);
  }
  else if (value !== "" && prop == "artists"){
    collection[id][artist] = [value];
  }
  else if (value === ""){
    delete collection.prop[value];
  }

  return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");
ahha
thanks man
James
@dev15firkin
Jan 17 2016 07:35
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function update(id, prop, value) {

  if (value !== "" && prop === "tracks"){
    collection[id][prop].push(value);
  }
  else if (value !== "" && prop === "artist"){
    collection[id][prop] = value;
  }
  else if (value === ""){
    delete collection.prop;
  }

  return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");
ok so something seems to be wrong with my second else if
James
@dev15firkin
Jan 17 2016 07:41
oh I figured it out. I forgot to put id before prop
delete collection[id][prop]
Madhulika
@madhulika24
Jan 17 2016 07:59
how we create class red-text to any element
greg
@wearenotgroot
Jan 17 2016 08:03
@madhulika24 in your <style></style> section create the class red-text
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 08:04
can somebody help me with 258 challege
greg
@wearenotgroot
Jan 17 2016 08:04
@madhulika24 to create a class. example
.classname{
    attributename:value;
}
@sukumarkutagulla what is the name of the waypoint?
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 08:05
@madhulika24 Return Largest Numbers in Arrays
greg
@wearenotgroot
Jan 17 2016 08:06
@sukumarkutagulla what do you have so far?
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 08:06
function largestOfFour(arr) {

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

   }
 }

}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
i dont have logic what to retrieve here
Luis Sanchez
@sanchezl391
Jan 17 2016 08:08
@sukumarkutagulla Use sort. http://www.w3schools.com/jsref/jsref_sort.asp
greg
@wearenotgroot
Jan 17 2016 08:09
@sukumarkutagulla what @sanchezl391 said :+1:
DJ
@qualitymanifest
Jan 17 2016 08:09
@sukumarkutagulla
//for each subarray
  //push the biggest number into the array that you will return when you are done
Luis Sanchez
@sanchezl391
Jan 17 2016 08:09
@sukumarkutagulla then you can use the last or first number (depending on your order) to find largest number for each array
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 08:11
how can you expalin
pls
Luis Sanchez
@sanchezl391
Jan 17 2016 08:13
There change fruits array into numbers and Try it. For Example : var fruits = [1,3,2];
greg
@wearenotgroot
Jan 17 2016 08:14
@sukumarkutagulla Array.sort() will sort all elements in that array in ascending or descending order depending on what you want
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 08:15
ok let me give a try
greg
@wearenotgroot
Jan 17 2016 08:15
@sukumarkutagulla in your case for example. arr[0] is equals [4, 5, 1, 3], if you apply .sort()-->arr[0].sort() it will give you ------>[1, 3, 4, 5]
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 08:16
yes
then??
greg
@wearenotgroot
Jan 17 2016 08:16
@sukumarkutagulla get the largest number?
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 08:17
do we have method for that
Luis Sanchez
@sanchezl391
Jan 17 2016 08:17
@sukumarkutagulla You can use array.length -1 to get last Number.(Biggest)
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 08:18
ok
thanks
Luis Sanchez
@sanchezl391
Jan 17 2016 08:18
@sukumarkutagulla No prob
Anaxim
@Anaxim
Jan 17 2016 08:23
Working on the calculator zipline. I'd like you to try your best to break it: http://codepen.io/Anaxim/full/KVvBxx/
Eina
@thelittleblacksmith
Jan 17 2016 08:24
@Anaxim so if i keep pressing the + sign, for example, it just keeps adding 0's?
Ashley
@atan77
Jan 17 2016 08:24
@Anaxim you get a lot of trailing zeros if you do something like 9*0.001
Anaxim
@Anaxim
Jan 17 2016 08:25
Hm
Thanks
And whoops
Woah, how I did miss that it would do that with the zeroes!
The ones adding, not the trailing ones
greg
@wearenotgroot
Jan 17 2016 08:26
@Anaxim also maybe implement a delete a one by one number?
Eina
@thelittleblacksmith
Jan 17 2016 08:26
@Anaxim also the percent sign doesn't seem to be doing what it's supposed to do? It seems to just add whatever numbers were before it?
Ashley
@atan77
Jan 17 2016 08:26
@Anaxim also, I think most people wouldn't consider the % button as giving the mod function
Anaxim
@Anaxim
Jan 17 2016 08:26
What would they consider it
?
Ashley
@atan77
Jan 17 2016 08:28
I'd expect the % button to give me a percentage
greg
@wearenotgroot
Jan 17 2016 08:28
@Anaxim so CE takes care of clearing everything, then make Del only delete one by one number
Anaxim
@Anaxim
Jan 17 2016 08:28
Fixed the adding zeroes bit
SleppyBear
@SleppyBear
Jan 17 2016 08:35
blob
greg
@wearenotgroot
Jan 17 2016 08:36
@SleppyBear remember the count starts at 0 not 1
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 08:40
@wearenotgroot
function largestOfFour(arr) {
//  arr = arr.sort();
 for(var i=0;i<arr.length;i++){
   for(var j=0;j<arr[i].length;j++){
    largest = arr[i].sort();
     return largest.length-1;
   }
 }

}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
its not working
greg
@wearenotgroot
Jan 17 2016 08:42
@sukumarkutagulla yes it wont work
@sukumarkutagulla the instruction said to get the largest numbers from the arrays and put em in another array
@sukumarkutagulla the end result should be for this one [5,27,39,1001]
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 08:44
yea
greg
@wearenotgroot
Jan 17 2016 08:44
@sukumarkutagulla you return the wrong thing largest.length-1;
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 08:45
how
?
kingdevapps
@kingdevapps
Jan 17 2016 08:46
#123
greg
@wearenotgroot
Jan 17 2016 08:46
@sukumarkutagulla make an empty array outside the loop
kingdevapps
@kingdevapps
Jan 17 2016 08:47
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

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

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

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

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

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

<a href="#"><img class="smaller-image thick-green-border" alt="A cute orange cat lying on its back" src="https://bit.ly/fcc-relaxing-cat"></a>

<p>Things cats love:</p>
<ul>
  <li>cat nip</li>
  <li>laser pointers</li>
  <li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
  <li>flea treatment</li>
  <li>thunder</li>
  <li>other cats</li>
</ol>
<form action="/submit-cat-photo" input type="text" placeholder="cat photo URL">
</form>
greg
@wearenotgroot
Jan 17 2016 08:47

@sukumarkutagulla then get the largest number from arr[i]------> by

arr[i][arr[i].length-1]

then push this on the empty array using .push()

finalArr.push( arr[i][arr[i].length-1]);
kingdevapps
@kingdevapps
Jan 17 2016 08:47
Nest your text input element within a form element.
error
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 08:49
can you please rewrite my code with correct one
greg
@wearenotgroot
Jan 17 2016 08:49
@sukumarkutagulla check you private chat
ultramun
@ultramun
Jan 17 2016 09:08
where exactly to put this code? i tried put it after <style> but it didn't work.smaller-image {
width: 100px;
}
greg
@wearenotgroot
Jan 17 2016 09:10

@ultramun this is a class

.smaller-image {
width: 100px;
}

when you are done creating them you need to apply them to some element(s) to see the effect

for example

<img class="smaller-image"></img>
@kingdevapps nest means to put it inside or between the
<form><input type=" "></input></form>
mukhtaarabdi
@mukhtaarabdi
Jan 17 2016 09:28
hi, is this correct way to turn string to Array?
function reverseString(str) {
  str.split();
  return str;
}

reverseString("hello");
greg
@wearenotgroot
Jan 17 2016 09:29
@mukhtaarabdi .split('') you will get an array of characters on the string
@mukhtaarabdi depending on the argument you put in the .split(arg) function you can get different result
@mukhtaarabdi an example .split(' ') will separate the string by space
mukhtaarabdi
@mukhtaarabdi
Jan 17 2016 09:32
yes but this is the task :
Reverse the provided string.

You may need to turn the string into an array before you can reverse it.

Your result must be a string.
so i want to return olleh
greg
@wearenotgroot
Jan 17 2016 09:34
@mukhtaarabdi steps:
  1. turn string to an array by using .split('')
  2. use the .reverse() on the array from 1.
  3. use .join('') on the reversed array from 2. to get a string
@mukhtaarabdi go search on google `js string methods
@mukhtaarabdi also go search on google js array methods
mukhtaarabdi
@mukhtaarabdi
Jan 17 2016 09:35
@wearenotgroot so all this things are happenning inside the function reverseString?
greg
@wearenotgroot
Jan 17 2016 09:36
@mukhtaarabdi you'll find available method
@mukhtaarabdi the .reverse() method reverse the order of the array you got from .split('')
Irfan Syed
@syedirfan7
Jan 17 2016 09:44
ok @marhyorh what could have been my approach ?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 09:57
How do I return an empty set? As in a truly empty set, just [], no speech marks around it, no 'null' in the middle. Is there a way?
Markus Kiili
@Masd925
Jan 17 2016 09:59
@CodingDucky return [];
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 09:59
thanks @Masd925
CamperBot
@camperbot
Jan 17 2016 09:59
codingducky sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star: 716 | @masd925 | http://www.freecodecamp.com/masd925
Robert Uivarosi
@URobert
Jan 17 2016 10:00
@CodingDucky if you have an empty array... let's say a = []; returning a, will result in []
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 10:00
Why doesn't this code work then?
function bouncer(arr) {
newArr = [];
// Don't show a false ID to this bouncer.
for (i = 0; i < arr.length; i++){
if (arr[i] !== '' && arr[i] !== false && arr[i] !== null && arr[i] !== 0 && arr[i] !== undefined && arr[i] !== NaN) {
newArr.push(arr[i]);
}
}
return newArr;
}
oops
function bouncer(arr) {
  newArr = [];
  // Don't show a false ID to this bouncer.
  for (i = 0; i < arr.length; i++){
    if (arr[i] !== '' && arr[i] !== false && arr[i] !== null && arr[i] !== 0 && arr[i] !== undefined && arr[i] !== NaN) {
      newArr.push(arr[i]);
    }
  }
  return newArr;
}
Robert Uivarosi
@URobert
Jan 17 2016 10:01
I would guess this : arr[i] !== NaN returns an error in the console ?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 10:01
Doesn't
Markus Kiili
@Masd925
Jan 17 2016 10:01
@CodingDucky NaN is special. Use value==value to test that value is not NaN.
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 10:02
how is NaN special?
Markus Kiili
@Masd925
Jan 17 2016 10:02
NaN is not equal to NaN.
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 10:02
Also @URobert It doesn't give an error. The code runs fine, just doesn't give the intended results
@Masd925 wat
what does that even mean
Markus Kiili
@Masd925
Jan 17 2016 10:03
It is the only value for which value!==value.
You can use value!==value for testing for NaN, or you can use typeof value==='number' && isNaN(value).
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 10:04
My original code worked fine for two out of three. The problem is with bouncer([false, null, 0, NaN, undefined, ""]) it returns null, even though I have my if statement set to remove it
Robert Uivarosi
@URobert
Jan 17 2016 10:04
@CodingDucky are you familiar with using if conditions without any operators .?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 10:04
And no
@URobert
Robert Uivarosi
@URobert
Jan 17 2016 10:05
for example if(fox){ //execute}
Markus Kiili
@Masd925
Jan 17 2016 10:05
@CodingDucky It is the NaN your code is not removing. FCC shows it as null probably.
Robert Uivarosi
@URobert
Jan 17 2016 10:05
@CodingDucky you know when the code inside your if will be executed?
@Masd925 he is right
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 10:06
@URobert it will evaluate if the statement in () is true?
Robert Uivarosi
@URobert
Jan 17 2016 10:06
@CodingDucky and if I used your code I do get the warning message: "use isNaN"
Markus Kiili
@Masd925
Jan 17 2016 10:07
@CodingDucky Just put: && arr[i]===arr[i] as the last condition in the if clause and it works.
Robert Uivarosi
@URobert
Jan 17 2016 10:07
@CodingDucky correct, and when will fox be true ?
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 10:07
When all the statements connected by ands are true?
Also, would arr.length return the number of elements in the array?
NEVERMIND I GOT IT TO WORK
Robert Uivarosi
@URobert
Jan 17 2016 10:09
@CodingDucky "Also, would arr.length return the number of elements in the array?" -yes
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 10:09
WOOOOO
thank @URobert
CamperBot
@camperbot
Jan 17 2016 10:09
codingducky sends brownie points to @urobert :sparkles: :thumbsup: :sparkles:
:star: 487 | @urobert | http://www.freecodecamp.com/urobert
Robert Uivarosi
@URobert
Jan 17 2016 10:09
@CodingDucky did you use if(arr[i]) {} ? :)
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 10:11
And I don't think I did?
function bouncer(arr) {
  newArr = [];
  // Don't show a false ID to this bouncer.
  for (i = 0; i < arr.length; i++){
    if (arr[i] !== '' && arr[i] !== false && arr[i] !== null && arr[i] !== 0 && arr[i] !== undefined && arr[i] == arr[i]) {
      newArr.push(arr[i]);
    }
  }
  return newArr;
}

bouncer([123]);
there's my full code
Robert Uivarosi
@URobert
Jan 17 2016 10:11
@CodingDucky that works too
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 10:11
not sure why some parts are commented out
Robert Uivarosi
@URobert
Jan 17 2016 10:11
@CodingDucky what I earlier tried to explain
@CodingDucky just formating when you post on gitter
@CodingDucky you can use only if (arr[i]) { }
Markus Kiili
@Masd925
Jan 17 2016 10:12
@CodingDucky Your condition does the same as built-in Boolean function Boolean(arr[i]). Therefore if(arr[i]) work as @URobert said.
If has automatic conversion to boolean.
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 10:13
now I get it
all falsy values become false in if statements
got it
Rich Keyzor
@Web-Dev-Rich
Jan 17 2016 10:13
On the “Check for Palindromes” challenge I have passed all tests except the last which is to check the following string 0_0 (: /-\ :) 0-0 and should return true. BUT look at the second character _ and the second to last -. They are not the same! What am I missing please?
Markus Kiili
@Masd925
Jan 17 2016 10:14
@CodingDucky It is good practice that you did it first yourself. Now you know how Boolean works.
@Web-Dev-Rich You should first remove all non-alphanumeric characters. Then that string is a palindrome, "0000" I think.
Robert Uivarosi
@URobert
Jan 17 2016 10:16
@Web-Dev-Rich you probably have an issue with the code that is filtering out your non-alphanumeric characters
Jose Dzireh Chong
@CodingDucky
Jan 17 2016 10:16
function destroyer(arr) {
  var temp = [];
  for (var i = 1; i < arr.length; i++) {
    temp.push(arr[i]);
  }
  // Remove all the values
  return temp;
}

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

so i want (so far) to add all the elements in 'arr' to 'temp' other than the first one

It's not working, the function that I have above returns 2, 3, 1, 2, 3

Markus Kiili
@Masd925
Jan 17 2016 10:18
@CodingDucky destroyer only has one parameter arr, which catches the first argument [1, 2, 3, 1, 2, 3].
The extra arguments 2,3 must be taken from arguments object.
arguments is a special array-like object inside every function that has all the arguments passed to the function. It has arguments.length and access by arguments[i], but no array methods. You can loop through arguments, and if you wan't to use array methods on arguments, you can transform arguments into an array by:
Markus Kiili
@Masd925
Jan 17 2016 10:23
var args = [];
  for (var i = 0; i < arguments.length; i++) args[i] = arguments[i];
Rich Keyzor
@Web-Dev-Rich
Jan 17 2016 10:24
@URobert I used \W+/g which I thought did that but guess not. Struggling to find the correct regex!
Markus Kiili
@Masd925
Jan 17 2016 10:24
@Web-Dev-Rich You must remove underscore.
Use /[W_]/g
Robert Uivarosi
@URobert
Jan 17 2016 10:28
@Web-Dev-Rich as @Masd925 said, that seems right.
Rich Keyzor
@Web-Dev-Rich
Jan 17 2016 10:36
@Masd925 That just broke more tests! This is what I used var cleanStr = str.replace(/[W_]/g, "").toLowerCase();
Robert Uivarosi
@URobert
Jan 17 2016 10:38
@Web-Dev-Rich can you link your whole code, let me take a look at it
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 10:39
hi @wearenotgroot
function end(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor

  if(str.endsWith(str.length) == target && str.endswith(str.length) !== target){
    return true;
  }else
  return false;
}

end("Bastian", "n");
somebody else there?
Rich Keyzor
@Web-Dev-Rich
Jan 17 2016 10:42
This message was deleted
Anaxim
@Anaxim
Jan 17 2016 10:44
console.log(9*0.001);
console.log(9*0.002);
console.log(9*0.004);
console.log(9*0.008);
console.log(9*0.016);
console.log(9*0.032);
Someone throw that in your favorite interpreter and tell me what you log?
For JS
Rich Keyzor
@Web-Dev-Rich
Jan 17 2016 10:45
@URobert
function palindrome(str) {
  var cleanStr = str.replace(/[W_]/g, "").toLowerCase();
  var reverseStr = cleanStr.split("").reverse().join("");
  console.log(cleanStr, reverseStr);

  if (cleanStr === reverseStr) {
    return true;
  } else {
    return false;
  }
}
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 10:46
@Web-Dev-Rich replace, toLowerCase, split, reverse and join it is the order
you need to work
in replace
use the delimiters
like
alpha - numeric
A-Z0-9a-z
Robert Uivarosi
@URobert
Jan 17 2016 10:47
@Web-Dev-Rich as I was saying your filter is not working properly
@Web-Dev-Rich here, try this: str.replace(/[\W_]/g, '')
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 10:48
no @Web-Dev-Rich
str.replace(/[A-Z0-9a-z]/g)
Rich Keyzor
@Web-Dev-Rich
Jan 17 2016 10:50
@URobert many thanks that extra \ worked. I think I need more study on regex!
CamperBot
@camperbot
Jan 17 2016 10:50
web-dev-rich sends brownie points to @urobert :sparkles: :thumbsup: :sparkles:
ultramun
@ultramun
Jan 17 2016 10:50
need help with this particular exercise
CamperBot
@camperbot
Jan 17 2016 10:50
:star: 488 | @urobert | http://www.freecodecamp.com/urobert
ultramun
@ultramun
Jan 17 2016 10:50
can you check what is wrong with this?

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

<style>
.smaller-image {
width: 100px;
}
.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">
<img class="smaller-image">

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

Rich Keyzor
@Web-Dev-Rich
Jan 17 2016 10:50
thanks @sukumarkutagulla
CamperBot
@camperbot
Jan 17 2016 10:50
web-dev-rich sends brownie points to @sukumarkutagulla :sparkles: :thumbsup: :sparkles:
:star: 260 | @sukumarkutagulla | http://www.freecodecamp.com/sukumarkutagulla
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 10:51
:smile: wc
Rich Keyzor
@Web-Dev-Rich
Jan 17 2016 10:51
thanks @Masd925
CamperBot
@camperbot
Jan 17 2016 10:51
web-dev-rich sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star: 717 | @masd925 | http://www.freecodecamp.com/masd925
Robert Uivarosi
@URobert
Jan 17 2016 10:51
@Web-Dev-Rich yw ;)
@ultramun what is that you need to do ?
ultramun
@ultramun
Jan 17 2016 10:52
can't run it
Robert Uivarosi
@URobert
Jan 17 2016 10:52
@ultramun link pl
z
sukumarkutagulla
@sukumarkutagulla
Jan 17 2016 10:52
somebody help me with 260
challenge
function end(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor

  if(str.endsWith(str.length) == target && str.endswith(str.length) !== target){
    return true;
  }else
  return false;


}

end("Bastian", "n");
Robert Uivarosi
@URobert
Jan 17 2016 10:55
@ultramun that is pretty straight forwards: 1) add the given class name to your img
2) use css to mod the width to be 100px
@ultramun i did not see any attempt of doing that
ultramun
@ultramun
Jan 17 2016 11:00
@URobert i just paste the link of the challenge.

@URobert can you find what is wrong in this : <link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<style>
.smaller-image {
width: 100px;
}
.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">
<img class="smaller-image">

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

Robert Uivarosi
@URobert
Jan 17 2016 11:02
@ultramun you need this: class="smaller-image" after img src="https://bit.ly/fcc-relaxing-cat"
@ultramun you have to define the class within the same tag < >
@ultramun otherwise you are not attributing the class to the right image. Does that make sense?
ultramun
@ultramun
Jan 17 2016 11:03
@URobert just a sec i'm a little slowpoke here btw thanks
CamperBot
@camperbot
Jan 17 2016 11:03
ultramun sends brownie points to @urobert :sparkles: :thumbsup: :sparkles:
:star: 489 | @urobert | http://www.freecodecamp.com/urobert
Robert Uivarosi
@URobert
Jan 17 2016 11:04
@ultramun yw, mak the change I mentioned it should work afterwards.
ultramun
@ultramun
Jan 17 2016 11:08
@URobert thanks i did it
CamperBot
@camperbot
Jan 17 2016 11:08
ultramun sends brownie points to @urobert :sparkles: :thumbsup: :sparkles:
:warning: ultramun already gave urobert points
Robert Uivarosi
@URobert
Jan 17 2016 11:11
@ultramun I'm glad I could help. Good luck with the rest. I'm out
Ademola Adegbuyi
@ooade
Jan 17 2016 11:19
Hello World!
CamperBot
@camperbot
Jan 17 2016 11:19

welcome to FreeCodeCamp @marhyorh!

Ademola Adegbuyi
@ooade
Jan 17 2016 11:19
Haha @camperbot
Tay
@tfloyd95
Jan 17 2016 11:23
Welcome
kingdevapps
@kingdevapps
Jan 17 2016 11:39
@wearenotgroot thnx for the help
CamperBot
@camperbot
Jan 17 2016 11:39
kingdevapps sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star: 463 | @wearenotgroot | http://www.freecodecamp.com/wearenotgroot
NormalWare
@Centuriom
Jan 17 2016 11:47
Hello /Help !
Josef Kolena
@ggverysoon
Jan 17 2016 11:48
help profile lookup
CamperBot
@camperbot
Jan 17 2016 11:48

:point_right: checkpoint profile lookup [wiki]

Checkpoint: Profile Lookup

Instructions

We have an array of objects representing different people in our contacts lists.

A lookUp function that takes firstName and a property (prop) as arguments has been pre-written for you.

The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact.

If both are true, then return the "value" of that property.

If firstName does not correspond to any contacts then return "No such contact"

If prop does not correspond to any valid properties then return "No such property"

Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.

:pencil: read more about checkpoint profile lookup on the FCC Wiki

NormalWare
@Centuriom
Jan 17 2016 11:48
How can i properly use the function .filter() without creating a new variable
??
Markus Kiili
@Masd925
Jan 17 2016 11:54
@Centuriom .filter creates a new array, so you must assign it to a variable. You can use the same variable if you like arr=arr.filter(...).
Or are you talking about the callback function passed to .filter()?
NormalWare
@Centuriom
Jan 17 2016 11:59
the callback function passed to .filter()
Markus Kiili
@Masd925
Jan 17 2016 12:00
@Centuriom You can define callback outside filter and pass it, or you can use function literal by writing the function inside .filter parenthesis.
NormalWare
@Centuriom
Jan 17 2016 12:02
@Masd925 Yeah, but i need to compare one element of the array to the another elements of the array, i don't know how to do that inside .filter()
Markus Kiili
@Masd925
Jan 17 2016 12:05
@Centuriom Post your code and try to explain what you try to do.
NormalWare
@Centuriom
Jan 17 2016 12:07
function destroyer(arr) {
  // Remove all the values
  return arr.filter(function(number) {for (i=1, i < arr.length,i++) {return number != arr[i]; }});
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Blauelf
@Blauelf
Jan 17 2016 12:07
This message was deleted
NormalWare
@Centuriom
Jan 17 2016 12:07
I want the filter to be all the elements of the array that are greater than arr[0]
Markus Kiili
@Masd925
Jan 17 2016 12:08
@Centuriom There is only one parameter on destroyer, but several arguments are passed. arr only catches the first argument [1, 2, 3, 1, 2, 3]. The extra arguments must be taken from arguments object.
NormalWare
@Centuriom
Jan 17 2016 12:08

for example:

arr = [[1,2,3],2,3]

i want the filter to be 2 and 3, and the filtered element would be [1,2,3]

Markus Kiili
@Masd925
Jan 17 2016 12:09
@Centuriom You can do this:
var args = [];
  for (var i = 1; i < arguments.length; i++) args[i] = arguments[i];
Then you have the extra arguments in an array.
You can use arr and args.
NormalWare
@Centuriom
Jan 17 2016 12:10
@Masd925 Oh thanks man, i got it now
CamperBot
@camperbot
Jan 17 2016 12:10
centuriom sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star: 718 | @masd925 | http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
Jan 17 2016 12:14
@Centuriom Here is an example of how to use filter:
function isBigEnough(value) {
  return value >= 10;
}
var filtered = [12, 5, 8, 130, 44].filter(isBigEnough);
// filtered is [12, 130, 44]

var filteredToo = [12, 5, 8, 130, 44].filter(function(value){
    return value>=10;
});
// filteredToo is [12, 130, 44]
NormalWare
@Centuriom
Jan 17 2016 12:16
@Masd925 thank you!
Nick Robson
@nickrobson
Jan 17 2016 12:16
This message was deleted
NormalWare
@Centuriom
Jan 17 2016 12:18
@nickrobson I don't get it
Markus Kiili
@Masd925
Jan 17 2016 12:18
@nickrobson My understanding of this is that there are no optimization problems if you only use arguments[i] and arguments.length, like I did in above code. If you for example slice arguments, there are problems.
Nick Robson
@nickrobson
Jan 17 2016 12:19
Oh? Sorry. Must have misread the article earlier then. :(
Markus Kiili
@Masd925
Jan 17 2016 12:19
@nickrobson It is because the code stores the numbers. Arguments is not passed.
Blauelf
@Blauelf
Jan 17 2016 12:20
@nickrobson Are you sure it is better to create a reference? Slicing seems to be worst, but using [] and length seems to be ok. The engine can use its internal array and does not have to create an actual arguments object.
Nick Robson
@nickrobson
Jan 17 2016 12:20
Deleted my earlier message since it's been proven wrong. Just read the MDN docs.
(again)
Blauelf
@Blauelf
Jan 17 2016 12:22
Passing the arguments object requires creation of that object, so no way to optimize that.
Anyone has an idea if a copy of the reference will be breaking any optimization, too?
Like in var args=arguments;
Markus Kiili
@Masd925
Jan 17 2016 12:24
@Blauelf How could that solve the problem?
Blauelf
@Blauelf
Jan 17 2016 12:25
Outer function's local variable is visible to the inner function, even if it points to outer function's arguments object.
Hemei de Wreede
@HemeiW
Jan 17 2016 12:25

Hi all, I got stuck with this one: wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).
wordBlanks("cat", "little", "hit", "slowly") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result = "myNoun";
result = "myAdjective";

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");

Blauelf
@Blauelf
Jan 17 2016 12:26
@HemeiW Use string concatenation (+ operator), using all the four variables an some text. Might want some code to check for empty strings, so you get a nice sentence even if words are missing.
@Masd925 One way to access the outer arguments object (but I don't know how this affects optimization, probably worse than doing a manual copy, but on the other hand you'll need to copy first, so maybe still better?)
function outer() {
  var args=arguments;
  function inner() {
    // obviously has its own arguments object, hiding outer's
    // but can access outer's arguments object using local variable args
  }
}
Hemei de Wreede
@HemeiW
Jan 17 2016 12:33
@Blauelf something like this? : result = "My " + "myNoun " + "is " + "myAdjective " + "and " + "myVerb " + "can " + "myAdverb";
Blauelf
@Blauelf
Jan 17 2016 12:35
More like result = "My " + myNoun + " is " + myAdjective + " and " + myVerb + " can " + myAdverb; (you want those to be variable names, not strings!)
Markus Kiili
@Masd925
Jan 17 2016 12:36
@Blauelf I get your point, but I guess that doesn't differ from the case of passing arguments, because in both cases the arguments object must be there in memory.
Hemei de Wreede
@HemeiW
Jan 17 2016 12:38
@Blauelf weird it does not work, it won't allow me to continue
Blauelf
@Blauelf
Jan 17 2016 12:38
@HemeiW Check the test cases.
Nick Robson
@nickrobson
Jan 17 2016 12:39
@Blauelf Only possible better way would be to create a local function:
function arg(i) { return arguments[i]; };
function alen() { return arguments.length; };
Luke Maddin
@thenewjarvis
Jan 17 2016 12:39
?does anyone know why i don't have my link? www.freecodecamp/the newjarvis
Nick Robson
@nickrobson
Jan 17 2016 12:40
you really screwed up the link
First of all, http://freecodecamp.com
Second of all, there are no subdomains in that format.
Blauelf
@Blauelf
Jan 17 2016 12:41
@HemeiW There is one saying you need to return at least 30 characters if called with four empty strings, you probably failed that one. You could include some blocks like if (myNoun=="") { myNoun="sister"; }, or even myNoun=myNoun||"sister";, or somehow artificially lengthen your sentence.
Luke Maddin
@thenewjarvis
Jan 17 2016 12:41
Firstly, it was a simple mistake, I hit space by accident.
secondly- Hence why i was asking
Blauelf
@Blauelf
Jan 17 2016 12:42
about @thenewjarvis
CamperBot
@camperbot
Jan 17 2016 12:42
:warning: no user found for thenewjarvis
Hemei de Wreede
@HemeiW
Jan 17 2016 12:43
I reset the code and replaced it as but it doesn't work... : result = "My " + myNoun + " is " + myAdjective + " and " + myVerb + " very " + myAdverb + "!!";
Blauelf
@Blauelf
Jan 17 2016 12:43
@HemeiW Which test cases fail?
@thenewjarvis When you are logged in on FCC, where does clicking your profile photo take you to? BTW, your link is missing the .com
Luke Maddin
@thenewjarvis
Jan 17 2016 12:46
@Blauelf got it thanks
CamperBot
@camperbot
Jan 17 2016 12:46
thenewjarvis sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star: 901 | @blauelf | http://www.freecodecamp.com/blauelf
Blauelf
@Blauelf
Jan 17 2016 12:48
@thenewjarvis If you haven't, link to your github profile in FCC, and @camperbot will find you :)
Luke Maddin
@thenewjarvis
Jan 17 2016 12:48
I have just linked it. :)
Blauelf
@Blauelf
Jan 17 2016 12:49
The link in your gitter profile is still missing the .com.
Hemei de Wreede
@HemeiW
Jan 17 2016 12:51
@Blauelf still those two cases: wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).
wordBlanks("cat", "little", "hit", "slowly") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).
Luke Maddin
@thenewjarvis
Jan 17 2016 12:53
@Blauelf like that?
Blauelf
@Blauelf
Jan 17 2016 12:53
@thenewjarvis Now the broken link is gone. But now one can find your profile by asking @camperbot.
about @thenewjarvis
CamperBot
@camperbot
Jan 17 2016 12:54
:star: 36 | @thenewjarvis | http://www.freecodecamp.com/thenewjarvis
Luke Maddin
@thenewjarvis
Jan 17 2016 12:54
thats great. does that mean I can now get my brownie points?
Blauelf
@Blauelf
Jan 17 2016 12:55
@HemeiW Is that really the code you use and the value you return? No missing space characters?
Luke Maddin
@thenewjarvis
Jan 17 2016 12:55
i had some yesterday but as it couldn't find my profile I lose them
lost*
Blauelf
@Blauelf
Jan 17 2016 12:55
Yeah, does not work without github link, as you are here identified by github profile, and might use a different name on FCC.
Luke Maddin
@thenewjarvis
Jan 17 2016 12:56
i see. no worries will have to work on earning some more :)