These are chat archives for FreeCodeCamp/HelpFrontEnd

28th
Dec 2017
Christopher Brown
@ChrisBrownie55
Dec 28 2017 00:17
@DanJP2016 I did 1/4 and it gave me 0.3 which is clearly wrong. So I'd say there's probably something wrong with your calculator
Also it doesn't support smaller screens and it shouldn't be using hover for touch screens but rather active
Daniel
@DanJP2016
Dec 28 2017 00:19
@ChrisBrownie55 ah ok i'll look into it. Thanks for the feedback on it
CamperBot
@camperbot
Dec 28 2017 00:19
danjp2016 sends brownie points to @chrisbrownie55 :sparkles: :thumbsup: :sparkles:
:cookie: 329 | @chrisbrownie55 |http://www.freecodecamp.org/chrisbrownie55
Christopher Brown
@ChrisBrownie55
Dec 28 2017 00:20
@DanJP2016 Here's a link for dealing with touch screens https://css-tricks.com/touch-devices-not-judged-size/
Daniel
@DanJP2016
Dec 28 2017 00:21
awesome, thats probably the easy fix so I'll tackle it first lol. thanks
actually setting toFixed(1) to toFixed(2) seems to give the correct answer for 1 / 4. I'll test it further but thanks for pointing that out.
Christopher Brown
@ChrisBrownie55
Dec 28 2017 00:26
@DanJP2016 Maybe you shouldn't be use .toFixed at all
Unless of course the string produced is too long for the screen
Daniel
@DanJP2016
Dec 28 2017 00:29
hmm, the string length has to be 22 chars or less to fit in the display area, so I can build a check into that function to limit it if needed. i got a lot of loops though with this algorithm im using, im getting worried about performance
Christopher Brown
@ChrisBrownie55
Dec 28 2017 00:31
Before you display the number just truncate it, problem solved. You don't even need to save the truncated number, just display it. @DanJP2016
Daniel
@DanJP2016
Dec 28 2017 00:34
yeah it seemed easier to use toFixed(). i'll change it before i post it as complete your suggestion makes more sense.
SakisBal
@SakisBal
Dec 28 2017 01:37
so what is up with this certification do you actually get a paper
Tom
@moT01
Dec 28 2017 02:51
@SakisBal no
you can print it off if you want
Tom
@moT01
Dec 28 2017 02:57
@DanJP2016 9/9 = 1.00
correct answer i guess
Daniel
@DanJP2016
Dec 28 2017 03:17
@moT01 blah this is driving me crazy. added it to the bug list. thanks
CamperBot
@camperbot
Dec 28 2017 03:17
danjp2016 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 944 | @mot01 |http://www.freecodecamp.org/mot01
hillsie
@Hillsie
Dec 28 2017 03:18
Hi there, doesn’t anyone know where I can find some info on setting up eslint to lint an html document?
I don’t seem to be able to catch a tag without a closing html tag
Daniel
@DanJP2016
Dec 28 2017 03:24
@Hillsie i think eslint is only for checking javascript, you probably want a html5 validator. Something like this site might help https://validator.w3.org/
Tom
@moT01
Dec 28 2017 03:28
@DanJP2016 yea - i feel for ya
youve been workin on that for a while
Daniel
@DanJP2016
Dec 28 2017 03:29
maybe I should give up on this algorithm and use Math.js lol
Tom
@moT01
Dec 28 2017 03:31
maybe - i dont know - but im not sure i want to try and figure out what the problem is again
made my head hurt
Daniel
@DanJP2016
Dec 28 2017 03:33
yeah, ive been working on this most of the day. I thought I was close but lots of little bugs are in the code.
Tom
@moT01
Dec 28 2017 03:33
i had the same problem with my calculator
i would fix one problem, and it would cause another to show up
Daniel
@DanJP2016
Dec 28 2017 03:37
i think something is wrong with the way im handling the actual math part of the program. but if I parseInt or parseFloat the number before trying to solve it, the numbers get treated like strings...its weird
Daniel
@DanJP2016
Dec 28 2017 03:55
solved that little problem, 9/9 should give one now
Tom
@moT01
Dec 28 2017 03:58
8*8
well, everything is giving me 0 right now
Daniel
@DanJP2016
Dec 28 2017 03:59
holy sweet jesus
Tom
@moT01
Dec 28 2017 03:59
haha
sorry
Daniel
@DanJP2016
Dec 28 2017 04:01
lol fixed it. was throwing a not a function error
Tom
@moT01
Dec 28 2017 04:04
2*.2
Daniel
@DanJP2016
Dec 28 2017 04:07
0.40
kalzimonium
@kalzimonium
Dec 28 2017 04:09
hi
Daniel
@DanJP2016
Dec 28 2017 04:09
here is what I don't understand. im parsing the strings into numbers when the problem gets solved and saving that result to the result var. but result is a string...shouldn't it be a number
kalzimonium
@kalzimonium
Dec 28 2017 04:09
could anyone please help me understand this?
var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13, 14]
];
arr[3]; // equals [[10,11,12], 13, 14]
arr[3][0]; // equals [10,11,12]
arr[3][0][1]; // equals 11
how did the last line equal 11?
Daniel
@DanJP2016
Dec 28 2017 04:13
@kalzimonium multi-dimensional array, so you got 5 arrays inside of your var arr
arr[3] == the 4th array [[10,11,12], 13, 14]
oops
arr[0] == the first element inside of arr[3] which is an array
so arr[1] equals the second element inside of that array
Ken Haduch
@khaduch
Dec 28 2017 04:14
@kalzimonium - you understood the first two statements? - arr[3]; // equals [[10,11,12], 13, 14] - because that is the element in arr at index 3. Then you continue from there with the breakdown. arr[3][0] gives your the first element in that line - that is the sub-array [10, 11, 12], and adding another index arr[3][0][1] gives you the second element in the [10,11,12], which is 11.
kalzimonium
@kalzimonium
Dec 28 2017 04:17
@khaduch oooooohhhh i see. i get it now. Thanks a lot
CamperBot
@camperbot
Dec 28 2017 04:17
kalzimonium sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3630 | @khaduch |http://www.freecodecamp.org/khaduch
kalzimonium
@kalzimonium
Dec 28 2017 04:17
@DanJP2016 thank you i got it now :smile:
CamperBot
@camperbot
Dec 28 2017 04:17
kalzimonium sends brownie points to @danjp2016 :sparkles: :thumbsup: :sparkles:
:cookie: 308 | @danjp2016 |http://www.freecodecamp.org/danjp2016
Michael Cordero
@CyberPutty
Dec 28 2017 05:09
$addTask.on('click',function(){
  $(this).after('<form id="newItem"><input type="text"> <input type="submit"></form>');
  $(this).hide();


});
$('#newItem').on('submit', function(e){
   e.preventDefault();
  $(this).after('<li class="entry">newEntry</li>');
  $(this).remove();

});
why can't i stop the page from reloading can someone help.
Christopher Brown
@ChrisBrownie55
Dec 28 2017 06:15
@CyberPutty what is #newItem
Michael Cordero
@CyberPutty
Dec 28 2017 06:40
It is the new form. sorry I figured it out. It looks like jquery doesn't let you use the on() method if the element wasn't present in the html when the page is loaded. So when i add the form using javascript it doesn't see it. I ended up just adding it in the HTML and hiding/showing it.
hillsie
@Hillsie
Dec 28 2017 06:41
thanks @DanJP2016
CamperBot
@camperbot
Dec 28 2017 06:41
hillsie sends brownie points to @danjp2016 :sparkles: :thumbsup: :sparkles:
:cookie: 309 | @danjp2016 |http://www.freecodecamp.org/danjp2016
hillsie
@Hillsie
Dec 28 2017 06:48
@DanJP2016 , I think I’ll make use of (htmlhint)[http://htmlhint.com/]. Takes a bit of config, but well work the code quality down the way.
Sweet Coding :)
@SweetCodingInc
Dec 28 2017 07:43
@CyberPutty I'd recommend you avoid adding new mark up in string format. Like this
$(this).after('<form id="newItem"><input type="text"> <input type="submit"></form>');
Sweet Coding :)
@SweetCodingInc
Dec 28 2017 07:48
You're better off using this syntax for better
  • Readability
  • Maintainability
  • Extensibility
