These are chat archives for FreeCodeCamp/HelpJavaScript

19th
Mar 2018
Brian
@BrianCodes33
Mar 19 2018 04:46
proud to have you part of the community
Vivek Nayyar
@vivek12345
Mar 19 2018 05:41
Anyone here who has built a instagram clone or a photo sharing app?
Wanted to understand the entire design process that he or she decided to go with
The db structure, what kind of db, caching layer, how to handle scaling etc etc
Stephen James
@sjames1958gm
Mar 19 2018 09:30
@BrianCodes33 thx
CamperBot
@camperbot
Mar 19 2018 09:30
sjames1958gm sends brownie points to @briancodes33 :sparkles: :thumbsup: :sparkles:
:cookie: 42 | @briancodes33 |http://www.freecodecamp.org/briancodes33
Joshua Frias
@Juke-Magic
Mar 19 2018 09:39
yo guys
i cant seem to load the data from url to console
how do i fix it?
Stephen James
@sjames1958gm
Mar 19 2018 09:50
@Juke-Magic See my comment on help front end chat
Makopa
@makopa
Mar 19 2018 12:22
class HospitalEmployee {
  constructor(name) {
    this._name = name;
    this._remainingVacationDays = 20;
  }

  get name() {
    return this._name;
  }
}

class Nurse extends HospitalEmployee {
  constructor(name, certifications) {
    super(name);
    this._certifications = certifications;
  } 
}
Good day campers. i just want to ask why do i need to put the "name" as argument for super() in my Nurse class ?
Sweet Coding :)
@SweetCodingInc
Mar 19 2018 12:24
@makopa Because constructor of HospitalEmployee expects one argument name.
Since you have extends HospitalEmployee the super(name) in Nurse will call the constructor of HospitalEmployee
Instantiating a class will instantiate the parent class as well
Makopa
@makopa
Mar 19 2018 12:28
i see, but if i only want to get access to the property of a parent class. i need to leave the super() argument empty?
@SweetCodingInc
Sweet Coding :)
@SweetCodingInc
Mar 19 2018 12:30
@makopa if you have extends clause on your classes, you MUST call super.
if you don't pass anything to super, the this._name will be undefined
Makopa
@makopa
Mar 19 2018 12:33
i see ! i get it now. thanks a lot @SweetCodingInc btw last quesiton is es6 is fully implemented now or do i need to use transpiler (not sure about the term) hehe
CamperBot
@camperbot
Mar 19 2018 12:33
makopa sends brownie points to @sweetcodinginc :sparkles: :thumbsup: :sparkles:
:cookie: 380 | @sweetcodinginc |http://www.freecodecamp.org/sweetcodinginc
Sweet Coding :)
@SweetCodingInc
Mar 19 2018 12:35
@makopa For most of the latest browsers, yes. (except for import and require).
But if you want your code to run on older browsers that don't support ES6, you must transpile.
if you're using import/require, you need to transpile your code anyway
and yes, transpiler is a correct term
Markus Kiili
@Masd925
Mar 19 2018 12:39
@makopa Much of front end production code js is still transpiled into ES5.
Makopa
@makopa
Mar 19 2018 12:40
@SweetCodingInc @Masd925 Copy! i ask coz last time i learn javascript is back in 2017, i though 2018 will be the full implementation of es6 to overthrown es5 hehe
Sweet Coding :)
@SweetCodingInc
Mar 19 2018 12:41
Those are the things that speculators want to jack off to.
Real world, the software needs to be kept running and is upgraded/migrated step by step.
There is no such thing as technology X was overthrown by technology Y overnight
Things fade away, but slowly... very...very... slowly :)
Makopa
@makopa
Mar 19 2018 12:44
ayt! i agree. my learning materials source changes too i got surprise. they start using es6 .
Markus Kiili
@Masd925
Mar 19 2018 12:45
@makopa Commercial sites need to work with old browsers too usually.
Makopa
@makopa
Mar 19 2018 12:51
@Masd925 noted!
Jason Luboff
@JLuboff
Mar 19 2018 15:14
:wave:
Nate Mallison
@NJM8
Mar 19 2018 16:30
All of my sites only conform to ES9. If the committee takes all my recommendations I'll be way ahead of the curve. :smile:
Jason Luboff
@JLuboff
Mar 19 2018 16:36
Staying bleeding edge
Chris
@ConnectCodes
Mar 19 2018 17:22
H guys stuck on "Exact Change” challenege. I get first few currencies correctly["TWENTY", 60], ["TEN", 20]but after it doesn’t work and while loop is exited. When Total = 9500 it should stop inner while loop and set i = 4 but it doesn’t. I feel like there is problem with condition currencyAmount[i] > local) && (changeCent > total)
https://codepen.io/Codeconnect/pen/dZQygY?editors=0011
Dardan Demiri
@dardandmr
Mar 19 2018 18:37

