These are chat archives for FreeCodeCamp/Help

9th
Aug 2015
Jacques de Reynal
@jdr972
Aug 09 2015 00:13
@mockturtle I figured it out
thanks though!
:smiley:
Anthony Blow
@anthonyblow
Aug 09 2015 00:15

hello people! wanted to know if I could get a little help on on challenge: Waypoint: Change the Font Size of an Element.<style>
.red-text {
color: red;
}
</style>

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

{ font-size: 16px; }

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

wondering where I am going wrong with the font size
Benjamin
@b1ggb3n86
Aug 09 2015 00:17
hi everyone. i've been getting stuck quite a bit lately on bonfires. I'm currently on seek and destroy, and the documentation provided is a bit hard to chew. can anybody recommend someplace/something i can delve into a bit deeper?
Marc Davenport
@oneate7
Aug 09 2015 00:22
@anthonyblow - The font size should be set inside the <style> tag, just like .red-text. It should target the <p> elements, using .p
  • using p, not .p... sorry.
gazzer82
@gazzer82
Aug 09 2015 00:34
Evening all, i'm having some issues with Bonfire: Inventory Update, seems the alphabetical sort that works in my testing IDE, does not work within the FreeCodeCamp code, so the results are not being correctly alphabetised. Anyone able to offer some guidance on why and a way to sort it?
function inventory(arr1, arr2) {
    // All inventory must be accounted for or you're fired!
    return arr2.reduce(function(stockArr,stockItem){
        var updated = false;
        stockArr.forEach(function(item){
            if(item[1] == stockItem[1]){
                item[0] = stockItem[0] + item[0];
            updated = true;
            }
        });
        if (updated === false){
            stockArr.push(stockItem);
        }
        return stockArr;
    },arr1).sort(function(a,b){
        return (a[1].toUpperCase() > b[1].toUpperCase());
    });
}
Anthony Blow
@anthonyblow
Aug 09 2015 00:40
@oneate7 I did it! that was my challenge for my first day of coding! THANKS!
Marc Davenport
@oneate7
Aug 09 2015 00:40
@anthonyblow - Awesome! Congrats :smile:
deaninous
@deaninous
Aug 09 2015 00:42
Bf Euclid
CamperBot
@camperbot
Aug 09 2015 00:42
Sorry, can't find a bonfire called euclid. [ Check the map? ]
deaninous
@deaninous
Aug 09 2015 00:42
Bf loop
CamperBot
@camperbot
Aug 09 2015 00:42
Sorry, can't find a bonfire called loop. [ Check the map? ]
gazzer82
@gazzer82
Aug 09 2015 00:45
Hmm, seems that any sort of sort is not showing correctly in the output in freecodecamp, it's just coming out in the original order.
Abhishek Arora
@abhishekarora12
Aug 09 2015 00:46
Hey Guys!
The last Bonfire : Arguments optional is pretty tough, can you tell me what is to be done in this ?
CamperBot
@camperbot
Aug 09 2015 00:46
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Abhishek Arora
@abhishekarora12
Aug 09 2015 00:46
bonfire Arguments Optional
CamperBot
@camperbot
Aug 09 2015 00:46

:fire:Bonfire: Arguments Optional :link:

function add() {
  return false;
}

add(2,3);

Create a function that sums two arguments together. If only one argument is provided, return a function that expects one additional argument and will return the sum.
For example, add(2, 3) should return 5, and add(2) should return a function that is waiting for an argument so that <code>var sum2And = add(2); return sum2And(3); // 5</code>
If either argument isn't a valid number, return undefined.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

gazzer82
@gazzer82
Aug 09 2015 00:47
Whoah, not sure why but the same code in Firefox passed first time. Must be something specific to the javascript engine in Safari!
Steve Tang
@Thescuba
Aug 09 2015 00:53
Waypoint: Mobile Responsive Images
gazzer82
@gazzer82
Aug 09 2015 00:54
Ok, so i was sorting incorrectly by returning boolean not -1 1 as specified, just seems node and firefox are more lenient, in the end did this and that worked everywhere.
return (b[1].toUpperCase() > a[1].toUpperCase()) ? 1 : (b[1].toUpperCase() < a[1].toUpperCase()) ? -1 : 0;
Steve Tang
@Thescuba
Aug 09 2015 00:55
@gazzer82 how do you share code like that? i still new to fcc
gazzer82
@gazzer82
Aug 09 2015 00:56
@Thescuba if you click the button over to the right of the text box it'll give you the markdown syntax you can use.
Basically you surround the code with "" above and "" below
Actually can't type them in, doh.
Ok so it's three of `
above and below the code and it applies the code formatting correctly,
Steve Tang
@Thescuba
Aug 09 2015 00:59
thanks @gazzer82
CamperBot
@camperbot
Aug 09 2015 00:59
thescuba sends brownie points to @gazzer82 :sparkles: :thumbsup: :sparkles:
gazzer82
@gazzer82
Aug 09 2015 01:00
No worries!
Steve Tang
@Thescuba
Aug 09 2015 01:00
@gazzer82 do you also know how to get camper bot to help me find Waypoint: Mobile Responsive Images?
I feel i am doing everything correct but it wont let me pass

'''<link rel='stylesheet' href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css'/>

<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 img-responsive' src='http://bit.ly/fcc-kittens'/></a>

<a href='#'><img class='smaller-image thick-green-border img-responsive' src='http://bit.ly/fcc-kittens2'/></a>
'''

Marc Davenport
@oneate7
Aug 09 2015 01:02
@Thescuba use the accent mark (the one next to the 1 key) instead of the apostrphe.
Steve Tang
@Thescuba
Aug 09 2015 01:02
<link rel='stylesheet' href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css'/>
<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 img-responsive' src='http://bit.ly/fcc-kittens'/></a>

<a href='#'><img class='smaller-image thick-green-border img-responsive' src='http://bit.ly/fcc-kittens2'/></a>
thanks @oneate7
CamperBot
@camperbot
Aug 09 2015 01:02
thescuba sends brownie points to @oneate7 :sparkles: :thumbsup: :sparkles:
:star: 2 | @oneate7 | http://www.freecodecamp.com/oneate7
Marc Davenport
@oneate7
Aug 09 2015 01:03
Which exercise are you on?
gazzer82
@gazzer82
Aug 09 2015 01:04
That exact same code works fine for me.
Steve Tang
@Thescuba
Aug 09 2015 01:04
Waypoint: Mobile Responsive Images
gazzer82
@gazzer82
Aug 09 2015 01:04
@Thescuba what browser are you using?
Steve Tang
@Thescuba
Aug 09 2015 01:05
@gazzer82 chrome
gazzer82
@gazzer82
Aug 09 2015 01:06
@Thescuba have you left the rest of the code intact?
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

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

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

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

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

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

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

<a href='#'><img class='smaller-image thick-green-border img-responsive' src='http://bit.ly/fcc-kittens2'/></a>

<p>Things cats love:</p>
<ul>
  <li>cat nip</li>
  <li>laser pointers</li>
  <li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
  <li>flea treatment</li>
  <li>thunder</li>
  <li>other cats</li>
</ol>
<form action="/submit-cat-photo">
  <label><input type='radio' name='indoor-outdoor'> Indoor</label>
  <label><input type='radio' name='indoor-outdoor'> Outdoor</label>
  <br>
  <label><input type='checkbox' name='personality'> Loving</label>
  <label><input type='checkbox' name='personality'> Lazy</label>
  <label><input type='checkbox' name='personality'> Crazy</label>
  <br>
  <input type='text' placeholder='cat photo URL' required>
  <button type='submit'>Submit</button>
</form>
Steve Tang
@Thescuba
Aug 09 2015 01:06
@gazzer82 yes
gazzer82
@gazzer82
Aug 09 2015 01:06
The exact above works fine for me.
pwdd
@pwdd
Aug 09 2015 01:07
Hi! Is there anyone available to help me with this:
```
oops. sorry for that
Steve Tang
@Thescuba
Aug 09 2015 01:07
@gazzer82 its works now, thanks. idk what happened
gazzer82
@gazzer82
Aug 09 2015 01:07
No i couldn't see anything obvious, maybe some funky whitespace or something.
pwdd
@pwdd
Aug 09 2015 01:08
this:
function mutation(arr) {
  var i = 0;
  // split strings into arrays of lower case letters
  var first = arr[0].toLowerCase().split("");  
  var second = arr[1].toLowerCase().split("");

  //offset 
  var len = second.length;

  // while each item of second array
  while (i < len ) {    
    // if first array has element of the second array
    if (first.indexOf(second[i])) {
      // keep looping
      i++;
      // else, it is false
    } else {
      return false;
    }
  }
  // if loop didn't stop earlier with false, return true
  return true;
}

mutation(['hello', 'hey']);
Steve Tang
@Thescuba
Aug 09 2015 01:08
@gazzer82 I took what you sent me and it let it pass? hmmm
gazzer82
@gazzer82
Aug 09 2015 01:08
@pwdd what bonfire is this for?
Marc Davenport
@oneate7
Aug 09 2015 01:08
@Thescuba @gazzer82 - It was because BOTH of the img tags were set to 'img-responsive'. It only wanted the second one to be responsive.
pwdd
@pwdd
Aug 09 2015 01:09
2
gazzer82
@gazzer82
Aug 09 2015 01:09
Ah yes, well spotted :)
pwdd
@pwdd
Aug 09 2015 01:09
@gazzer82 Mutations
Marc Davenport
@oneate7
Aug 09 2015 01:09
bf mutations
CamperBot
@camperbot
Aug 09 2015 01:09

:fire:Bonfire: Mutations :link:

function mutation(arr) {
  return arr;
}

mutation(['hello', 'hey']);

Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.
For example, ['hello', 'Hello'], should return true because all of the letters in the second string are present in the first, ignoring case.
The arguments ['hello', 'hey'] should return false because the string 'hello' does not contain a 'y'.
Lastly, ['Alien', 'line'], should return true because all of the letters in 'line' are present in 'Alien'.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

gazzer82
@gazzer82
Aug 09 2015 01:10
No need to try to split the string into an array, it kinda already is.
You can just iterate over it as you would an array based on it's length.
Steve Tang
@Thescuba
Aug 09 2015 01:11
@oneate7 ohh i see, thanks for clearing taht up
pwdd
@pwdd
Aug 09 2015 01:12
@gazzer82 I thought the suggestion for that bonfire was to use arrays, since they sugest indexOf
gazzer82
@gazzer82
Aug 09 2015 01:13
@pwdd you can use indexOf on a string also.
pwdd
@pwdd
Aug 09 2015 01:15
@gazzer82 cool! I just tried the same code, but without spliting the strings into arrays.
@gazzer82 I get some tests to pass, not all of them
gazzer82
@gazzer82
Aug 09 2015 01:15
Also indexOf does not return true/false, it returns an index or a -1 if it can't find the item in the array.
And i would use a for loop to loop through the string you're checking, and tally the results. You can then check that result before you return.
You're along the wright lines.
pwdd
@pwdd
Aug 09 2015 01:17
@gazzer82 GOT IT! first.indexOf(second[i]) >= 0
gazzer82
@gazzer82
Aug 09 2015 01:18
Boom
:)
pwdd
@pwdd
Aug 09 2015 01:18
thanks @gazzer82 !
CamperBot
@camperbot
Aug 09 2015 01:18
pwdd sends brownie points to @gazzer82 :sparkles: :thumbsup: :sparkles:
gazzer82
@gazzer82
Aug 09 2015 01:19
No worries, anything to keep me from the next Bonfire :)
pwdd
@pwdd
Aug 09 2015 01:19
@gazzer82 :D Good luck! I'll go to my next now :)
gazzer82
@gazzer82
Aug 09 2015 01:20
Thanks, good luck to you too!
Tyler St. Onge
@tylerstonge
Aug 09 2015 01:29
I'm sure a more elegant way to make the Roman Numeral Converter exists than this?
function convert(num) {
  var result = "";
  var ones = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];
  var tens = ["X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"];
  var huns = ["C", "CC", "CCC", "CD", "D", "MD", "MDD", "MDDD", "CM"];

  if(num > 100 && num < 10000) {
    result += huns[Math.floor(num / 100) - 1];    
    num = num % 100;
  }

  if(num > 10) {
    result += tens[Math.floor(num / 10) - 1];
    num = num % 10;
  }

  if(num > 0) {
    result += ones[num - 1];
  }

  return result;
}

convert(36);
Tyler St. Onge
@tylerstonge
Aug 09 2015 01:36
I especially feel like I did it wrong since I didn't use any of the methods from the "More information" :worried:
Marc Davenport
@oneate7
Aug 09 2015 01:37
I did it a bit differently, but I also didn't use any of the methods they mention.
Instead of doing separate arrays for ones, tens, etc. You can do one multidimensional array that matches the large values to their roman numeral.
And then just have a loop that pushes the roman numerals to a string and subtracts the value from num, continuing until num is zero.
Tyler St. Onge
@tylerstonge
Aug 09 2015 01:41
@oneate7 Yeah, that sounds like a better idea. I'll try to get something like that to work. Thanks!
SM
@nogo10
Aug 09 2015 01:49
hello all: question: I know JS syntax allows one to define a function within a function. But does FreecodeCamp allow this in the answers for Bonfire?
I ran a solution that gives correct results but rjected by FCC servers
Marc Davenport
@oneate7
Aug 09 2015 01:51
@nogo10 It should, yes.
SM
@nogo10
Aug 09 2015 01:52
well the Roman numbers converter I did works (gives correct answer) but rejected!!
eg. result "XXIX" but server says: expect(convert(29)).to.equal("XXIX");
missing } after function body
gazzer82
@gazzer82
Aug 09 2015 01:56
Ok i'm confused yet again. Now on Bonfire: No Repeats Please
I don't get how there are 6 permutations of aab, surely there are just three?
aab, aba, baa?
and only one of those has no repeating letters?
SM
@nogo10
Aug 09 2015 01:58
@tylerstonge btw I like your solution ;
Moisés Man
@moigithub
Aug 09 2015 01:58
if u have 3 characters (no matter which ).. u should have 6 permutations...
lets say if u have "123"
123, 132,213,232,312,321
gazzer82
@gazzer82
Aug 09 2015 01:59
Ah i see, i'm forgetting that the letter actually exists twice . . even through it's the same letter.
I need to stop for the evening i think . . .
Moisés Man
@moigithub
Aug 09 2015 01:59
so.. if a = 1 and a = 3,,,... u still have 6 permutations aba aba aab aab baa baa
u should check for character "position" not for content for the permutation part
SM
@nogo10
Aug 09 2015 02:02
......
return answer.join('');
}

convert(29);
FCC console displays "XXIX" (correct) but server says :
: expect(convert(29)).to.equal("XXIX");
missing } after function body
Anyone tell me why FCC did not accept answer?
"missing } after function body" is that because FCC expects ONE function? and allows no function within function??
gazzer82
@gazzer82
Aug 09 2015 02:06
Thanks @moigithub i get it now, just need to work out how to actually do it now :)
CamperBot
@camperbot
Aug 09 2015 02:06
gazzer82 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
Moisés Man
@moigithub
Aug 09 2015 02:08
@nogo10 whats ur full code ?
SM
@nogo10
Aug 09 2015 02:11
@moigithub ..Im not too pleased with it ..but it works..
function convert(numArg) {


  function Numerals(numAr,mag){
  var scaLe = [];
  scaLe[1]= [1,"I",'IV','V','IX'];
  scaLe[10]= [10,"X",'XL','L','XC'];
  scaLe[100]= [100,"C",'CD','D','CM'];
  scaLe[1000]= [1000,"M","MMMM","MMMMM","MMMMMMMMM"];
  var fNum = '';
  var check = numAr / scaLe[mag][0];

  switch (true) {
        case ((numAr >= 1*scaLe[mag][0]) && (numAr < 4*scaLe[mag][0])):
             fNum = scaLe[mag][1].repeat(check);

            break;
        case (numAr == 4*scaLe[mag][0]):
            fNum = scaLe[mag][2];

            break;
        case (numAr == 9*scaLe[mag][0]):
             fNum = scaLe[mag][4];

            break; 
        case (numAr >= 5*scaLe[mag][0] && numAr < 10*scaLe[mag][0]):
             fNum = scaLe[mag][3];
             fNum = fNum.concat(scaLe[mag][1].repeat(check - 5));

            break;
        case (numAr == 10*scaLe[mag][0]):
            fNum = scaLe[mag*10][1];

            break;
        default: console.log("error0"); } return fNum;}


 var answer =[];
 while (numArg > 0){
 switch(true){ 
    case (numArg >=1000):
         answer.push(Numerals(numArg, 1000));
         numArg = numArg % 1000;
         break; 
    case ((numArg >=100) && (numArg < 999)):
         answer.push(Numerals(numArg, 100)); 
         numArg = numArg % 100;
         break;      
    case ((numArg >=10) && (numArg < 99)):
         answer.push(Numerals(numArg, 10));
         numArg = numArg % 10;
         break;      
    case ((numArg >= 1) && (numArg < 11)): 
         answer.push(Numerals(numArg,1));numArg = -1;
         break; 

    default: numArg = -1; console.log(numArg + " error2"); 

 }

 }
 return answer.join('');
}

convert(29);
SM
@nogo10
Aug 09 2015 02:16
@moigithub any thoughts why FCC would reject this solution posted?
other than being a outrageously convoluted pasta :smile:
Moisés Man
@moigithub
Aug 09 2015 02:19
not sure :) pasted on repl.it and works like charm :)
Rob
@BobsHub
Aug 09 2015 02:21
Q: if I have var i = str.search(/[A-Z]/); how do I resume search from the returned index?
Cristián Berríos
@crisberrios
Aug 09 2015 02:24
Rob
@BobsHub
Aug 09 2015 02:31
thanks, exec() seems to be helpful
Mark Dang
@dangm24
Aug 09 2015 02:41
Hey all, I could use some quick help on Bonfire: Spinal Tap Case
23crompton
@23crompton
Aug 09 2015 02:47
@dangm24 what you got
i probably wont be much help at the moment but im interested all the same
th3mattman
@th3mattman
Aug 09 2015 02:49
So I'm on Bonfire: Convert HTML entities, I have a code that works as far as I can tell, but I can't tell what the error message means
Cristián Berríos
@crisberrios
Aug 09 2015 02:49
can you post the formatted code?
@dangm24 what do you have until now?
th3mattman
@th3mattman
Aug 09 2015 02:50
what's the code markup?
Mark Dang
@dangm24
Aug 09 2015 02:51
@crisberrios i pmed you
Cristián Berríos
@crisberrios
Aug 09 2015 02:53
help format
CamperBot
@camperbot
Aug 09 2015 02:53

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Cristián Berríos
@crisberrios
Aug 09 2015 02:54
wiki spinal
CamperBot
@camperbot
Aug 09 2015 02:54
no wiki entry for: spinal
:pencil: click here to create one now!after creating your page type update to reload it here
Cristián Berríos
@crisberrios
Aug 09 2015 02:54
bf spinalcase
CamperBot
@camperbot
Aug 09 2015 02:54
Sorry, can't find a bonfire called spinalcase. [ Check the map? ]
SojournerOctocat
@SojournerOctocat
Aug 09 2015 02:55
bf spinal
CamperBot
@camperbot
Aug 09 2015 02:55

:fire:Bonfire: Spinal Tap Case :link:

function spinalCase(str) {
  // "It's such a fine line between stupid, and clever."
  // --David St. Hubbins
  return str;
}

spinalCase('This Is Spinal Tap');

Convert a string to spinal case. Spinal case is all-lowercase-words-joined-by-dashes.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

th3mattman
@th3mattman
Aug 09 2015 02:59
I'm running this:
function convert(str) {
    var newStr = str.replace(/\&/g, "&amp");
    newStr = newStr.replace(/</g, "&lt");
    newStr = newStr.replace(/\>/g, "&gt");
    newStr = newStr.replace(/\"/g, "&quot");
    newStr = newStr.replace(/\'/g, "&apos");
    return newStr;
}

convert('Dolce & Gabbana');
but getting these errors:
assert.strictEqual(convert('Dolce & Gabbana'), 'Dolce & Gabbana', 'should escape characters');should escape characters: expected 'Dolce & Gabbana' to equal 'Dolce & Gabbana'
assert.strictEqual(convert('Hamburgers < Pizza < Tacos'), 'Hamburgers < Pizza < Tacos', 'should escape characters');should escape characters: expected 'Hamburgers < Pizza < Tacos' to equal 'Hamburgers < Pizza < Tacos'
assert.strictEqual(convert('Sixty > twelve'), 'Sixty > twelve', 'should escape characters');should escape characters: expected 'Sixty > twelve' to equal 'Sixty > twelve'
assert.strictEqual(convert('Stuff in "quotation marks"'), 'Stuff in "quotation marks"', 'should escape characters');should escape characters: expected 'Stuff in "quotation marks"' to equal 'Stuff in "quotation marks"'
assert.strictEqual(convert("Shindler's List"), 'Shindler's List', 'should escape characters');should escape characters: expected 'Shindler&aposs List' to equal 'Shindler's List'
assert.strictEqual(convert('<>'), '<>', 'should escape characters');should escape characters: expected '<>' to equal '<>'
SojournerOctocat
@SojournerOctocat
Aug 09 2015 03:00
@th3mattman "&amp" should be "&amp;".
The HTML entities close with semicolons.
th3mattman
@th3mattman
Aug 09 2015 03:02
Dammit
Darrell Wong
@darrell1226
Aug 09 2015 03:04
I need help troubleshooting my code. In the console it shows error: Cannot read property 'name' of undefined. I don't understand that.
Luis Felipe López G.
@luishendrix92
Aug 09 2015 03:10

Here's what I got for the roman numeral bonfire:

function convert(num) {
  var roman = [//0   1    2      3      4    5     6     7      8       9
               ["", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"], // Units
               ["", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"], // Tens
               ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"], // Hundreds
               ["", "M"] // Thousands
              ];
  var romanized = [];

  num.toString().split('').reverse().forEach(function(digit, index) {
    romanized.unshift(roman[index][digit]);
  });

  return romanized.join('');
}

convert(36);

I really tried to avoid declaring an empty variable but I just couldn't find a reverse iterative method in the array prototype :S

And I found a bug, it returns I with 10, 100 and 1000 :(
Mike Frazier
@mfrazie2
Aug 09 2015 03:14
Did anyone have an issue with the "Functional Programming" waypoint?
I am not understanding the concept
Cristián Berríos
@crisberrios
Aug 09 2015 03:15
what concept?
functional programming?
Mike Frazier
@mfrazie2
Aug 09 2015 03:16
Yeah
Marc Davenport
@oneate7
Aug 09 2015 03:16
@mfrazie2 I ended up moving past it and will come back to it later. Bought a couple of books to help out.
Mike Frazier
@mfrazie2
Aug 09 2015 03:16
Ahh, that's what I thought would be helpful
Cristián Berríos
@crisberrios
Aug 09 2015 03:16
the core point is being able to write code that's reliable and testable
and deterministic
Mike Frazier
@mfrazie2
Aug 09 2015 03:17
I get how to run some of the map, forEach, etc, individually, but chaining them together is where I lose it
Cristián Berríos
@crisberrios
Aug 09 2015 03:17
so for function add1 ( x) { return x+1 }
anytime you input 1, you will get back 2
but....
if you do something in jquery like... function add1toValue { var x = $('#someId').text ; $(#someOtherId).text(parse(x)) }
and it fails
you don't know what part failed
maybe the selector is missing
maybe the value is invalid
and maybe the parsing is failing
etc...
SM
@nogo10
Aug 09 2015 03:27
In Bonfire Roman numeral converter we have a function that works 100% but FCC gives error messages ..why? The code returns correct answer every time
CamperBot
@camperbot
Aug 09 2015 03:27
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
John Chau
@ydjjabt
Aug 09 2015 03:30

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

t.forEach( function(n){
  document.createElement('div').innerHTML(n)
  document.createTextNode('click me')
})
how come it doesnt work?
anyone?
Cristián Berríos
@crisberrios
Aug 09 2015 03:32
let me check
deaninous
@deaninous
Aug 09 2015 03:36
hello help world
CamperBot
@camperbot
Aug 09 2015 03:36

welcome to FreeCodeCamp @deaninous!

Dayne Wright
@daynewright
Aug 09 2015 03:43
The object oriented javascript waypoints using udacity.com are really confusing. This hack reactor guy is so hard to follow. Anyone else think that?
Logan Tegman
@ltegman
Aug 09 2015 03:45
@Daynewr I definitely agree. I think the style of the udacity course (tons of trick questions) is unnecessarily confusing. I already knew most of the OOP stuff and was using it as a refresher and I was still getting confused by it.
SojournerOctocat
@SojournerOctocat
Aug 09 2015 03:46
Hello world
CamperBot
@camperbot
Aug 09 2015 03:46

welcome to FreeCodeCamp @SojournerOctocat!

Cristián Berríos
@crisberrios
Aug 09 2015 03:47
@ydjjabt
t.forEach(function(n){
  x = document.createElement('div');
  x.innerHTML = '<span></span>';
  y = document.createTextNode(n);
  x.appendChild(y);
  document.body.appendChild(x);
});
Dayne Wright
@daynewright
Aug 09 2015 03:48
@ltegman That is good to know. I thought I was just really losing it. I found this video and it helped a TON more on prototypes. He goes slow so speeding it up helps : https://www.youtube.com/watch?v=xLNySpJiiuc
Suzanne Atkinson
@AdventureBear
Aug 09 2015 03:49
@crisberrios good to se eyou!
Cristián Berríos
@crisberrios
Aug 09 2015 03:49
thanks :)
Logan Tegman
@ltegman
Aug 09 2015 03:49
@Daynewr I’ll have to check it out, thanks for the link! Thankfully the new version of the FCC curriculum doesn’t use the udacity course, so the OOP section should be much better once the update is deployed.
Dayne Wright
@daynewright
Aug 09 2015 03:51
@ltegman So is there a an OOP section I can see on the new version currently?
Actually…it is probably better to start with part 1: https://www.youtube.com/watch?v=bstIvkeksAk&spfreload=1
John Chau
@ydjjabt
Aug 09 2015 03:53
@crisberrios thank
Rockpile
@rock-pile
Aug 09 2015 03:55
```
var languages = {
    english: "Hello!",
    french: "Bonjour!",
    notALanguage: 4,
    spanish: "Hola!"
};