$addTask.on('click',function(){
  const $newItem = $('<form/>');
  const $inputText = ${'<input/>', {type:'text'});
  const $inputSubmit = $('<input/>', {type: 'submit'});

  $newItem
    .append($inputText)
    .append($inputSubmit);
  $newItem.on('submit', formSubmitCallback);

  $(this).after($newItem);
  $(this).hide();
});

function formSubmitCallback(e){
   e.preventDefault();
  const $li = $('<li/>', {text: 'newEntry'});
  $(this).after($li);
  $(this).remove();
}
Luca Corsilli
@Lc0rE
Dec 28 2017 09:11

Hello there, I’m having trouble in understanding how to use regex in order to trim spaces at the end and at the beginning of a string.
I’m referring to the regex lesson: https://beta.freecodecamp.org/en/challenges/regular-expressions/reuse-patterns-using-capture-groups

My solution would be something like:

let hello = "   Hello, World!  ";
let wsRegex = /^\s*(.*)\s*$/; // Change this line
let result = hello.replace(wsRegex, ''); // Change this line

But, of course, it’s not workin.
Could you be so kind to help me?

alpox
@alpox
Dec 28 2017 09:21
@Lc0rE you now replace the whole match with '' so you end probably with an empty string. You have to replace with using the capturing group in the replace string: "$1"
Luca Corsilli
@Lc0rE
Dec 28 2017 09:24

