These are chat archives for FreeCodeCamp/HelpFrontEnd

9th
Aug 2017
juni
@junipberry
Aug 09 2017 00:06
@SkyC0der
Znadams
@Znadams
Aug 09 2017 00:26
What is the purpose of a <fieldset> tag inside of a form?
Colin
@finkbeca
Aug 09 2017 00:26
Hello everyone I have been messing around with flexbox and I have been having trouble centering the container. Does anyone know how to solve this. All I want to do is center the outer div. Thanks! https://codepen.io/buddyfinkbear/pen/LjyYmg
Znadams
@Znadams
Aug 09 2017 00:27
It seems to be somewhat redundant on the surface
Trommelochse
@Trommelochse
Aug 09 2017 00:28
@junipberry try to start with an empty object var myObj = {}
Eunice Park
@eunicode
Aug 09 2017 00:31
@SkyC0der Bless you. Thank you so, so much for taking the time to answer my question. Also super impressed with your on-the-fly CSS skills :eyes:
The problem was indeed the way I integrated the code, as someone else also pointed out.
Tbh, I'm still confused why the jQuery method doesn't work if the if-else code is inside the .getJSON function, but it works if it's outside.
Here's a pic of what I mean: http://i.imgur.com/E7bwDYv.png
CamperBot
@camperbot
Aug 09 2017 00:31
eunipa sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2348 | @skyc0der |http://www.freecodecamp.com/skyc0der
juni
@junipberry
Aug 09 2017 00:32
@Trommelochse but I need to specify the format for my object, dont I
Trommelochse
@Trommelochse
Aug 09 2017 00:35
and then you assign one property to your newly created object
and return that object afterwards
dyon3334
@dyon3334
Aug 09 2017 00:38
can anyone tell me why this not work
function findLongestWord(str) {
  var index = 0;
  var test;
  var arr = str.split(" ");
  for(i=0;i<arr.length;i++){
    test = arr[i].length;}
    if (index<test){
    index = arr[i].length;
    }
   return index;
    }

