by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 19 20:09
    @krisb1220 banned @Gastony
  • May 14 22:39
    @bjorno43 banned @minitechtips_twitter
  • May 14 22:38
    @bjorno43 banned @real-action
  • Feb 01 00:27
    @bjorno43 banned @Ndoua
  • Jan 07 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 2019 17:13
    @mstellaluna banned @cmal
  • Jan 08 2019 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
CamperBot
@camperbot
:cookie: 431 | @gersho |http://www.freecodecamp.com/gersho
Victor Abeledo
@victorja
Any idea on how to fix the unordered list? (the bullet points stay left aligned but I want them centered)
https://codepen.io/victorabeledo/pen/prNOGM
BrianWilliams28
@BrianWilliams28
@korzo right i see what you mean now
korzo
@korzo
@BrianWilliams28 but you should avoid such complicated structures of conditions. It often introduce bugs and it's hard to follow.
also always use curly braces in condition, even on one liners. It's easier to read
amare16
@amare16
someone help me how to make online my laravel project... free
korzo
@korzo
@amare16 Like where to host you laravel project for free?
BrianWilliams28
@BrianWilliams28
@korzo i know i'm trying to make it as simple as possible but this algorithm is giving me a lot of trouble
Gersho
@Gersho
i skipped that one, they weren't even being that clear about what should be a valid number, and it's not mandatory D:
BrianWilliams28
@BrianWilliams28
you skipped the telephone algorithm?
Gersho
@Gersho
yes
BrianWilliams28
@BrianWilliams28
they do tell you what a valid number is, with a couple conditions..
so far in the code i have im really close, there's a few that are going unsolved
literally two cases are going unsolved
Gersho
@Gersho
which ones ?
BrianWilliams28
@BrianWilliams28
telephoneCheck("(555-555-5555") and telephoneCheck("(6505552368)") its due to my regex testing true through them
here's my code
Gersho
@Gersho
both should return true right ?
BrianWilliams28
@BrianWilliams28
both should return false
my regex needs some tweaking i think

```function telephoneCheck(str) {
let regex = /(\d{3}|(\d{3}))([0-9]{3}|-[0-9]{3})(\d{4}|-\d{4})/g;
str = str.replace(/\s/g, '');
let match = str.match(/\d/g);

if (match.length == 11 && str.charAt(0) == 1) {
str = str.slice(1);

if (regex.test(str)) {
return true;
}
else return false;
} else if (match.length == 10 && regex.test(str))
{
return true;
} else
return false;
}
console.log(telephoneCheck("1 555-555-5555"));
telephoneCheck("1 555-555-5555");```

korzo
@korzo
@BrianWilliams28 Your regex doesn't cover several variants
https://regexr.com/3gp4p
Gersho
@Gersho
what ? the first one should return false ? isn't that a valid number ? o_o
BrianWilliams28
@BrianWilliams28
@korzo are you sure? https://regex101.com/r/xRyVpm/2/
korzo
@korzo
@BrianWilliams28 I took numbers from challenge description
BrianWilliams28
@BrianWilliams28
look at my code though
i remove white spaces
if you remove white spaces the regex works
function telephoneCheck(str) {
let regex = /(\d{3}|\(\d{3}\))([0-9]{3}|-[0-9]{3})(\d{4}|-\d{4})/g;  
str = str.replace(/\s/g, '');
let match = str.match(/\d/g);

if (match.length == 11 && str.charAt(0) == 1) {
 str = str.slice(1);

 if (regex.test(str)) {
   return true;
 }
  else return false;
} else if (match.length == 10 && regex.test(str)) 
{
return true;
} else
return false;
}
console.log(telephoneCheck("1 555-555-5555"));
telephoneCheck("1 555-555-5555");
line 3
amare16
@amare16
@korzo just to make it live on the internet
BrianWilliams28
@BrianWilliams28
i know how to fix it to make it work for evetything
how can i write if (str.charAt(0) != a num) ?
korzo
@korzo
@BrianWilliams28 isNaN
BrianWilliams28
@BrianWilliams28
@korzo if (str.charAt(0) isNaN) ?
Gersho
@Gersho
or since you're in full regex mode why not check for [0-9] ?
korzo
@korzo
@BrianWilliams28 if(isNaN(str.charAt(0)))
for non numbers
@amare16 there is a lot of free hostings for php + mysql
And you can make Laravel to work on shared host with few modifications
amare16
@amare16
@korzo please if you know... because i tried a lot but i didn't get any success
BrianWilliams28
@BrianWilliams28
i need to edit my regex to stop testing positive through these two strings.
(6505552368)
(555-555-5555
i need a rule in the regex to not count the open and closed brackets unless they encase only 3 numbers
BrianWilliams28
@BrianWilliams28
if i have a string inside an array, and i want to split up that string into multiple elements how would i do that?
korzo
@korzo
@BrianWilliams28 splice
BrianWilliams28
@BrianWilliams28
this algorithm is making me lose my mind lol
every time i change something i fix some and lose the others
Gersho
@Gersho
arr[0].split() ?
BrianWilliams28
@BrianWilliams28
need to take a break. @korzo @Gersho thanks
CamperBot
@camperbot
brianwilliams28 sends brownie points to @korzo and @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 502 | @korzo |http://www.freecodecamp.com/korzo
:cookie: 433 | @gersho |http://www.freecodecamp.com/gersho