Hi everybody, so far I made the RegEx to select if the phone number is valid

But the only problem is testing if it has Opened and Closed ()


function telephoneCheck(str) {

  var reg = /^[\(]?(?:1[\s|\(]*)?\d{3}[-|\s|\)]*?\d{3}[-|\s]*?\d{4}$/;

  return reg.test(str);
}

telephoneCheck("555)-555-5555"); // Should return false but returns true

The regex for testing the opening and closing ()
is this:

 \((?=.*?\))

But when I add it:

^[\((?=.*?\))]?(?:1[\s|\((?=.*?\))]*)?\d{3}[-|\s|\)]*?\d{3}[-|\s]*?\d{4}$
It won't work
I think the way I have added it is wrong
but don't know how the right way is
Tiago Correia
@tiagocorreiaalmeida
Mar 19 2018 19:55
@dardandmr I will recommend you regex101.com
if you still need help after that and if you dont figure out your issue I willhelp for sure
Jason Luboff
@JLuboff
Mar 19 2018 19:58
Suuurrree you will
Amit Patel
@AmitP88
Mar 19 2018 19:59

hey guys, just polished up my pomodoro timer (not 100% finished yet, I want to add a countdown border for better visuals). Can you guys see if you can break it? I want to make sure the functionality has no hiccups :)

https://amitp88.github.io/Pomodoro-Timer/

Tiago Correia
@tiagocorreiaalmeida
Mar 19 2018 20:00
@JLuboff ahahah come on
regex is the kind of thing you have to get your hands on and test to start to get used
from my experience, I used to run from regex
I still do in certain situations
Jason Luboff
@JLuboff
Mar 19 2018 20:01
Haha I know. I'm slowly getting better at regex but still not great
Arturo Mago
@ArturoMago
Mar 19 2018 20:01
@AmitP88 The stopwatch when it starts for example 24:40 and you hit "+" should increase to 25:40. since the reset button exists and when you give it more it is resetting the same time clock
Matej Bošnjak
@mbosnjak01
Mar 19 2018 20:01
@AmitP88 Now add multiple timers at once and some alarm sound for each time some countdown comes to 0, or even a warning when a counter comes to a certain time, for example from 25:00 to 05:00 - a sound alert that countdown will finish soon ..., and alarm sound could be one randomly taken from a list of sounds from some file :D
Amit Patel
@AmitP88
Mar 19 2018 20:02
@ArturoMago oh yeah, it was like that at first, but I thought that looked awkward to do?
@mbosnjak01 wow, that's a lot! lol but good ideas ;)
Matej Bošnjak
@mbosnjak01
Mar 19 2018 20:04
Now that I look at it ... and I see I didn't do pomodoro s.. I could try that
Cause I need that kind of times on my PC anyway, might as well do it in electron
Adel
@AdelMahjoub
Mar 19 2018 20:06
:cactus: :cactus: :sunny:
Matej Bošnjak
@mbosnjak01
Mar 19 2018 20:06
Hell I could do whole app do manage my free time better ... :D
Amit Patel
@AmitP88
Mar 19 2018 20:06
@ArturoMago I could change it to your suggestion easily, but I just thought that most stopwatch timers reset the seconds to 0 when changing the minutes
Tiago Correia
@tiagocorreiaalmeida
Mar 19 2018 20:07
hey @AdelMahjoub
Adel
@AdelMahjoub
Mar 19 2018 20:07
@tiagocorreiaalmeida hey
Amit Patel
@AmitP88
Mar 19 2018 20:07
@mbosnjak01 lol I could probably spend a month scaling up my timer :P
add all sorts of craziness to it
Matej Bošnjak
@mbosnjak01
Mar 19 2018 20:10
It's not timer I am concerned about anymore ... I'll add a lot of stuff in that one ... calendar and events, might even connect it to some sound and data analitics api .. database could be implemented as well for local usage ... I should start writting down on a paper
Amit Patel
@AmitP88
Mar 19 2018 20:11
lol damn haha
dont forget, fcc still has more projects ahead
Matej Bošnjak
@mbosnjak01
Mar 19 2018 20:11
  • show events nearby based on your interests and what you do in spare time