findLongestWord("The quick brown fox jumped over the lazy dog");
Trommelochse
@Trommelochse
Aug 09 2017 00:39
function findLongestWord(str) { var arr = str.split(" "); arr.sort(function(a, b) { return a.length < b.length }); return arr[0]; } findLongestWord("The quick brown fox jumped over the lazy dog");
oops
dyon3334
@dyon3334
Aug 09 2017 00:41
@Trommelochse can you help me ?
Trommelochse
@Trommelochse
Aug 09 2017 00:43
my try
tried on codepen quickly, seems to work
Long Nguyen
@longnt80
Aug 09 2017 00:46
@dyon3334 you have an extra curly brace test = arr[i].length;}
Roxroy
@roxroy
Aug 09 2017 00:48
@dyon3334, Your algorithm, although not optimized will work. The problem is with the brackets, they are in the wrong place. Try this for it to work -
function findLongestWord(str) {
  var index = 0;
  var test;
  var arr = str.split(" ");
  for (i = 0; i < arr.length; i++) {
    test = arr[i].length;
    if (index < test) {
      index = arr[i].length;
    }
  }
  return index;
}
dyon3334
@dyon3334
Aug 09 2017 00:49
@roxroy thanks a lot !! doyou ike this algo ?
CamperBot
@camperbot
Aug 09 2017 00:49
dyon3334 sends brownie points to @roxroy :sparkles: :thumbsup: :sparkles:
:star2: 1093 | @roxroy |http://www.freecodecamp.com/roxroy
Roxroy
@roxroy
Aug 09 2017 00:53
@dyon3334 , there is room for improvement. For example, if (index < test) { index = test; }. Also use variable names that reflect the purpose and the intent.
dyon3334
@dyon3334
Aug 09 2017 00:55
@roxroy thanks !!
CamperBot
@camperbot
Aug 09 2017 00:55
dyon3334 sends brownie points to @roxroy :sparkles: :thumbsup: :sparkles:
:warning: dyon3334 already gave roxroy points
Gulsvi
@gulsvi
Aug 09 2017 01:33
@eunipa Based on :point_up: the code in the screenshot you sent, you seem to have tempD defined instead of tempF and the .on('change' code will not run because your getJSON can't access the url "blahblah", so it fails.
If you have a codepen you can send, I can help take a closer look
That looks better @junipberry but we can't write out the object like that. The value has to be assigned to the property, like myObj[propertyName] = value
var myObj = {}
myObj[propertyName] = value;
replace propertyName with array[0] and value with the last element of your array. (array[-1] is not valid syntax for the last element of an array)
iso
@iso1048
Aug 09 2017 01:37
@SkyC0der ideas for using the star wars api?
Gulsvi
@gulsvi
Aug 09 2017 01:38
@gothamknight Hmmmm, I'm not sure :video_game: maybe a trivia game?
multiple choice question/answer
Or, random character cards
iso
@iso1048
Aug 09 2017 01:39
that would be cool....but hard to make. yeah I was thinking of just doing 'simple' character or planet cards that a user could search for or something
just to practice
Gulsvi
@gulsvi
Aug 09 2017 01:40
Random star wars character machine :)
iso
@iso1048
Aug 09 2017 01:40
oh true
i was thinking of using the pokemon api to make a search thing for the first gen pokemon.
Gulsvi
@gulsvi
Aug 09 2017 01:41
the pokemon api could maybe be a companion app for pokemon go?
quick way to look up info, but I know there are tons of wikis out there already
iso
@iso1048
Aug 09 2017 01:41
but in that case, would it be better to request each of the 151 json when the website loads?
yeah that is true.
Gulsvi
@gulsvi
Aug 09 2017 01:43
Usually best to get only the JSON you need
If you get all the JSON though, you could just get it once and hard-code it into your app, then it works offline :)
iso
@iso1048
Aug 09 2017 01:44
you mean it works offline after the ajax call has been made (and the data received)...?
the json are quite large too which may be a problem
Gulsvi
@gulsvi
Aug 09 2017 01:46
I meant just get them once, copy paste all the data into your app
iso
@iso1048
Aug 09 2017 01:47
@SkyC0der wouldnt it just be easier then to make my own objects with only the info i want?
i dunno. will see. I want to learn command line and js animations/canvas (whatever you call it) first
Gulsvi
@gulsvi
Aug 09 2017 01:48
Yeah, depends on your final design idea I guess
command line, js animations, and canvas are three very different things :)
iso
@iso1048
Aug 09 2017 01:48
yeah thought so haha
Gulsvi
@gulsvi
Aug 09 2017 01:49
Though, canvas can be useful for animations
iso
@iso1048
Aug 09 2017 01:49
i know command line is completely different
Gulsvi
@gulsvi
Aug 09 2017 01:49
I think @Pagnito was playing around with canvas recently
iso
@iso1048
Aug 09 2017 01:50
yeah i saw his stuff and then all those things on codepen too which look cool
and i want to learn to make apps on android/iOS.
too many things to do
Gulsvi
@gulsvi
Aug 09 2017 01:51
Yeah, wish I could download all this knowledge
iso
@iso1048
Aug 09 2017 01:52
I wish I knew about all this stuff earlier so I could have started earlier
@SkyC0der did you start that comp sci course you linked me a while back?
Gulsvi
@gulsvi
Aug 09 2017 01:55
hmmmm, I don't remember. the Harvard CS50 course?
CallMeOrange
@EgnaroDev
Aug 09 2017 01:55
:wave:
Gulsvi
@gulsvi
Aug 09 2017 01:55
I didn't do that one - only course I've done outside of FCC is a codecademy one on React
:wave: :sunglasses: :wave: @EgnaroDev
iso
@iso1048
Aug 09 2017 01:55
@SkyC0der yeah
oh, i thought you were thinking about doing it
@EgnaroDev long time no see. busy doing algorithms?
CallMeOrange
@EgnaroDev
Aug 09 2017 01:56
Nah, doing homework
Came back to school yesterday
iso
@iso1048
Aug 09 2017 01:57
haha.
that sucks
CallMeOrange
@EgnaroDev
Aug 09 2017 01:57
lol
I really need to improve my math skills, I'm fine for now
I use slader.com sometime... to confirm my answers
iso
@iso1048
Aug 09 2017 01:58
same. I forgot calculus since I havnt used it in ages
CallMeOrange
@EgnaroDev
Aug 09 2017 01:58
I see
I thought you were majoring in Bio-engineering? or biochemistry?
iso
@iso1048
Aug 09 2017 01:59
yeah biochem
CallMeOrange
@EgnaroDev
Aug 09 2017 01:59
oh
So you don't need calc for it?
Eunice Park
@eunicode
Aug 09 2017 01:59
@SkyC0der Thank you Sky! That was a typo :) The jQuery method works, I just don't understand why it has to be placed in that location?
CamperBot
@camperbot
Aug 09 2017 01:59
eunipa sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2349 | @skyc0der |http://www.freecodecamp.com/skyc0der
iso
@iso1048
Aug 09 2017 02:00
@EgnaroDev not at all
CallMeOrange
@EgnaroDev
Aug 09 2017 02:00
ah
iso
@iso1048
Aug 09 2017 02:00
for undergrad anyway
Gulsvi
@gulsvi
Aug 09 2017 02:05
@eunipa It needs to be inside your getJSON function. If you put it outside your getJSON function, the tempF and tempC values won't be available.
Also, this line document.getElementById("weatherNumId").innerHTML = weatherNum; is causing an error, so any code after that will fail to run
It's causing an error because an element with id='weatherNumId' doesn't exist in your HTML
Eunice Park
@eunicode
Aug 09 2017 02:10
@SkyC0der Yep, I know. I commented out "weatherNumId" in the HTML (I was using that to display/test switch/if statements for weather icons).
The code is actually outside of the getJSON function, and it works. It actually doesn't work if it's inside the getJSON function
Gulsvi
@gulsvi
Aug 09 2017 02:12
@eunipa It works for me if you move it inside the getJSON and comment out that one line referencing the element with id="weatherNumId"
https://codepen.io/skycoder/pen/ayWOWN?editors=0010
^^ That's a fork with the fixes I was talking about
Eunice Park
@eunicode
Aug 09 2017 02:19
@SkyC0der Wow. Fascinating. So that one line of code breaks the getJSON function instead of being ignored?
Thank you so much!!! :raised_hands:
CamperBot
@camperbot
Aug 09 2017 02:19
eunipa sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:warning: eunipa already gave skyc0der points
Gulsvi
@gulsvi
Aug 09 2017 02:24
@eunipa No problem - glad that got figured out :)
Eunice Park
@eunicode
Aug 09 2017 02:30
@SkyC0der I learned something important thanks to you, that errors cause functions to break. I apologize for bothering you so much, but your debugging skills are amazing! Can you please tell how you knew document.getElementById("weatherNumId").innerHTML = weatherNum; was the line causing an error?
CamperBot
@camperbot
Aug 09 2017 02:30
eunipa sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:warning: eunipa already gave skyc0der points
Gulsvi
@gulsvi
Aug 09 2017 02:36

@eunipa Browsers have a much better console than the one in Codepen. (Ctrl + Shift + J on Windows/Linux, Command + Option + J on Mac OS). It was showing the following error:

pen.js:36 Uncaught TypeError: Cannot set property 'innerHTML' of null

I looked at line 36 of your code and found:
      document.getElementById("weatherNumId").innerHTML = weatherNum;
So, I looked in your HTML for weatherNumId and didn't see it
:shipit:
Eunice Park
@eunicode
Aug 09 2017 02:39
@SkyC0der you are the gift that keeps on giving. You're like the genie that answers everyone's question in this chat. Thank you so much :heart_eyes_cat:
CamperBot
@camperbot
Aug 09 2017 02:39
eunipa sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:warning: eunipa already gave skyc0der points
Gulsvi
@gulsvi
Aug 09 2017 02:40
lol, you're welcome
Pagnito
@Pagnito
Aug 09 2017 02:51
@SkyC0der yo
Elerio
@Elerio
Aug 09 2017 04:16
hello
iso
@iso1048
Aug 09 2017 04:24
@Elerio hi
juni
@junipberry
Aug 09 2017 04:40
hi
I have a general question here
does anyone know what happened to the help tab in the freeCodeCamp lesson?
*lessons
heroiczero
@heroiczero
Aug 09 2017 04:42
@junipberry Help or Hint?
juni
@junipberry
Aug 09 2017 04:42
it was not Hint before
there was a tab that opened gitter chat
heroiczero
@heroiczero
Aug 09 2017 04:43
@junipberry oh that went into your profile
juni
@junipberry
Aug 09 2017 04:43
specifically for JavaScript, I believe
yea? gonna check it !
heroiczero
@heroiczero
Aug 09 2017 04:43
https://gitter.im/FreeCodeCamp/HelpJavaScript here is the link for javascript
juni
@junipberry
Aug 09 2017 04:44
ahh
ty @heroiczero
CamperBot
@camperbot
Aug 09 2017 04:44
junipberry sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1591 | @heroiczero |http://www.freecodecamp.com/heroiczero
Chris Cullen
@123xylem
Aug 09 2017 04:52

Really easy question. How do i get an image to the right of my text? THe text wont move for my image so the image just goes over my text in this example

.homeImg2{
margin-right:40%;
max-height: 400px;
        max-width: 400px;
        float:right;

}
.homeParagraph{
    margin-top:0;
float:left;
}
<div class="homeParagraph">

         <p>blah blah blah courage you to experience the difference that Occupational Therapy can make for your child.
         </p>      

</div>
         <img class="homeImg2" src ="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT8DzuZO4CHsOz7d7NOACEkbYoi0dyr3faG-wf4D091e7AydmHV">

<div class="clearfix"></div>

How do i make the image and paragraph sit side by side

iso
@iso1048
Aug 09 2017 04:57
@123xylem div elements are block level elements, meaning that by default, they take up the whole width of their parent element. In css, you could give the divs display:inline-block, and then give them a width. https://stackoverflow.com/questions/9189810/css-display-inline-vs-inline-block
Codifurus
@Codifurus
Aug 09 2017 04:59
has anyone had issues where codepen does not accept margin changes? If I load my quote generator from my local files the margin between my buttons works as I expect it to. Once I put it in codepen though it puts the buttons right next to each other
https://codepen.io/brewercodym/pen/dzNmJE
danskeerththana
@danskeerththana
Aug 09 2017 05:00

help In nano, at the top of the window, type

"Hello, I am nano."

In nano, at the top of the window, type

"Hello, I am nano." what ?answer plz

Chris Cullen
@123xylem
Aug 09 2017 05:03
@gothamknight hi, That still didnt make my image sit on the right of the text
juni
@junipberry
Aug 09 2017 05:05
@123xylem , have you tried setting columns for your body
Chris Cullen
@123xylem
Aug 09 2017 05:05
i did before but it didnt work. SO ive tried a few different ways.
Im a bit rusty but feel like this is an easy problem!
juni
@junipberry
Aug 09 2017 05:07
I would do smtg like col-2-lg for the html part in your case
there is also the option of specifying column count and column width in css
column-width, column-count
Will Waymel
@willwaymel
Aug 09 2017 05:33
@Codifurus it looks like the css for your right and left margins is not attached to your buttons. you have it with .buttons, but that is not attached to your button html class
(just add buttons to your class for your buttons) @Codifurus
iso
@iso1048
Aug 09 2017 05:41
@123xylem sorry bro i had to step away for a while. try putting the img in a div also, then changing the display of that div to inline-block, then giving it a width too...
Chris Cullen
@123xylem
Aug 09 2017 05:41
@gothamknight thanks
CamperBot
@camperbot
Aug 09 2017 05:41
123xylem sends brownie points to @gothamknight :sparkles: :thumbsup: :sparkles:
:cookie: 365 | @gothamknight |http://www.freecodecamp.com/gothamknight
Fernando
@lestairon
Aug 09 2017 06:37
Hi, is there a way to put my buttons on the header without using grids?
I know that it can be done, but don't know how
https://codepen.io/Lestairon/pen/JJVRVx
Martialis39
@Martialis39
Aug 09 2017 06:43
Hi all! can anyone please help with this CSS card flip, I cant figure out why it is not working https://codepen.io/martialis39/pen/NvxMPW
its my first use of SASS
so its probably something to do with that
Martialis39
@Martialis39
Aug 09 2017 06:51
Nvm! Got it working with plain CSS
iso
@iso1048
Aug 09 2017 06:54
@lestairon you could look into bootstrap v4 navbar... https://v4-alpha.getbootstrap.com/components/navbar/ or do you not want to use that?
Fernando
@lestairon
Aug 09 2017 07:05
@gothamknight I think i'm using it
Fernando
@lestairon
Aug 09 2017 07:11
I don't really know what i'm doing wrong...
iso
@iso1048
Aug 09 2017 07:13
@lestairon oh sorry bro, didnt even look at your code. let me see.
@lestairon i would suggest looking at the examples they have on the link i gave. It should help you see what is wrong - for example, i am not sure you would want to but the nav tag inside a header. I have to leave for a while so good luck.
buiphuking
@buiphuking
Aug 09 2017 07:29

can i ask something?
i have this

<button type="submit" class="btn btn-default">Đăng nhập</button>
but when i click, browser open a new tab, i want to stay in that page, how can i do??

Markus Kiili
@Masd925
Aug 09 2017 07:39
@buiphuking You are using the button to submit the form?
buiphuking
@buiphuking
Aug 09 2017 07:40
@Masd925 yes i am

@buiphuking full code of this

<form action="dangnhap" method="post" >
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div>
<label>Email</label>
<input type="email" class="form-control" placeholder="Email" name="email">
</div>
<br>
<div>
<label>Mật khẩu</label>
<input type="password" class="form-control" name="password">
</div>
<br>
<button type="submit" formtarget="_blank" class="btn btn-default">Đăng nhập</button>
</form>

Markus Kiili
@Masd925
Aug 09 2017 07:44
@buiphuking I order for the page not to refresh, you need to handle the submit event manually. I think if you just have a form and submit button, the click refreshes the page.
Javi Ferré
@CurrentDate
Aug 09 2017 07:49
Hi guys, I'm trying to fill the background of a div which contains an SVG, but i'm a bit lost trying to find a solution to adjust the size, please any idea? : https://codepen.io/CurrentDate/pen/qXRGmj
buiphuking
@buiphuking
Aug 09 2017 07:56
@Masd925
i code this
formtarget="_self"
and done
这一章音频在哪下
Thore
@KurzGedanke
Aug 09 2017 10:13
Hi!
Liam Docherty
@ldocherty1
Aug 09 2017 12:04
Does anyone use Wordpress here and use the online store website template? Not sure what the correct phrasing is as I'm enquiring about how it works. I was wondering if you have an online store how does the fee tax works. Does it get taken of the person who signs up to the account who creates the site or to the person who is my client who I'm creating the site for?
Long Nguyen
@longnt80
Aug 09 2017 12:43
@Mr-Li-admin did you do this yourself or you copied the code from the example? I saw many things exactly from the fcc example
even the design
Bartosz
@CataciD
Aug 09 2017 13:40
chinese ppl have copying other ppls shit in their culture
:^)
KEKEKEKKEKEKE
Clyde Lobo
@oppiniated
Aug 09 2017 13:56
@longnt80 It's an exact copy. He did not even bother to change the comments . eg for freeCodeCamp.com
h1tag
@h1tag
Aug 09 2017 14:01
He didn't say it was his own. If you take a look at the pen's owner account, it's not him
I tried to translate what he's saying, I think he's asking about the audio
Clyde Lobo
@oppiniated
Aug 09 2017 14:02
Just translated his text. He wants to know here the audio comes from
h1tag
@h1tag
Aug 09 2017 14:04
@Mr-Li-admin here's the link for the chinese room: https://gitter.im/FreeCodeCamp/chinese
Abhishek Saini
@sainiabhi
Aug 09 2017 14:25
hello everyone
devpaaji
@devpaaji
Aug 09 2017 14:41
@sainiabhi do you know where is the Coding Jobs page here
is that closed
in Free Code Camp
Abhishek Saini
@sainiabhi
Aug 09 2017 14:46
even I can't see
@devpaaji
Clyde Lobo
@oppiniated
Aug 09 2017 15:18
That channel has ben closed
mstellaluna
@mstellaluna
Aug 09 2017 15:24
@devpaaji the codingJobs channel was closed, please use the FCC Forum "Getting a Developer Job" section in its place.
Magdalena Dering
@magdalena-dering
Aug 09 2017 16:47
Hi ; ), I'm looking for someone who can look at my latest web project and give me some comments. Is anyone here willing to do it? ;) I need comments about mobile layout, colors etc., someone who know more than me about web design, UI and UX.
Thayyeb salim
@Thayyebsalim
Aug 09 2017 16:49
Post the link someone ought to help :D
@magdalena-dering
Magdalena Dering
@magdalena-dering
Aug 09 2017 16:51
I want to apply for Web Master internship, and show it like a last project
Chris
@bestintown23
Aug 09 2017 16:57
why is my slideshow overlapping my about us section, i would like the slideshow then the about us section. https://codepen.io/bestintown23/pen/VzpgyM
Trommelochse
@Trommelochse
Aug 09 2017 17:12
@bestintown23 your slideshow has its position set to absolute
other elements act, as if absolute positioned elements don't exist
Chris
@bestintown23
Aug 09 2017 17:15
@Trommelochse ok so what should i do to fix it?
Andrew Horn
@sophyphreak
Aug 09 2017 17:46

Hey so I'm having a weird bug in my react app. It's the calculator app, and this.setState() isn't working for one of my states, and it's weird. https://codepen.io/sophyphreak/pen/Vzbxrw?editors=0010

It's working to update the state currentEq but not to update the state display. And I have no idea why.

The method in question is lines 33-38.

longerNumber(val, last) {
    let display = last * 10 + val;
    let currentEq = this.state.currentEq;
    currentEq[currentEq.length - 1] = display;
    this.setState({ display, currentEq });
  };

currentEq updates but displaydoes not

Gulsvi
@gulsvi
Aug 09 2017 17:50
@sophyphreak If you remove the .min from your react.js and react-DOM.js files in your JavaScript settings, you'll get a lot more debug information to help.
Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the Calculator component.
I'm a complete noob when it comes to react, so I don't know how to fix your code, but hopefully the error above helps. Seems you need to use this.setState({ display, currentEq }); after the component is mounted
Andrew Horn
@sophyphreak
Aug 09 2017 17:52
It should help. Gives me something to google with. But I'm not sure why it wouldn't be mounted. That's a strange error. Thanks so much for the help!
@SkyC0der Thanks!
Gulsvi
@gulsvi
Aug 09 2017 17:53
Hopefully google is more helpful than me :)
Andrew Horn
@sophyphreak
Aug 09 2017 17:53
well now I have somewhere to start haha
Bashaar (Bas)
@Chiefbas
Aug 09 2017 17:57
hello
Zerka1982
@Zerka1982
Aug 09 2017 17:58
Hello Js
guys, any tutorials about React please ? What will you recommend ?
Bashaar (Bas)
@Chiefbas
Aug 09 2017 17:58
FCC youtube channel
they explain it there very nicely
Zerka1982
@Zerka1982
Aug 09 2017 17:59
Can you give me a link please ?
Bashaar (Bas)
@Chiefbas
Aug 09 2017 18:00
Hmm. You can actually just type in youtube "Freecodecamp"
Zerka1982
@Zerka1982
Aug 09 2017 18:00
got it now , thanks dude
You're very welcome Sir
Andrew Horn
@sophyphreak
Aug 09 2017 18:09
If anyone else can help me with my setState() problem, it would be much appreciated. I'm still really not sure what the problem is here.
Andrew Horn
@sophyphreak
Aug 09 2017 18:27
figured it out. I was testing using the constructor. That was the problem. Should've tested in componentWillMount()
alpox
@alpox
Aug 09 2017 18:29

@sophyphreak As @SkyC0der already pointed out, you call that function through handleInput in

componentWillMount() {  
    this.handleInput(1);
    this.handleInput(2);
    // this.handleInput('+');
  }

but componentWillMount, as the name already says, will be called BEFORE the mount of the component. The component is not mounted yet at this point.
You should not call any setStatein there. Use handleInput from a button as it is intended and it should work

Andrew Horn
@sophyphreak
Aug 09 2017 18:34
Well, don't ask me why, but the errors I was getting by testing things in the constructor don't appear when I test the same things in componentWillMount()
¯_(ツ)_/¯
@alpox Thanks all the samee
CamperBot
@camperbot
Aug 09 2017 18:34
sophyphreak sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1299 | @alpox |http://www.freecodecamp.com/alpox
Martialis39
@Martialis39
Aug 09 2017 19:16
Hey! I have a stupid question
can anyone please explain
how to do a GET request
to the wikipedia api
this is my attempt so far, but I am going insane trying to figure this out
Gulsvi
@gulsvi
Aug 09 2017 19:30
@Martialis39 Most people use getJSON for that. XMLHttpRequest() can get a little complicated. If you don't want to use jQuery, try using fetch() instead? https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
Martialis39
@Martialis39
Aug 09 2017 19:32
I have one working version with fetch : )
but I just want to understand
why this doesnt work
what am I missing
Trommelochse
@Trommelochse
Aug 09 2017 19:32
I vote for axios
Thayyeb salim
@Thayyebsalim
Aug 09 2017 20:11
Thanks alot @SkyC0der
your'e a great help
CamperBot
@camperbot
Aug 09 2017 20:11
thayyebsalim sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2351 | @skyc0der |http://www.freecodecamp.com/skyc0der
Peter Steele
@PeterHSteele
Aug 09 2017 20:59
hey guys, working on the markdown previewer. Trying to figure out why the handleChange() method in my <Previewer /> component doesn't work. Says "can't read property 'target' of undefined" in error message. Let me know if you have any ideas, and thanks! https://codepen.io/psteele1128/pen/EXbQJw?editors=1111
Chilusoft
@chilusoft
Aug 09 2017 21:03
Bello world
teevik
@teevik
Aug 09 2017 21:04
@PeterHSteele onChange={(e)=>this.handleChange()} You're not passing e
hello
aRtoo
@artoodeeto
Aug 09 2017 21:13

hi guys. i think i found a but. im on the algo search and replace. and this is my code


function myReplace(str, before, after) {

  var myRegex = RegExp('(\\w*'+before+'\\w*)','gi');


  return str.replace(myRegex,after);
}
myReplace("He is Sleeping on the couch", "Sleeping", "sitting");

its returning right but i have an error. like what???

Peter Steele
@PeterHSteele
Aug 09 2017 21:14
@teevik onChange={(e)=>this.handleChange(e)} doesn't seem to work either. definitely confused about where I need to explicitly pass 'e' and where not.
Moisés Man
@moigithub
Aug 09 2017 21:15

cuz ur custom object dont have a event object... u also need to pass e

class Input extends React.Component{
  render (){
    return (
      <div>
        <input type='text' value={this.props.value} onChange={(e)=>this.props.onChange(e)}/>
      </div>
    )
  }
}

input type='text' value={this.props.value} onChange={ (e)=>this.props.onChange(e) @PeterHSteele

iso
@iso1048
Aug 09 2017 21:17
@artoodeeto you have to make 'sitting' into 'Sitting' to preserve the uppercase of before
Trommelochse
@Trommelochse
Aug 09 2017 21:18
@PeterHSteele look at the following pen, I changed lines 7, 27 and 40
(.)
aRtoo
@artoodeeto
Aug 09 2017 21:19
@gothamknight damn. grr
@gothamknight thanks bro
CamperBot
@camperbot
Aug 09 2017 21:19
artoodeeto sends brownie points to @gothamknight :sparkles: :thumbsup: :sparkles:
:cookie: 367 | @gothamknight |http://www.freecodecamp.com/gothamknight
iso
@iso1048
Aug 09 2017 21:20
@artoodeeto no problem bro
Peter Steele
@PeterHSteele
Aug 09 2017 21:22
@Trommelochse @teevik @moigithub thanks, got it!
CamperBot
@camperbot
Aug 09 2017 21:22
peterhsteele sends brownie points to @trommelochse and @teevik and @moigithub :sparkles: :thumbsup: :sparkles:
:cookie: 307 | @trommelochse |http://www.freecodecamp.com/trommelochse
:cookie: 223 | @teevik |http://www.freecodecamp.com/teevik
:star2: 3575 | @moigithub |http://www.freecodecamp.com/moigithub
Mike
@MikeJSchorah
Aug 09 2017 22:48
Which WebMail application should I use: Horde, RoundCube, or SquirrelMail?
aRtoo
@artoodeeto
Aug 09 2017 22:54
@gothamknight bro you know why fast is not adding to the text?
console.log('freecode'.split('').splice(0,1,"fast"));
Roxroy
@roxroy
Aug 09 2017 22:56
@MikeJSchorah , I actually use both RoundCube and Horde. However, all 3 are available to me through my hosting provider and they are sync'd to the same account. So when I delete emails from one it is automatically gets deleted in the others.
عبدالله بن علي نور
@liamsy
Aug 09 2017 22:59
hey guys
iso
@iso1048
Aug 09 2017 23:00
@artoodeeto what do you mean by adding to the text? Do you mean that 'fast' is not being inserted into the array?
aRtoo
@artoodeeto
Aug 09 2017 23:00
@gothamknight yea bro. the first letter should be deleted and replaced with the 'fast'
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:01
in the wordBlanks , can someone please explain to me why we have to add the plus sign(+) before and after word blanks?
iso
@iso1048
Aug 09 2017 23:01
@artoodeeto ok. what does the console log instead?
aRtoo
@artoodeeto
Aug 09 2017 23:02
@gothamknight its returning the deleted index. [ 's' ]
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:02
e.g "+myNoun+"
aRtoo
@artoodeeto
Aug 09 2017 23:02
@gothamknight this is the sample from mdn
var myFish = ['angel', 'clown', 'trumpet', 'sturgeon'];
var removed = myFish.splice(0, 2, 'parrot', 'anemone', 'blue');

// myFish is ["parrot", "anemone", "blue", "trumpet", "sturgeon"] 
// removed is ["angel", "clown"]
Long Nguyen
@longnt80
Aug 09 2017 23:03

@MikeJSchorah

Which WebMail application should I use: Horde, RoundCube, or SquirrelMail?

None. Just set them up to forward the email to your favourite email client (Gmail, Outlook,..)

عبدالله بن علي نور
@liamsy
Aug 09 2017 23:04
guys???
Long Nguyen
@longnt80
Aug 09 2017 23:06
@liamsy review your lesson, string concatenation
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:06
i reviewed it man
iso
@iso1048
Aug 09 2017 23:06

@artoodeeto if you look at the mdn, you are doing what is being done in the second example - you are doing console.log on the item which is removed by the looks of it.

var removed = myFish.splice(0, 2, 'parrot', 'anemone', 'blue');

is analogous to your:

var removed = 'freecode'.split('').splice(0,1,"fast");

what do you reckon?

im not too sure otherwise
Long Nguyen
@longnt80
Aug 09 2017 23:06
@liamsy so you still don't know what the plus sign for?
@liamsy what is myNoun?
aRtoo
@artoodeeto
Aug 09 2017 23:07
@gothamknight yea. im removing and adding at the same time. isnt it the same??
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:08
i know what the plus sign is for. what i dont understand is why do we have to put it before and after the words..."+myNoun+" like this
Long Nguyen
@longnt80
Aug 09 2017 23:09
@liamsy to concatenate both strings
the string before myNoun and the string after myNoun
Mike
@MikeJSchorah
Aug 09 2017 23:09
@roxroy Nice, thanks
CamperBot
@camperbot
Aug 09 2017 23:09
mikejschorah sends brownie points to @roxroy :sparkles: :thumbsup: :sparkles:
:star2: 1100 | @roxroy |http://www.freecodecamp.com/roxroy
Long Nguyen
@longnt80
Aug 09 2017 23:10
@liamsy example: "My " + myNoun + " is big"
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:11
@longnt80 so why do we have the plus sign again before myAdjective
Mike
@MikeJSchorah
Aug 09 2017 23:11
@longnt80 Awesome! Thanks. I'm trying to make my e-mail anonymous (not linked to my name). If I forward my e-mail to my gmail account (which is my full name), will they know what my gmail e-mail account name is?
CamperBot
@camperbot
Aug 09 2017 23:11
mikejschorah sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 486 | @longnt80 |http://www.freecodecamp.com/longnt80
Long Nguyen
@longnt80
Aug 09 2017 23:11
@liamsy same thing
@MikeJSchorah who are "they"?
aRtoo
@artoodeeto
Aug 09 2017 23:11
@gothamknight bro bro bro i think i kinda got it. thanks bro
CamperBot
@camperbot
Aug 09 2017 23:11
artoodeeto sends brownie points to @gothamknight :sparkles: :thumbsup: :sparkles:
:cookie: 368 | @gothamknight |http://www.freecodecamp.com/gothamknight
Mike
@MikeJSchorah
Aug 09 2017 23:12
@longnt80 People who e-mail my WebMail account
iso
@iso1048
Aug 09 2017 23:12

@artoodeeto you could try something like:

var myArr = 'freecode'.split('');
var removed = myArr.splice(0,1,"fast");
console.log(myArr);

that works

Long Nguyen
@longnt80
Aug 09 2017 23:12
@MikeJSchorah no, you will have option to display the name as your hosting email
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:13
@longnt80 like this example: "My " + myNoun + " is big" why dont we have a plus before "is big" ?
Mike
@MikeJSchorah
Aug 09 2017 23:13
Thanks @longnt80
CamperBot
@camperbot
Aug 09 2017 23:13
mikejschorah sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:warning: mikejschorah already gave longnt80 points
Long Nguyen
@longnt80
Aug 09 2017 23:13
@liamsy there is a plus sign before " is big"
@liamsy if your sentence is like this: "This is a dog" then you only need to do this: "This is a " + myNoun
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:14
@longnt80 but we dont have two plus signs like this "+myNoun+" "+myAdjective+"
CallMeOrange
@EgnaroDev
Aug 09 2017 23:15
+ would be considered as a string
Gulsvi
@gulsvi
Aug 09 2017 23:15
In mathematics, we don't use two plus signs in a row. It's the same with string concatentation. You are adding a string to a variable
CallMeOrange
@EgnaroDev
Aug 09 2017 23:15
"this is a string"
Gulsvi
@gulsvi
Aug 09 2017 23:15
'string' + variable + 'string' + variable + 'string'
CallMeOrange
@EgnaroDev
Aug 09 2017 23:16
@SkyC0der :wave:
iso
@iso1048
Aug 09 2017 23:16
@SkyC0der (stupid question) could you explain why they return different arrays please:
var myArr = 'freecode'.split('');
myArr.splice(0,1,"fast");
console.log(myArr);//["fast", "r", "e", "e", "c", "o", "d", "e"]

var myArr = 'freecode'.split('').splice(0,1,"fast");
console.log(myArr);//["f"]
Long Nguyen
@longnt80
Aug 09 2017 23:16

@liamsy see the difference?
"My dog is here" -> "My " + myNoun + " is here"
"This is my dog" -> "This is my " + myNoun

the plus sign is to combine string

Gulsvi
@gulsvi
Aug 09 2017 23:16
Hey @EgnaroDev :wave: how are you?
CallMeOrange
@EgnaroDev
Aug 09 2017 23:16
Good
iso
@iso1048
Aug 09 2017 23:16
@EgnaroDev good day at school?
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:16
thanks @longnt80
CamperBot
@camperbot
Aug 09 2017 23:16
liamsy sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 487 | @longnt80 |http://www.freecodecamp.com/longnt80
CallMeOrange
@EgnaroDev
Aug 09 2017 23:16
Yea
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:16
thanks @SkyC0der
CamperBot
@camperbot
Aug 09 2017 23:16
liamsy sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2352 | @skyc0der |http://www.freecodecamp.com/skyc0der
CallMeOrange
@EgnaroDev
Aug 09 2017 23:17
Nothing bad
Gulsvi
@gulsvi
Aug 09 2017 23:17
@gothamknight I don't know the answer to that question
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:18
what i understood is that there is a blank string between "+myNoun+" and "+myAdjective+"
Long Nguyen
@longnt80
Aug 09 2017 23:19
@liamsy what blank string?
CallMeOrange
@EgnaroDev
Aug 09 2017 23:19
"+myNoun+" "+myAdjective+" might cause errors
There is no + between them
Gulsvi
@gulsvi
Aug 09 2017 23:19
@gothamknight Actually, never mind. It's because .splice() returns the elements removed from the array, so that's what gets assigned to myArr
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:19
var result = ""; this is a blank string
aRtoo
@artoodeeto
Aug 09 2017 23:20
@gothamknight thanks bro i got it.

function myReplace(str, before, after) {


  if(before[0] === before[0].toUpperCase()){
     after = after.split('');
     afterNew = after.splice(0,1,after[0].toUpperCase());
     //console.log(after.join('')); 
     after = after.join('');

  }else if(before[0] === before[0].toLowerCase()){
     after = after.split('');
     afterNew = after.splice(0,1,after[0].toLowerCase());
     //console.log(after.join('')); 
     after = after.join('');
  }



  var myRegex = RegExp('(\\w*'+before+'\\w*)','gi');


  return str.replace(myRegex,after);
}
CallMeOrange
@EgnaroDev
Aug 09 2017 23:20
Oh, it is just a empty string
CamperBot
@camperbot
Aug 09 2017 23:20
artoodeeto sends brownie points to @gothamknight :sparkles: :thumbsup: :sparkles:
:warning: artoodeeto already gave gothamknight points
CallMeOrange
@EgnaroDev
Aug 09 2017 23:20
result contain empty string
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:20
@EgnaroDev i hope you got what i meant
Long Nguyen
@longnt80
Aug 09 2017 23:20
@liamsy no, you need space, like this: var result = " ", not result = ""
space between words
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:21
@longnt80 yeah sorry thats what i meant
CallMeOrange
@EgnaroDev
Aug 09 2017 23:21
@liamsy Oh, I understand now, since result contain " ", you do not need to use a variable, it would be better to use " " instead
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:22
@EgnaroDev yap
iso
@iso1048
Aug 09 2017 23:22
@SkyC0der so what makes .splice add 'fast' in myArr.splice(0,1,"fast"); ? this has got me confused
Gulsvi
@gulsvi
Aug 09 2017 23:23
@gothamknight .splice() changes the array in place - if you return the splice or assign it to a variable, you get the removed element(s) instead.
عبدالله بن علي نور
@liamsy
Aug 09 2017 23:24
really appreciate your time n help . thanks @longnt80
CamperBot
@camperbot
Aug 09 2017 23:24
:warning: liamsy already gave longnt80 points
liamsy sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
Gulsvi
@gulsvi
Aug 09 2017 23:24
@gothamknight Same idea with .push()
var myArr = [20,30,40];
myArr.push(50); 
console.log(myArr) // [20,30,40,50]
myArr = myArr.push(60)
console.log(myArr) // 5
because .push() returns the length of the new array
CallMeOrange
@EgnaroDev
Aug 09 2017 23:25
yeah, I return .push() sometime lol
Long Nguyen
@longnt80
Aug 09 2017 23:25
@liamsy np
CallMeOrange
@EgnaroDev
Aug 09 2017 23:26
No need to assign it to a variable or return it unless you want a length of an array
I'm going to take a shower
:v:
iso
@iso1048
Aug 09 2017 23:30

@SkyC0der yeah thought so. But like, if the right hand side gets resolved first, then shouldnt:

myArr = myArr.push(60);
myArr = [20,30,40,50,60];

I'm just being an idiot.

@SkyC0der did you see those new the last jedi images?
Gulsvi
@gulsvi
Aug 09 2017 23:32
@gothamknight a variable can't be equal to two things, so you'd have to do:
var myArr = [20, 30, 40];
myArr.push(50);
console.log(myArr); // [20, 30, 40, 50]
myArrLength = myArr.push(60);
console.log(myArr); // [20, 30, 40, 50, 60]
console.log(myArrLength); // 5
But yeah, the change to the array still happens, it's just lost if you assign .push() to the array variable
iso
@iso1048
Aug 09 2017 23:33
@SkyC0der i was trying to show that myArr.push(60) equates to [20,30,40,50,60], which would then be assigned to myArr (not a variable being equal to two things)
@SkyC0der but i think i get what you mean anyway. thanks
CamperBot
@camperbot
Aug 09 2017 23:33
gothamknight sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2353 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Aug 09 2017 23:34
Not sure what you mean, but glad I was able to help :)
And, yeah, I can't wait for the new movie :)
iso
@iso1048
Aug 09 2017 23:36

like,

myArr = myArr.push(60);
myArr = [20,30,40,50,60];

is analogous to a step in solving a maths problem, for example:
x = 20 + 30
x = 50
so just showing the step of resolving myArr.push(60).... @SkyC0der but yeah i got it