These are chat archives for FreeCodeCamp/Help

26th
Aug 2017
Uriel Guzmán
@Burinson
Aug 26 2017 00:05
if (e.keyCode === 13 && "#output".length > 0) {
        // When spacebar is pressed.        
        $("#searchTerm").removeClass("margin"); // Searchbar goes to the top.
        $("#output").empty(); // Output is refreshed.
        var searchTerm = $("#searchTerm").val(); // Typed words are output.
        var url =
            "https://en.wikipedia.org/w/api.php?action=opensearch&search=" +
            searchTerm +
            "&format=json&callback=?"; // Link with keywords.
        $.ajax({
            url: url,
            type: "GET",
            async: false,
            dataType: "json",
            success: function(data, status, jqXHR) {
                for (var i = 0; i < data[1].length; i++) {
                    $("#output").append(
                        "<a target='_blank' href=" +
                            data[3][i] +
                            "><div><div class='well'><h2>" +
                            data[1][i] +
                            "</h2>" +
                            "<p>" +
                            data[2][i] +
                            "</p></div></div></a>"
                    ); // Show a different result for every loop.
                } // End of for loop.
            } // End of success function.        
        }); // End of ajax call.
    } else if (e.keyCode === 13 && "#output".length === 0) {"<h2>No results found</h2>"}// End of if statement.
}); // End of searchTerm function.
Guys, how can I make my Wikipedia Viewer show a "No results found" text when no results are... found?
Stephen James
@sjames1958gm
Aug 26 2017 00:12
@Burinson IN your success function - test for if ( data[1].length == 0)
Eric Miller
@ericmiller777
Aug 26 2017 00:16
Heu guys
Stephen James
@sjames1958gm
Aug 26 2017 00:17
@ericmiller777 :wave:
Uriel Guzmán
@Burinson
Aug 26 2017 00:17
@sjames1958gm
$("#searchTerm").keypress(function(e) {
    // Keypress.

    if (e.keyCode === 13) {
        // When spacebar is pressed.        
        $("#searchTerm").removeClass("margin"); // Searchbar goes to the top.
        $("#output").empty(); // Output is refreshed.
        var searchTerm = $("#searchTerm").val(); // Typed words are output.
        var url =
            "https://en.wikipedia.org/w/api.php?action=opensearch&search=" +
            searchTerm +
            "&format=json&callback=?"; // Link with keywords.
        $.ajax({
            url: url,
            type: "GET",
            async: false,
            dataType: "json",
            success: function(data, status, jqXHR) {
                if (data[1].length == 0) {
                for (var i = 0; i < data[1].length; i++) {
                    $("#output").append(
                        "<a target='_blank' href=" +
                            data[3][i] +
                            "><div><div class='well'><h2>" +
                            data[1][i] +
                            "</h2>" +
                            "<p>" +
                            data[2][i] +
                            "</p></div></div></a>"
                    ); // Show a different result for every loop.
                } // End of for loop.
            } else {"<h2>No results found</h2>"}} // End of success function.        
        }); // End of ajax call.
    } // End of if statement.
}); // End of searchTerm function.
Did I do something wrong?
Stephen James
@sjames1958gm
Aug 26 2017 00:17
@Burinson You didn't append that to #output
Uriel Guzmán
@Burinson
Aug 26 2017 00:17
Oh, right
@sjames1958gm
$("#searchTerm").keypress(function(e) {
    // Keypress.

    if (e.keyCode === 13) {
        // When spacebar is pressed.        
        $("#searchTerm").removeClass("margin"); // Searchbar goes to the top.
        $("#output").empty(); // Output is refreshed.
        var searchTerm = $("#searchTerm").val(); // Typed words are output.
        var url =
            "https://en.wikipedia.org/w/api.php?action=opensearch&search=" +
            searchTerm +
            "&format=json&callback=?"; // Link with keywords.
        $.ajax({
            url: url,
            type: "GET",
            async: false,
            dataType: "json",
            success: function(data, status, jqXHR) {
                if (data[1].length > 0) {
                for (var i = 0; i < data[1].length; i++) {
                    $("#output").append(
                        "<a target='_blank' href=" +
                            data[3][i] +
                            "><div><div class='well'><h2>" +
                            data[1][i] +
                            "</h2>" +
                            "<p>" +
                            data[2][i] +
                            "</p></div></div></a>"
                    ); // Show a different result for every loop.
                } // End of for loop.
            } else {$("#output").append("<h2>No results found</h2>");}} // End of success function.        
        }); // End of ajax call.
    } // End of if statement.
}); // End of searchTerm function.
Thank you, it worked
I also noticed I had to change data[1].length == 0 to data[1].length > 0
@sjames1958gm thanks
CamperBot
@camperbot
Aug 26 2017 00:20
burinson sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8390 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Eric Miller
@ericmiller777
Aug 26 2017 00:20
anyone wanna help me out with the diff two arrays challenge
function diffArray(arr1, arr2) {
  var newArr = [];
  var finalArr = [];
  var count = 0;
  // Same, same; but different.
  newArr = arr1.concat(arr2);
  for (let i = 0; i < newArr.length; i++){
    for (let b=0; b < newArr.length; b++){
      if (newArr[i] != newArr[b]){
        finalArr.push(newArr[i]);

    }
  }
  }
  return finalArr;
}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
it doesnt work at all
Manish Giri
@Manish-Giri
Aug 26 2017 00:24
@ericmiller777 not sure what your inner for is doing
there's another way
Eric Miller
@ericmiller777
Aug 26 2017 00:24
i was trying to run through it twice
but i kind of understand that makes no sense
i suck at these algorithms....
Manish Giri
@Manish-Giri
Aug 26 2017 00:25
return newArr.filter(num => !arr1.includes(num) && !arr2.includes(num))
this should work
Eric Miller
@ericmiller777
Aug 26 2017 00:26
yea it should i was truing to figure it out with a loop
Manish Giri
@Manish-Giri
Aug 26 2017 00:26
do the same thing with a loop
Kyle Holm
@thekholm80
Aug 26 2017 00:26
loops are awesome
Manish Giri
@Manish-Giri
Aug 26 2017 00:27
 for (let i = 0; i < newArr.length; i++){ 
 // if arr1 and arr2 both doesn't have newArr[i]
  // push
}
Kyle Holm
@thekholm80
Aug 26 2017 00:35
bleh twitter still isn't loading for me @Manish-Giri
tried 2 comps, must be my isp
Manish Giri
@Manish-Giri
Aug 26 2017 00:36
lol
Eric Miller
@ericmiller777
Aug 26 2017 00:38
well i had an idea
function diffArray(arr1, arr2) {
  var newArr = [];
  var finalArr = [];
  newArr = arr1.concat(arr2);
  for (let i=0; i < newArr.length; i++){
    if(arr1.indexOf(newArr[i]) == -1 || arr2.indexOf(newArr[i] == -1)){
      finalArr.push(newArr[i]);
    }
  }
    return finalArr;
}
diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
but it didnt work
just returns the whole array
hmm
it works!
@Manish-Giri thanks
CamperBot
@camperbot
Aug 26 2017 00:40
ericmiller777 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6463 | @manish-giri |http://www.freecodecamp.com/manish-giri
Eric Miller
@ericmiller777
Aug 26 2017 00:41
just had the ) in the wrong place in the if staement at the end
Josebuendia
@Josebuendia
Aug 26 2017 00:46
<style>
body {
background-color: rgb (0, 0, 0, );
}
</style>
I'm trying to use RGB values to colour elements what's wrong above?
Josebuendia
@Josebuendia
Aug 26 2017 01:02
ahh there managed it
Ravi Kishore Thella
@ravikishorethella
Aug 26 2017 01:15
@Josebuendia no , after third 0 and also remove the space between rgb and (
andry91959
@andry91959
Aug 26 2017 01:35
hello
can someone tell me why is it happening
Capture.PNG
why the sentence overlap bullet point
Long Nguyen
@longnt80
Aug 26 2017 01:49
@andry91959 are you using CSS-reset?
@andry91959 try put list-style-position: outside; on your li
andry91959
@andry91959
Aug 26 2017 01:55
Give me a sec let me try
not working :(
Long Nguyen
@longnt80
Aug 26 2017 01:59
do you have it on a codepen?
andry91959
@andry91959
Aug 26 2017 01:59
its on shopify website
Long Nguyen
@longnt80
Aug 26 2017 02:00
where is it?
andry91959
@andry91959
Aug 26 2017 02:00
like if you minimize the window \
the bullet points messed up
Long Nguyen
@longnt80
Aug 26 2017 02:00
ok let me see
it does work with list-style-position: outside;
Spacetime
@justinemar
Aug 26 2017 02:02
@andry91959 seems okay to me when i view it
andry91959
@andry91959
Aug 26 2017 02:02
do we do it like this?
<li><span style="color: #444444;" "list-style-position:outside;">Generous space to store cards, phones, money, and keys</span></li>
Long Nguyen
@longnt80
Aug 26 2017 02:03
@andry91959 your theme style have list-style-position: inside;
so just override it with list-style-position: outside;
@andry91959 no, on your li, not span
@andry91959 put it in your css file
.rte ul {
   list-style-position: outside;
}
@andry91959 <span style="color: #444444;" "list-style-position:outside;"> this is not how you write inline css anyway
andry91959
@andry91959
Aug 26 2017 02:08
let me find it
Long Nguyen
@longnt80
Aug 26 2017 02:09
@andry91959 you should put it in your custom css stylesheet
don't modify the theme css (unless that is your custom css)
andry91959
@andry91959
Aug 26 2017 02:10
but then does it mean I cant modify the current one?
sorry I'm kinda lost here
Long Nguyen
@longnt80
Aug 26 2017 02:11
you override it
andry91959
@andry91959
Aug 26 2017 02:11
and I can not find their css either
its like all .liquid
Long Nguyen
@longnt80
Aug 26 2017 02:13
I'm not familiar with Shopify structure
but I think you can insert your custom css in the system?
they allow you to write custom css right?
andry91959
@andry91959
Aug 26 2017 02:18
I can't really find it, let me just get rid of the bullet points for now
thank you Long
Long Nguyen
@longnt80
Aug 26 2017 02:19
no problem
Mike Batista
@mbmontana
Aug 26 2017 02:43
Title Case a Sentence challenge
Woops

Let me try this again. Title Case a Sentence Challenge. Instructions: Return the provided string with the first letter of each word capitalized. Make sure the rest of the word is in lower case.

For the purpose of this exercise, you should also capitalize connecting words like "the" and "of".

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

How likely is it I'll need to use a RegEx in this challenge? I've been trying a for loop and using charAt but that doesn't seem to be working.

Long Nguyen
@longnt80
Aug 26 2017 02:48
@mbmontana you don't need Regexp and charAt
Mike Batista
@mbmontana
Aug 26 2017 02:49
@longnt80 Here's what I got so far, but it's not working:
function titleCase(str) {
 var splitStr;
  var newStr;
  splitStr =  str.toLowerCase().split(" ");
  for (i = 0; i < splitStr.length; i++) {
    splitStr[i][0].toUpperCase();
  }

  return splitStr.join(" "); 

}

titleCase("I'm a little tea pot");
Long Nguyen
@longnt80
Aug 26 2017 02:51
@mbmontana splitStr[i][0] is a string, and string is immutable meaning you cannot modify it
you can re-write it though
and you need to rewite splitStr[i]
for (i = 0; i < splitStr.length; i++) {
    splitStr[i] = // rewrite it here
  }
Mike Batista
@mbmontana
Aug 26 2017 02:55
@longnt80 Well this: splitStr = str.toLowerCase().split(" "); Changed the I to lowercase.
Long Nguyen
@longnt80
Aug 26 2017 02:56
@mbmontana you split the each word in the sentence with that
then inside the for loop, you can rewrite each word with the example I gave you above
so little will be rewritten as Little
Mike Batista
@mbmontana
Aug 26 2017 03:04
@longnt80 If that's the answer, I'm not peeking.
Long Nguyen
@longnt80
Aug 26 2017 03:28
@mbmontana no
not the answer
Mike Batista
@mbmontana
Aug 26 2017 03:41
@longnt80 I tried this and it didn't work.
function titleCase(str) {
 var splitStr;
  splitStr =  str.toLowerCase().split(" ");
  for (i = 0; i < splitStr.length; i++)  {
    splitStr[i] = splitStr[i][0].toUpperCase() + splitStr[i].shift();
  }

  return splitStr.join(" "); 




}

titleCase("I'm a little tea pot");
Long Nguyen
@longnt80
Aug 26 2017 03:42
@mbmontana what does .shift do?
Mike Batista
@mbmontana
Aug 26 2017 03:42
@longnt80 removes the first element of an array
Long Nguyen
@longnt80
Aug 26 2017 03:43
why do you need to remove an array's item?
you're rewrite the word with splitStr[i] =
ah I see your logic here
no, you rewrite the word, not the sentence
Mike Batista
@mbmontana
Aug 26 2017 03:45
@longnt80 I've capitalized the first letter of each word, now I have to add the rest of the word without the capital letter.
So I have to add each word without the first letter.
Long Nguyen
@longnt80
Aug 26 2017 03:46
yes
btw, splitStr[i] is not an array so you cannot use shift
Mike Batista
@mbmontana
Aug 26 2017 03:49
yeah i figured that. I don't need another for loop, do i?
Long Nguyen
@longnt80
Aug 26 2017 03:50
no
Mike Batista
@mbmontana
Aug 26 2017 03:51
good
Long Nguyen
@longnt80
Aug 26 2017 03:53
@mbmontana look for string method that can grab a part of the string
Marc
@MWBauer
Aug 26 2017 03:57
 for (var i = 0; i <= splitArray.length; i++) {
    var strLength = splitArray[i].length;
I'm trying to figure out how to capture each iterating and compare it to the next, keeping only the longest
Randell Dawson
@RandellDawson
Aug 26 2017 04:01
@MWBauer - You are on the right path.
Mike Batista
@mbmontana
Aug 26 2017 04:02
@longnt80 Whew! Thanks! I can't wait until I can figure one of these out without assistance.
function titleCase(str) {
 var splitStr;
  splitStr =  str.toLowerCase().split(" ");
  for (i = 0; i < splitStr.length; i++)  {
    splitStr[i] = splitStr[i][0].toUpperCase() + splitStr[i].substring(1);
  }

  return splitStr.join(" "); 




}

titleCase("sHoRt AnD sToUt");
CamperBot
@camperbot
Aug 26 2017 04:02
mbmontana sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 531 | @longnt80 |http://www.freecodecamp.com/longnt80
Randell Dawson
@RandellDawson
Aug 26 2017 04:02
@MWBauer - Now you need to compare it another variable which currently holds the current longest length
Long Nguyen
@longnt80
Aug 26 2017 04:03
@mbmontana you'll be able to when you finish all the algorithms
Marc
@MWBauer
Aug 26 2017 04:03
@rmdawson71 Right. That's where I am. I'm trying to figure out how to capture each itereation, then compare it.
Randell Dawson
@RandellDawson
Aug 26 2017 04:03
@mbmontana - Now see if you can follow a similar logic, but not use any arrays.
Marc
@MWBauer
Aug 26 2017 04:04
strLength is watching as they all pass by. How would I compare the current to the next?
I'm flipping thru my book trying to find an example or ....ya' know, something.
Long Nguyen
@longnt80
Aug 26 2017 04:06
@MWBauer splitArray[i] is the current value the loop is checking
what's the next value?
Marc
@MWBauer
Aug 26 2017 04:07
i++
that's not a variable, that's a command to take the next step
Long Nguyen
@longnt80
Aug 26 2017 04:07
splitArray[i+1]
Marc
@MWBauer
Aug 26 2017 04:08
so....if splitArray[i] > splitArray[i+1].....
Long Nguyen
@longnt80
Aug 26 2017 04:08
check the length
that's the value
Marc
@MWBauer
Aug 26 2017 04:09
Isn't the loop checking the length?
Long Nguyen
@longnt80
Aug 26 2017 04:09
no
Marc
@MWBauer
Aug 26 2017 04:09
what's my loop doin'?
lazy loop
Long Nguyen
@longnt80
Aug 26 2017 04:09
the method .length is checking the length
Marc
@MWBauer
Aug 26 2017 04:11
ok. The loop is stepping thru the array until the length of it is iterated. The strLength is taking those iterations and checking the lengths. right?
at least that was my intent. lol
Long Nguyen
@longnt80
Aug 26 2017 04:14
if splitArray[i].length > splitArray[i+1].length
this is what I meant
Marc
@MWBauer
Aug 26 2017 04:15
Ok. Thank you. This is questioning which is longer with the IF statement. It needs something to do with it's answer.
should I assign it to a var?
if splitArray[i].length > splitArray[i+1]
var longest = splitArray[i]
??
Randell Dawson
@RandellDawson
Aug 26 2017 04:17
@MWBauer - I sent you a pm.
Long Nguyen
@longnt80
Aug 26 2017 04:18
@MWBauer yeah, something like that
Marc
@MWBauer
Aug 26 2017 04:18
something LIKE that, or THAT?
In theory, would that not take the first element of the array, place it in longest, then take the next and compare them?
would I need a second if statement in case splitArray[i+1] is greater?
Long Nguyen
@longnt80
Aug 26 2017 04:21
because the loop will move to the next item, and it will be the current
@MWBauer sorry, you need to store the first item as the longest
then compare the next item against it
Long Nguyen
@longnt80
Aug 26 2017 04:26
if the next item is longer than remember that as the longest
so [2,3,1,6,4]
longest = 2;
2 > longest(2) -> false -> move on
3 > longest(2) -> true -> longest = 3
1 > longest(3) -> false -> move on
6 > longest(3) -> true -> longest = 6
4 > longest(6) -> false -> move on
=> 6 is longest
just1witness
@just1witness
Aug 26 2017 04:38
Can anyone here look at my advanced javascript algorithm code for exact change? I have a while loop that stops before the condition is met, I can't figure out why.
function checkCashRegister(price, cash, cid) {
  var cidArr = cid.reverse();
  var changeDue = (cash - price) * 100;
  var cidTot = (cid.reduce(function(acc,val){
    return acc+val[1] * 100;
   },0));

 if (changeDue === cidTot) {
    return 'Closed';
  }
 if (changeDue > cidTot){
    return 'Insufficient Funds';
 }

   while (changeDue > 0){
    var answer = [["ONE HUNDRED", 0],
                  ["TWENTY", 0],
                  ["TEN", 0],
                  ["FIVE", 0],
                  ["ONE", 0],
                  ["QUARTER", 0],
                  ["DIME", 0],
                  ["NICKEL", 0],
                  ["PENNY", 0]];

   if(changeDue >= 10000 && cidArr[0][1] * 100 >= 10000){
    changeDue = changeDue - 10000;
     answer[0][1] = answer[0][1] + 10000;
      cidArr[0][1] = cidArr[0][1] * 100 - 10000;
   }
    else if(changeDue >= 2000 && cidArr[1][1] * 100 >= 2000){
     changeDue = changeDue - 2000;
      answer[1][1] = answer[1][1] + 2000;
       cidArr[1][1] = cidArr[1][1] * 100 - 2000;
   } 
     else if(changeDue >= 1000 && cidArr[2][1] * 100 >= 1000){
     changeDue = changeDue - 1000;
      answer[2][1] = answer[2][1] + 1000;
       cidArr[2][1] = cidArr[2][1] * 100 - 1000;
   } 
      else if(changeDue >= 500 && cidArr[3][1] * 100 >= 500){
     changeDue = changeDue - 500;
      answer[3][1] = answer[3][1] + 500;
       cidArr[3][1] = cidArr[3][1] * 100 - 500;
   } 
      else if(changeDue >= 100 && cidArr[4][1] * 100 >= 100){
     changeDue = changeDue - 100;
      answer[4][1] = answer[4][1] + 100;
       cidArr[4][1] = cidArr[4][1] * 100 - 100;
   } 
      else if(changeDue >= 25 && cidArr[5][1] * 100 >= 25){
     changeDue = changeDue - 25;
      answer[5][1] = answer[5][1] + 25;
       cidArr[5][1] = cidArr[5][1] * 100 - 25;
   } 
      else if(changeDue >= 10 && cidArr[6][1] * 100 >= 10){
     changeDue = changeDue - 10;
      answer[6][1] = answer[6][1] + 10;
       cidArr[6][1] = cidArr[6][1] * 100 - 10;
   } 
      else if(changeDue >= 5 && cidArr[7][1] * 100 >= 5){
     changeDue = changeDue - 5;
      answer[7][1] = answer[7][1] + 5;
       cidArr[7][1] = cidArr[7][1] * 100 - 5;
   } 
         else if(changeDue >= 1 && cidArr[8][1] * 100 >= 1){
     changeDue = changeDue - 1;
      answer[8][1] = answer[8][1] + 1;
       cidArr[8][1] = cidArr[8][1] * 100 - 1;
         }
       else { return "Insufficient Funds";    

   } 
   return answer;    

 }
BryanS
@BSISJ7
Aug 26 2017 04:38

I'm trying to access state in a react component, but I keep getting the error: this.setState is not a function

I've tried using

this.dispIngredients = this.dispIngredients.bind(this);

and setting a var equal
to this and using it instead, but neither of these solutions worked for me.

just1witness
@just1witness
Aug 26 2017 04:41
@BSISJ7 I wish I could help you, but I haven't used "this" very much yet. Is is a method only for certain types, and your react component is the wrong type maybe?
BryanS
@BSISJ7
Aug 26 2017 04:47
Well, the component is
class MainWindow extends React.Component
So I don't think that would stop me from using "this" to reference it.
Randell Dawson
@RandellDawson
Aug 26 2017 04:51
@just1witness - Which test case are you failing? Paste it in here.
just1witness
@just1witness
Aug 26 2017 04:52
@BSISJ7 maybe this would be helpful for you. https://toddmotto.com/understanding-the-this-keyword-in-javascript/
Randell Dawson
@RandellDawson
Aug 26 2017 04:53
@just1witness - Or which test case is having the issue of the while loop exiting before it should?
just1witness
@just1witness
Aug 26 2017 04:54
@rmdawson71 checkCashRegister(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]]);
sorry I should have added that
It only adds the value for one twenty
then stops
Randell Dawson
@RandellDawson
Aug 26 2017 04:56
You have a lot of if else if statements. Have you tried putting a console.log after each if to see which ones are being hit?
just1witness
@just1witness
Aug 26 2017 04:57
I checked the conditions and the changeDue, they all seem right, but the loop stops after it adds one amount to the index of the answer varaible
Randell Dawson
@RandellDawson
Aug 26 2017 04:57
ok let me check something
just1witness
@just1witness
Aug 26 2017 04:57
it happens for the other money values too, it adds one, then stops
Randell Dawson
@RandellDawson
Aug 26 2017 04:59
I noticed that your return answer; is inside your while loop, so that would cause only 1 iteration.
just1witness
@just1witness
Aug 26 2017 05:01
You are awesome
@rmdawson71 THANK YOU
CamperBot
@camperbot
Aug 26 2017 05:01
just1witness sends brownie points to @rmdawson71 :sparkles: :thumbsup: :sparkles:
:cookie: 295 | @rmdawson71 |http://www.freecodecamp.com/rmdawson71
just1witness
@just1witness
Aug 26 2017 05:01
I put it in there because my variable was in there, so I had to move that, make it global, and it works, thank you so much.
@rmdawson71
Randell Dawson
@RandellDawson
Aug 26 2017 05:02
When I run that test case, it still does not pass after moving the return statement.
just1witness
@just1witness
Aug 26 2017 05:03
Yeah, the money values should return 20.00 ext ext instead of 2000, dividing by 100 will fix the value, and I think? using toFixed(2) should give me the decimal places?
Randell Dawson
@RandellDawson
Aug 26 2017 05:06
The functions returns:
[ [ 'ONE HUNDRED', 0 ],
  [ 'TWENTY', 0 ],
  [ 'TEN', 0 ],
  [ 'FIVE', 0 ],
  [ 'ONE', 0 ],
  [ 'QUARTER', 0 ],
  [ 'DIME', 0 ],
  [ 'NICKEL', 0 ],
  [ 'PENNY', 1 ] ]
So I assume you will be doing something else with answer.
prakash chandra yadav
@prakashyadav008
Aug 26 2017 05:08
hey everyone
can anyone confirm
FCC doesnt accept request from a http site right
it has to be https
just1witness
@just1witness
Aug 26 2017 05:11
@rmdawson71 Try this, I just need to get rid of 0 value sub arrays and I'm done. After 4 days.....
    var answer = [["ONE HUNDRED", 0],
                  ["TWENTY", 0],
                  ["TEN", 0],
                  ["FIVE", 0],
                  ["ONE", 0],
                  ["QUARTER", 0],
                  ["DIME", 0],
                  ["NICKEL", 0],
                  ["PENNY", 0]];

function checkCashRegister(price, cash, cid) {
  var cidArr = cid.reverse();
  var changeDue = (cash - price) * 100;
  var cidTot = (cid.reduce(function(acc,val){
    return acc+val[1] * 100;
   },0));

 if (changeDue === cidTot) {
    return 'Closed';
  }
 if (changeDue > cidTot){
    return 'Insufficient Funds';
 }

   while (changeDue > 0){


   if(changeDue >= 10000 && cidArr[0][1] * 100 >= 10000){
    changeDue = changeDue - 10000;
     answer[0][1] = answer[0][1] + 10000 / 100;
      cidArr[0][1] = cidArr[0][1] * 100 - 10000;
   }
    else if(changeDue >= 2000 && cidArr[1][1] * 100 >= 2000){
     changeDue = changeDue - 2000;
      answer[1][1] = answer[1][1] + 2000 / 100;
       cidArr[1][1] = cidArr[1][1] * 100 - 2000;
   } 
     else if(changeDue >= 1000 && cidArr[2][1] * 100 >= 1000){
     changeDue = changeDue - 1000;
      answer[2][1] = answer[2][1] + 1000 / 100;
       cidArr[2][1] = cidArr[2][1] * 100 - 1000;
   } 
      else if(changeDue >= 500 && cidArr[3][1] * 100 >= 500){
     changeDue = changeDue - 500;
      answer[3][1] = answer[3][1] + 500 / 100;
       cidArr[3][1] = cidArr[3][1] * 100 - 500;
   } 
      else if(changeDue >= 100 && cidArr[4][1] * 100 >= 100){
     changeDue = changeDue - 100;
      answer[4][1] = answer[4][1] + 100 / 100;
       cidArr[4][1] = cidArr[4][1] * 100 - 100;
   } 
      else if(changeDue >= 25 && cidArr[5][1] * 100 >= 25){
     changeDue = changeDue - 25;
      answer[5][1] = answer[5][1] + 25 / 100;
       cidArr[5][1] = cidArr[5][1] * 100 - 25;
   } 
      else if(changeDue >= 10 && cidArr[6][1] * 100 >= 10){
     changeDue = changeDue - 10;
      answer[6][1] = answer[6][1] + 10 / 100;
       cidArr[6][1] = cidArr[6][1] * 100 - 10;
   } 
      else if(changeDue >= 5 && cidArr[7][1] * 100 >= 5){
     changeDue = changeDue - 5;
      answer[7][1] = answer[7][1] + 5 / 100;
       cidArr[7][1] = cidArr[7][1] * 100 - 5;
   } 
         else if(changeDue >= 1 && cidArr[8][1] * 100 >= 1){
     changeDue = changeDue - 1;
      answer[8][1] = answer[8][1] + 1 / 100;
       cidArr[8][1] = cidArr[8][1] * 100 - 1;
         }
       else { return "Insufficient Funds";           
   } 


 }
  for(var i = 0; i < answer.length; i++){
    answer[i][1] = answer[i][1].toFixed(2);
  }
 return answer;                



}
checkCashRegister(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]]);
Randell Dawson
@RandellDawson
Aug 26 2017 05:13
When I run your function against all the tests, it fails two of them.
just1witness
@just1witness
Aug 26 2017 05:14
Yeah, I'm not completely done yet, I need to get rid of subarrays that have a value of 0.
I'm a tad disturbed by it not passing the first one though
It looks like an array to me...
Randell Dawson
@RandellDawson
Aug 26 2017 05:15
One thing that will definitely prevent you from passing some of the tests is declaring answer globally.
That should be inside your function.
then you will only being failing the 4th and 5th test cases.
I know exactly why you are failing those tests now.
Each of the nested arrays should have a number for the second element and not a string.
Then you will pass all the tests.
just1witness
@just1witness
Aug 26 2017 05:22
Huh, I didn't even notice they were converted to a string after I added the for loop to fix the value to two decimal points. How do I avoid doing that?
Randell Dawson
@RandellDawson
Aug 26 2017 05:27
Don't worry about the two decimal places for the test that says [QUARTER, 0.50]. It is a typo. The test behind the scenes tests for 0.5. I looked at the actual test.
just1witness
@just1witness
Aug 26 2017 05:31
I'm getting this and it doesn't pass.
[["ONE HUNDRED", 0],
                  ["TWENTY", 80],
                  ["TEN", 10],
                  ["FIVE", 5],
                  ["ONE", 1],
                  ["QUARTER", 0.5],
                  ["DIME", 0.2],
                  ["NICKEL", 0],
                  ["PENNY", 0.04]];
It's the right amount for the change.
Randell Dawson
@RandellDawson
Aug 26 2017 05:32
Which test is that?
just1witness
@just1witness
Aug 26 2017 05:33

Is it the arrays with a zero value?

this test:
checkCashRegister(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]]);

Randell Dawson
@RandellDawson
Aug 26 2017 05:34
Did you move the answer array declaration to inside your function?
just1witness
@just1witness
Aug 26 2017 05:34
yes
it's the line directly under the function decleration
Randell Dawson
@RandellDawson
Aug 26 2017 05:34
I am going to pm you so we don't keep filling the room with the code.
just1witness
@just1witness
Aug 26 2017 05:34
declaration*
k
Nahuel Ovejero
@NahuelOvejero
Aug 26 2017 05:45
is a quarter 0.5?
Gulsvi
@gulsvi
Aug 26 2017 05:52
Two quarters are 0.5
1 quarter = 1/4 = 0.25
koder3
@koder3
Aug 26 2017 09:36
do i need to use cors in this jsfiddle https://jsfiddle.net/koder3/1msp901d/ to get through the 'Access-Control-Allow-Origin' ... if so how do i go about using it
Jill Lee
@jill-lee
Aug 26 2017 09:38
@DarrenfJ Target_blank works but it duplicates the nav bar. Im not working on it atm but if you figured it out pls let me know. I also need help with my portfolio. I cant get rid of the white on the side of it https://codepen.io/phoenix-burn/full/bRRaEO/
you think you can help?
heroiczero
@heroiczero
Aug 26 2017 10:42
@koder3 you need a https:// in front of //en.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&list=&meta=&generator=search&exchars=500&exlimit=10&exintro=1&explaintext=1&gsrsearch=meaning&gsrlimit=10&gsrwhat=text this link in your code
heroiczero
@heroiczero
Aug 26 2017 10:47
@koder3 i don't know if you already did this, but if you want to see the console log in JS fiddle try doing: https://stackoverflow.com/questions/17382200/print-var-in-jsfiddle by using https://getfirebug.com/firebug-lite-debug.js
@phoenix-burn nice job :+1: it looks good. I don't know what you are having trouble with. You accomplished the user story and the design is nice. only problem is the collapsed nav-bar is overflowing into the text when the screen is small
Dean
@SupernaturalDean
Aug 26 2017 13:01
blob
what should i do
i dont get my task clear
Stephen James
@sjames1958gm
Aug 26 2017 13:12
@SupernaturalDean You aren't using the variable "myNoun" is a string myNoun is a variable - Also inject spaces " " between the words
@koder3 add query parameter origin=* to get around cors issues with wiki
You don't need to add https: to front of URL
It will pick up the https or http from the page that is sending the requrest
Dean
@SupernaturalDean
Aug 26 2017 13:24
blob
@sjames1958gm I dont understand where to add spaces
could you please tell me in detail. I Am a new one
Stephen James
@sjames1958gm
Aug 26 2017 13:29
@SupernaturalDean Example: myNoun + " " + myAdjective
Dean
@SupernaturalDean
Aug 26 2017 13:33
Finally! thanks
Pawel Golabek
@CodingToBeWithHer
Aug 26 2017 13:41
hi is there anybody ?
wow what has happend to FCC ??
I was doing this 9 months ago and there was chat embedded in the page and loads of people and in general great
not chat is removed and nobody's here at all, not working tests on the page, what has happend ?
Mennaali
@MennaAly
Aug 26 2017 13:46
i have a problem friends :D i'm using brackets in coding and it allow to me to test it on chrome after finishing the code i put it in the code pen but all the css and html destroyed so can anyone tell me why and how can i do to solve this problem ? :D
Stephen James
@sjames1958gm
Aug 26 2017 13:57
@CodingToBeWithHer it is definitely quieter than it used to be
Stephen James
@sjames1958gm
Aug 26 2017 14:16
@MennaAly what do you mean destroyed?
Mennaali
@MennaAly
Aug 26 2017 14:21
@sjames1958gm all the elements overlap each other because the css broke down
Stephen James
@sjames1958gm
Aug 26 2017 14:25
@MennaAly did you include any libraries you were using?
Mennaali
@MennaAly
Aug 26 2017 14:25
@sjames1958gm yes
Marc
@MWBauer
Aug 26 2017 14:28
Hello and good morning everyone!
How are we today?
Brains melting and tempers flaring?
柯摩
@ExcaliburEX
Aug 26 2017 14:28
good night!
Marc
@MWBauer
Aug 26 2017 14:31
HIya @sjames1958gm
Stephen James
@sjames1958gm
Aug 26 2017 14:32
@MWBauer hey
Marc
@MWBauer
Aug 26 2017 14:32
How ya' doin' today?
Stephen James
@sjames1958gm
Aug 26 2017 14:32
relaxin'
Marc
@MWBauer
Aug 26 2017 14:32
that's no way to be. Get your caffeine and get wired!
Let's get crazy up in here.
lol
I've got The Algorithms playing in my ears

function findLongestWord(str) {
  var splitArray = str.split(" ");
  //variable splitArray takes the str and splits it at each space and creates an array of words
  var longestLength = 0;
  for (var i = 0; i <= splitArray.length; i++) {
    var strLength = splitArray[i].length;
  //this loop steps thru the array and checks the length of each word
    if (longestLength > strLength) {
    var longestWord = longestLength;
    } return longestWord;

  }
}
Now how purty is that?
I know I'm at the end of this, but the return stops all iterations, so I can't put it on the inside of the curly.
I'm a little confused as to how to end this.
Stephen James
@sjames1958gm
Aug 26 2017 14:35
@MWBauer nope
Also don't you want to test if strLength > longestLength? And then update longestLength if it is
longestWord is not needed
Marc
@MWBauer
Aug 26 2017 14:36
Yes. I do.
Absolutely
lol
how would I go about doing that?
Stephen James
@sjames1958gm
Aug 26 2017 14:37
set longestLength to strLength if strLength is greater
Ultimately you would return longestLength after the loop completes
Marc
@MWBauer
Aug 26 2017 14:40
if (longestLength < strLength) {
longesetLength = strLength}
is that what you're saying?
Stephen James
@sjames1958gm
Aug 26 2017 14:40
yes
Marc
@MWBauer
Aug 26 2017 14:42
It will iterate thru the loop, checking each word of the array for the longest/biggest value by way of strLength, store the longest/biggest value in longestLength, then I would just need to report or return longestLength. Right?
Stephen James
@sjames1958gm
Aug 26 2017 14:43
yes
Marc
@MWBauer
Aug 26 2017 14:43
Ok. The return statement stops the loop, so how do I make it thru the whole array? console.log?
Stephen James
@sjames1958gm
Aug 26 2017 14:44
why would you return from inside the loop you haven't checked all the values yet
Marc
@MWBauer
Aug 26 2017 14:45
function findLongestWord(str) {
  var splitArray = str.split(" ");
  //variable splitArray takes the str and splits it at each space and creates an array of words
  var longestLength = 0;
  for (var i = 0; i <= splitArray.length; i++) {
    var strLength = splitArray[i].length;
  //this loop steps thru the array and checks the length of each word
    if (longestLength < strLength) { //this compares the longestLength to the current iteration and saves the longest
    longestLength = strLength; //if strLength is longer than longestLength then the higher value is stored in longestLength
    } return longestLength;

  }
}
Move it down one curly?
Stephen James
@sjames1958gm
Aug 26 2017 14:45
@MWBauer move the return after the loop not inside the loop.
yes
Marc
@MWBauer
Aug 26 2017 14:46
ok. I did.
Unable to get property 'length' of undefined or null reference
what did I undefined or nullify?
Stephen James
@sjames1958gm
Aug 26 2017 14:46
@MWBauer it could be you are accessing past the end of the array?
Marc
@MWBauer
Aug 26 2017 14:47
hows that?
My loop should only go as far as splitArray.length....the length of the array.
right?
Stephen James
@sjames1958gm
Aug 26 2017 14:47
and splitArray[splitArray.length] is undefined past end of array
remove the = from <=
Marc
@MWBauer
Aug 26 2017 14:50
why would the = move it past the end? I would think that it would be the end.
Stephen James
@sjames1958gm
Aug 26 2017 14:50
you need to stop when i is equal to splitArray.length because the last entry is splitArray[splitArray.length - 1]
Remember indexes start at zero
Marc
@MWBauer
Aug 26 2017 14:51
ok
Is there a cleaner more precise way of coding this?
That's something that I've been curious about. I know that coding allows for multiple ways of accomplishing things
Stephen James
@sjames1958gm
Aug 26 2017 14:58
@MWBauer There are array functions that take care of the looping and you could also use sort on the array of strings.
Marc
@MWBauer
Aug 26 2017 14:58
ok. Thanks.
Looking at the next it says to look at string.prototype.split.
is that different from string.split?
Stephen James
@sjames1958gm
Aug 26 2017 15:00
strings are objects of type String so they get the function split from String.prototype.split (Note capital S String)
so str.split and String.prototype.split are the same function (assuming str is a variable holding a string)
Marc
@MWBauer
Aug 26 2017 15:06
ok. So at the beginning I could use str.split inserting my string at the beginning, or I could use String.prototype.split then reference my string, right?
str.split creates an array of words, correct?
String.prototype.split should do the same, right?
Rajan
@ProgramNovice
Aug 26 2017 15:23
Hi guys
I have a doubt in one of the challenges
"Set the Font Family of an Element"
The sample code is given as:

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

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>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

Can I inplement the code in an alternative way:

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

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

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

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

whereby I declare diff-font class instead of using p
@ProgramNovice Yes, you can
Rajan
@ProgramNovice
Aug 26 2017 15:29

Ok thanks korzo :)

@ProgramNovice https://www.youtube.com/watch?v=ITu5kyiVtDw

CamperBot
@camperbot
Aug 26 2017 15:29
sorry programnovice, you can't send brownie points to yourself! :sparkles: :sparkles:
Rajan
@ProgramNovice
Aug 26 2017 15:29
@korzo ok thank korzo :)
i'll post the code in proper format from now on :)
Marc
@MWBauer
Aug 26 2017 15:35
I was just thinking about the Title Case challenge.
Could one use the regexp to find the first letter and then toUpperCase and return?
Darren
@DarrenfJ
Aug 26 2017 15:37
morning fCC
@phoenix-burn i haven't really looked at it at all but might today if I get a chance..
Marc
@MWBauer
Aug 26 2017 15:40
Morning Darren.
korzo
@korzo
Aug 26 2017 15:41
@MWBauer Yes, you could do this with replace if you are not familiar with regex.
Marc
@MWBauer
Aug 26 2017 15:41
I'm attempting to become familiar. I was thinking var title = /\^/g;
does that look right for finding the first character?
Darren
@DarrenfJ
Aug 26 2017 15:42
@MWBauer :D
Marc
@MWBauer
Aug 26 2017 15:42
Ok. Is replace a method outside of regexp?
title.replace()
?
korzo
@korzo
Aug 26 2017 15:43
@MWBauer Yes, you can use it with regex or with regular string
Marc
@MWBauer
Aug 26 2017 15:43
Ok.
now let's see if I can put all of the legos together.
brainstorming... could I
var title.replace(/\^/g, ??)
or is that too much for one step?
korzo
@korzo
Aug 26 2017 15:46
@MWBauer You can also use function instead of ??
Marc
@MWBauer
Aug 26 2017 15:46
I used ?? as a placeholder for whatever step needs to go there
I haven't quite figured that part out yet.
I don't suppose I could use title.toUpperCase there?
korzo
@korzo
Aug 26 2017 15:47
@MWBauer It's second parameter, either string or function
Randell Dawson
@RandellDawson
Aug 26 2017 15:48
@MWBauer - I am back in the private chat.
Marc
@MWBauer
Aug 26 2017 15:48
HIya' Randell
Marc
@MWBauer
Aug 26 2017 15:57
it got awfully quiet in here
Darren
@DarrenfJ
Aug 26 2017 16:03
@MWBauer it happens... the room is not as active as it used to be
Marc
@MWBauer
Aug 26 2017 16:04
Maybe we need to work on that. Lol
I'm trying to use the .toUpperCase as the second parameter in replace.
I tried
 var title = str.replace(/\^/g, str.toUpperCase());
that didn't work
Darren
@DarrenfJ
Aug 26 2017 16:07
once they dropped the help link to the gitter rooms the chat dropped off significantly
Marc
@MWBauer
Aug 26 2017 16:07
I thought it was kind of strange of them, but I'm sure they have their reasons
any thoughts on upperCase
Marc
@MWBauer
Aug 26 2017 16:09
this makes a variable, then takes str and tries find the first character of each word and replace it with the upper case version
Darren
@DarrenfJ
Aug 26 2017 16:09
@MWBauer what exercise are yah working on?
Title case I'm guessing
Manish Giri
@Manish-Giri
Aug 26 2017 16:12
@DarrenfJ :wave:
Darren
@DarrenfJ
Aug 26 2017 16:13
@Manish-Giri hey buddy :D
what's up in yer life man?
Manish Giri
@Manish-Giri
Aug 26 2017 16:14
life sucks
lol
Darren
@DarrenfJ
Aug 26 2017 16:14
ha.. i hear yah
Manish Giri
@Manish-Giri
Aug 26 2017 16:15
@DarrenfJ how're you
Darren
@DarrenfJ
Aug 26 2017 16:15
ah, you know, busy... as usual
trying to figure out blockchain for the idea project...
might make a good way for people to throw their support behind an idea..
Marc
@MWBauer
Aug 26 2017 16:17
@DarrenfJ Yes, TitleCase.
Sadly I have run out of time. Need to get to work.
Will be back later.
aRtoo
@artoodeeto
Aug 26 2017 16:18

alright guys. so im back. this is getting crazier. so on algorithm challenge entitled. arguments optional. the instruction says:

// Create a function that sums two arguments together. If only one argument is provided, then return a function that expects one argument and returns the sum.
// For example, addTogether(2, 3) should return 5, and addTogether(2) should return a function.
// Calling this returned function with a single argument will then return the sum:
// var sumTwoAnd = addTogether(2);
// sumTwoAnd(3) returns 5.
// If either argument isn't a valid number, return undefined

now how can i return the a sum with only one argument?
this is my code:

function addTogether(a,b) {

  var len = arguments.length;

  if(len === 1){
    return function(x){
      return x;
    };
  } 
  return a+b;
}
addTogether(2,3);
Darren
@DarrenfJ
Aug 26 2017 16:19
but i really need a day or two to study it fully and can't find the time
@MWBauer later brutha... fyi.. did mine differently.. without regex.. so not sure I can help yah... basically broke it into an array and touppercased th that way
off for :coffee: and podcasts...
thanks @Manish-Giri for the chat however short :D
CamperBot
@camperbot
Aug 26 2017 16:21
darrenfj sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6467 | @manish-giri |http://www.freecodecamp.com/manish-giri
Darren
@DarrenfJ
Aug 26 2017 16:21
jebbus yer getting up there in numbers :D
Manish Giri
@Manish-Giri
Aug 26 2017 16:22
Haha
It's now hit a block
No more people, no more brownies
Lol
It's a good thing you reminded me of the idea thing
Something interesting to look forward to!
Darren
@DarrenfJ
Aug 26 2017 16:29
yah way harder to get brownies tbh
you can be helping out for a while and nothing
and it's empty at my usual time like 3 am
nobody
Josebuendia
@Josebuendia
Aug 26 2017 16:32

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

<style>

.red-text {
color: red;
}
<div{.container-fluid; } h2 { font-family: Lobster, Monospace; } p { font-size: 16px; font-family: Monospace; } .thick-green-border { border-color: green; border-width: 10px; border-style: solid; border-radius: 50%; } .smaller-image { width: 100px; } </style>

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

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

<a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back. "></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>
<label><input type="checkbox" name="personality"> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Crazy</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
</div>

What's incorrect with above?
Doing Use Responsive Design with Bootstrap Fluid Containers challenge
Darren
@DarrenfJ
Aug 26 2017 16:33
@Josebuendia this <div{.container-fluid; } shouldn't have the < in it

@Josebuendia but for this

Doing Use Responsive Design with Bootstrap Fluid Containers challenge

all you have to do is add the class container-fluid to a div you put around all the html .. (and not add it to the CSS)
@Josebuendia you don't hafta add it to the CSS since with bootstrap you are 'importing' a set of CSS that already has set classes
that's the whole point of Bootstrsap.. to use an existing library of CSS to save you time building it yourself..
@Josebuendia so.. just add a div under the closing style tag with container fluid as a class and close the div at the very end of all the html (all of the code)
Stephen James
@sjames1958gm
Aug 26 2017 16:40
@artoodeeto With one argument you return a function that takes one argument and adds it to the one passed to addTogether
Josebuendia
@Josebuendia
Aug 26 2017 16:42

Do you mean like this: <link href="https://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>
}

<div{.container-fluid; } <h2 class="red-text">CatPhotoApp</h2>

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

<a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back. "></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>
<label><input type="checkbox" name="personality"> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Crazy</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
</div>

@DarrenfJ
Darren
@DarrenfJ
Aug 26 2017 16:44
@Josebuendia <div{.container-fluid; } is close to how you do something in CSS.. how do you add a class in html (think of the red-text exercises)
@Josebuendia or how you did smaller-image on the img tag in the html
@Josebuendia also, you somehow snuck a closing } after the </style> tag:
</style>
}
@Josebuendia just as a reminder.. here's how you do classes in html <img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back. ">
@Manish-Giri speaking of our project.. yah, trying to finish off some actual fCC projects.. but definitely heading back into working on it...
koder3
@koder3
Aug 26 2017 17:03
@sjames1958gm thanks!!
CamperBot
@camperbot
Aug 26 2017 17:03
koder3 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8394 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
koder3
@koder3
Aug 26 2017 17:08
@heroiczero you can check console by ctrl+shift+i on windows and https doesnt matter ive done it be4 as well. Thanks anyway.
CamperBot
@camperbot
Aug 26 2017 17:08
koder3 sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1655 | @heroiczero |http://www.freecodecamp.com/heroiczero
koder3
@koder3
Aug 26 2017 17:12
do u mean something else? i dont understand.
@heroiczero
koder3
@koder3
Aug 26 2017 17:21
image.png
i am getting the exact results i wanted on jsfiddle for the same code in the console
but why not in webstorm
koder3
@koder3
Aug 26 2017 17:27
my console is blank no matter what i console.log
kingsniper10
@kingsniper10
Aug 26 2017 18:00

I need help i dont know how I need to do

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

<h2>CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
how do i make my this :h2 element should have the class red-text.

Jan Shah
@JanShah
Aug 26 2017 18:00
jsfiddle is on the browser, webstorm console isn't the same
@koder3
@kingsniper10
<tag class="thisclassname"></tag>
Darren
@DarrenfJ
Aug 26 2017 18:20
@kingsniper10 you need to add a class called red-text, then assign it to the h2 element in the html
Rajat Khare
@rajatkhare619
Aug 26 2017 18:20

Hey guys,

I’m looking for a way to change the opacity of a particular area of an image. The images would be fetched dynamically.
Something like this:

Darren
@DarrenfJ
Aug 26 2017 18:20
@JanShah gave you the syntax above.. I think the exercise also wants you to remove the part where you make it blue...
Darren
@DarrenfJ
Aug 26 2017 18:21
also, thanks @JanShah for helping out
CamperBot
@camperbot
Aug 26 2017 18:21
darrenfj sends brownie points to @janshah :sparkles: :thumbsup: :sparkles:
:cookie: 490 | @janshah |http://www.freecodecamp.com/janshah
Rajat Khare
@rajatkhare619
Aug 26 2017 18:21
The circular area has higher opacity than the rest of the image.
Darren
@DarrenfJ
Aug 26 2017 18:21
@Josebuendia sorry buddy I missed if oyu got it figured out.. stepped out of the room for a bit
Rajat Khare
@rajatkhare619
Aug 26 2017 18:22
One way of selecting area is image map but I don’t think I can style that.
I would appreciate any ideas.
Darren
@DarrenfJ
Aug 26 2017 18:22
@rajatkhare619 i'm about to scoot and listen to podcasts.. but have you though about covering it with a div sized the same and control that? like grey it.. but leave it a little (2%) grey?
so it's slightly less than the background?
if that's what you are trying to do
ok i'm off.. code on room :D
Rajat Khare
@rajatkhare619
Aug 26 2017 18:24
@DarrenfJ do you mean I use an empty div with same size as the image?
Darren
@DarrenfJ
Aug 26 2017 18:24
@rajatkhare619 yah
whichever you want to be more opaque
Rajat Khare
@rajatkhare619
Aug 26 2017 18:24
@DarrenfJ ok will try that
thanks
Darren
@DarrenfJ
Aug 26 2017 18:25
overlay it.. and grey it but with a very slight % of opacity
something like that
later :D
tell me how it goes..
Rajat Khare
@rajatkhare619
Aug 26 2017 18:25
@DarrenfJ yeah sure bye :smile:
Josebuendia
@Josebuendia
Aug 26 2017 18:37
I'm still trying to do this bit: Your div element should have the class container-fluid.
Stephen James
@sjames1958gm
Aug 26 2017 18:40
@Josebuendia did you create a <div> </div> around all of the existing HTML?
And give it the class container-fluid
Josebuendia
@Josebuendia
Aug 26 2017 18:44

<link href="https://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>

<div{ class="container-fluid"; src="container-fluid">


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

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

<a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back. "></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>
<label><input type="checkbox" name="personality"> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Crazy</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
</div>

This is where I'm @
Stephen James
@sjames1958gm
Aug 26 2017 18:46
You don't in general put { or ; inside of tags and you don't need src= for divs
just the class= part
Abdul Rehman (Bsienn)
@bsienn
Aug 26 2017 18:49
@QuincyLarson How to Donate to freecodecamp?
I don't have paypal, I can't do a monthly donation, But I'll like to donate whenever I have some savings to say my thanks.
Uriel Guzmán
@Burinson
Aug 26 2017 19:51
@Josebuendia <div{ class="container-fluid"; src="container-fluid"> The { should not be there and src is unnecessary.
Denise Pilgrim
@godluvu22
Aug 26 2017 19:56
I am still struggling with the issue of centering my code and page. I have a project called Mimi Camp on Code Pen and if anyone could check it and tell me what I can do to center my design. I am not even sure how to put my code where someone can view it!
Alexander Køpke
@alexanderkopke
Aug 26 2017 19:59
@godluvu22 you can copy and paste in the url to the codepen here in the chat
Josebuendia
@Josebuendia
Aug 26 2017 20:01
Your div element should have the class container-fluid.<----i've done but now :Make sure you have nested all HTML elements in .container-fluid.<--- has turn red. Why?
Denise Pilgrim
@godluvu22
Aug 26 2017 20:03
<div class="container-fluid">
<div class="col-xs-12 col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2">
</div>
<h1 class="text-center"> Mimi Camp!
</h1>
<img class="smaller-image text-center" src="http://onmilwaukee.com/images/articles/in/inflatablesindoorplay/inflatablesindoorplay_fullsize_story1.jpg" alt="a room with jumping and sliding blow ups.">
</img>


<h2 class="red-text text-center">
Activities</h2>


<p class="blue-text text-center">Here at Mimi camp we have choices of some wonderful activities for the campers!:
</p>
<ul>
<li>"Sprinkler park"</li>
<li>"Jumpin'Jack Party Shack"</li>
<li>"Discovery Science Center"</li>
<li> "Swimming Pool"</li>
<li>"Putt-Putt"</li>
<li>"Dress up Days"</li>
<li>"crafts</li>
<li>"Bible Stories acted out"</li>
<li>"Cooking Class"</li>
</ul>
<img class="smaller image text-center" src="http://image1.masterfile.com/getImage/NjMwLTAzNDgxOTMyZW4uMDAwMDAwMDA=AAmsoO/630-03481932en_Masterfile.jpg">
</img>



<p class="blue-text text-center"> Dress up days will connect with the bible stories acted out. 1. will be a King and Queen day (Esther). The craft activity will make the crowns. Other stories will be acted out with Bible costumes!.
</p>
</div>
<p> class="red text text-center">
Mimi Camp begins on Sunday, August 6 following dropping off the Pine Cove campers. Pick up from camp is Saturday, August 12 before leaving for Pine Cove campers! We are looking forward to seeing these campers:
</p>
<ul class="green text text-center">
<li> Tate Nichelson</li>
<li> Darcy Frantz</li>
<li> Daxon Frantz</li>
</ul>
</div <img class="smaller image text-center" src="https://greenscreenanimals.com/assets/img/common/recent@1x.png." alt="kids in costumes">
<img class="smaller image text-center" src="https://www.dropbox.com/s/w5q7bfbnmirscmx/IMG_5394.jpg?dl=0." alt="girl in red dress">

<h3 class="purple text text-center">
Things to Bring:
<ul class= "purple text text-center">
<li> Swim Suit</li>
<li> Sun Glasses</li>
<li> Tooth brush/toothpaste</li>
<li> Bible (notebook and markers provided) </li>
<li> Flip flops, Tennis shoes, water shoes if available</li>
<li> clothes for summer play outside and inside</li>
<li>Favorite blanket and/or pillow</li>
<li> Any dress up clothes you desire for costume days. Mimi Camp will provide some specific ones for dramas.</li>
<li> All items not listed will be provided by Mimi Camp and even some listed!</li>
<//ul>
<p>class="red text"> Mimi Camp questions can be sent to: Mimi at 903 618 0235 or wylj618@yahoo.com.
</p>

<img class="smaller image" src= "https://louisvilleky.gov/sites/default/files/styles/horizontal_feature/public/parks/photos/jmf_wlad_image.jpg?itok=4Cpq38rA">


</div>
Alexander Køpke
@alexanderkopke
Aug 26 2017 20:04
@godluvu22 that is fine too but it is easier if you copy the address to the codepen and then paste it here
Denise Pilgrim
@godluvu22
Aug 26 2017 20:05
ok thanks
Jan Shah
@JanShah
Aug 26 2017 20:07
@godluvu22 what are you trying that's not working?
Denise Pilgrim
@godluvu22
Aug 26 2017 20:08
JanShah I am not seeing my results centered on the page. I have changed my code several times to get my texts, images etc. centered on the page and nothing works.
Manish Giri
@Manish-Giri
Aug 26 2017 20:10
@DarrenfJ ty
CamperBot
@camperbot
Aug 26 2017 20:10
manish-giri sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1988 | @darrenfj |http://www.freecodecamp.com/darrenfj
Manish Giri
@Manish-Giri
Aug 26 2017 20:11
Ooh almost there
Uriel Guzmán
@Burinson
Aug 26 2017 20:11

@godluvu22

$blue: #a3d5d3;

body {
  background-color: $blue;
}

I don't understand this. Why not background-color: #a3d5d3;?

Denise Pilgrim
@godluvu22
Aug 26 2017 20:14
thanks to Jan Shah and Kapke. For some reason on my work page the centering did not appear but when I pasted my code pen on this chat it showed the centering.!
Uriel Guzmán
@Burinson
Aug 26 2017 20:15
@godluvu22
body {
  background-color: #a3d5d3;
}

.smaller-image {
  width: 50px;
}

h2 {
  font-family: Lobster;
  font-size: 30px;
}
.red-text {
  color: red;
}

.blue-text {
  color: blue;
  font-size: 20px;
}
p {
  font-size: 30px;
  font-family: Monospace;
}
li {
  font-size: 18px;
  color: green;
}
p {
  font-size: 18px;
  color: red;
}

li {
  font-size: 20px;
}
h3 {
  font-family: Monospace;
  color: purple;
  font-size: 25px;
}
Replace your CSS with this, you had a weird script that didn't even let the page load in the first place
Lots of unmatched {} and that weird $blue thing, also a closing </style> tag that didn't match with anything
Denise Pilgrim
@godluvu22
Aug 26 2017 20:16
Part of that script came with my project before I added css code. Thank you so much! Guzman!
I will change it.
Uriel Guzmán
@Burinson
Aug 26 2017 20:20
No prob :)
And for the centering, your div are misplaced
Denise Pilgrim
@godluvu22
Aug 26 2017 20:21
@Burinson ok! Thanks again!
CamperBot
@camperbot
Aug 26 2017 20:21
godluvu22 sends brownie points to @burinson :sparkles: :thumbsup: :sparkles:
:cookie: 271 | @burinson |http://www.freecodecamp.com/burinson
Jan Shah
@JanShah
Aug 26 2017 20:22

@Burinson

$blue: #a3d5d3;

body {
  background-color: $blue;
}

is valid code
https://en.wikipedia.org/wiki/Sass_(stylesheet_language)

Uriel Guzmán
@Burinson
Aug 26 2017 20:24
@JanShah Didn't know that, but wouldn't it be simpler to directly add the color for what he is trying to do?
It seems he just wanted to color the background
Jan Shah
@JanShah
Aug 26 2017 20:25
if you think about it, declaring a variable and using it several times is much less code
@Burinson
Uriel Guzmán
@Burinson
Aug 26 2017 20:26
That makes sense, but he only used the var once
Jan Shah
@JanShah
Aug 26 2017 20:26
in this case it may have only been used once, but the concept works if you expand the css into more detail and want to use the variable again
Denise Pilgrim
@godluvu22
Aug 26 2017 20:27
Actually I didnt want the background blue but it was in the project beginning code. I did not put it in.
Uriel Guzmán
@Burinson
Aug 26 2017 20:27
Oh, hahhaa
Jan Shah
@JanShah
Aug 26 2017 20:29
@godluvu22 play about with the variables and see what colour combinations work for you. you can easily add more styles and make the page pop
Denise Pilgrim
@godluvu22
Aug 26 2017 20:29
I think I know what I did wrong. It was a pre assigned Hello World project and I changed it to my own design project but I did not take off the original beginning code! Ultimate mistake! Lol
Uriel Guzmán
@Burinson
Aug 26 2017 20:31
Yeah, lots of unwanted code I guess
You are missing a curly brace at the end of
h3 {
  font-family: Monospace;
  color: purple;
  font-size: 25px;
Denise Pilgrim
@godluvu22
Aug 26 2017 20:32
ok @Burinson thanks!
CamperBot
@camperbot
Aug 26 2017 20:32
godluvu22 sends brownie points to @burinson :sparkles: :thumbsup: :sparkles:
:warning: godluvu22 already gave burinson points
Uriel Guzmán
@Burinson
Aug 26 2017 20:32
<ul class="green text text-center">
      <li> Tate Nichelson</li>
      <li> Darcy Frantz</li>
      <li> Daxon Frantz</li>
    </ul>
</div
That div is also wrong
Denise Pilgrim
@godluvu22
Aug 26 2017 20:33
yes!
Uriel Guzmán
@Burinson
Aug 26 2017 20:33
<ul class= "purple text text-center">
  <li> Swim Suit</li>
  <li> Sun Glasses</li>
  <li> Tooth brush/toothpaste</li>
  <li> Bible (notebook and markers provided)   </li>
  <li> Flip flops, Tennis shoes, water shoes if available</li>
  <li> clothes for summer play outside and inside</li>
  <li>Favorite blanket and/or pillow</li>
  <li> Any dress up clothes you desire for costume days. Mimi Camp will provide some specific ones for dramas.</li> 
  <li> All items not listed will be provided by Mimi Camp and even some listed!</li>
  <//ul>
And the <//ul> should be </ul>
Denise Pilgrim
@godluvu22
Aug 26 2017 20:34
ok
Darren
@DarrenfJ
Aug 26 2017 20:35
@alexanderkopke hey buddy! :D
Denise Pilgrim
@godluvu22
Aug 26 2017 20:36
@Burinson Thank you so much! This has been a mountain of impossibility for me. Blessings! It finally loaded after that last correction!
CamperBot
@camperbot
Aug 26 2017 20:36
godluvu22 sends brownie points to @burinson :sparkles: :thumbsup: :sparkles:
:warning: godluvu22 already gave burinson points
Uriel Guzmán
@Burinson
Aug 26 2017 20:37
No problem :), we're here to learn
Denise Pilgrim
@godluvu22
Aug 26 2017 20:37
Yes we are!
Jill Lee
@jill-lee
Aug 26 2017 21:21
@DarrenfJ No probs. @heroiczero If you noticed there is a white space on the side of the homepage on mobile. hmm how do I get rid of it? Thanks
CamperBot
@camperbot
Aug 26 2017 21:21
phoenix-burn sends brownie points to @darrenfj and @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1657 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 1989 | @darrenfj |http://www.freecodecamp.com/darrenfj
Sam Moradi
@sammymm
Aug 26 2017 21:52
hi everyone, i'm doing the wikipedia search challenge and I'm not sure why my ajax function does not return any data
Manish Giri
@Manish-Giri
Aug 26 2017 22:09
Screen Shot 2017-08-26 at 6.07.33 PM.png
@sammymm your data is there
look in the browser console
Sam Moradi
@sammymm
Aug 26 2017 22:10
thanks Manish, yea I had to add origin=*
edburdett1980
@edburdett1980
Aug 26 2017 22:33
hello all! Quick question. Isn't there a way to highlight matching brackets in codepen?
Jan Shah
@JanShah
Aug 26 2017 22:42
@edburdett1980 if you click on a bracket, it's matching one is underlined
edburdett1980
@edburdett1980
Aug 26 2017 22:44
thanks @JanShah
CamperBot
@camperbot
Aug 26 2017 22:44
edburdett1980 sends brownie points to @janshah :sparkles: :thumbsup: :sparkles:
:cookie: 496 | @janshah |http://www.freecodecamp.com/janshah
edburdett1980
@edburdett1980
Aug 26 2017 22:44
As usual, I'm trying to over-complicate things
Mike Batista
@mbmontana
Aug 26 2017 23:01
I'm on the Find Largest Numbers in Arrays challenge and came across the Math.max() function. At first I returned null, but I changed something and now at least I'm getting an array of nulls. Any hints?
function largestOfFour(arr) {
  // You can do this!
 var finalArray = [];
  for (i=0; i < arr.length; i++) {
    for (var j=0; j < arr[i].length; j++)
   Math.max(arr[i]); 

  finalArray.push(Math.max(arr[i]));}

  return finalArray;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Margaret
@Margaret2
Aug 26 2017 23:05
@mbmontana gotta do Math.max.apply(null, arr) to get the max of an array
Long Nguyen
@longnt80
Aug 26 2017 23:05
@mbmontana The following function uses Function.prototype.apply() to find the maximum element in a numeric array
just1witness
@just1witness
Aug 26 2017 23:05
@Gersho I finally finished it! And it's 40 lines shorter than my first version. :) (Exact Change that is)
ehutchllew
@ehutchllew
Aug 26 2017 23:54
@mbmontana So if you do a console.log of finalArray after each push, it comes back null?
Mike Batista
@mbmontana
Aug 26 2017 23:55
@ehutchllew Sorry. went out for a run and just came back. I'll get back to this a little later on.