Thanks, I’m starting to understand what the capturing group is used for :)
Now, I’m on this:

let hello = "   Hello, World!  ";
let wsRegex = /^\s*(.*)\s*$/; // Change this line
let result = hello.replace(wsRegex, '$1'); // Change this line

and I have as result: Hello, World! with two spaces at the end.
It’s not considering the ending space and I’m wondering why

Luca Corsilli
@Lc0rE
Dec 28 2017 09:36
I’m solving it using /^\s*(.*!)\s*$/ but it’s kinda a workaround… any better solution?
alpox
@alpox
Dec 28 2017 09:36
I believe its because the capturing group is already greedy and therefore "eats" all the spaces as well until the end. Put a ? right after the * inside of the capturing group
Tiago Correia
@tiagocorreiaalmeida
Dec 28 2017 09:37
try to match only digits since it only asks for it on the tests
Luca Corsilli
@Lc0rE
Dec 28 2017 09:37
yup! It’s working fine! I was not thinking about the greedy… thanks!
alpox
@alpox
Dec 28 2017 09:37
The ? after a multiplier makes the multiplier non-greedy
Np :)
Tiago Correia
@tiagocorreiaalmeida
Dec 28 2017 09:37
hey @alpox !
alpox
@alpox
Dec 28 2017 09:38
Hiho :)
Tiago Correia
@tiagocorreiaalmeida
Dec 28 2017 09:54
can you give me a hint on how to handle large numbers? the solution is probably turn them into strings but in this case I need to calculate something like base * exponent and the number becomes infinity literally :D
Kartik Mudgal
@Sprinting
Dec 28 2017 13:01
thanks :)
dinesh
@1532j0004kg
Dec 28 2017 13:41
@1532j0004kg
hey , i need a help ... when i trying to post those datas into the server . thats not working properly.
problem is : i cant able to post the data /.
but when i am trying to post the data using postman its working properly .
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>maxi</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

  </head>
  <body>
    <input type="text" id="search1" >
    <input type="text" id="search2" >
    <button class="btn-primary">click</button>
         <div class="well"></div>

  <script>
               $(document).ready(function(){
                    $("button").click(function(){

                     $.ajax({

                          type : "POST",
                          url : "/api/ninjas",
                          data : {
                            name : $("#search1").val(),
                            rank : $("#search2").val()
                           },
                           success : function(data){
                                     console.log(data.name);
                           },
                           error : function(err){
                             console.log('error' ,err);
                           }
                         });
                    });
               });
  </script>
  </body>
</html>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>maxi</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

  </head>
  <body>
    <input type="text" id="search1" >
    <input type="text" id="search2" >
    <button class="btn-primary">click</button>
         <div class="well"></div>

  <script>
               $(document).ready(function(){
                    $("button").click(function(){

                     $.ajax({

                          type : "POST",
                          url : "/api/ninjas",
                          data : {
                            name : $("#search1").val(),
                            rank : $("#search2").val()
                           },
                           success : function(data){
                                     console.log(data.name);
                           },
                           error : function(err){
                             console.log('error' ,err);
                           }
                         });
                    });
               });
  </script>
  </body>