this is better :D
Amit Patel
@AmitP88
Mar 19 2018 20:11
that sounds interesting :)
Matej Bošnjak
@mbosnjak01
Mar 19 2018 20:13
or ... do electron app for desktop, place a database on a server, and have people create accounts for the app so I could make a mobile app conversion as well
would be nice
and implement a local storage for when the app isn't connected to the internet
wow .. too much for one day >:|
Jason Luboff
@JLuboff
Mar 19 2018 20:22
@mbosnjak01 Is electron worth while to learn?
Matej Bošnjak
@mbosnjak01
Mar 19 2018 20:23
Depends if you have some app idea. There are a lot of adds for electron, and even electron - react / angular / laravel and other bundles on github. I also did read several articles on is it worth to learn or not .. some say it is, some say it sucks ... so I couldn't tell you honestly
And also you can use OS features to extend your app as well
Jason Luboff
@JLuboff
Mar 19 2018 20:25
Gotcha. I would be using it for applications strictly used within our intranet
Matej Bošnjak
@mbosnjak01
Mar 19 2018 20:27
@JLuboff Electron apps gave more memory usage than apps run in browser we daily use
but i don't think the difference is high
depends on the app XD
Jason Luboff
@JLuboff
Mar 19 2018 20:32
Fair enough, I may try it out
Matej Bošnjak
@mbosnjak01
Mar 19 2018 20:35
I'm just not sure if I should approach it with some framework bundle like angular 5, since I barely know it, although I'd be learning it in the same time.
Jason Luboff
@JLuboff
Mar 19 2018 20:36
I'd probably still use bulma/bootstrap :joy: Eventually I'll get on that React bandwagon
Matej Bošnjak
@mbosnjak01
Mar 19 2018 20:36
react sounds like a better solution
for the one i have in mind
cause i'll have dinamically generated templates based on user input
I have never used bulma ... what's the difference between that and bootstrap?
Jason Luboff
@JLuboff
Mar 19 2018 20:39
Just a different frontend CSS framework. No javascript. Less to it too but I like it
Matej Bošnjak
@mbosnjak01
Mar 19 2018 20:40
I'll check that out, cause Bootstrap 4 gives me chills every time i open it's documentation
XD
Jason Luboff
@JLuboff
Mar 19 2018 20:41
Give it a look, I've used it for several projects. There's themes out there for it too (like bootswatch themes)
Matej Bošnjak
@mbosnjak01
Mar 19 2018 20:42
I definitely will. When Bootstrap 4 alpha got in a way, switching from 3 to 4 was painfull, in the end i just avoided bootstrap in general xD
Jason Luboff
@JLuboff
Mar 19 2018 20:45
I've been partially avoiding bootstrap until 4 is complete (unless it is now?)
Matej Bošnjak
@mbosnjak01
Mar 19 2018 20:46
i think it is
Jason Luboff
@JLuboff
Mar 19 2018 20:47
Ya looks like it is
Brian
@BrianCodes33
Mar 19 2018 21:02
4 isnt that bad
im using react materialize. saying i have syntax error here. ideas?
class Results extends Component {
    let responses = this.props.result.map((response) =>
      <CollectionItem>{response}</CollectionItem>
    );
    render() {
      return (
        <Collection>{responses}</Collection>
      );
    }
}
alpox
@alpox
Mar 19 2018 21:13
@BrianCodes33
   let responses = this.props.result.map((response) =>
      <CollectionItem>{response}</CollectionItem>
    );
You cannot put expressions/statements directly inside a class
You have to put this inside of render() {
class Results extends Component {
    render() {
      let responses = this.props.result.map((response) =>
        <CollectionItem>{response}</CollectionItem>
      );
      return (
        <Collection>{responses}</Collection>
      );
    }
}
Brian
@BrianCodes33
Mar 19 2018 21:18
thanks @alpox
CamperBot
@camperbot
Mar 19 2018 21:18
briancodes33 sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1589 | @alpox |http://www.freecodecamp.org/alpox
Tiago Correia
@tiagocorreiaalmeida
Mar 19 2018 22:39
@AdelMahjoub can you try to challenge me for a fight on codefights ? I have no idea where the button to request a fight went lol
Adel
@AdelMahjoub
Mar 19 2018 22:42
@tiagocorreiaalmeida no button to challenge
Tiago Correia
@tiagocorreiaalmeida
Mar 19 2018 22:42
strange :\
Jason Luboff
@JLuboff
Mar 19 2018 22:48
... sure is annoying to go back and refactor code and save ~750 lines just becuase you actually take advantage of your templating engine :worried:
Stephen James
@sjames1958gm
Mar 19 2018 23:09
@JLuboff But it is satisfying to see all that nice new clean code
Jason Luboff
@JLuboff
Mar 19 2018 23:10
@sjames1958gm True... but argh.. I made things so much more difficult for myself before. I guess part of the problem is designing my database as I go as opposed to starting with a fully designed database
Stephen James
@sjames1958gm
Mar 19 2018 23:11
@JLuboff So you get a nice lesson as well, lose, win win :)
https://youtu.be/SJUhlRoBL8M
Jason Luboff
@JLuboff
Mar 19 2018 23:12
:joy:
FlashHero
@FlashHero
Mar 19 2018 23:13
:smile: