These are chat archives for FreeCodeCamp/Help

1st
Nov 2017
artbohr
@artbohr
Nov 01 2017 00:00
@AdelMahjoub thank you, but I was looking to make a more react legacy styled app
CamperBot
@camperbot
Nov 01 2017 00:00
artbohr sends brownie points to @adelmahjoub :sparkles: :thumbsup: :sparkles:
:cookie: 604 | @adelmahjoub |http://www.freecodecamp.com/adelmahjoub
Albert Cardona II
@daddycardona
Nov 01 2017 01:08
@alexandrupintilei I am sorry I literally fell asleep on you :)
Donnie
@Donnie-D
Nov 01 2017 01:10
can someone please explain how passing a outer function to a variable below made the inner function being called?
<button type="button" onclick="myFunction()">Count!</button>

<p id="demo">0</p>

<script>
var add = function () {
    var counter = 0;
    return function () {return counter += 1;}
}();

function myFunction(){
    document.getElementById("demo").innerHTML = add();
}
</script>
Donnie
@Donnie-D
Nov 01 2017 01:15
if i call document.getElementById("demo").innerHTML = add; only then that doesn't run the inner function but putting () next to add makes inner function run. can someone tell me how this works?
Darren
@DarrenfJ
Nov 01 2017 01:22
evening fCC
Morchid Chellali
@Morched23MJ
Nov 01 2017 01:23
Good evening, @DarrenfJ
Albert Cardona II
@daddycardona
Nov 01 2017 01:29
@Donnie-D because when you put the = add you're not calling a function you're calling a variable that is not define, everytime you call a function it is called with a () look at all the functions being called in the challenges either calledFunction() or calledFunction(a,b) :)
good evening @DarrenfJ
@khaduch @alexanderkopke @GitHub-Henry @Manish-Giri @thekholm80 @heroiczero @korzo @longnt80 @sjames1958gm @Marmiz @DarrenfJ TY for helping out everyday
CamperBot
@camperbot
Nov 01 2017 01:30
daddycardona sends brownie points to @khaduch and @alexanderkopke and @github-henry and @manish-giri and @thekholm80 and @heroiczero and @korzo and @longnt80 and @sjames1958gm and @marmiz and @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1985 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 1691 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
:star2: 3440 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 6730 | @manish-giri |http://www.freecodecamp.com/manish-giri
:cookie: 438 | @github-henry |http://www.freecodecamp.com/github-henry
:cookie: 630 | @longnt80 |http://www.freecodecamp.com/longnt80
:cookie: 710 | @korzo |http://www.freecodecamp.com/korzo
:star2: 1555 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 2216 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 8641 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 1069 | @marmiz |http://www.freecodecamp.com/marmiz
Long Nguyen
@longnt80
Nov 01 2017 01:33
@daddycardona ty :sparkles:
@daddycardona thanks
CamperBot
@camperbot
Nov 01 2017 01:33
longnt80 sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 438 | @daddycardona |http://www.freecodecamp.com/daddycardona
Albert Cardona II
@daddycardona
Nov 01 2017 01:38
I don't usually do that all the time :)
so what is up @longnt80
Long Nguyen
@longnt80
Nov 01 2017 01:38
preparing for another interview today
Albert Cardona II
@daddycardona
Nov 01 2017 01:38
I am about to do this phone number challenge soon
Nice I hope you get the job of your dreamn :)
Long Nguyen
@longnt80
Nov 01 2017 01:38
just had one interview yesterday too
Albert Cardona II
@daddycardona
Nov 01 2017 01:38
dreams
Long Nguyen
@longnt80
Nov 01 2017 01:39
thanks, I hope so :D
Albert Cardona II
@daddycardona
Nov 01 2017 01:39
nice I have not worked since last year but I am also retired :)
about to go to school for electronic repairs though and try to get a job there
Long Nguyen
@longnt80
Nov 01 2017 01:40
why do you want to learn programming?
Albert Cardona II
@daddycardona
Nov 01 2017 01:42
I want to do web sights
sites
and I also want to do more than just that like truly understand one language and be able to do more than just one type of coding explore the possibilities
Long Nguyen
@longnt80
Nov 01 2017 01:43
like a hobby
Albert Cardona II
@daddycardona
Nov 01 2017 01:44
both hobby and work but I need more money and that is paid with my military grant and also haves some stuff to learn with just C as well for the commands of certain machines :)
hey I am about to get off this chat so I can start playing some xbox :)
Long Nguyen
@longnt80
Nov 01 2017 01:45
:D nice
haven't played game for a long time
I'll be back to my preparation
Kyle Holm
@thekholm80
Nov 01 2017 04:03
@daddycardona @Manish-Giri @DarrenfJ @heroiczero ty
CamperBot
@camperbot
Nov 01 2017 04:03
thekholm80 sends brownie points to @daddycardona and @manish-giri and @darrenfj and @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 2217 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 1986 | @heroiczero |http://www.freecodecamp.com/heroiczero
:cookie: 439 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 6731 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Nov 01 2017 05:16
@thekholm80 @DarrenfJ @heroiczero @daddycardona @longnt80 @khaduch @alexanderkopke @GitHub-Henry @sjames1958gm @Marmiz ty
CamperBot
@camperbot
Nov 01 2017 05:16
manish-giri sends brownie points to @thekholm80 and @darrenfj and @heroiczero and @daddycardona and @longnt80 and @khaduch and @alexanderkopke and @github-henry and @sjames1958gm and @marmiz :sparkles: :thumbsup: :sparkles:
:cookie: 440 | @daddycardona |http://www.freecodecamp.com/daddycardona
:cookie: 439 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 1556 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 1987 | @heroiczero |http://www.freecodecamp.com/heroiczero
:cookie: 631 | @longnt80 |http://www.freecodecamp.com/longnt80
:star2: 2218 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 3441 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 1070 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 8642 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 1693 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
Anthony DeSordi
@desordi3
Nov 01 2017 05:55
if anyones up, any reason why my code isnt working? i just want a box shadow to happen on mousedown events

$("button").on("mousedown", function() {
$("button").css(
"box-shadow", "0 12px 16px 0 rgba(0,0,0,0.24)", "0 17px 50px 0 rgba(0,0,0,0.19)"
);

});

Long Nguyen
@longnt80
Nov 01 2017 06:23
@Manish-Giri thanks :fire:
CamperBot
@camperbot
Nov 01 2017 06:23
longnt80 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6732 | @manish-giri |http://www.freecodecamp.com/manish-giri
Long Nguyen
@longnt80
Nov 01 2017 06:24
@desordi3 why there are 2 values for box-shadow: "0 12px 16px 0 rgba(0,0,0,0.24)", "0 17px 50px 0 rgba(0,0,0,0.19)?
Henry
@GitHub-Henry
Nov 01 2017 06:32
@daddycardona hello & thank you
CamperBot
@camperbot
Nov 01 2017 06:32
github-henry sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 441 | @daddycardona |http://www.freecodecamp.com/daddycardona
Stephen
@TeddyHugs
Nov 01 2017 06:42
Hey all :D
Anthony DeSordi
@desordi3
Nov 01 2017 07:01
@longnt80 ended up figuring it out. thank you though!
CamperBot
@camperbot
Nov 01 2017 07:01
desordi3 sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 632 | @longnt80 |http://www.freecodecamp.com/longnt80
Manikanth
@manikanth1024
Nov 01 2017 08:03
Hi I need your help
I created a program that sends 1000 push notifs to users
but its taking much time to completed how do i divide this and execute this program on multiple computers and sync with them?
heroiczero
@heroiczero
Nov 01 2017 10:31
@thekholm80 @DarrenfJ @daddycardona @longnt80 @khaduch @alexanderkopke @GitHub-Henry @sjames1958gm @Marmiz ty @Manish-Giri
CamperBot
@camperbot
Nov 01 2017 10:31
heroiczero sends brownie points to @thekholm80 and @darrenfj and @daddycardona and @longnt80 and @khaduch and @alexanderkopke and @github-henry and @sjames1958gm and @marmiz and @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 1557 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:cookie: 442 | @daddycardona |http://www.freecodecamp.com/daddycardona
:cookie: 633 | @longnt80 |http://www.freecodecamp.com/longnt80
:cookie: 440 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 2219 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 1694 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
:star2: 1071 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 3442 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 8643 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 6733 | @manish-giri |http://www.freecodecamp.com/manish-giri
Alexander Køpke
@alexanderkopke
Nov 01 2017 10:34
@heroiczero @thekholm80 @DarrenfJ @daddycardona @longnt80 @khaduch @GitHub-Henry @sjames1958gm @Marmiz ty @Manish-Giri
CamperBot
@camperbot
Nov 01 2017 10:34
alexanderkopke sends brownie points to @heroiczero and @thekholm80 and @darrenfj and @daddycardona and @longnt80 and @khaduch and @github-henry and @sjames1958gm and @marmiz and @manish-giri :sparkles: :thumbsup: :sparkles:
:cookie: 443 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 1558 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 1072 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 3443 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 1988 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 2220 | @darrenfj |http://www.freecodecamp.com/darrenfj
:cookie: 441 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 6734 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 8644 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:cookie: 634 | @longnt80 |http://www.freecodecamp.com/longnt80
Alex
@alexandrupintilei
Nov 01 2017 12:40
What i need to make navbar items to be responsive(when i click on it,to directionate me to a specific page in site) ?
Fabien SHAN
@X140hu4
Nov 01 2017 13:55
@alexandrupintilei You want to click on a link that moves your view to a specific section of your page?
Alex
@alexandrupintilei
Nov 01 2017 14:04
@X140hu4 yes,but i figure it out.thx anyway
Sudhanshu Mishra
@rocky3031
Nov 01 2017 14:26
hai koi??
Dirk W du Plooy
@dirkduplooy
Nov 01 2017 15:39
Hi Everybody, do any of you possibly have links to a basic setup for Visual Studio Code and essential extensions for the first part of the course CSS and HTML5?
Albert Cardona II
@daddycardona
Nov 01 2017 16:54
all you need is vscode but all you have to do is click the extentions button
@dirkduplooy
all you have to do is google what extensions are best for what you want :)
Albert Cardona II
@daddycardona
Nov 01 2017 17:51
anyone on?
@thekholm80 @DarrenfJ @daddycardona @longnt80 @khaduch @alexanderkopke @GitHub-Henry @sjames1958gm @Marmiz ty @Manish-Giri
CamperBot
@camperbot
Nov 01 2017 17:56
daddycardona sends brownie points to @thekholm80 and @darrenfj and @longnt80 and @khaduch and @alexanderkopke and @github-henry and @sjames1958gm and @marmiz and @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 2221 | @darrenfj |http://www.freecodecamp.com/darrenfj
:cookie: 635 | @longnt80 |http://www.freecodecamp.com/longnt80
:star2: 1695 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
:star2: 1073 | @marmiz |http://www.freecodecamp.com/marmiz
:cookie: 442 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 8648 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 3444 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 1559 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 6737 | @manish-giri |http://www.freecodecamp.com/manish-giri
Albert Cardona II
@daddycardona
Nov 01 2017 17:56
so what up people what y'all doing why isn't anyone on why did i just thank yall lmao
Kyle Holm
@thekholm80
Nov 01 2017 17:58
@daddycardona :wave:
Albert Cardona II
@daddycardona
Nov 01 2017 18:00
what up bro
I have a question about the phone number challenge
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:00
@thekholm80 :wave:
Albert Cardona II
@daddycardona
Nov 01 2017 18:01
One I guess I have to validate that it is proper format first then I can parseInt it. however, It still doesn't fix the problem I have now with it and that I can't get it to parseInt a zero
@thekholm80
:wave: @JimmayVV and @thekholm80
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:03
@daddycardona oh this one was fun. I'm not sure how to do this with ParseInt, I did it with RegEx
Kyle Holm
@thekholm80
Nov 01 2017 18:03
@JimmayVV heya
@daddycardona just a sec, trying to get to a stopping point lol
Albert Cardona II
@daddycardona
Nov 01 2017 18:05
I was actually thinking about that too @JimmayVV about trying to figure out a pattern that would work. I am researching the ParseINt and I guess if it is the first or the only number since I split it into an array it will not parse zero by itself lol
Also besides that it won't work the way I have it because it removes all the (?-. and stuff like that from it lol man I was like I almost have it then like not even close lol
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:06
@daddycardona It's up to you, ultimately how you'd like to solve it, and I'm glad you're exploring other ways to do it. I forced myself to do it with RegEx because I don't know RegEx all that well (ironic, I know, but I wanted to force myself to better understand it)
Albert Cardona II
@daddycardona
Nov 01 2017 18:07
me either and that is why I stood away from it because I get angry I try something that should work and then come here and someone is like not even close lol
I think I am about to create a pattern but this is confusing @JimmayVV
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:10
@daddycardona first things first, if you want to try to get it to work, I highly recommend you use this site to test your regex (in fact, I recommend you have multiple tabs open, to test multiple RegEx's)
Albert Cardona II
@daddycardona
Nov 01 2017 18:10
I was literraly aobut to go there lol
I was typing I am about to go to this site or one similar to it lol
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:10
you will know your regex is right if the entire phone number is highlighted. If something is not highlighted, but some of it is, then that's a fail
also, if you have an invalid ph #, the whole thing won't highlight (at least if you come up with a regex like I did)
and while testing it, just work left to right. Don't focus on getting the entire ph# highlighted, just start with the left #'s - so test a regex that captures 1-555, 1555, 1(555) and 1 (555)
Kyle Holm
@thekholm80
Nov 01 2017 18:11
@daddycardona sorry playing a video game, at a good stopping place now. looks like @JimmayVV has you all sorted out now
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:12
and make sure your regex caputres all, not just some of them
and I think getting that part of the regex is the hardest part, the rest of it is all downhill
Albert Cardona II
@daddycardona
Nov 01 2017 18:13
exaclty what I am trying to do this thing sucks sometimes if I made a websit e
I would make a website I would not have this issue I would literally use <input type='tel'
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:14
the funny thing is when I look at my regex, I can't immediately read it and understand it - but what's funny is that I knew I wouldn't be able to read it so I made comments explaining the logic of what I did
Albert Cardona II
@daddycardona
Nov 01 2017 18:14
then I would be like if not like this alert not proper format of phone number try again
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:15
so one thing I will say is, you need to start your regex with /^1? - because you need to make sure that starts with zero or one 1
so if you go to that regex tester, and literally only have that for your regex, you will at least see it captures all of the test phone numbers FCC gives you that start with a 1
Albert Cardona II
@daddycardona
Nov 01 2017 18:16
zero or one I thought if it started with a zero you was wrong lol
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:16
zero or one instances of 1
I wrote words to represent instances, I wrote the #1 to indicate the actual digit
Albert Cardona II
@daddycardona
Nov 01 2017 18:16
oh yeah that means it can start with a one or not you're saying?
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:17
you can have a phone # start with zero 1's in front (ex 555-555-5555) or one 1 in front (ex 1-555-555-5555)
so ^1? says "starts with zero or one 1"
Albert Cardona II
@daddycardona
Nov 01 2017 18:17
but that example doesn't have a zero
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:17
if you wanted to mandate it always start with a 1, then you remove the ? mark - but FCC explicitly demands that flexibility, hence the ? part
you are translating my word 'zero' into 0 which isn't what I mean
Albert Cardona II
@daddycardona
Nov 01 2017 18:18
okay the question mark, lol I get confused because you can use it like and if statement sometimes
yes you mean nothing or 1
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:18
555-555-5555 has 'zero' 1's in it
Albert Cardona II
@daddycardona
Nov 01 2017 18:19
oh okay yeah I get that now
thanks @JimmayVV
CamperBot
@camperbot
Nov 01 2017 18:19
daddycardona sends brownie points to @jimmayvv :sparkles: :thumbsup: :sparkles:
:cookie: 304 | @jimmayvv |http://www.freecodecamp.com/jimmayvv
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:19
right, so ^1? covers both scenarios, a leading 1, or no leading 1
Albert Cardona II
@daddycardona
Nov 01 2017 18:20
:) you the best :)
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:20
so next, you need to cover the fact there could be a space following it, or no space following it. the regex for space is \s, and you want to factor in the fact you could have a space (or not) - I chose to use * as my wildcard tester, just in case there was more than one space (otherwise, using a ? again might be appropriate)
so ^1\s* now covers all scenarios of phone numbers that start with zero or one 1, followed by zero or more spaces.... next time to find a regex that captures area codes with, or without parenthesis around it
Albert Cardona II
@daddycardona
Nov 01 2017 18:23
I know a little it just sometimes I get confuse with it because I don't know if I should use [] or / /
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:23

getting this next part was the hardest part for me... but MDN has good info on this

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp

Albert Cardona II
@daddycardona
Nov 01 2017 18:23
even though you can basically do it both way s lol
I read that like 10 times this reference lol
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:23
/ begins and ends the regex itself, so try to not let that distract you :)
Albert Cardona II
@daddycardona
Nov 01 2017 18:26
yes but you got /[ ]/ or / \ / and so many combinations drives me insane lol
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:26
in order to capture (555) and 555 styled area codes, I used (term1|term2) next - term1 was a regex explicitly design to capture (555) area codes, and term2 was a regex explicitly designed to capture 555 area codes. If FCC mandated that the string had only one or the other, I could skip the (term1|term2) function, and replace it with whatever was in term1 or term2 (based on whatever restriction FCC placed on input variables. But since we can have both, I used (term1|term2)
Kyle Holm
@thekholm80
Nov 01 2017 18:26
wow I just looked at my solution for that and it's freaking ugly
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:27
Here's what I gave myself for comments, to explain what I did
  // ^1? - valid if it starts with 1 or zero 1's
  // \s* any number of spaces can follow (including 0 spaces), which is why I use *
  // (term1|term2) - I will define each term below to make this cleaner
  //    term1 = \(\d{3}\) - meaning starts with an open parenthesis, followed immediately by 3 digits, then followed
  //                        by a closed parenthesis
  //    term2 = \d{3}     - meaning 3 digits only (no parenthesis)
  // [\s-.]? - after that last match, zero or one of the provided characters can be present (dash, dot, or space)
  // \d{4}$ now make sure 4 digits follow, and also make sure it's the end of the string (otherwise it's too long)
wow, that got formatted really ugly - but in any case, all of my regex is there, and you can piece it together based on my comments lol. Sorry if I gave away the farm on it :)
Albert Cardona II
@daddycardona
Nov 01 2017 18:29
wow that is a lot of awesome comments :)
so @thekholm80 did you use regex?
Kyle Holm
@thekholm80
Nov 01 2017 18:30
@daddycardona I did, but in the worst way possible
Albert Cardona II
@daddycardona
Nov 01 2017 18:30
lol
don't worry my code might look like yours lmao
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:31
@daddycardona I have to keep using ? or * everywhere because it needs to be ok with that match being there, or not being there. It would be much simpler if I didn't have to search for dashes or parenthesis at all, or even if we did, if I could rely on it always being there. It's the variable-ness of it that makes it so long
also having to escape literals like ( makes it long - since ( is a tool for regex, I have to escape it in order to search for it in the term \(
that's why if you focus on formatting the regex from left to right, and ignore the fact it won't match the end, you'll be ok. If you rush to the end, you'll definitely get frustrated
Albert Cardona II
@daddycardona
Nov 01 2017 18:33
I was trying to make everything a integer then asked if the length of the string after I took all that out was 11 and the first character was a 1 then boolean = true; if the length was 10 then boolean = true; everything else was false lol
Yes patience something I need with this and I don't have enough of this lol
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:35
you know what, that's a clever solution too!
Albert Cardona II
@daddycardona
Nov 01 2017 18:35
doesn't work lol
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:35
well, clever thinking, at least!
Albert Cardona II
@daddycardona
Nov 01 2017 18:36
because of examples like this 1(555-555-5555 I don't have the closing parenthesis lol
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:36
oh right!
Albert Cardona II
@daddycardona
Nov 01 2017 18:37
Like I said when you use html with javascript it makes it easier because they have definitions for imput values like type='tel'
input*
and you can create a placeholder which would allow you to put a format it
or they call it a mask so they have to put it in your way with a drop down menu as well
Albert Cardona II
@daddycardona
Nov 01 2017 18:42
and the reason I parse it is because I want it to be a number not a string but i guess it really don't matter
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:44
@daddycardona right, using the HTML to pre-validate information is certainly useful. RegEx is pretty fast at doing it too, it's just such a foreign language that it can be tough to sort out. It is a nearly usiniversal convention, though, so you can apply it to more than just JavaScript, which is nice :)
Albert Cardona II
@daddycardona
Nov 01 2017 18:45
Yes that is the best part the fact you can use it for different languages and it is basically the same expression
Albert Cardona II
@daddycardona
Nov 01 2017 18:50
so I like and thank you for your regex. I used your ^1? and tried my own stuff this is what I tried I might be wrong
/^1?\s*\(?\-?\d{3}\s*?\-?\)?\s*?\d{3}\-?\d{4}/g not sure if it will get them all I might have forgotten one space thingy
also it can be just straight numbers damn why this is confusing lol
@JimmayVV
thanks again :)
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:54
lol you seem really close, if you're not on it
you don't need \s*? because * & ? are interchangable. Use one or the other, not both
Albert Cardona II
@daddycardona
Nov 01 2017 18:56
oh okay got you I was thinking that but was like just in case lmao
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:56
for instance, you want to use ^1? because you don't want to capture 11-555-555-5555
Albert Cardona II
@daddycardona
Nov 01 2017 18:56
exactly I got that but now I see my errors lmao
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:56
but you do want to use * if an unlimited number of matches could exist before it (like with spaces)
Albert Cardona II
@daddycardona
Nov 01 2017 18:57
oh okay so do I want g at the end?
yes for everyspace okay never mind
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:57
and with \-* you're going to want to capture spaces, dashes, or dots. So 555.555.5555 will capture just the same as 555-555-5555 or 555 555 5555
so I used [\s-.]? to account for that
and yes, g at the end
Albert Cardona II
@daddycardona
Nov 01 2017 18:59
aww dammit I originally did it like (\s-.)? and it did not work properly now I know why needed [ ]
Jimmy Van Veen
@JimmayVV
Nov 01 2017 18:59
so with my term1 catch, (phone numbers with the area code in parenthesis) I used \(\d{3}\) (that captures a prefix ( followed immediately by 3 digits, then immediately after that a closed )
term 2 is almost the same, just excluding the parenthesis things, so \d{3}
this makes my (term1|term2) RegEx look like: (\(\d{3}\)|\d{3})
(all those backslashes make my head spin too)
Albert Cardona II
@daddycardona
Nov 01 2017 19:01
yes but then you have to account for the one that is straight numbers :)
lmao
15555555555
Jimmy Van Veen
@JimmayVV
Nov 01 2017 19:01
right, that's why I use (term1|term2) - so term1 = phone # with (), term2 = straight numbers - so it will catch either
so ^1?\s*(\(\d{3}\)|\d{3}) will catch, "zero or one 1, followed by zero or more spaces, followed by (###) or ###"
Albert Cardona II
@daddycardona
Nov 01 2017 19:03
I see what you did there nice ;)
I read it earlier but now that I am trying to do my own expression what you wrote makes sense now lol
Jimmy Van Veen
@JimmayVV
Nov 01 2017 19:04
if you have (555)555-5555 ^1? will catch nothing, but it will still pass regex because ? allows for zero matches - \s* will also catch nothing, but just like ?, * allows for zero matches and still pass RegEx, then the real match begins with my (term1|term2) code
so, after the (term1|term2) code, you now have the "zero or one space, dot, or dash" code, which as we just mentioned is [\s-.]?
then you look for 3 digits consecutively \d{3}, then, (again) look for "zero or one space, dot, or dash", [\s-.]?, then finally 4 digits, and make sure to put a $ at the end, otherwise phone numbers that are too long will pass when they should fail
if you don't search at the end for \d{4}$ then 1-555-555-55550 will pass, and it shouldn't
Albert Cardona II
@daddycardona
Nov 01 2017 19:07
okay I am going to retry it and hopefully not use your code lol
might end up rewriting what you told me too lol
but without looking ;)
Jimmy Van Veen
@JimmayVV
Nov 01 2017 19:08
haha there aren't too many ways to do it, I think all of the solutions will be really close, if not identical
perhaps the wildcard selectors might be the only differences (? or *)
besides, Google knows the answer. So as long as you can look at a regex and expand it in your head, then that's all you're looking for. That's why I made comments in my code, otherwise I would have forgotten and not been able to help :)
Henry
@GitHub-Henry
Nov 01 2017 19:16
@daddycardona @alexanderkopke @heroiczero hello & thank you :+1:
CamperBot
@camperbot
Nov 01 2017 19:16
github-henry sends brownie points to @daddycardona and @alexanderkopke and @heroiczero :sparkles: :thumbsup: :sparkles:
:cookie: 444 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 1696 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
:star2: 1990 | @heroiczero |http://www.freecodecamp.com/heroiczero
Albert Cardona II
@daddycardona
Nov 01 2017 19:17
Yes you're right but you can like group the first thing maybe like (\^1\s* ) maybe lol
Jimmy Van Veen
@JimmayVV
Nov 01 2017 19:18
@daddycardona oh true - when I have more time I'll have to Google some other solutions to see what else is out there :)
Albert Cardona II
@daddycardona
Nov 01 2017 19:18
me too lol
Albert Cardona II
@daddycardona
Nov 01 2017 19:26
holy crap I thought that one was hard and thanks for that site after playing with it, I made like 20 mistakes, i finished it with a simple let var equal that expression and then a if statement that says regVar.exec(str) I think I could of use .test(str) too maybe
Jimmy Van Veen
@JimmayVV
Nov 01 2017 20:00

@daddycardona yup, I used

```
var regex = /^1?\s*((\d{3})|\d{3})[\s-.]?\d{3}[\s-.]?\d{4}$/g;

return regex.test(str);

sorry,
var regex = /^1?\s*(\(\d{3}\)|\d{3})[\s-.]?\d{3}[\s-.]?\d{4}$/g;
return regex.test(str);
Ken Haduch
@khaduch
Nov 01 2017 20:09
@daddycardona - hey, thanks for thinking of us - did you get going on the phone number challenge?
CamperBot
@camperbot
Nov 01 2017 20:09
khaduch sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 446 | @daddycardona |http://www.freecodecamp.com/daddycardona
Ken Haduch
@khaduch
Nov 01 2017 20:11
or maybe you are finished with it?
Chris
@bestintown23
Nov 01 2017 20:48
Why are my menu options not showing when i click the menu button. (Must minimize screen between 768 to 1023 px to see what i am talking about.) i want my menu options to come up when i hit the button but its not working for me. https://codepen.io/bestintown23/pen/yPYbyo
Kaz Baig
@kbaig
Nov 01 2017 20:50
@bestintown23 you don't need the script tags, codepen knows it's js
and you haven't added jquery
Chris
@bestintown23
Nov 01 2017 20:51
ahhh how can i forget the jquery. Man i feel stupid. lol @kbaig
Kaz Baig
@kbaig
Nov 01 2017 20:53
@bestintown23 that won't make it so your functionality is implemented but at least your click handler is doing what you want it to
Chris
@bestintown23
Nov 01 2017 20:56
@kbaig yes i see.How can i make my nav options appear when i hit the menu button
Darren
@DarrenfJ
Nov 01 2017 21:27
hi fCC!
just popping in to say hi and thanks to the regulars who stick it out and help people...
thanks @khaduch @daddycardona @GitHub-Henry @alexanderkopke @heroiczero @thekholm80 @Manish-Giri @longnt80 @sjames1958gm @Marmiz @korzo
CamperBot
@camperbot
Nov 01 2017 21:30
darrenfj sends brownie points to @khaduch and @daddycardona and @github-henry and @alexanderkopke and @heroiczero and @thekholm80 and @manish-giri and @longnt80 and @sjames1958gm and @marmiz and @korzo :sparkles: :thumbsup: :sparkles:
:star2: 1697 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
:cookie: 447 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 3445 | @khaduch |http://www.freecodecamp.com/khaduch
:cookie: 443 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 8650 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 1560 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:cookie: 715 | @korzo |http://www.freecodecamp.com/korzo
:star2: 1991 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 1074 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 6738 | @manish-giri |http://www.freecodecamp.com/manish-giri
:cookie: 636 | @longnt80 |http://www.freecodecamp.com/longnt80
Henry
@GitHub-Henry
Nov 01 2017 21:31
@DarrenfJ hello & thank you :thumbsup:
CamperBot
@camperbot
Nov 01 2017 21:31
github-henry sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2222 | @darrenfj |http://www.freecodecamp.com/darrenfj
Alexander Køpke
@alexanderkopke
Nov 01 2017 21:33
@heroiczero @thekholm80 @DarrenfJ @daddycardona @longnt80 @khaduch @GitHub-Henry @sjames1958gm @Marmiz ty @Manish-Giri @longnt80 @sjames1958gm @Marmiz @korzo :)
CamperBot
@camperbot
Nov 01 2017 21:33
alexanderkopke sends brownie points to @heroiczero and @thekholm80 and @darrenfj and @daddycardona and @longnt80 and @khaduch and @github-henry and @sjames1958gm and @marmiz and @manish-giri and @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 637 | @longnt80 |http://www.freecodecamp.com/longnt80
:star2: 2223 | @darrenfj |http://www.freecodecamp.com/darrenfj
:cookie: 448 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 3446 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 1992 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 1561 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:cookie: 444 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 8651 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 1075 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 6739 | @manish-giri |http://www.freecodecamp.com/manish-giri
:cookie: 716 | @korzo |http://www.freecodecamp.com/korzo
Henry
@GitHub-Henry
Nov 01 2017 21:34
@alexanderkopke hello & thank you :smile:
CamperBot
@camperbot
Nov 01 2017 21:34
github-henry sends brownie points to @alexanderkopke :sparkles: :thumbsup: :sparkles:
:star2: 1698 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
Alexander Køpke
@alexanderkopke
Nov 01 2017 21:37
hi and no problem :smile_cat:
zootechdrum
@zootechdrum
Nov 01 2017 23:32
trying to validate phone numbers
why isnt this showing up as regex

function telephoneCheck(str) {

  var checkagainst = /^([1]{1})?\s?\(?([0-9]{3})\)?\s?[-]?([0-9]{3})[-]?([0-9]{4})/g.test(str);

}

telephoneCheck("555-555-5555");
I did this on the regexr website
alpox
@alpox
Nov 01 2017 23:41
@zootechdrum it is a regex but you dont return anything from your function
korzo
@korzo
Nov 01 2017 23:46
@alexanderkopke @DarrenfJ Thanks guys
CamperBot
@camperbot
Nov 01 2017 23:46
korzo sends brownie points to @alexanderkopke and @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2224 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 1699 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
zootechdrum
@zootechdrum
Nov 01 2017 23:47
@alpox damn thank you didnt pass the challenge but ill keep trying
CamperBot
@camperbot
Nov 01 2017 23:47
zootechdrum sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1425 | @alpox |http://www.freecodecamp.com/alpox