// print hello in the 3 different languages
for (var prop in languages) {

    if (languages[prop].typeof === 'string') {
        console.log(languages[prop]);
    }
}
Does anyone remember this one? It keeps erroring saying I did not print out the strings for Hello
Rex Schrader
@SaintPeter
Aug 09 2015 03:57
@camgoodman What is the specific error text?
Rockpile
@rock-pile
Aug 09 2015 03:57
@SaintPeter 'Oops, try again. It looks like you didn't print Hello!'
the console is empty
Rex Schrader
@SaintPeter
Aug 09 2015 03:58
interesting
Rockpile
@rock-pile
Aug 09 2015 03:58
it looks correct right?
Rex Schrader
@SaintPeter
Aug 09 2015 03:59
Ah HA.
John Chau
@ydjjabt
Aug 09 2015 03:59
@camgoodman syntax error in the if stattement
Rex Schrader
@SaintPeter
Aug 09 2015 03:59
typeof is not a memeber function - it's a language construct
if (typeof languages[prop] === 'string') {
Rockpile
@rock-pile
Aug 09 2015 03:59
DOH!
thanks!
Rex Schrader
@SaintPeter
Aug 09 2015 03:59
:D
John Chau
@ydjjabt
Aug 09 2015 04:00
if (typeof(languages[prop]) === 'string')
BoomTheFace
@BoomTheFace
Aug 09 2015 04:00
is there a method for converting binary to decimal? or getting a character from a binary string?
John Chau
@ydjjabt
Aug 09 2015 04:00
@BoomTheFace u have to write the method lol
Rex Schrader
@SaintPeter
Aug 09 2015 04:00
@boomTheface Yeah:
parseInt(booleanString, 2)
BoomTheFace
@BoomTheFace
Aug 09 2015 04:00
@ydjjabt lol, figured... :)
Rockpile
@rock-pile
Aug 09 2015 04:00
rookie mistake :D
John Chau
@ydjjabt
Aug 09 2015 04:01
@camgoodman watch out for 'string' or string lol
Rex Schrader
@SaintPeter
Aug 09 2015 04:01
Although writing the method can be a useful learning experience
John Chau
@ydjjabt
Aug 09 2015 04:01
damn i hate coding, it mad syntax lol
jk...i love and hate it
currently studying html/js new thing waht a headache man
Rockpile
@rock-pile
Aug 09 2015 04:02
javascript so funky, function is a class, a method an object, a kitchen sink, lol , and everything is a var
John Chau
@ydjjabt
Aug 09 2015 04:03

@SaintPeter

var t = [3,4,5,36]

t.forEach(function(n){

  x = document.createElement('h4');
  //x.innerHTML = '<span></span>';
  y = document.createTextNode(n);
  x.appendChild(y);

 document.body.appendChild(x);

});

so i have to create the node element, then create the text node, then attach the text node to the node element, then attach the node element to the document body? what a fkkkk madness

@camgoodman dude js have function as object and it easy
David Vaughan-Brown
@dvaun
Aug 09 2015 04:03
Would it be okay if I asked a question about HTML that doesn't pertain exactly to the course?
John Chau
@ydjjabt
Aug 09 2015 04:03
i dont know so far, js is easy for me
David Vaughan-Brown
@dvaun
Aug 09 2015 04:03
not sure what the ettiquette is in here
John Chau
@ydjjabt
Aug 09 2015 04:03
@dvaun it free speech
BoomTheFace
@BoomTheFace
Aug 09 2015 04:03
@SaintPeter true, might try writing my own
Rex Schrader
@SaintPeter
Aug 09 2015 04:04
@dvaun Ask your question or post your code and ask your question.
wiki format
CamperBot
@camperbot
Aug 09 2015 04:04

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Rex Schrader
@SaintPeter
Aug 09 2015 04:04
@dvaun Don't forget to take off your shoes and no spitting on the couch.
David Vaughan-Brown
@dvaun
Aug 09 2015 04:05
Alright, thanks @SaintPeter @ydjjabt
Currently I'm playing around with jQuery on a domain and server I own, http://www.divisionkings.com/
It may sound silly but...where can I put new html pages when I create them? Specifically, I'm looking to create two new pages, "About" and "Feeds" for future play as I get through the waypoints.
Rex Schrader
@SaintPeter
Aug 09 2015 04:06
@dvaun Well, if you're just doing a "flat" website, but them in the same directory as your index.html file
call them something like "about.html" and "feeds.html" or whatever
David Vaughan-Brown
@dvaun
Aug 09 2015 04:07
@SaintPeter is it possible to structure pages within folders?
Rex Schrader
@SaintPeter
Aug 09 2015 04:07
@dvaun absolutely. Just create a folder and make sure your url includes it when you link to them
@dvaun for example, it's generally good practice to put all your images in a subfolder, your css in another folder, and your js in a third folder
David Vaughan-Brown
@dvaun
Aug 09 2015 04:08
@SaintPeter alright thanks so much!
Rex Schrader
@SaintPeter
Aug 09 2015 04:08
No problem
David Vaughan-Brown
@dvaun
Aug 09 2015 04:19
Thanks again, I feel more confident now that I've set up three pages - I'll practice what you said and put my js and css into folders!
Robert
@rc242
Aug 09 2015 04:20
woosh.
Logan Tegman
@ltegman
Aug 09 2015 04:30
@Daynewr You can check out the new version of the OOP curriculum at http://beta.freecodecamp.com/map#Object-Oriented-and-Functional-Programming
Michael Christofersen
@mchristofersen
Aug 09 2015 04:36
@rc242 thanks for the response. Thats the route i took too. seems silly...
Max
@MaxRubyDev
Aug 09 2015 06:18
Hi there. I'm on
... lesson 14 (I think): Waypoint: Say Hello to Elements. I can't see the embedded text editor mentioned in the left sidebar.
I'm browsing on an iPad. Could that be the reason?
Max
@MaxRubyDev
Aug 09 2015 06:28
Ok, nevermind, it showed up. Thanks & sorry for the intrusion.
Ozy Design & Software
@OzySky
Aug 09 2015 06:49
@MaxRubyDev don't worry mate
Henry Erickson
@henryed86
Aug 09 2015 07:03
@ltegman now I'm confused with the curriculum..so we all should follow that link instead ?
Logan Tegman
@ltegman
Aug 09 2015 07:04
@henryed86 You can if you want to. That is the future curriculum that will be deployed to the website soon. I personally didn’t like the udacity OOP lessons, but I haven’t done the new ones yet, so I can’t speak to how much of an improvement they are.
Henry Erickson
@henryed86
Aug 09 2015 07:06
oh ...The more... the better
Benjamin
@b1ggb3n86
Aug 09 2015 07:08
quick question. on seek and destroy bonfire, how would you make the function to filter the initial array?
Henry Erickson
@henryed86
Aug 09 2015 07:13
@b1ggb3n86 seek and destroy is a tricky one
in order to use slice you will need to put in .call() to take more arguments
destroyer([1, 2, 3, 1, 2, 3], 2, 3); See how is taking three arguments
Benjamin
@b1ggb3n86
Aug 09 2015 07:16
Array.prototype.slice.call(arr, 1)?
@henryed86
Henry Erickson
@henryed86
Aug 09 2015 07:21
@b1ggb3n86 yes if you want that first argument
Benjamin
@b1ggb3n86
Aug 09 2015 07:23
@henryed86 nvm. i totally got it. thank you so much
Henry Erickson
@henryed86
Aug 09 2015 07:24
@b1ggb3n86 your welcome
!
Teejay Parker
@TeejayParker
Aug 09 2015 07:53
So, I know what this module is asking of me.. but I can't seem to get it to work properly, keeps giving me an error saying "addClass" is not a function: https://www.codecademy.com/courses/web-beginner-en-JwhI1/0/4#
$(document).ready(function() {
    $('div').hover(function() {
        $('div').addclass('red');
    });
});
flota113
@flota113
Aug 09 2015 07:57
@Majeye I think that it's because of typo ;) I mean You wrote addclass instead of addClass ;)
note capitalization ;)
Teejay Parker
@TeejayParker
Aug 09 2015 07:58
ahh... //facepalms-self. thank you. lol
flota113
@flota113
Aug 09 2015 07:58
no problem ;)
Teejay Parker
@TeejayParker
Aug 09 2015 07:59
can't believe i've been stumped on a typo for over an hour
Bianca Mihai
@biancamihai
Aug 09 2015 08:00
@Majeye to avoid this problems keep your console open
Teejay Parker
@TeejayParker
Aug 09 2015 08:02
Thank you @biancamihai & @flota113 I will be more aware of typos now lol
CamperBot
@camperbot
Aug 09 2015 08:02
majeye sends brownie points to @biancamihai and @flota113 :sparkles: :thumbsup: :sparkles:
:star: 6 | @flota113 | http://www.freecodecamp.com/flota113
Bianca Mihai
@biancamihai
Aug 09 2015 08:03
@Majeye this are very common mistakes, if you keep your console open you will not spend hours on them next time ---- Uncaught TypeError: $(...).addclass is not a function
fateshaper
@fateshaper
Aug 09 2015 08:53
hey does anybody else have this problem?
these 2 days for any of the bonfires
when i try to run a solution that is not correct (in the process of getting the correct solution)
the error message always appears " Sorry, your code is either too slow, has a fatal error or contains an infinite loop"
Bianca Mihai
@biancamihai
Aug 09 2015 08:55
@fateshaper probably it is an infinite loop because just tested now and it is working
fateshaper
@fateshaper
Aug 09 2015 08:55

but even for a code such as the below

```

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

findLongestWord('The quick brown fox jumped over the lazy dog');
this definitely isn't a infinite loop in any way
yet the same message appears
Bianca Mihai
@biancamihai
Aug 09 2015 08:58
hmm, I don't get the error? refresh? clear cache? hard refresh? :D
Elizabeth Hatleli
@TheHighPriestess
Aug 09 2015 09:01

Question about palindrome Bonfire

It doesn't like this regular expression: [^a-zA-Z0-9]

It says that the ^ is an unexpected token. Does anyone know why?

I'm getting the same error message in Dev Tools.
When I input it at regexr.com it works fine. I'm confused.
Omar
@oab00
Aug 09 2015 09:04
try escape ^ with a back slash \^
Elizabeth Hatleli
@TheHighPriestess
Aug 09 2015 09:04
It doesn't like that either.

Ok, this seems to have solved the problem partially:

/[^a-zA-Z0-9]/g

Omar
@oab00
Aug 09 2015 09:08
/[a-zA-Z0-9]/g ?
Elizabeth Hatleli
@TheHighPriestess
Aug 09 2015 09:09
Well...it worked when I included / in the front and /g at the end
Omar
@oab00
Aug 09 2015 09:09
u want to select start of a word with ^ ?
/^[a-zA-Z0-9]/g outside bracket
Elizabeth Hatleli
@TheHighPriestess
Aug 09 2015 09:11

I'm trying to remove the commas, spaces and periods from:

A man, a plan, a canal. Panama

Omar
@oab00
Aug 09 2015 09:12
put them in the bracket then!
Elizabeth Hatleli
@TheHighPriestess
Aug 09 2015 09:13
What is inside the brackets is what I want
Omar
@oab00
Aug 09 2015 09:13
use .replace() to make regex remove things
Elizabeth Hatleli
@TheHighPriestess
Aug 09 2015 09:14
I am using that.
str = str.replace(/[^a-zA-Z0-9]/g,"");
Omar
@oab00
Aug 09 2015 09:15
/[a-zA-Z0-9]/g then do the reverse of this is doing ^^
Elizabeth Hatleli
@TheHighPriestess
Aug 09 2015 09:15

I'm confused about why:

str = str.replace(/[^a-zA-Z0-9]/g,"");

Doesn't work.

Omar
@oab00
Aug 09 2015 09:15
replace removes what it finds with the regex not keep it
Elizabeth Hatleli
@TheHighPriestess
Aug 09 2015 09:16
right...so it should remove everything except a-b, A-B, and 0-9...replacing it with: ""
except that it doesn't
Omar
@oab00
Aug 09 2015 09:18
example "HELLO WORLD".replace( /[L]/g, '') => "HEO WORD"
Elizabeth Hatleli
@TheHighPriestess
Aug 09 2015 09:18
right
so...I can't see the problem with mine
oh wait...I may have made a dumb mistake.
Omar
@oab00
Aug 09 2015 09:19
you're removing everything but punctuations and spaces
Elizabeth Hatleli
@TheHighPriestess
Aug 09 2015 09:26
no...i'm removing only punctuations and spaces
it's not chaning it to lowercase
that's the problem
because i forgot that part
Omar
@oab00
Aug 09 2015 09:27
works now? :o
Elizabeth Hatleli
@TheHighPriestess
Aug 09 2015 09:27
it will soon haha
Omar
@oab00
Aug 09 2015 09:27
okay lol
Elizabeth Hatleli
@TheHighPriestess
Aug 09 2015 09:27
I just realized that I didn't change everything to lowercase
Mark Williams
@mw8020
Aug 09 2015 09:40
Is there any guidelines for how long one should take getting through the bonfires? i.e. Basic Algorithm Scripting
Shouvik Roy
@royshouvik
Aug 09 2015 09:49
There is no hard and fast timeline, you should take as much time as needed
One of the USP of FreeCodeCamp is that its self paced,
I changed the data source in one of the controllers
CamperBot
@camperbot
Aug 09 2015 09:51
If you're having troll problems notify admins here
Shouvik Roy
@royshouvik
Aug 09 2015 09:52
but my angularJS app would not load the new data, it was always fetching from cache
Mark Williams
@mw8020
Aug 09 2015 09:52
@royshouvik k thanks
Shouvik Roy
@royshouvik
Aug 09 2015 09:52
till I had to disable caching, anyone faced similar issue??
Sam Deacon
@SamDeacon
Aug 09 2015 10:42
ugh, hate to admit it but i'm completely stumped by one of the bonfires (16 Bonfire: Where art thou)
CamperBot
@camperbot
Aug 09 2015 10:42
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Sam Deacon
@SamDeacon
Aug 09 2015 10:42
bonfire Where art thou
CamperBot
@camperbot
Aug 09 2015 10:42

:fire:Bonfire: Where art thou :link:

function where(collection, source) {
  var arr = [];
  // What's in a name?
  return arr;
}

where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });

Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument).
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

Sam Deacon
@SamDeacon
Aug 09 2015 10:42
oh right there's a bonfire chatroom :smile:
Matthew Barber
@Honno
Aug 09 2015 11:17
Hey, any mind showing me their pairwise solution?

I got

function pairwise(arr, arg) {
  var filtered = function(value) {
    return arr.indexOf(value) !== i;
  };
  var pairwisers = [];
  console.log("arr = " + arr);
  console.log("Begin i loop");
  for(i = 0; i < arr.length; i++) {
    var arrNew = arr.filter(filtered);
    console.log("arr[i] = " + arr[i]);
    console.log("arrNew = " + arrNew);
    for(j = 0; j < arrNew.length; j++) {
      if(arr[i] + arrNew[j] === arg) {
        console.log("pairwisers before = " + pairwisers);
        console.log("Pairwisers when arrNew[j] " + arrNew[j] + " & arr[i] = " + arr[i]);
        if(pairwisers.indexOf(arrNew[j]) === -1) {
          pairwisers.push(arrNew[j]);
        }
        if(pairwisers.indexOf(arr[i]) === -1) {
          pairwisers.push(arr[i]);
        }
        console.log("pairwisers after = " + pairwisers);
      }
    }
  }
  var sum = 0;
  for(k = 0; k < pairwisers.length; k++) {
    sum += arr.indexOf(pairwisers[k]);
    if(arr.indexOf(pairwisers[k]) === 0 && arr.indexOf(pairwisers[k], 1) !== -1) { // cba making a for loop to find the index  to start wtih lol
      sum += arr.indexOf(pairwisers[k], 1);
    }
  }
  return sum;
}

but it's pretty bad

It doesn't work with some things I know
I just can't think of a good solution without my mind exploding
Shouvik Roy
@royshouvik
Aug 09 2015 11:33
any recommendation where I can host MEAN apps for free?
JMitnik
@JMitnik
Aug 09 2015 11:33
Hey guys
A question: what is the most recommended way of using variables attained from inside a JSON Api call
Sean Campbell
@natac13
Aug 09 2015 11:36
Can someone look this over since it passes all test but the 5th one.... however it says Array(7) to deeply equal Array(7) to I do not understand under to correct this since it looks like it should pass.... thank in advance for the help
function drawer(price, cash, cid) {
  var string_to_number = {
    "PENNY": 0.01,
    "NICKEL": 0.05,
    "DIME": 0.1,
    "QUARTER": 0.25,
    "ONE": 1,
    "FIVE": 5,
    "TEN": 10,
    "TWENTY": 20,
    "ONE HUNDRED": 100,
  };
  var change_arr = [];
  var change_due = cash - price;
  var total_drawer = cid.reduce(function(prev, curr, index) {
    return prev + curr[1];
  }, 0);

  console.log(total_drawer);

  if(total_drawer < change_due) {
    return "Insufficient Funds";
  } else if( total_drawer === change_due) {
    return "Closed";
  } else {
    cid.reverse();
    cid = cid.map(function(unit) {
      var initial_amount = unit[1];
      if(change_due / string_to_number[unit[0]] >= 1) {
        var count = 0;
        while(change_due / string_to_number[unit[0]] >= 1) {
          change_due -= string_to_number[unit[0]];
          initial_amount -= string_to_number[unit[0]];
          count++;
        }
        change_arr.push([unit[0], (string_to_number[unit[0]]*count)]);
        return [unit[0], initial_amount];
      } else {
        return [unit[0], unit[1]];
      }
    });

  }

  return change_arr;
}

// Example cash-in-drawer array:
// [['PENNY', 1.01],
// ['NICKEL', 2.05],
// ['DIME', 3.10],
// ['QUARTER', 4.25],
// ['ONE', 90.00],
// ['FIVE', 55.00],
// ['TEN', 20.00],
// ['TWENTY', 60.00],
// ['ONE HUNDRED', 100.00]]

drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]);
Shouvik Roy
@royshouvik
Aug 09 2015 11:39
Thanks @oab00 the free and hobby tier looks good for me
CamperBot
@camperbot
Aug 09 2015 11:39
royshouvik sends brownie points to @oab00 :sparkles: :thumbsup: :sparkles:
:star: 181 | @oab00 | http://www.freecodecamp.com/oab00
Omar
@oab00
Aug 09 2015 11:46

@natac13
for the test:

drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]])

this is what it's expecting in the return:

[ ['TWENTY', 60.00], ['TEN', 20.00], ['FIVE', 15], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ]

this is what your function returns:

[ ["TWENTY", 80], ["TEN", 10], ["FIVE", 5], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.03] ]
something wrong with twenty ?
@natac13 the drawer only has 60 of twenty bills but your function gives out 80 of twenty bills
invisible money!
Sean Campbell
@natac13
Aug 09 2015 11:49
yeah i got that!!
but
now i am a penny off here look at this
function drawer(price, cash, cid) {
  var string_to_number = {
    "PENNY": 0.01,
    "NICKEL": 0.05,
    "DIME": 0.1,
    "QUARTER": 0.25,
    "ONE": 1,
    "FIVE": 5,
    "TEN": 10,
    "TWENTY": 20,
    "ONE HUNDRED": 100,
  };
  var change_arr = [];
  var change_due = cash - price;
  var total_drawer = cid.reduce(function(prev, curr, index) {
    return prev + curr[1];
  }, 0);

  console.log(total_drawer);

  if(total_drawer < change_due) {
    return "Insufficient Funds";
  } else if( total_drawer === change_due) {
    return "Closed";
  } else {
    cid.reverse();
    cid = cid.map(function(unit) {
      var initial_amount = unit[1];
      if(change_due / string_to_number[unit[0]] >= 1) {
        var count = 0;
        while(change_due / string_to_number[unit[0]] >= 1 && initial_amount > 0) {
          change_due -= string_to_number[unit[0]];
          initial_amount -= string_to_number[unit[0]];
          count++;
        }
        change_arr.push([unit[0], (string_to_number[unit[0]]*count)]);
        return [unit[0], initial_amount];
      } else {
        return [unit[0], unit[1]];
      }
    });

  }

  return change_arr;
}


drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]);
in the while loop i fixed the initial_amount has to be bigger than 0 but now the change comes out right exact for the penny at 0.03 instead of 0.04 and I don;t know where this rounding error can be
Omar
@oab00
Aug 09 2015 11:51
probably something to do with adding and subtracting floats with integers
Sean Campbell
@natac13
Aug 09 2015 11:52
lol lovely
JMitnik
@JMitnik
Aug 09 2015 11:55
$(document).ready(function() { 
  var coords =getWeather();
});


function getWeather(){
  var arr=[];
  $.getJSON("https://freegeoip.net/json/?callback=?",function(json){
    var city = json.city;
    $('#city').text(city);
    weatherInfo(city);

  });
}

function weatherInfo(city){
  var url="http://api.openweathermap.org/data/2.5/weather?q="+city+"&APPID=cee148fb0779f2a22dca2f1c4fdb911c";
  $.getJSON(url,function(weather){
    console.log(city);
    var general=weather.weather[0].main;
    var description = weather.weather[0].description;
    var kTemp= weather.main.temp;
    var cTemp= Math.round((kTemp-273.15)*100)/100;
    var fTemp = cTemp*1.8+32;
    $('#temp').text(cTemp+" C");
    $('#desc').text(description.slice(0,1).toUpperCase()+description.slice(1));
  });

}
How do I make the cTemp and fTemp in my weatherInfo() function available to the global scope?
so that I can use the two variables within a new function in my .ready function (for when I click a button)
flota113
@flota113
Aug 09 2015 11:58
@JMitnik declare them in global scope - it means in no function
@JMitnik e.g.
var cTemp;
function(){
//use cTemp
cTemp = 5;
console.log(cTemp);
}
Ozy Design & Software
@OzySky
Aug 09 2015 11:59
@JMitnik @flota113 then just change them inside the function by assigning without var
JMitnik
@JMitnik
Aug 09 2015 12:02
var cTemp;
$(document).ready(function() { 
  var coords =getWeather();
  console.log(cTemp);
});


function getWeather(){
  var arr=[];
  $.getJSON("https://freegeoip.net/json/?callback=?",function(json){
    var city = json.city;
    $('#city').text(city);
    weatherInfo(city);

  });
}

function weatherInfo(city){
  var url="http://api.openweathermap.org/data/2.5/weather?q="+city+"&APPID=cee148fb0779f2a22dca2f1c4fdb911c";
  $.getJSON(url,function(weather){
    console.log(city);
    var general=weather.weather[0].main;
    var description = weather.weather[0].description;
    var kTemp= weather.main.temp;
    cTemp= Math.round((kTemp-273.15)*100)/100;
    fTemp = cTemp*1.8+32;
    $('#temp').text(cTemp+" C");
    $('#desc').text(description.slice(0,1).toUpperCase()+description.slice(1));
    $('#optionsRadios2').click(function(){
      $('#temp').text(fTemp+ " F");
    });
    $('#optionsRadios1').click(function(){
      $('#temp').text(cTemp+ " C");
    });
  });

}
Right, so I did that, but it cTemp is logged as 'undefined'
I have a feeling it is related to the getJSON function
for now, I put in two event listeners in my weatherInfo function that uses the variables used in the weatherinfo, but what if I want to put such an event listener in my getready, and not within a function within another function? I guess I would have to make them global then
but if that is not as easy with getJSON, I wonder if that really is the best thing to do
Omar
@oab00
Aug 09 2015 12:05
you mean in the ready function ?
it's not wrong cTemp is undefined put something with the deceleration :smile:
JMitnik
@JMitnik
Aug 09 2015 12:06
yeah, whoops, ready()
flota113
@flota113
Aug 09 2015 12:06
@JMitnik Yes You're right it's beacuse of getJson
it's and async function
JMitnik
@JMitnik
Aug 09 2015 12:06
@oab00 , but doesn't that already come from cTemp=Math.round (etc etc)?
@flota113 yeah I know
flota113
@flota113
Aug 09 2015 12:07
it means that it works in background and the rest of the code is executed
Omar
@oab00
Aug 09 2015 12:07
^
JMitnik
@JMitnik
Aug 09 2015 12:07
However, is there no way to make every thing wait until it has found the information, and then continue?
Basically, turn of the async
Omar
@oab00
Aug 09 2015 12:07
you should make another function to call inside the getJSON so you know that getJSON has finished
JMitnik
@JMitnik
Aug 09 2015 12:07
Probably the $.ajax()
@oab00 how do you mean?
wont the rest of the code still continue ,regardless of whether I know if the getJSON is finished>
flota113
@flota113
Aug 09 2015 12:08
@JMitnik one way is like @oab00 to call a function inside GetJson
$.getJSON("https://freegeoip.net/json/?callback=?",function(json){
    var city = json.city;
    $('#city').text(city);
    weatherInfo(city);
//here call function or just do whatever You need with data

  });
it's what @oab00 means ;)
JMitnik
@JMitnik
Aug 09 2015 12:09
right, like I did inside the getWeather function
Omar
@oab00
Aug 09 2015 12:09
something like this
var temp;

function gotData() {
    console.log(temp);
}

$.getJSON('url', function(data) {
    temp = data.temperature;
    gotData();
});
flota113
@flota113
Aug 09 2015 12:09
@JMitnik exactly, there's also http://api.jquery.com/jQuery.Deferred/
JMitnik
@JMitnik
Aug 09 2015 12:10
but then, should I put event listeners in functions, such as $('button').click() ?
flota113
@flota113
Aug 09 2015 12:10
@JMitnik maybe ajax call will also do the trick I don't know - still learning like You do ;)
JMitnik
@JMitnik
Aug 09 2015 12:10
Heheh, we all do
So if I got it right in my head: if you want to use info achieved from an API, call a function to play with that value, and do not return it
flota113
@flota113
Aug 09 2015 12:12
@JMitnik I just did that today - I mean I put the event listener in deferred object so it's almost the same as if used it in getJSON - I don't see any troubles with it - the button won't work before data is fetched but anyway how could it work without data ;)
JMitnik
@JMitnik
Aug 09 2015 12:13
@flota113 I should research this deferred object, this is the first I heard of it. Do you use it often for such a purpose?
flota113
@flota113
Aug 09 2015 12:15
@JMitnik Would love to answer this question but really can't - I searched for this because I know C# and there are also async function - in c# I use a lot of deferred object alternative so it was easy for me to use it here as well - is it a good practise - can't say - I know that Parse (it's facebook's property) use deferred object in their api (or sth veerryy similiar to it )
it has some cons for sure
JMitnik
@JMitnik
Aug 09 2015 12:16
@flota113 Thank you for the tips, I will check them out later tomorrow ;)
flota113
@flota113
Aug 09 2015 12:17
no problem, just sharing what I know ;)
EphemeralArchitect
@EphemeralArchitect
Aug 09 2015 12:26
can anyone explain how to do the "check for palindromes" bonfire? i'm stuck and the few pair programmers i've worked with were too
i dont understand how the replace method fits into it
hammadpatel
@hammadpatel
Aug 09 2015 12:28
any tip on how to approach the Symmetric Difference problem in advance algorithm scripting? I can't seem to wrap my head around it
flota113
@flota113
Aug 09 2015 12:36
@EphemeralArchitect I made it a while ago so don't remember it well but checked and see that it can be helpful to remove blank spaces,dots - I mean I did this - not sure if You need it
Ozy Design & Software
@OzySky
Aug 09 2015 12:52
@hammadpatel maybe flattening all the arrays together, then replacing any number that appears twice?
EphemeralArchitect
@EphemeralArchitect
Aug 09 2015 13:23
is the determinant of an object, method, function, etc., punctuaction (special characters)? Is an object an object by way of it being behind an equal sign and curly brackets? Are those the only things that determine whether something is an object?
are special characters what make a programming language a language?
Arsalan Sabir
@aayanqazi
Aug 09 2015 13:52
Create an "urgently-red" class that gives an element the font-color of red, but add !important to the class to ensure the element is rendered as being red. Immediately below your "urgently-red" class declaration, create a "blue-text" class that gives an element the font-color of blue. Apply both classes to your h2 element.
Can Any One help Me ?
Matthew Barber
@Honno
Aug 09 2015 13:53
@EphemeralArchitect In JS at least, every primitive value is an object, an object being something which stores one or more values
as far as I know, I may be wrong, I'm new heh
@aayanqazi you need to do something like
.class {
  font: Monospace !important;
}
Miauwi
@Miauwi
Aug 09 2015 14:00

hey, any reason this wouldn't work?

 <div ng-show="story.description.length > 0" class="description">
    {{story.description.length}}
</div>

it doesn't matter what evaluation I make, it still shows the div with 0 in it. (i made it write the length of itself to debug)
It's on line 17
http://codepen.io/Miauwi/pen/WvmpQd

Arsalan Sabir
@aayanqazi
Aug 09 2015 14:04
Not Working
Miauwi
@Miauwi
Aug 09 2015 14:17
oh, it was because I was using ng-if in div siblings
Mehrosh
@mehroshh
Aug 09 2015 14:23
i was in the main room wondering why everyone is so dead all of a sudden xD
@aayanqazi you still stuck?
Abhishek Arora
@abhishekarora12
Aug 09 2015 14:27
Hi Everyone
i'm stuck on the last bonfire
Ozy Design & Software
@OzySky
Aug 09 2015 14:28
@abhishekarora12 advanced?
Abhishek Arora
@abhishekarora12
Aug 09 2015 14:29
Argument optional
begginer still @ozydesign
:smile:
if you could tell me just what is to be done here, i will do it myself
dont tel me the code
Moisés Man
@moigithub
Aug 09 2015 14:36
bf argument
CamperBot
@camperbot
Aug 09 2015 14:36

:fire:Bonfire: Arguments Optional :link:

function add() {
  return false;
}

add(2,3);

Create a function that sums two arguments together. If only one argument is provided, return a function that expects one additional argument and will return the sum.
For example, add(2, 3) should return 5, and add(2) should return a function that is waiting for an argument so that <code>var sum2And = add(2); return sum2And(3); // 5</code>
If either argument isn't a valid number, return undefined.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

Moisés Man
@moigithub
Aug 09 2015 14:37
bf links
Andreia Melo
@andreiamlm
Aug 09 2015 14:38
hi. a little question if maybe someone can help me I would appreciate it. Is it feasible to install a mac OS X on a normal PC? is it a crazy idea? don't have the means to get a mac now. I've been using win 8. thanks
Andreia Melo
@andreiamlm
Aug 09 2015 14:42
thanks @moigithub so only emulation =(
CamperBot
@camperbot
Aug 09 2015 14:42
andreiamlm sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
Miauwi
@Miauwi
Aug 09 2015 14:42
thats from 2005
@andreiamlm http://www.macbreaker.com/2014/10/install-os-x-yosemite-on-your-pc-with-unibeast.html this says it's possible on most new intel motherboards
Kameron Robinson
@RobinsonKameron
Aug 09 2015 14:45

‘’'
function binaryAgent(str) {
// Check if string matches 1s & 0s & repeats 8 times
if(str.match(/[10]{8}/g))
{
// Match regex -> map string to function
var wordsFromBin = str.match(/([10]{8}|\s+)/g).map(function(fromBinary)
{
// parseInt fromBinary on the base of 2
/
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
/
return String.fromCharCode(parseInt(fromBinary, 2) );
}).join('');
//console.log(wordsFromBin);
return wordsFromBin;
}
}

binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111');
‘''

I needs help with my function, in the console it works( safari, maybe chrome, not FF)
Moisés Man
@moigithub
Aug 09 2015 14:49
wiki match
CamperBot
@camperbot
Aug 09 2015 14:49
no wiki entry for: match
:pencil: click here to create one now!after creating your page type update to reload it here
Anna Presnyakova
@chiffenok
Aug 09 2015 14:50
Hi guys. Can I look somehow nonprofits projects of FCC alumni ?
I'm just curious about results of their works and how it's look like
Arsalan Sabir
@aayanqazi
Aug 09 2015 14:55
Yes @mehroshh
Miauwi
@Miauwi
Aug 09 2015 14:57
@chiffenok i remember seeing it on their website, but cant for the life of me find it now :|
Andreia Melo
@andreiamlm
Aug 09 2015 14:59
thanks @Miauwi
CamperBot
@camperbot
Aug 09 2015 14:59
andreiamlm sends brownie points to @miauwi :sparkles: :thumbsup: :sparkles:
Anna Presnyakova
@chiffenok
Aug 09 2015 15:00
@Miauwi if you accidentally will find, can u pls give me a link in private msg ?)
Abhishek Arora
@abhishekarora12
Aug 09 2015 15:01
Harvey
@harvey56
Aug 09 2015 15:05

i'm on bonfire 20. i can't pass the last test. here is the error message :

assert.deepEqual(diff([], ['snuffleupagus', 'cookie monster', 'elmo']), ['snuffleupagus', 'cookie monster', 'elmo'], 'empty array');
empty array: expected [ Array(3) ] to deeply equal [ Array(3) ]

what does that mean ?

Anna Presnyakova
@chiffenok
Aug 09 2015 15:05
@Miauwi @abhishekarora12 wait a moment I've seen this page. But I thought it's nonprofits who is in the order. But I meant if smbd from you have already did nonprofit project. and can give link to just look what you did
Miauwi
@Miauwi
Aug 09 2015 15:08
ooooh... nop, im not that advanced :sparkles:
Abhishek Arora
@abhishekarora12
Aug 09 2015 15:09
@chiffenok those websites have been built!
just go to the website link on the page :smile:
it tells on the page the status of project : completed or started
Anna Presnyakova
@chiffenok
Aug 09 2015 15:13
@abhishekarora12 ah, Ok thanks, sorry)
Abhishek Arora
@abhishekarora12
Aug 09 2015 15:23
@chiffenok np :smile:
BIKRAM-MIS
@bikram-mits
Aug 09 2015 15:30
hi
Ross Kaffenberger
@rossta
Aug 09 2015 15:41
@harvey56 means the expected array ['snuffleupagus', 'cookie monster', 'elmo’] doen’t equal the array returned by your function
Harvey
@harvey56
Aug 09 2015 15:43
@rossta yes, what is different is that the array my function returns is sorted, whereas the array expected keeps the same order as the array given at the start
Ross Kaffenberger
@rossta
Aug 09 2015 15:43
looks like it doesn’t want you to sort
Harvey
@harvey56
Aug 09 2015 15:45
that test was defined to avoid people like me find a workaround not using the filter function lol
remitamine
@remitamine
Aug 09 2015 15:53
why this doesn't work for strings:
str[0] = str[0].toUpperCase();
the first character stay lower case
Valerie M
@SerenityFL
Aug 09 2015 15:55
Can someone help me with jquery? I'm just starting, and usually what makes anything difficult in learning this stuff is that I don't speak the language, so have a hard time understand what it is, exactly, that is being asked.
Cody Bouscaren
@codybousc
Aug 09 2015 15:59

Hi all, I'm working on the 8th bonfire and am a bit stuck. So far, I'm able to sort and return the first three of the four nested arrays. For some reason though, the fourth nested array won't sort! The only methods the problem description mention are the comparison operators. Should I attempt to solve the problem with comparison operators or can it be done with a for loop/calling the sort function like i'm doing? Here's my code:
```largestOfFour = [[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]];

for(i = 0; i <= 3; i++) {
sortedArr = largestOfFour[i].sort();
newArr = [[],[],[],[]];
newArr.push(largestOfFour[i].pop());
console.log(newArr);
}
```

largestOfFour = [[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]];

for(i = 0; i <= 3; i++) {
    sortedArr = largestOfFour[i].sort();
    newArr = [[],[],[],[]]; 
    newArr.push(largestOfFour[i].pop()); 
    console.log(newArr);
}
Harvey
@harvey56
Aug 09 2015 16:06
@codybousc
hint :
If compareFunction is not supplied, elements are sorted by converting them to strings and comparing strings in Unicode code point order. For example, "Cherry" comes before "banana". In a numeric sort, 9 comes before 80, but because numbers are converted to strings, "80" comes before "9" in Unicode order
check the last sentence
Valerie M
@SerenityFL
Aug 09 2015 16:10
Anyone? Is this microphone working?
Ozy Design & Software
@OzySky
Aug 09 2015 16:13
@remitamine strings are immutble
@SerenityFL yep
Cody Bouscaren
@codybousc
Aug 09 2015 16:18
@SerenityFL I think the help chatroom is most effective when you ask for help on a specific problem. It's a bit tough to 'help you with JQuery'.
Valerie M
@SerenityFL
Aug 09 2015 16:19
@codybousc yes, cody, I understand that. First I needed to know if anyone was available.
Cody Bouscaren
@codybousc
Aug 09 2015 16:19
@harvey56 Thanks harvey. I'll read up on compareFunction
Ozy Design & Software
@OzySky
Aug 09 2015 16:19
@SerenityFL see my pm
Optmistic
@Optmistic
Aug 09 2015 16:20
whtas wrong with this code
//Title Case a Sentence
function titleCase(str) {
  str.split(" ");

  return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
}

titleCase("I'm a little tea pot");
Ozy Design & Software
@OzySky
Aug 09 2015 16:22
you aren't saving the split as in str = str.split
Optmistic
@Optmistic
Aug 09 2015 16:25
it show error
if i save it in str
@ozydesign
Ozy Design & Software
@OzySky
Aug 09 2015 16:26
because you then need to loop through the array
str[0] and so on
Optmistic
@Optmistic
Aug 09 2015 16:26
hows
Ozy Design & Software
@OzySky
Aug 09 2015 16:28
@Optmistic pm me
Cody Bouscaren
@codybousc
Aug 09 2015 16:57
So, I'm still on the 8th Bonfire. Can anyone see where I'm going wrong here?:
largestOfFour = [[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]];

for(i = 0; i <= 3; i++) {
    sortedArr = largestOfFour[i].sort(function(a,b){
        return a - b;
    });
    newArr = [[],[],[],[]]; 
    newArr.push(largestOfFour[i].pop()); 
    console.log(newArr);
}
Moisés Man
@moigithub
Aug 09 2015 16:58
@codybousc ur function should return a result
Cody Bouscaren
@codybousc
Aug 09 2015 16:59
@moigithub i'm 'console logging' at the moment just to troubleshoot
Moisés Man
@moigithub
Aug 09 2015 16:59
if u put newArr = [[],[],[],[]]; in middle of ur for/loop.. everytime it "loops" will delete previous value, and reasign `newArr = [[],[],[],[]];' so ur push only will have newArr = [[],[],[],[]]; + last value pushed
so.. on console log i bet u seeing
[[],[],[],[], 5]
[[],[],[],[], 27]
[[],[],[],[], 39]
[[],[],[],[], 1001]
Cody Bouscaren
@codybousc
Aug 09 2015 17:02
@moigithub that's exactly what i'm getting
Moisés Man
@moigithub
Aug 09 2015 17:02
declare newArr on top.. outside ur for
var newArr= []; <-- empty array
that will fix :)
Cody Bouscaren
@codybousc
Aug 09 2015 17:03
@moigithub now i'm getting
Moisés Man
@moigithub
Aug 09 2015 17:04
[5]
[5,27]
[5,27,39]
[5,27,39,1001]
Cody Bouscaren
@codybousc
Aug 09 2015 17:04
[[],[],[],[], 5, 27, 39, 1001]
]
Moisés Man
@moigithub
Aug 09 2015 17:04
var newArr= [];
not tihs
var newArr= [[],[],[],[]];
Cody Bouscaren
@codybousc
Aug 09 2015 17:05
ahhh
four empty arrays and then the properly sorted array
Moisés Man
@moigithub
Aug 09 2015 17:05
not four emtpy 2d array.. only 1 emtpy arr
Cody Bouscaren
@codybousc
Aug 09 2015 17:06
@moigithub that might just work! i think the question may have asked for a nested array though
which is why i was attempting to set the var newArr to that funny looking empty nested array
Moisés Man
@moigithub
Aug 09 2015 17:06
if u read the left bottom part (where the test are.. u will see what the answer should looks like )
or what the test expect
Cody Bouscaren
@codybousc
Aug 09 2015 17:07
@moigithub thanks for your help!
Moisés Man
@moigithub
Aug 09 2015 17:07
:) yw
Richard Gay
@willbonds
Aug 09 2015 17:13
Is there a problem with testing on Convert HTML Entities?
Ozy Design & Software
@OzySky
Aug 09 2015 17:24
@willbonds maybe you forgot the semicolon at the end
that problem has been the bane of campers lately
literally every day someone comes and asks about that
sinsukh
@sinsukh
Aug 09 2015 17:25
Screen Shot 2015-08-09 at 1.27.00 PM.png
Can someone help me on this?
Ozy Design & Software
@OzySky
Aug 09 2015 17:27
@Singhsukh what's the problem?
sinsukh
@sinsukh
Aug 09 2015 17:28
@ozydesign It just equals one for each test in the bonfire
Ozy Design & Software
@OzySky
Aug 09 2015 17:28
can you paste the code?
@Singhsukh
zadamah
@zadamah
Aug 09 2015 17:31
hi everyone, can somebody invite me to superhero please?
M Used
@mildused
Aug 09 2015 17:31
Superhero?
ScreenHero?
zadamah
@zadamah
Aug 09 2015 17:31
:smile: yeah this one
getting late
Ozy Design & Software
@OzySky
Aug 09 2015 17:32
@Singhsukh you need str.split(" "), you forgot the space in the split, else it will split each character and not by word.
sinsukh
@sinsukh
Aug 09 2015 17:34
@ozydesign Thanks! I've been stuck on this and had no idea
zadamah
@zadamah
Aug 09 2015 17:36
@mildused so can you invite me?
Michelle
@michelleafleck
Aug 09 2015 17:39
How to ignore whitespace and characters that are not letters when checking for a palidrome?
zadamah
@zadamah
Aug 09 2015 17:41
@michelleafleck replace/regex and lowercase string
zadamah
@zadamah
Aug 09 2015 17:50
@michelleafleck regexp may be too much. I'm doing the same exercise right now... still not working
Moisés Man
@moigithub
Aug 09 2015 17:59
post code
gabazine
@gabazine
Aug 09 2015 18:00
This message was deleted
Moisés Man
@moigithub
Aug 09 2015 18:00
triple backticks on its own line ```
gabazine
@gabazine
Aug 09 2015 18:00

`function palindrome(str) {
var newString =str.replace(/[^\w\s{}]|_/g,"").replace(/\s{1,}/g,"").toLowerCase();
var newStringWoSpace = newString.split('').reverse().join('');

if(newString === newStringWoSpace){
return true;
}
// Good luck!
else {
return false;
}
}

