These are chat archives for FreeCodeCamp/HelpJavaScript

12th
Nov 2018
Lia-Sue-Kim
@Lia-Sue-Kim
Nov 12 2018 00:00
I can't give example with programming that's why im asking but using css and bootstrap are different
CSS is kinda you do everythihng yourself and bootstrap is something like you typpe responsive and it becomes responsive
is it the same with programming
Tom
@moT01
Nov 12 2018 00:01
not sure what you mean by programming
css and bootstrap are programming I would say
Lia-Sue-Kim
@Lia-Sue-Kim
Nov 12 2018 00:01
Not really
Tom
@moT01
Nov 12 2018 00:01
bootstrap is just all CSS under the hood
in the same way that any javascript library is just JS under the hood
Lia-Sue-Kim
@Lia-Sue-Kim
Nov 12 2018 00:02
by programming I meant actual programming language like JS php java etc
Tom
@moT01
Nov 12 2018 00:02
well, it's not the same
Lia-Sue-Kim
@Lia-Sue-Kim
Nov 12 2018 00:02
What is not the same
Tom
@moT01
Nov 12 2018 00:03
css/bootstrap vs JS/php/java
Lia-Sue-Kim
@Lia-Sue-Kim
Nov 12 2018 00:04
so
or like?
Tom
@moT01
Nov 12 2018 00:06
im confused
I would recommend the fcc javascript stuff
Lia-Sue-Kim
@Lia-Sue-Kim
Nov 12 2018 00:08
lol
okay thank you
Tom
@moT01
Nov 12 2018 00:10
you can certainly come ask me any questions, I'm around here often
Lia-Sue-Kim
@Lia-Sue-Kim
Nov 12 2018 00:11
good to know and I will ask as I'm learning JS
Pagnito
@Pagnito
Nov 12 2018 01:25
does chrome have its own password manage ?
like that thing always asking to save passwords, is that a password manager?
Christopher McCormack
@cmccormack
Nov 12 2018 01:49
@Pagnito yeah
Pagnito
@Pagnito
Nov 12 2018 01:49
thnx
Shubham soni
@shubhamsoni2617
Nov 12 2018 12:14
let newArr=[];
//saving api in movie details
let movieDetails="https://gist.githubusercontent.com/shubhamsoni2617/8af0e188cfaa5497174cb3621ca17b95/raw/1972e00d6f112ac533b849496c5a1e41b9ed2655/movie1.json";
//fetching data 
let promise=fetch(movieDetails).then(response=>response.json()).then(json=>{console.log(json[1]["title"])
let details=json[0]["title"]
console.log(details);
//trying to push data into newArr...but it isn't working..
newArr.push(json);
console.log(newArr);
}).
catch(err=>console.log(err));
console.log(newArr);
why does transferring data from api to global variable not working...
what shall I do to make it working?//
Johnny
@JohnnyBizzel
Nov 12 2018 14:25
@shubhamsoni2617 update the global variable inside the fetch
Jason Luboff
@JLuboff
Nov 12 2018 16:10
Morning :wave:
Christopher McCormack
@cmccormack
Nov 12 2018 16:41
@JLuboff heya morning
Jason Luboff
@JLuboff
Nov 12 2018 16:44
Whats up
Christopher McCormack
@cmccormack
Nov 12 2018 16:44
busy busy
Can't believe how many calls I have today, on a holiday
Jason Luboff
@JLuboff
Nov 12 2018 16:44
That sucks
Christopher McCormack
@cmccormack
Nov 12 2018 16:45
yeah all day then 8PM as well
what about you?
Jason Luboff
@JLuboff
Nov 12 2018 16:45
Just doing my morning checks before getting to some programming
Christopher McCormack
@cmccormack
Nov 12 2018 16:46
that sounds nice
I want to get to programming haha
Jason Luboff
@JLuboff
Nov 12 2018 16:47
Lol
Still gotta figure out how to break my state apart so I can have seperate classes...but..I'll get there hopefully today
Or I should say break my single class apart so I can have seperate classes with seperate states
Christopher McCormack
@cmccormack
Nov 12 2018 16:49
It's tough, I still don't always know where or how I should break it out
like should I pass a few components to a child component directly, or hardcode those in the child component itself
it all comes down to reusability I guess but you don't always know what you'll reuse later
Jason Luboff
@JLuboff
Nov 12 2018 16:51
Ya true....its just at this point my state inside my class is getting large along with all the different functions... bit hard to keep track of
Christopher McCormack
@cmccormack
Nov 12 2018 16:54
I know you don't feel like jumping in yet but maybe today is a good time to check out the context api
it's React's state management
You can have multiple contexts as well, and only wrap the components that depend on it with the provider
Jason Luboff
@JLuboff
Nov 12 2018 16:56
Perhaps I will give it a try
I was giving the docs a bit of a read again on Saturday
Slowly getting a better understanding
Like..I answered a question about React...very impressive
Tom
@moT01
Nov 12 2018 16:58
hello
Jason Luboff
@JLuboff
Nov 12 2018 16:58
Howdy
Christopher McCormack
@cmccormack
Nov 12 2018 16:59
@JLuboff I think I saw that, awesome
@moT01 heya morning
@moT01 I'm making progress on the local conflict resolution stuff
@moT01 better to rebase than to merge is my current understanding
Jason Luboff
@JLuboff
Nov 12 2018 17:07
Word
Christopher McCormack
@cmccormack
Nov 12 2018 17:09
@JLuboff FCC repo is freakin nuts, there are 10000 pull requests right now, dozens of commits a day
a PR from 20 days ago is now way off the master so if you have to resolve conflicts you have to be really careful
Jason Luboff
@JLuboff
Nov 12 2018 17:10
Ah... you're in charge of that?
Tom
@moT01
Nov 12 2018 17:16
:sucky:
no, he's not in charge - there's quite a few people going over the PR's and trying to get them merged
Jason Luboff
@JLuboff
Nov 12 2018 17:18
Ah
Tom
@moT01
Nov 12 2018 17:19
there was close to 11,000 PR's after hacktoberfest
we're down to almost 9900
Jason Luboff
@JLuboff
Nov 12 2018 17:20
Damn..
Tom
@moT01
Nov 12 2018 17:24
you should come get in on the action
Jason Luboff
@JLuboff
Nov 12 2018 17:24
If only I had time :P
Christopher McCormack
@cmccormack
Nov 12 2018 18:14
@JLuboff it's a good learning experience man, I don't have time either but it's helping me force myself to learn git better
Jason Luboff
@JLuboff
Nov 12 2018 18:14
I have no doubt its a good learning experience :)
but right now I'm racking my brain on how to close off this <div> and create another one based on inner maps (if any of that makes sense lol)
Christopher McCormack
@cmccormack
Nov 12 2018 18:16
@JLuboff haha didn't we solve that one a few weeks ago? :D
Jason Luboff
@JLuboff
Nov 12 2018 18:16
Nah...this is a different one :)
Christopher McCormack
@cmccormack
Nov 12 2018 18:18
I ran into a weird one just last night, tables and stuff like that can be difficult to properly design in React sometimes
Jason Luboff
@JLuboff
Nov 12 2018 18:18
Ya... I'll send you a message and see if you have any quick insight
Christopher McCormack
@cmccormack
Nov 12 2018 18:19
@JLuboff probably not quick today my friend but I'll try
creator0323
@Amasian
Nov 12 2018 18:22
Hello, Everyone! these days, I am studying Javascript design pattern. I learned that it is not recommended to use global variables. When I work with DOM however, I don't know how not to use global variables. such as, eventListener, I usually specify global variables for Elements and after that, I addEvent with 'addEventListener'. Is there any pattern I can add events to Elements without Using global variables? Thank you so much for your time! Have a wonderful day!
Christopher McCormack
@cmccormack
Nov 12 2018 18:23
I believe they mean you don't store values on the global object, but you can use global variables all you want
Kudzu
@czhower
Nov 12 2018 18:23
@Amasian It doesnt mean not to USE existing globals, it means dont create new ones for your code.
creator0323
@Amasian
Nov 12 2018 18:27
so basically, I can specify and use essential variables. Then what are considered less essential global variables? could you give me answers or examples if you don't mind?
Pagnito
@Pagnito
Nov 12 2018 18:31
hey i need some advice on setting up postgres on my machine
the course im doing isnt going into a lot of detail, so im watchin a yotube video and the guy is using the postres App method, i was wondering if anyone here uses other methods and which ones are optimal if there isa difference
Christopher McCormack
@cmccormack
Nov 12 2018 18:33
I've not used it sorry
Kudzu
@czhower
Nov 12 2018 19:07
do you mean app vs service?
Brad
@bradtaniguchi
Nov 12 2018 20:16
new feature alert :D
Christopher McCormack
@cmccormack
Nov 12 2018 20:44
@bradtaniguchi for what? Work?
Brad
@bradtaniguchi
Nov 12 2018 20:45
Yea, just wanted to say something cuse I was bored
Christopher McCormack
@cmccormack
Nov 12 2018 21:02
@bradtaniguchi haha
well good luck on the feature, remember you get paid by the line so fill it up!
Brad
@bradtaniguchi
Nov 12 2018 21:14
@cmccormack thanks :P
creator0323
@Amasian
Nov 12 2018 21:20
when do you think we need to use OOP or functional programming? Could you let me know the pros and cons?
mnedzka
@mnedzka
Nov 12 2018 21:21
Hey good people! How I can return two objects in an array instead of one in this task? :) https://jsfiddle.net/a8kqf954/5/
Brad
@bradtaniguchi
Nov 12 2018 21:22
@Amasian They are two different ways to approach solving a problem
You technically don't need to use either for a given problem. Some are easier thought about and reasoned easier about for some use-cases tho.
A good example would be using OOP for game development. OOP allows you to think of everything in the game as objects, thus it's easier to reason about since it translates better to our real world environment.
You can think of doing math as a form of functional programming, where each operation results in an output, that is always the same given the same arguments, and has no "side-effects".
creator0323
@Amasian
Nov 12 2018 21:28
@bradtaniguchi Thank you for your detailed advice! then, Is it reasonable to use OOP for big project and FP for relatively small project such as library development?
Brad
@bradtaniguchi
Nov 12 2018 21:29
@Amasian I wouldn't say reasonable, it just one way to do it yes. Neither is "better" for most use-cases. I mean OOP works for big projects, and small projects, and functional can be used for large projects and small aswell.
I would say the difference lies in the actual problem domain. For example, I know you CAN do large scale multi-threaded applications in OOP, but functional languages have more potential due to having no sharedstate, thus they scale better.
but your making some basic utilities, Id say neither really matters much overall
creator0323
@Amasian
Nov 12 2018 21:32
then I will be able to have broad perspective when I more grow up as a developer
then for now, I think I need to study both patterns
@bradtaniguchi I really appreciate your advice :) thank you
Brad
@bradtaniguchi
Nov 12 2018 21:35
@Amasian Yes, if your just starting out its good to know both, the advantages, how they approach solving problems and disadvantages. It's very likely you will run into more OOP, as it's the more popular of the two, but as I mentioned earlier it's not because "its better" but rather it just the more popular one of the two.
creator0323
@Amasian
Nov 12 2018 21:36
@bradtaniguchi Okay, studying both, I will try to know what is pros and cons of the each pattern
Pagnito
@Pagnito
Nov 12 2018 21:37
anyone use postgresql?
Brad
@bradtaniguchi
Nov 12 2018 21:41
@Pagnito Nope, i've only used mysql
Jason Luboff
@JLuboff
Nov 12 2018 21:59
I'm sort of okay with MS SQL
Jason Luboff
@JLuboff
Nov 12 2018 22:09

Anybody see anything wrong with this

  <div className="container" style={{"margin": "50px 0px 50px 0px"}}>

The inline styling isn't applying correctly.. But if I do marginBottom and marginTop seperately, it works fine

To be clearer... this works
<div className="container" style={{"marginBottom": "50px", "marginTop" : "50px"}}>
Christopher McCormack
@cmccormack
Nov 12 2018 22:11
@JLuboff not 0px, just 0
Jason Luboff
@JLuboff
Nov 12 2018 22:12
Same thing :shrug:
It pushes the element partially off screen lol
Brad
@bradtaniguchi
Nov 12 2018 22:12
@JLuboff what about: margin: 50px 0px?
Christopher McCormack
@cmccormack
Nov 12 2018 22:13
did you add * { box-sizing: border-box;}?
Jason Luboff
@JLuboff
Nov 12 2018 22:13
@bradtaniguchi Same issue. It looked like React was shortening it to that anyhow
@cmccormack No sir
Not to say the CSS framework doesn't have that though
Brad
@bradtaniguchi
Nov 12 2018 22:13
hmm, react must change it for some reason
Jason Luboff
@JLuboff
Nov 12 2018 22:14
Its not the biggest deal to have to specify marginBottom and top but odd that margin doesn't work
Christopher McCormack
@cmccormack
Nov 12 2018 22:16
@JLuboff can you make a codepen?
Jason Luboff
@JLuboff
Nov 12 2018 22:18
I'll see if there is the same behavior in there, but as I said not a big deal
Meh...I give up...won't work in codepen lol
Tom
@moT01
Nov 12 2018 22:23
lets see the pen
Jason Luboff
@JLuboff
Nov 12 2018 22:23
I already closed it without saving :joy:
Jason Luboff
@JLuboff
Nov 12 2018 22:26
Just thought of something.....the container class has its own set of margins... I was most likely overriding that due to setting right/left 0px
:stuck_out_tongue_closed_eyes:
Christopher McCormack
@cmccormack
Nov 12 2018 22:28
Jason Luboff
@JLuboff
Nov 12 2018 22:29
Yes yes
Pretty sure its the reason I posted above
Christopher McCormack
@cmccormack
Nov 12 2018 22:30
probably :)
harder to visualize margin than I expected
Jason Luboff
@JLuboff
Nov 12 2018 22:32
Ya
Simon Cordova
@gbsimon87
Nov 12 2018 22:37
hey all
Jason Luboff
@JLuboff
Nov 12 2018 22:38
Yo
Simon Cordova
@gbsimon87
Nov 12 2018 22:43
whats happening, hows that margin treating you
Jason Luboff
@JLuboff
Nov 12 2018 22:43
Better now that I know I'm just an idiot :)
Simon Cordova
@gbsimon87
Nov 12 2018 22:48
Oh man, I wish I could say the same
I'm so stuck at a task for work it's not even funny
I'm like 5 days behind and still can't get it
Jason Luboff
@JLuboff
Nov 12 2018 22:49
Difficult task it sounds like
Simon Cordova
@gbsimon87
Nov 12 2018 22:49
Shoot me
how was the weekend
Jason Luboff
@JLuboff
Nov 12 2018 22:50
Not bad...except no internet (which meant no TV either) from Friday afternoon until Saturday evening
you
Simon Cordova
@gbsimon87
Nov 12 2018 22:53
No internet, hard to imagine life without
I spent it taking React courses and went out one night, good night, nothing special
It's kind of different going to bars these days with no intention of picking up lol
I got old :/
Jason Luboff
@JLuboff
Nov 12 2018 22:54
We had cellular but...didn't want to use up our data :-/
I've never been a bar person
Simon Cordova
@gbsimon87
Nov 12 2018 22:59
I've been a bar guy, and hard not to be when out in London, but never much a nightclub guy, nor even when young
Found them so toxic and pretentious
Jason Luboff
@JLuboff
Nov 12 2018 23:00
Only been to a few nightclubs..lol
Simon Cordova
@gbsimon87
Nov 12 2018 23:17
You aren't missing much, festivals however I can do nicely
want to burning man one day
Jason Luboff
@JLuboff
Nov 12 2018 23:19
Never been lol
Simon Cordova
@gbsimon87
Nov 12 2018 23:23
I went to the first Wayhome, which is in Ontario, the province which Toronto is in - I loved it
There was also a group of about 20 of us all from primary schools plus respective significant others, I think that made it more special
Jason Luboff
@JLuboff
Nov 12 2018 23:26
Now you're just settling down like a square :{P
Simon Cordova
@gbsimon87
Nov 12 2018 23:55
(in a box)