</html>
Tom
@moT01
Dec 28 2017 14:13
@1532j0004kg try using the full url maybe?
@Sprinting looks pretty good - and mostly working
i can't use the closing parenthesis
Tom
@moT01
Dec 28 2017 14:19
not properly anyway - it shows up when i use it after an operator, but not after a number
Kartik Mudgal
@Sprinting
Dec 28 2017 14:19
thanks!
I don't know what happened. it was ,and I changed few behaviors
Tom
@moT01
Dec 28 2017 14:19
an there's no limit to how many digits i can put on the screen
Kartik Mudgal
@Sprinting
Dec 28 2017 14:19
looking into it now
yea I didn't put a limit because there's no limit on the stack and I didn't think of it :P thanks I'll fix it
dinesh
@1532j0004kg
Dec 28 2017 14:23
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>maxi</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

  </head>
  <body>
    <input id="search1" placeholder="enter playername">
    <input id="search2" placeholder="enter playerscore">
    <button class="btn-primary">click</button>
         <div class="well"></div>
  </body>
  <script>
               $(document).ready(function(){
                    $("button").click(function(){
                     $.ajax({
                           type : "POST",
                           dataType : "json",
                           url : "http://localhost:4000/api/maxi",
                           data :{
                            "player" : $("#search1").val(),
                            "score" :  $("#search2").val()
                           },
                           success : function(data){
                               console.log(data);
                           },
                           error : function(err){
                             console.log('error' ,err);
                           }
                         });
                    });
               });
  </script>
</html>
\still not working.
@moT01
Stephen James
@sjames1958gm
Dec 28 2017 14:25
@1532j0004kg Do you see the request being sent from the browser - in the network tab of the dev tools?
Compare that to what is being sent by postman
dinesh
@1532j0004kg
Dec 28 2017 14:25
no thats my problem , i cant able to post things in server.
but when i getting back response from the server (db is response with id)
but its working good in postman
Stephen James
@sjames1958gm
Dec 28 2017 14:28
@1532j0004kg So the browser is sending the message to the server?
dinesh
@1532j0004kg
Dec 28 2017 14:29
yes ,
but without the data.
its sending empty message.
i think i made the mistake in posting those data's.
from the browser.
kindly i asking u to check the client code!
elad ben aderet
@eladonline
Dec 28 2017 14:32
is there a way to calculate min max in one function like Math.minMax()
or somthing ?
1rjun
@1rjun
Dec 28 2017 14:35
hi friends i am not good at div and layouts
Markus Kiili
@Masd925
Dec 28 2017 14:35
@eladonline Minimum and maximum of what?
1rjun
@1rjun
Dec 28 2017 14:35
suggest me any website so that i can learn it
and i can make the webpage fluently and bring my creativity into product
Markus Kiili
@Masd925
Dec 28 2017 14:37
@eladonline
function minMax () {
  return [Math.min.apply(null,arguments),Math.max.apply(null,arguments)];
}

minMax(1,5,3,7); //  [ 1, 7 ]
Chris Rutherford
@cjrutherford
Dec 28 2017 14:39
@gothamknight Hey! I worked it out with the Grid! Thanks again!
https://codepen.io/christopherrutherford/pen/PEpOvb
CamperBot
@camperbot
Dec 28 2017 14:39
cjrutherford sends brownie points to @gothamknight :sparkles: :thumbsup: :sparkles:
:cookie: 472 | @gothamknight |http://www.freecodecamp.org/gothamknight
Stephen James
@sjames1958gm
Dec 28 2017 14:42
@1532j0004kg You might try using JSON.stringify on your data before sending it.
@1532j0004kg Might I also suggest that you be more specific on what is happening,
if you had led with "its sending empty message." . . .
dinesh
@1532j0004kg
Dec 28 2017 14:49
how to post external photos
$.ajax({
                           type : "POST",
                           url : "http://localhost:4000/api/maxi",
                           JSON.stringify(data :{
                            player : $("#search1").val(),
                            score :  $("#search2").val()
                          }),
                          dataType : "json",
                          success : function(data){
                               console.log(data);
                           },
                           error : function(err){
                             console.log('error' ,err);
                           }
                         });
this is right?
dinesh
@1532j0004kg
Dec 28 2017 14:55
or probably i want add json.stringify after data:{
Dhruv Parashar
@falcon1996
Dec 28 2017 15:06
Hey everyone
i am trying to render components from separate .JSX files into HTML files but it's clearly not showing anything. I checked the browser console and it shows Uncaught ReferenceError: require is not defined
How to work around this problem. Please help.
Tzahi
@Tzahile
Dec 28 2017 15:12
hey guys, lately tried to solve a FCC BETA challenge about template literals, but I think there's a bug, since console logs a right answer, yet the test doesn't work. here's the challenge
Tom
@moT01
Dec 28 2017 15:12
sounds like a problem with babel settings @falcon1996
not sure
Tzahi
@Tzahile
Dec 28 2017 15:14
my answer is very simple, although can be smarter using map or something, but still should work (and it doesn't):
"use strict";
const result = {
  success: ["max-length", "no-amd", "prefer-arrow-functions"],
  failure: ["no-var", "var-on-top", "linebreak"],
  skipped: ["id-blacklist", "no-dup-keys"]
};
// change code below this line
const resultDisplayArray = `<li class="text-warning">${result.failure[0]}</li>
<li class="text-warning">${result.failure[1]}</li>
<li class="text-warning">${result.failure[2]}</li>`
// change code above this line
console.log(resultDisplayArray);
/**
 * should look like this
 * <li class="text-warning">no-var</li>
 * <li class="text-warning">var-on-top</li>
 * <li class="text-warning">linebreak</li>
 **/
Tom
@moT01
Dec 28 2017 15:19
@Tzahile i put the <li>'s into an array and it passes the first two tests
that is not described very clearly
dinesh
@1532j0004kg
Dec 28 2017 15:27
```
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>maxi</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

  </head>
  <body>
    <input id="search1" placeholder="enter playername">
    <input id="search2" placeholder="enter playerscore">
    <button class="btn-primary">click</button>
         <div class="well"></div>
  </body>
  <script>
               $(document).ready(function(){
                    $(".btn-primary").click(function(){
                    console.log("click");

                    var obj = {
                     player : $("#search1").val(),
                     score :  $("#search2").val()
                   };



                     $.ajax({
                           type : "POST",
                           url : "http://localhost:4000/api/maxi",
                           data : obj ,
                              success : function(data){
                               console.log(data);
                           },
                           error : function(err){
                             console.log('error' ,err);
                           },
                           dataType : "json"
                         });
                    });
               });
  </script>
</html>
```
this i right way to post things?
Tom
@moT01
Dec 28 2017 15:45
something is a little off - cause i see the ticks at the bottom, but yes - its pretty right
three ticks(```) -> new line(shift+enter) -> code -> new line -> three ticks
cyoung045
@cyoung045
Dec 28 2017 15:47
How do I add a caption to a thumbnail? One that is included in the differently colored background that the image has? Here's what I've done so far:
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<h1 class="text-center">La Tour Eiffel</h1>
<h2 class="text-center"><em>The Symbol of Paris</em></h2>
<div class="thumbnail">
<img class="img-thumbnail img-fluid" src="https://media-exp2.licdn.com/mpr/mpr/AAEAAQAAAAAAAAg3AAAAJDkyYmM1ZTQ5LTI5YmQtNGUwZS1iMjY3LTlhMDk0ZWQ2YzAwMw.jpg">
SoteroX
@SoteroX
Dec 28 2017 16:01
@cyoung045 do you have a codepen link?
SoteroX
@SoteroX
Dec 28 2017 16:03
you want the caption on the thumbnail?
cyoung045
@cyoung045
Dec 28 2017 16:04
yeah, to be included in the thumbnail.
Michael Grienauer
@mgrienauer
Dec 28 2017 16:12
im on sorted union and im not sure how i can check the array to be returned by reduce
function uniteUnique(arr) {

  var argArr = Array.from(arguments);
  var newArr = argArr.reduce(function(x){
    return newArr.indexOf(x) == -1;
  }, []);

  return newArr;

}

uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
im trying to check if the current index from argArr is not in the newArr
Alex Dobre
@Zerelt
Dec 28 2017 16:13
I think you're using Bootstrap 3 classes and you have Bootstrap 4 library loaded there
@cyoung045
Markus Kiili
@Masd925
Dec 28 2017 16:14
@mgrienauer You should look at the MDN reduce page for simple examples of how reduce works.
Alex Dobre
@Zerelt
Dec 28 2017 16:14

bootstrap 4 captions are now like this :
https://v4-alpha.getbootstrap.com/content/figures/

so I think your code chould be

<div class="figure">
         <img class="figure-img img-fluid" src="https://media-exp2.licdn.com/mpr/mpr/AAEAAQAAAAAAAAg3AAAAJDkyYmM1ZTQ5LTI5YmQtNGUwZS1iMjY3LTlhMDk0ZWQ2YzAwMw.jpg">

         <figcaption class="figure-caption text-center">The Eiffel Tower at night.</figcaption>
        </div>
cyoung045
@cyoung045
Dec 28 2017 16:15
Ok, I'll switch. How do you learn the BS4 updates?
Alex Dobre
@Zerelt
Dec 28 2017 16:15

and if you want the white background for the caption then add

.figure{
  background-color:white;
}

to your css

Michael Grienauer
@mgrienauer
Dec 28 2017 16:15
@Masd925 i mean i get the basic idea, just wondering if there's some way I can recursively check the array it's returning
Alex Dobre
@Zerelt
Dec 28 2017 16:15
you read the bootstrap 4 documentation i guess :D
SoteroX
@SoteroX
Dec 28 2017 16:16

@cyoung045 .thumbnail {
border: solid white;
}

.img-thumbnail {
border: none;
}

.caption {
background-color: white
}

Markus Kiili
@Masd925
Dec 28 2017 16:17
@mgrienauer The first two parameters that the reduce callback function can have are the accumulator (the value that changes on each array element and is returned at the end from reduce) and the element being iterated. The return value is the next accumulator value.
cyoung045
@cyoung045
Dec 28 2017 16:18
Question: in general, is it more sophisticated to use bootstrap and html than to use CSS?
Markus Kiili
@Masd925
Dec 28 2017 16:19
@cyoung045 It is just easier to make a responsive page with Bootstrap, because it has the grid system.
Alex Dobre
@Zerelt
Dec 28 2017 16:19
bootstrap is just a library with predefined responsive classes, so it's made with css, you just need to know the classes and make any changes depending on your needs.
Markus Kiili
@Masd925
Dec 28 2017 16:20
@mgrienauer So make the callback like function(acc,elem){...} where acc will be the running value (accumulator that is an array here) and elem is the array element being iterated, and figure out what the next accumulator should be and return it.
Michael Grienauer
@mgrienauer
Dec 28 2017 16:24
@Masd925 alright thanks ill take a look at the MDN page again
CamperBot
@camperbot
Dec 28 2017 16:24
mgrienauer sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4631 | @masd925 |http://www.freecodecamp.org/masd925
dinesh
@1532j0004kg
Dec 28 2017 16:48
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>maxi</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

  </head>
  <body>
    <input id="search1" placeholder="enter playername">
    <input id="search2" placeholder="enter playerscore">
    <button class="btn-primary">click</button>
         <div class="well"></div>
  </body>
  <script>
               $(document).ready(function(){
                    $(".btn-primary").click(function(){
                    console.log("click");

                    var obj = {
                     player : $("#search1").val(),
                     score :  $("#search2").val()
                   };



                     $.ajax({
                           type : "POST",
                           url : "http://localhost:4000/api/maxi",
                           data : obj ,
                              success : function(data){
                               console.log(data);
                           },
                           error : function(err){
                             console.log('error' ,err);
                           },
                           dataType : "json"
                         });
                    });
               });
  </script>
</html>
is it right way to post data
need help.
Dhruv Parashar
@falcon1996
Dec 28 2017 17:11
@moT01 I am using babel-cli to transpile JSX to JS , and then rendering it in HTML but console is showing Uncaught ReferenceError: require is not defined
Tom
@moT01
Dec 28 2017 17:17
dont know - i had a similar problem once - and i think i fixed it by changing some of those settings
maybe try the backend room https://gitter.im/FreeCodeCamp/HelpBackEnd
Chris Rutherford
@cjrutherford
Dec 28 2017 18:00
anyone know of a good zip code distance api? I've been looking at https://www.zipcodeapi.com/ but I'm not sure I want to use them....
Jean Marco Romero
@volkranium
Dec 28 2017 18:02
let me see if ive understood a bit of React , so you should always make a stateful parent component that controls the props of child components ?????
or at least try?
Tiago Correia
@tiagocorreiaalmeida
Dec 28 2017 18:31
@volkranium dependin of the situation but normally you have a component foreach part of a big component so if you wanna chnge the childs component when changing another component you need to change the parent component so it affects all of them, hope it wasnt confusing aaa
@volkranium so yes your statement is right :)
Seleah
@Seleah
Dec 28 2017 19:26
Hey, I'm a little stuck on something. Anyone here done with the weather app? I'm struggling with json/jQuery. I really thought I had a handle on it, but I feel clueless and I'm not sure what I'm doing wrong. Help?
Toni Shortsleeve
@KoniKodes
Dec 28 2017 19:37
@Seleah What is happening with it?
Seleah
@Seleah
Dec 28 2017 19:42
Not sure,
@KoniKodes k. now I'm here lol. Someone saw that I didn't add jQuery. I'm trying that now to see if that fixes me up
rna7
@rna7
Dec 28 2017 20:01
Can someone help my "tribute page" project's header image look better when being responsive? The image shrinks but looses the bottom of the image. https://codepen.io/rna7/pen/vpgegV
iso
@iso1048
Dec 28 2017 20:34
@cjrutherford awesome bro
David Belmares
@DavidBelmares
Dec 28 2017 20:39

function titleCase(str) {
  var strWords = str.split(" "); // stores input of function
  var strOutput = []; // stores output of function
  var strTemp = []; // temporary array used to store letters of each word

  for (i = 0; i < strWords.length; i++){
    strWords[i] = strWords[i].toLowerCase(); // change each word of input to lowercase
  }

  for (j = 0; j < strWords.length; j++){
    strTemp.push(strWords[j].split("")); // push the current word of input string to temp array as a split string
    strTemp[0] = strTemp[0].toUpperCase(); // change the first letter (first array index) of current word to uppercase
    strOutput.push(strTemp.join("")); // push modified word to output array
    strTemp = []; // clear temporary array for next iteration
  }


  return strOutput.join(" "); // output string from joined array of modified words
}

titleCase("I'm a little tea pot");
This function is supposed to capitalize the first letter of each word of an input string. However, I get the error that toUpperCase() is not a function. Any ideas?
Stephen James
@sjames1958gm
Dec 28 2017 20:42
@DavidBelmares You have put an array into strTemp - so strTemp[0] is not a string
@DavidBelmares perhaps you mean strTemp = strWords[j].split("")
David Belmares
@DavidBelmares
Dec 28 2017 20:45
@sjames1958gm Thanks, I didn't notice that
CamperBot
@camperbot
Dec 28 2017 20:45
davidbelmares sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8808 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
David Belmares
@DavidBelmares
Dec 28 2017 20:45
My code validates now
Stephen James
@sjames1958gm
Dec 28 2017 20:47
@DavidBelmares :+1:
Daniel
@DanJP2016
Dec 28 2017 22:15
working on finishing my calculator project. I have the code giving me the same answers as the example project, or if that is wrong it gives me the same answer as an actual calculator. there are still some bugs to work out but would someone mind taking a look at it and see if they get the correct results. Thanks. https://codepen.io/bones211/pen/LeWVzQ?editors=0010
sgs006
@sgs006
Dec 28 2017 22:27
Hey, I'm trying to become a front end developer and am learning from scratch. Is it a good idea to be using bootstrap at this early stage or should I be trying to do the projects using just CSS?
Jean Marco Romero
@volkranium
Dec 28 2017 22:30
Do i need to finish the entire map to get certificate? or can i just do the final porjects of each section
??/
Daniel
@DanJP2016
Dec 28 2017 22:37
@sgs006 if I did it all over again I would just use css because now I struggle with building responsive projects without a library. But it is entirely up to you.
@volkranium yes I think you have to finish the whole map
Tom
@moT01
Dec 28 2017 22:38
@volkranium i think the projects required for the certs are marked with a * or something
Mohamed Osama Khan
@Assaonator
Dec 28 2017 22:47
checkout my Camper Leaderboard app!
/ /
https://codepen.io/Assaonator/pen/GyWYNB
//
//
help
//
\
\
test
\
Assaonator @Assaonator
Mohamed Osama Khan
@Assaonator
Dec 28 2017 22:49
//
sgs006
@sgs006
Dec 28 2017 22:53
@DanJP2016 Yes, I think that is the route I'm going to go. I really want a foundational knowledge
Jacob Pieczynski
@JacobPie
Dec 28 2017 23:36
Why is the background around my h1 element not the same color as the navbar? Thanks for the help. https://codepen.io/JakePie/pen/gomBeZ