palindrome("A man, a plan, a canal. Panama");
`

Moisés Man
@moigithub
Aug 09 2015 18:01

```function <--- not on same line
should be

```
function

Michelle
@michelleafleck
Aug 09 2015 18:03
Capture.JPG
I can get all but these two.
gabazine
@gabazine
Aug 09 2015 18:04
@michelleafleck i used regex to solve mine
Moisés Man
@moigithub
Aug 09 2015 18:04
@gabazine [^\w] <-- non word.. u can also do like this [\W] <-- uppercase W
Michelle
@michelleafleck
Aug 09 2015 18:04

Holy cow... that's not how I have it at all. Maybe I need to redo the whole thing...
function palindrome(str) {

str = str.replace(/\s/, '');
str = str.replace(/\W/, '');
var reverseStr = str.split([[]]);
reverseStr = reverseStr.reverse([[]]);
reverseStr = reverseStr.join([[]]);

if (str === reverseStr) {
return true;
}
else {
return false;
}
return str.toLowerCase;
}

palindrome("eye");

gabazine
@gabazine
Aug 09 2015 18:05
@Singhsukh, hey how do you format your code like that
is there a way to combine the two replace to one replace
softeg
@softeg
Aug 09 2015 18:08
plz what is the diff beetween type primitive and immutable ?
zadamah
@zadamah
Aug 09 2015 18:08
shorter one:
function palindrome(str) {
str = str.replace(/(\s|\W)+/g, '').toLowerCase();
return str === str.split('').reverse().join('');
}
Moisés Man
@moigithub
Aug 09 2015 18:08
(a|b) <-- a or b
[ab] <-- a or b
Michelle
@michelleafleck
Aug 09 2015 18:09
@gabazine apparently there is... and i still did it the long way?
gabazine
@gabazine
Aug 09 2015 18:10
@zadamah thanks thats make so much sense
zadamah
@zadamah
Aug 09 2015 18:11
you're welcome. i had some difficulties at first to understand "replace" syntax
William Wagner
@wcwagner
Aug 09 2015 18:12
Can someone explain why assert.deepEqual(telephoneCheck("(6505552368)"), false);expected true to deeply equal false
Moisés Man
@moigithub
Aug 09 2015 18:13
parenthesis
William Wagner
@wcwagner
Aug 09 2015 18:13
Oh yeah I just saw that, thanks! @moigithub
pwdd
@pwdd
Aug 09 2015 18:14
Hi. Is anyone ablle to help me with bf Where art thou?
I have pretty much everything working. My problem is when I try to compare the values of the keys.
here is my code:
function where(collection, source) {
  var arr = [];
  // get array of keys from source
  var sourceKeys = Object.keys(source);
  // loop through collection
  for (i = 0; i < collection.length; i++) {
    // loop through sourceKeys
    for (x = 0; x < sourceKeys.length; x++) {
      // if key is in collection
      if (collection[i].hasOwnProperty(sourceKeys[x])) {
        // if found key has same value in collection obj and source obj
        // HERE IS THE ERROR. IF I DO THIS USING VALUES, LIKE 
        // COLLECTION[2].LAST == SOURCE[0].LAST
        // I GET TRUE
        // HOWEVER, IF I USE THE BELOW CODE, IT GET
        // COLLECTION[I].SOURCEKEYS IS UNDEFINED
        if (collection[i].sourceKeys[x] === source.sourceKeys[x]) {
          // add obj to new array
          arr.push(collection[1]);
        }
      }
    }
  }  
  return arr;
}

where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });
Michelle
@michelleafleck
Aug 09 2015 18:14
@zadamah That worked, but clearly I don't really understand it as well as I should.
pwdd
@pwdd
Aug 09 2015 18:16
btw, the last push (arr.push(collection[1]) was fixed to arr.push(collection[i]
Moisés Man
@moigithub
Aug 09 2015 18:17
@pwdd use bracket notation.. instead of dot notation
sourceKeys[x] its a variable... wich holds a value like "last"
so ur the correct code should be
urobject["last"]
ur object do NOT have a property/key named "sourceKeys"
zadamah
@zadamah
Aug 09 2015 18:18
@michelleafleck it replace one space \s or one non alpha char. \W or more "+" with nothing
gabazine
@gabazine
Aug 09 2015 18:18
@michelleafleck , 1. you telling javascript to take the string, remove all the non-words and punctuation and space,
2.Turn the newly cleaned string to lowerCase
3.perform the previous bonfire(how to reverse a string bonfire)
4.Comparely newly reversed string to cleaned and reversed string.
pwdd
@pwdd
Aug 09 2015 18:19
@moigithub thanks! I got it working by using the square braket notation.
@moigithub that was tricky... because {foo: "a"}.foo returns a, right? I wrongly assumed that sourceKeys[index] would be treated as a key...
@moigithub so, thank you very much for that!
Alex Litel
@alexlitel
Aug 09 2015 18:24
Could someone explain the Object.keys() to me? I'm on the Where art thou? and totally confused by the documentation page linked.
pwdd
@pwdd
Aug 09 2015 18:26
@alexlitel It returns the keys from an object.
For instance:
var obj = {keyOne: "valueOne", keyTwo: "valueTwo"}
if you call Object.keys(obj)
it will return an array of the keys: [keyOne, keyTwo]
Alex Litel
@alexlitel
Aug 09 2015 18:29
@pwdd Thanks.
pwdd
@pwdd
Aug 09 2015 18:29
@alexlitel yw. I hope it helps you ;)
Alex Litel
@alexlitel
Aug 09 2015 18:34
In Where art Thou, why does console.log Object.keys(source) only return the common property "last" and not "first & last?
Moisés Man
@moigithub
Aug 09 2015 18:36
where(
[{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }],
{ last: 'Capulet' }
);
where function have 2 arguments
first is an array <-- collection
second is an object <-- source
function where(collection, source) {
so source argument will "hold" this data
{ last: 'Capulet' }
Objects.keys({ last: 'Capulet' }) will return ["last"]
Alex Litel
@alexlitel
Aug 09 2015 18:38
@moigithub so the source object will only refer to the first source object?
Er, last source object
Moisés Man
@moigithub
Aug 09 2015 18:39
@alexlitel if u check the code.. at the end it call where function and it PASS 2 values to that function
where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }] , { last: 'Capulet' });
where( [array] , {object} )
see the comma separator ?
Alex Litel
@alexlitel
Aug 09 2015 18:40
Yes.
Moisés Man
@moigithub
Aug 09 2015 18:40
so .. the function header its like this...
function where(collection, source) {
first value will be passed to "collection" variable
and second value.. will be passed to "source" variable
Alex Litel
@alexlitel
Aug 09 2015 18:41
I understand that the source is the object in the array and the collection is the array.
Moisés Man
@moigithub
Aug 09 2015 18:41
so source will be { last: 'Capulet' }
Alex Litel
@alexlitel
Aug 09 2015 18:42
Because I'm not iterating over the array?
Moisés Man
@moigithub
Aug 09 2015 18:42
doin Objects.keys(source)
in memory JS will be doin
Object.keys ({ last: 'Capulet' } )
if u call where function with "others values".. then source variable will hold "other values"
Joe Pfohl
@japfohl
Aug 09 2015 18:44
hey all. I need some help with bonfire Arguments Optional. Anyone familiar with that solution? I'm getting totally and completely hung up on the part where I have to return a function...
Moisés Man
@moigithub
Aug 09 2015 18:45
Joe Pfohl
@japfohl
Aug 09 2015 18:47
reading now!
hmm... I think my issues has to do with the fact that I'm using arguments[0], arguments1 to refer to the parent functions arguments, but want to also use arguments[0] to refer to the input of the child function that I'm returning. Does that makes sense?
still not sure where to go from here...
Mistereo
@Mistereo
Aug 09 2015 18:51
show your code..
Moisés Man
@moigithub
Aug 09 2015 18:51
each function have their OWN arguments object
so if u have nested function
calling arguments[0] inside one or another.. will return differents results
depending what data argument u passing
ctcrnitv
@ctcrnitv
Aug 09 2015 18:52
what is a good api to use for the quote generator zipline
a lot quote websites like brainyquote don’t seem to have an api
Joe Pfohl
@japfohl
Aug 09 2015 18:54
function add() {
  var singleNum = arguments[0];
  function addOneMore () {
    return singleNum + arguments[0];
  }

  if (typeof arguments[0] !== 'number' || typeof arguments[1] !== 'number') {
    return undefined;
  } else if (arguments.length === 2) {
    return arguments[0] + arguments[1];
  } else if (arguments.length === 1) {
    return addOneMore;
  }
}

add(2)(3);
this is giving me the error --> add(...) is not a function
I pulled the test "add(2)(3)" from the errors that chai.js was throwing
Sophanarith Sok
@sok213
Aug 09 2015 18:57
@japfohl try adding a parameter that represents the arguments like
function add(n) {
and replace "arguments" with n
Moisés Man
@moigithub
Aug 09 2015 18:57
addonemore is a function
return addOneMore(); <-- parentesis
Mistereo
@Mistereo
Aug 09 2015 18:57
This line seems to be wrong for me:
if (typeof arguments[0] !== 'number' || typeof arguments[1] !== 'number')
In this case when you call add(2) - the second argument is undefined
And instead of return a function you return undefined
Joe Pfohl
@japfohl
Aug 09 2015 18:59
@Mistereo but it still passes the first test so the || operator helps prevent that from failing right?
plus... its not returning undefined.
Mistereo
@Mistereo
Aug 09 2015 18:59
It returns undefined..
Joe Pfohl
@japfohl
Aug 09 2015 18:59
its returning "add(. . .) is not a function"
oh doh...
Moisés Man
@moigithub
Aug 09 2015 19:00
return addOneMore(); <-- parentesis
Mistereo
@Mistereo
Aug 09 2015 19:00
yes your add(2)(3) - is same as add2 = add(2); add2(3)
Moisés Man
@moigithub
Aug 09 2015 19:00
posted above...
Mistereo
@Mistereo
Aug 09 2015 19:00
add2 is undefined
Moisés Man
@moigithub
Aug 09 2015 19:01
@japfohl saw ?
Mistereo
@Mistereo
Aug 09 2015 19:01
why parentesis?
@moigithub he returns a function, not their result...
Joe Pfohl
@japfohl
Aug 09 2015 19:01
@moigithub i still cant get it to work. let me repost the code
Mistereo
@Mistereo
Aug 09 2015 19:02
@japfohl check add(2) gives undefined...
Rickee Vang
@rvang
Aug 09 2015 19:02
Can someone help me out with assignment 63? I've been stuck on it for awhile.
Joe Pfohl
@japfohl
Aug 09 2015 19:02
@Mistereo yeah you're right...
argh...
Moisés Man
@moigithub
Aug 09 2015 19:03
@Mistereo because oneAddMore its a function.. not a variable.. so it need paretesis
Mistereo
@Mistereo
Aug 09 2015 19:03
@moigithub nope, it need paretesis when you call it :)
Moisés Man
@moigithub
Aug 09 2015 19:04
ofc u calling it at return :)
Sophanarith Sok
@sok213
Aug 09 2015 19:04
@japfohl Also, you aren't passing anything into your addOneMore(); function.
Moisés Man
@moigithub
Aug 09 2015 19:04
only place it calling..
above it declaring..
Joe Pfohl
@japfohl
Aug 09 2015 19:04
function add() {
  var singleNum = arguments[0];
  function addOneMore (n) {
    return singleNum + n;
  }

  if (typeof arguments[0] !== 'number' || typeof arguments[1] !== 'number') {
    return undefined;
  } else if (arguments.length === 2) {
    return arguments[0] + arguments[1];
  } else if (arguments.length === 1) {
    return addOneMore();
  }
}


add(2, 3);
Mistereo
@Mistereo
Aug 09 2015 19:04
@moigithub in this case you return a function itself but not their result.
Moisés Man
@moigithub
Aug 09 2015 19:04
on return it calling
Mistereo
@Mistereo
Aug 09 2015 19:04
@japfohl paretesis is a mistake :)
Joe Pfohl
@japfohl
Aug 09 2015 19:05
erm...
Moisés Man
@moigithub
Aug 09 2015 19:05
the returning fuction returning a value.. so at the end its returing a result
Mistereo
@Mistereo
Aug 09 2015 19:05
@moigithub nope, we return a function, that we can call later...
@moigithub the function is a value :)
Cody Bouscaren
@codybousc
Aug 09 2015 19:06
Hi all, I'm working on the 9th Bonfire and am running into some difficulties. So far, I'm able to get the function to work when the second argument is a letter and when the string is one word. But, as soon as the string is a sentence, my function fails. How can I save the final word of a string as a variable? Here's my code that works when the string is a single word:
Joe Pfohl
@japfohl
Aug 09 2015 19:07
I'm almost feeling more lost than before... lol
Cody Bouscaren
@codybousc
Aug 09 2015 19:07
function end(str, target) {
  strLength = str.length; 
  lastLet = str.substr(strLength - 1, strLength)

  if (lastLet === target) {
    return true;
  }
  else {
    return false;
  }


}

console.log(end('Bastian', 'n'));
Sophanarith Sok
@sok213
Aug 09 2015 19:07
@japfohl On line 12, you still aren't passing anything into your function, so n is holding no value.
look at line 4, what is var singleNum being added to?
Mistereo
@Mistereo
Aug 09 2015 19:08
@japfohl you are close, some additions and you get it :)
Moisés Man
@moigithub
Aug 09 2015 19:08
function is not a value :P
but it execute/evaluate and return a result
Joe Pfohl
@japfohl
Aug 09 2015 19:08
thanks @Mistereo
CamperBot
@camperbot
Aug 09 2015 19:08
japfohl sends brownie points to @mistereo :sparkles: :thumbsup: :sparkles:
Joe Pfohl
@japfohl
Aug 09 2015 19:08
oh thats interesting!!!
@moigithub why are you confuse peoples? :/
Mahtab
@RoadToCode822
Aug 09 2015 19:11
Would greatly appreciate it if someone could send me an invitation for screen hero
Joe Pfohl
@japfohl
Aug 09 2015 19:14
@RoadToCode822 just download the app and you can create an account within the app itself without an invite
Cody Bouscaren
@codybousc
Aug 09 2015 19:18
@sok213 grrrrr
that's actually very helpful. thank you!
Sophanarith Sok
@sok213
Aug 09 2015 19:18
@codybousc Glad to help
Lux3
@Lux3
Aug 09 2015 19:19
var square = new Object();
square.sideLength = 6;
square.calcPerimeter = function() {
  return this.sideLength * 4;
};
// help us define an area method here
var calcArea = function () {
  return this.sideLength * this.sideLength;
};

var p = square.calcPerimeter();
var a = square.calcArea();
what am I doing wrong, it says square.calcArea is not a function.
Moisés Man
@moigithub
Aug 09 2015 19:19
@japfohl so got ur code working ?
Mistereo
@Mistereo
Aug 09 2015 19:20
@Lux3 look at calcPerimeter and calcArea definitions and compare them :)
Joe Pfohl
@japfohl
Aug 09 2015 19:20
Nope... still brooding and trying little things but not having success
Lux3
@Lux3
Aug 09 2015 19:20
derp
Mistereo
@Mistereo
Aug 09 2015 19:20
@japfohl I can help you at floobits.
Joe Pfohl
@japfohl
Aug 09 2015 19:20
floobits?
Lux3
@Lux3
Aug 09 2015 19:21
@Mistereo not sure how I was missing that thank you!
Mahtab
@RoadToCode822
Aug 09 2015 19:44
@japfohl Thanks, did exactly that.
gabazine
@gabazine
Aug 09 2015 19:52
code

`function findLongestWord(str) {
str = str.split(" ");
str.sort(function(a,b){
return b.length - a.length;
});

return str[0].length;
}

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

Mahtab
@RoadToCode822
Aug 09 2015 19:53
This message was deleted
gabazine
@gabazine
Aug 09 2015 19:54
is there a way to combine the split and sort into one big line
Mahtab
@RoadToCode822
Aug 09 2015 19:54
This message was deleted
According to the doc,
//var strReverse = str.split('').reverse().join(''); // 'lkjhgfdsa'
This message was deleted
//var strReverse = str.split('').reverse().join(''); // 'lkjhgfdsa'
Mistereo
@Mistereo
Aug 09 2015 19:55
use ``` for multiline code.
Mahtab
@RoadToCode822
Aug 09 2015 19:57
function reverseString(str) {
  var strReverse = str.split('');
  strReverse.reverse();
  strRevrse.join('');
  return str;

  //var strReverse = str.split('').reverse().join(''); // 'lkjhgfdsa'

}

reverseString('hello');
gabazine
@gabazine
Aug 09 2015 19:57
function findLongestWord(str) {
str = str.split(" ");
str.sort(function(a,b){
return b.length - a.length;
});
return str[0].length;
}
findLongestWord('The quick brown fox jumped over the lazy dog');
Mahtab
@RoadToCode822
Aug 09 2015 19:57
can someone tell me why my code isn’t working?
Mistereo
@Mistereo
Aug 09 2015 19:57
@gabazine yes, you can chain them :)
var str = "bcda";
str.split("").sort();
gabazine
@gabazine
Aug 09 2015 19:59
@Mistereo it doesn't work, it keeps saying str.split not a function
L. Becker
@LCBecker
Aug 09 2015 19:59
@LCBecker
I have a dumb question about the Twitch TV zipline. What key is the stream's "name" under?
The JSON sample has "game"...but that's only if the stream is under the game category. What would, say, FCC's Saturday stream's name be under if it was live?
Mistereo
@Mistereo
Aug 09 2015 20:00
@gabazine show what you are truing to do..
@RoadToCode822 first: you return str, not strReverse, second: strRevrse.join(''); -- typo...
missed 'e'.
gabazine
@gabazine
Aug 09 2015 20:02
@Mistereo Not working
function findLongestWord(str) {
  //str = str.split(" ");
   str.split(" ").sort(function(a,b){
    return b.length - a.length;
  });


  return str[0].length;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
Anthony Blow
@anthonyblow
Aug 09 2015 20:02
Hi ladies and gents - can anyone provide any help on one of the beginning lessons?Waypoint: Override Styles with Important
Mahtab
@RoadToCode822
Aug 09 2015 20:03
function reverseString(str) {
  var strReverse = str.split('');
  strReverse.reverse();
  strReverse.join('');
  return strReverse;

  //var strReverse = str.split('').reverse().join(''); // 'lkjhgfdsa'

}

reverseString('hello');
Not sure why this isn’t working either, after fixing my mistakes
zadamah
@zadamah
Aug 09 2015 20:04
@RoadToCode822 you have to assign your function calls like so temp=strReverse.reverse();
gabazine
@gabazine
Aug 09 2015 20:04
@RoadToCode822 i think because you are perfoming parallel things to strReverse
Mistereo
@Mistereo
Aug 09 2015 20:04

@RoadToCode822 join didn't mutate the source array;

strReverse.join('');
return strReverse;

Should be:

return strReverse.join('');
@gabazine the same, split didn't mutate the source string..
Juan Martínez
@jbmartinez
Aug 09 2015 20:05
@LCBecker I think it's called game in any case
Anthony Blow
@anthonyblow
Aug 09 2015 20:05

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

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

h2 {
font-family: Lobster, Monospace;
}
!important: <style> .urgently-blue { color: blue !important; }

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>

Trying to figure out what I did wrong here
zadamah
@zadamah
Aug 09 2015 20:05
this should work
gabazine
@gabazine
Aug 09 2015 20:06
@Mistereo I dont get it
Mistereo
@Mistereo
Aug 09 2015 20:06
@gabazine
function findLongestWord(str) {
   str = str.split(" ").sort(function(a,b){
    return b.length - a.length;
  });
  return str[0].length;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
Also you return the length of word, is it what you want?
zadamah
@zadamah
Aug 09 2015 20:07
function reverseString(str) {
  var strReverse = str.split('');
  var temp = strReverse.reverse();
  return temp.join("");
}
reverseString('hello');
gabazine
@gabazine
Aug 09 2015 20:07
@Mistereo yep, not the word, but its length.. thanks I get it now
zadamah
@zadamah
Aug 09 2015 20:08
or even simpler
function reverseString(str) {
  return strReverse = str.split('').reverse.join("");
}
without the stdReverse =
Mahtab
@RoadToCode822
Aug 09 2015 20:09
Can you elaborate on “join didnt mutate the source arraY”
Mistereo
@Mistereo
Aug 09 2015 20:15
I guess I mean 'does not', sorry English is foreign for me :)
var arr = ['a', 'b', 'c', 'd'];
arr.join('');
// arr is still ['a', 'b', 'c', 'd'] not "abcd";
sinsukh
@sinsukh
Aug 09 2015 20:22
Screen Shot 2015-08-09 at 4.13.36 PM.png
Screen Shot 2015-08-09 at 4.13.36 PM.png
Could anyone help me fix my code?
Valerie M
@SerenityFL
Aug 09 2015 20:29
@anthonyblow did it say your text should be blue or red? And where is your "urgently-red" class?
Marc Davenport
@oneate7
Aug 09 2015 20:31
@Singhsukh - That bonfire doesn't want you to remove the spaces. The spaces should count as characters to be removed. Also, you need to add "..." to the end of the string before its returned.
Anthony Blow
@anthonyblow
Aug 09 2015 20:32
@SerenityFL The text should be red -
Mahtab
@RoadToCode822
Aug 09 2015 20:32
thanks, i appreciate the help everyone :)
Anthony Blow
@anthonyblow
Aug 09 2015 20:33
@SerenityFL here's the updated with urgently red

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

<style>
.red-text urgently-red {
color: red !important;

h2 {
font-family: Lobster, Monospace;
}

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

<h2 class='blue-text'.urgently-red> 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>

Valerie M
@SerenityFL
Aug 09 2015 20:33
@anthonyblow Ok, I did this probably 10 times to make sure I could do it without hints, so I'm very familiar with the lesson you're on
softeg
@softeg
Aug 09 2015 20:33
i like Practice Functional Programming its very coool
Valerie M
@SerenityFL
Aug 09 2015 20:33
in your H2, you don't need the dot before urgently red, should read: "h2 class='blue-text urgently-red'
Anthony Blow
@anthonyblow
Aug 09 2015 20:33
@SerenityFL Thanks - I've been on this for a couple of hours - really appreciate it - just need to know what I'm doing wrong
Rex Schrader
@SaintPeter
Aug 09 2015 20:34
wiki format
CamperBot
@camperbot
Aug 09 2015 20:34

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Anthony Blow
@anthonyblow
Aug 09 2015 20:34
@SerenityFL OK
Valerie M
@SerenityFL
Aug 09 2015 20:35
let me go back and look at mine, your urgently red up in the top I'm wondering about, but I did see that you got the !important fixed up from the first c/p you put up.
Anthony Blow
@anthonyblow
Aug 09 2015 20:35
main thing is the last two - making the text emerge as red @SerenityFL
Yes... not going to let this challenge beat me! @SerenityFL
Valerie M
@SerenityFL
Aug 09 2015 20:36
@anthonyblow what is the title of that lesson?
Anthony Blow
@anthonyblow
Aug 09 2015 20:36
@SerenityFL Waypoint: Override Styles with Important
Kolloom
@Kolloom
Aug 09 2015 20:37
bonfire trun
CamperBot
@camperbot
Aug 09 2015 20:37

:fire:Bonfire: Truncate a string :link:

function truncate(str, num) {
  // Clear out that junk in your trunk
  return str;
}

truncate('A-tisket a-tasket A green and yellow basket', 11);

Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a '...' ending.
Note that the three dots at the end add to the string length.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

Valerie M
@SerenityFL
Aug 09 2015 20:37
@anthonyblow ok, give me a second
Ok, @anthonyblow at the top, you have .red-text and .urgently-red. What I did was create it separately. I created it like this: .urgently-red { color: red !important }
so you will have one .red-text if and then anotehr .urgently-red with the !important declaration going there after your color.
Anthony Blow
@anthonyblow
Aug 09 2015 20:41
@SerenityFL ok one sec - let me try again
Valerie M
@SerenityFL
Aug 09 2015 20:41

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

h2 {
font-family: Lobster, Monospace;
}

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

<h2 class='blue-text urgently-red'>CatPhotoApp</h2>

Anthony Blow
@anthonyblow
Aug 09 2015 20:47
@SerenityFL Thank you for your help - I have one last task which says the h2 element should be red. my text is red now, but just wondering why this is not checked off
Valerie M
@SerenityFL
Aug 09 2015 20:47
c/p what you have?
Anthony Blow
@anthonyblow
Aug 09 2015 20:49
c/p?
Valerie M
@SerenityFL
Aug 09 2015 20:49
sorry, copy/paste
Anthony Blow
@anthonyblow
Aug 09 2015 20:49

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

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

h2 {
font-family: Lobster, Monospace;
}

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

<h2 class='blue-text urgently-red'> 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>

Valerie M
@SerenityFL
Aug 09 2015 20:50
Ok, up by your "urgently-red" at the top under style, it needs to read: .urgently-red { (your forgot your lead bracket)
so .urgently-red { color: red !important }
Anthony Blow
@anthonyblow
Aug 09 2015 20:52
@SerenityFL Thank you so much SerenityFL! I'm going to go back as you did and work this one a couple more times to get it down
Patience I'll have to pay forward once I get the hang of this
Valerie M
@SerenityFL
Aug 09 2015 20:53
@anthonyblow No problem. Brackets and / and < and ' are killers. I go over everything a lot of times to make sure I'm as comfy with it as I am HTML.
Anthony Blow
@anthonyblow
Aug 09 2015 20:55
@SerenityFL Advice adopted
Valerie M
@SerenityFL
Aug 09 2015 20:55
@anthonyblow and congrats, you're the first person I was actually able to help. I've never done CSS before my 9 hour marathon on it yesterday. Once you get it, it actually starts to click.
Zeljko Sevic
@schewmeister
Aug 09 2015 20:58
hi everyone
how can I get same random values two times?
John Albritton
@jma921
Aug 09 2015 21:01
Can someone look at my Twitch code. Everything works but I can't get it to load the initial list on page load. http://codepen.io/jma921/pen/LVabXd?editors=001
Brian Daub
@briandaub
Aug 09 2015 21:12
Anyone already complete the Confirm the Ending bonfire? I think it's bonfire #9.
Alejandro Tejada
@wannabecoding
Aug 09 2015 21:15
Hi all. Can anybody give me some direction on the reverse string bonfire?
Brian Daub
@briandaub
Aug 09 2015 21:15
I am just curious how other people solved it
Alejandro Tejada
@wannabecoding
Aug 09 2015 21:15
I tried using the string split method following this instruction to break it down into an array
Brian Daub
@briandaub
Aug 09 2015 21:16
@wannabecoding you have to use .split(' ').reverse().join(' ');
Moisés Man
@moigithub
Aug 09 2015 21:16
@codeJunkie01 return str.slice(-end.length)===end
Alejandro Tejada
@wannabecoding
Aug 09 2015 21:16
@codeJunkie01 thanks, didn't want the exact answer though :)
Brian Daub
@briandaub
Aug 09 2015 21:16
Interesting I used a regex
Mahtab
@RoadToCode822
Aug 09 2015 21:16
what regex did you use codejunkie
Alejandro Tejada
@wannabecoding
Aug 09 2015 21:16
How do I individually test .split? I get undefined
Mahtab
@RoadToCode822
Aug 09 2015 21:17
@codeJunkie01 what regex did you use
Brian Daub
@briandaub
Aug 09 2015 21:17
function end(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor\
  var regex = new RegExp(target + "$");
  if(str.match(regex)){
      str = true;
  }else{
      str = false;
  }
  return str;
}

end('Bastian', 'n');
@wannabecoding are you doing .split(' ');?
you have to put a space with quotes around it
Moisés Man
@moigithub
Aug 09 2015 21:19
@codeJunkie01 i think.. instead str.match..u can use str.test() wich returns a boolean
Brian Daub
@briandaub
Aug 09 2015 21:19
just .split(); wont work I dont think
Mahtab
@RoadToCode822
Aug 09 2015 21:19
I don’t think you have to put a space between the beginning and ending quotes for the split method
Brian Daub
@briandaub
Aug 09 2015 21:20
@moigithub when I use .test() it gives me an error and states str.text() is not a function
Moisés Man
@moigithub
Aug 09 2015 21:20
test not text
Brian Daub
@briandaub
Aug 09 2015 21:20
so I was able to get the .match() method to work
Moisés Man
@moigithub
Aug 09 2015 21:20
var regex = new RegExp(target + "$");
//return str.test(regex); <-- wrong syntax
regex.test(str); //<-- fixed
should work...
i think
Brian Daub
@briandaub
Aug 09 2015 21:21
@RoadToCode822 i think you at least have to have the quotes in the parenthesis
ctcrnitv
@ctcrnitv
Aug 09 2015 21:21
has anyone here done the quote generator zipline?
looking for a good api to use to get quotes
any suggestions?
Moisés Man
@moigithub
Aug 09 2015 21:23
some used api.. some used arrays.. some said both are valid :)
some did drunks quotes,, other startrek, saw even pokemon quotes...
AfricanSam
@AfricanSam
Aug 09 2015 21:51
Hi, I'm not sure where it's appropriate to post about needing help but this place seemed the most likely? I'm early on in coding and am stuck even though I feel as though I've completed the task. I need the image to be 100 px wide and this is my code:
Screen Shot 2015-08-09 at 11.46.34 PM.png
Jason Martinez
@snwyvern
Aug 09 2015 21:52
African: Read the instructions carefully, I think you have to add a class as well-
AfricanSam
@AfricanSam
Aug 09 2015 21:57
@snwyvern is .smaller-image not a class? It's saying that I've created the class but that my image is still not 100 px.
Jason Martinez
@snwyvern
Aug 09 2015 22:02
Make sure the CSS matches? :|
Kolloom
@Kolloom
Aug 09 2015 22:10
@AfricanSam try refresh ?
ctcrnitv
@ctcrnitv
Aug 09 2015 22:14
@moigithub arrays is cheating imo :p
Marc Davenport
@oneate7
Aug 09 2015 22:17
@skr5e Hey! :wink: It depends on what quotes you want to use. For example, I wanted to do a Star Trek quotes thing, and there wasn't an API available for that. So I was stuck typing them in one by one. I would have LOVED to use an API instead.
Valerie M
@SerenityFL
Aug 09 2015 22:38
Is there supposed to be a space between width and 100px? I'm just guessing.
AfricanSam
@AfricanSam
Aug 09 2015 22:41
Ag, I've moving onto the next task. It's frustrating to not get a green tick but the code is resizing the image if I put in different amounts. Thanks for the suggestions everyone!
deaninous
@deaninous
Aug 09 2015 22:45
@AfricanSam you have the number of the waypoint?
SojournerOctocat
@SojournerOctocat
Aug 09 2015 22:47
@AfricanSam Or the URL/link?
Erica
@Buzzlightyear90
Aug 09 2015 22:48
has anyone used regex before?
I am trying to solve this question: Write an expression to see if the num variable contains the string "3.5".
I tried num.test("3.5")
num.exec(/3.5/)
Juan Martínez
@jbmartinez
Aug 09 2015 22:50
@Buzzlightyear90 /3\.5/
Erica
@Buzzlightyear90
Aug 09 2015 22:50
that's what I entered except that the backslash disappeared every time I enter the thing on here
Juan Martínez
@jbmartinez
Aug 09 2015 22:51
@Buzzlightyear90 and didn't work?
Erica
@Buzzlightyear90
Aug 09 2015 22:51
is ```num.test(/3.5/) good?
it didn't work
it worked, I don't know why
Juan Martínez
@jbmartinez
Aug 09 2015 22:53
@Buzzlightyear90 perhaps you need to use the global flag
/3\.5/g
deaninous
@deaninous
Aug 09 2015 22:55
@AfricanSam I couldnt find where you went wrong. I tried it and this worked
<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 class = "smaller-image" src='https://bit.ly/fcc-kittens'/>

<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>
and it is waypoint 19
Clayton
@cjg040103
Aug 09 2015 23:19
hmmm...
i cant find anything wrong either
can anyone help me?
i'm on bonfire: chunky monkey, and i just dont no wer 2 start. any tips on what i shood do first?
Clayton
@cjg040103
Aug 09 2015 23:25
bonfire chunky monkey
CamperBot
@camperbot
Aug 09 2015 23:25

:fire:Bonfire: Chunky Monkey :link:

function chunk(arr, size) {
  // Break it up.
  return arr;
}

chunk(['a', 'b', 'c', 'd'], 2);

Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

SojournerOctocat
@SojournerOctocat
Aug 09 2015 23:26
@cjg040103 Remember that you can iterate in chunks of specific sizes, you don't have to always use i++.
Clayton
@cjg040103
Aug 09 2015 23:26
i just don't understand wat it wants me 2 do.
brb 10 mins. hav 2 go eat dinnr
Ingrid
@voodoobettie
Aug 09 2015 23:32
bonfire title case a sentence
CamperBot
@camperbot
Aug 09 2015 23:32

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

function titleCase(str) {
  return str;
}

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

Return the provided string with the first letter of each word capitalized.
For the purpose of this exercise, you should also capitalize connecting words like 'the' and 'of'.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

type: bf details bf links bf spoiler

Ingrid
@voodoobettie
Aug 09 2015 23:33
Hi all. I can't seem to figure out why my array will only ever have one word in it, and was hoping someone could help
bf spoiler
CamperBot
@camperbot
Aug 09 2015 23:33
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Ingrid
@voodoobettie
Aug 09 2015 23:33
When I push the current word into the array, it doesn't append it, it seems to be overwritten.
// This part is working, now I need to loop it
function titleCase(str) {
        var words = str.replace(myRegExp, "").toLowerCase().split(" ");
        var myRegExp = /[^a-zA-Z][\.,-\/#!$%\^&\*;:{}=\-_`~()]?/ig;

        console.log (words + ' <= word list');

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


        var current = words[i].slice(0,1).toUpperCase() + words[i].slice(1).toLowerCase();
        console.log(current + ' <= current word');
        var titled = [];
        titled.push(current);
        console.log(titled  + ' <= titled word list');
    }
    return titled;
};

titleCase('help I need somebody');
Tom Pyszczuk
@Ne0nite
Aug 09 2015 23:37
~~
Kolloom
@Kolloom
Aug 09 2015 23:39
@voodoobettie you created a blank titled in every iteration
SojournerOctocat
@SojournerOctocat
Aug 09 2015 23:40
@Kolloom Oooh. I kept looking at it, trying to figure out why it was doing that!
Ingrid
@voodoobettie
Aug 09 2015 23:40
@Kolloom Okay, thanks. Duh me. lol
@Kolloom Instantly fixed. Many thanks!
Kolloom
@Kolloom
Aug 09 2015 23:41
no problem
Ingrid
@voodoobettie
Aug 09 2015 23:43
Okay one more question, it runs but I get an error which says words[i] is undefined, how can I fix that?
SojournerOctocat
@SojournerOctocat
Aug 09 2015 23:43
Working on Smallest Common Multiple. I've got one iteration down, but I'm now trying to figure out how to loop through the rest of the numbers. Code below. I want to multiply the largest number by 1, then 2, then 3, then 4, etc, checking each time to see if the numbers in the range are evenly divisible by that multiple. I can't figure out how to get that done.
function smallestCommons(arr) {
    var numMin = Math.min(arr[0], arr[1]);
    var numMax = Math.max(arr[0], arr[1]);
    var numMultiplier = 1;
    var arrBool = [];

        for (var i = numMin; i < numMax; i++) {
            if ( (numMax * numMultiplier) % i === 0) {
                arrBool.push(true);
            } else {
                arrBool.push(false);
            }
            console.log("min " + numMin + "   " + "max " + numMax + "   " + "i " + i + "   " + "mult " + numMultiplier);
        }    

        console.log(arrBool);
        if (arrBool.indexOf(false) == -1) {
            return numMax * numMultiplier;
        }

}

smallestCommons([1,5]);
Anthony MacMahon
@SansPulp
Aug 09 2015 23:43
I'm having trouble with bonfire: mutations. For whatever reason, my argument is returning true no matter what. Do I have the syntax wrong on my indexOf call?
function mutation(arr) {
  var baseStr = arr[0].toLowerCase();
  var searchStr = arr[1].toLowerCase().split('');

  for (i = 0; i < searchStr.length; i++) {
    if (baseStr.indexOf(searchStr[i]) < 0) {
        return false;
        }
  else {
        return true;
        }
  }
}
mutation(['hello', 'hey']);
Ingrid
@voodoobettie
Aug 09 2015 23:44
@SojournerOctocat Would a switch statement work?
Reggie
@Reggie01
Aug 09 2015 23:44
@voodoobettie Hint: take a 2nd look at
i <= words.length
SojournerOctocat
@SojournerOctocat
Aug 09 2015 23:45
@voodoobettie I think not. The issue is that I don't know how many multiples it would take to find the answer. I think switch statements are for when you know all of the answers available, no?
Kolloom
@Kolloom
Aug 09 2015 23:45
@sanspulp you see the return statement will break the entire for loop at first iteration
Ross Kaffenberger
@rossta
Aug 09 2015 23:46
@SansPulp Your for loop is short-circuiting with the return statement
Kolloom
@Kolloom
Aug 09 2015 23:46
since the first letter are the same, true is returned
which means your for loop never looks for any other letter but the first one
Ross Kaffenberger
@rossta
Aug 09 2015 23:50
@SojournerOctocat I think I can see what you’re trying to do; there may be an easier way to solve this problem.
Ingrid
@voodoobettie
Aug 09 2015 23:51
@Reggie01 I'm confused, the i is just to run the loop and it runs correctly, and gets the right result but I still get the error.
Kolloom
@Kolloom
Aug 09 2015 23:52
could you post the new code ? @voodoobettie
Ingrid
@voodoobettie
Aug 09 2015 23:54
@Kolloom Here it is...
// This part is working, now I need to loop it
function titleCase(str) {
        var words = str.replace(myRegExp, "").toLowerCase().split(" ");
        var myRegExp = /[^a-zA-Z][\.,-\/#!$%\^&\*;:{}=\-_`~()]?/ig;
        //console.log (words);
        var titled = [];

    for (i = 0; i <= words.length; i++){
        var current = words[i].slice(0,1).toUpperCase() + words[i].slice(1).toLowerCase();
        // console.log(current + ' <= current word');
        titled.push(current);
        console.log(titled  + ' <= titled word list');
    }
    return titled;
}

titleCase('help I need somebody');
Ross Kaffenberger
@rossta
Aug 09 2015 23:55
@voodoobettie you’ll want to change your for loop
use i < words.length
e.g., for an array of length 4, the last index is 3
Ingrid
@voodoobettie
Aug 09 2015 23:56
@rossta Ah ok, I gotcha. It's undefined because it's an index that doesn't exist. Okay. Thanks!
Ross Kaffenberger
@rossta
Aug 09 2015 23:57
you got it
Zeljko Sevic
@schewmeister
Aug 09 2015 23:57
Hello everyone, does anyone have any problem with Codepen interface? I have some bugs, I tested my code on jsfiddle, it works very well
Kolloom
@Kolloom
Aug 09 2015 23:58
what are the bugs you see?
Tom Pyszczuk
@Ne0nite
Aug 09 2015 23:58
Heya gang I am kind of stuck since yesterday on the "find the longest word bonefire" .. I know how to find make the array out of the string , and how to find the character number in all the words in the array ,but I cant figure out the logic for finding the longest word :/ Any tips ? :)
function findLongestWord(str) {
   var stringReplace = str.split(/\s/g);
    console.log(stringReplace);
     for (var i=0;  i !== stringReplace.length; i++) {
            console.log(stringReplace[i] + " has the length of " + stringReplace[i].length + " characters");
//            var longest = "";
//            if(stringReplace[i].length > longest.length ){
//                longest.length += stringReplace[i].length ;
//                console.log("This is the longest word: " + longest);
//            }
         }
  }



findLongestWord('The quick brown fox jumped over the lazy dog');
I tried all kinds of ways. array sorting, some weird if else loops
probably missing something obvious :)