Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • May 10 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 25 17:12
    @mstellaluna banned @cmal
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:09
    thecodingaviator commented #31179
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:07
    thecodingaviator commented #31182
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator commented #31190
  • Apr 01 18:05
    thecodingaviator commented #31157
  • Apr 01 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

  • Apr 01 18:04
    thecodingaviator closed #31157
  • Apr 01 18:04
    thecodingaviator closed #33788
  • Apr 01 18:04
    thecodingaviator commented #33788
  • Apr 01 18:02
    thecodingaviator closed #31059
  • Apr 01 18:02
    thecodingaviator commented #31059
Manish Giri
@Manish-Giri
like with regular loops, you could do - if (element !== '\s')
Jason Luboff
@JLuboff
How are you testing?
Manish Giri
@Manish-Giri
but if you do /\S/, it matches a whole world of other characters that aren't whitespaces
it's for a codewars kata, lol
Jason Luboff
@JLuboff
You could always do if(!string.test(regex))
Oh gotcha
Manish Giri
@Manish-Giri
right but then I'd need multiple regexes?
if(string.test(r1) && !string.test(r2))
Jason Luboff
@JLuboff
Hmmm..possibly..
Manish Giri
@Manish-Giri
Screenshot 2017-09-07 19.29.34.png
@JLuboff that looks like it works, but I can't think coz of the flu, ugh
@JLuboff ty
CamperBot
@camperbot
manish-giri sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2187 | @jluboff |http://www.freecodecamp.com/jluboff
Jason Luboff
@JLuboff
my syntax was wrong... should be regex.test(string)
Manish Giri
@Manish-Giri
worked
Jason Luboff
@JLuboff
:+1:
Manish Giri
@Manish-Giri
Screenshot 2017-09-07 19.34.37.png
Jason Luboff
@JLuboff
const alphanumeric = s => { /[A-Za-z\d]+/.test(s) && !/[\s*_!]/.test(s)
Manish Giri
@Manish-Giri
damn ppl have solved it with just one .test
Jason Luboff
@JLuboff
I believe it. My regex aint that strong though so I wouldn't be able to
Manish Giri
@Manish-Giri
s => /^[a-z\d]+$/i.test(s);
so this
Andrew Kay
@andrewjkay
Does anyone know of a way to get around a No 'Access-Control-Allow-Origin' header is present error? Trying to query an API from vanilla JS, don't want to have to use jquery or implement a back end
Jason Luboff
@JLuboff
@Manish-Giri Ya I'd have to look all that up to see what it does lol
Manish Giri
@Manish-Giri
I think this bit - ^[a-z\d]+ - matches start of the input
and this matches the end - [a-z\d]+$
since it doesn't leave scope for anything else in between
maybe that's why it passes?
@JLuboff
Jason Luboff
@JLuboff
...sure!
Addison
@addisonday

More Regex help!! XD.

I am not sure why this matches the last test. It passes all the others. I thought the syntax {num1, num2} matched a range? Is it a bug? Here is my regex:

let ohStr = "Ohhh no";
let ohRegex = /h{3,6}/;
let result = ohRegex.test(ohStr);

\*Your regex should use curly brackets.
Your regex should not match "Ohh no"
Your regex should match "Ohhh no"
Your regex should match "Ohhhh no"
Your regex should match "Ohhhhh no"
Your regex should match "Ohhhhhh no"
Your regex should not match "Ohhhhhhh no"*/
Nick Cleary
@Hijerboa
question: is there a more efficient way to determine if a number is a prime than through a for loop?
Manish Giri
@Manish-Giri
@addisonday link to challenge?
Andrew Kay
@andrewjkay
@Hijerboa a for loop without checking even numbers or numbers that are multiples of those already checked
or a hash of some kind
Nick Cleary
@Hijerboa
@andrewjkay hmm thats not a bad idea
luccifer00
@luccifer00
hi there!
Ronique Ricketts
@RoniqueRicketts
Sup
luccifer00
@luccifer00
 var rank1=[];
  var file1=[];

    for(var i=0;i<input;i++){
      rank1+= String.fromCharCode(i+65);
    file1+= parseInt(i+1);
  }
how can i get file1 return a [1,2,3,4,5....] , only can get a string as "12345..."
i use parseInt to change the number in string to a number... but i also return the "12345...."string
Nick Cleary
@Hijerboa
@luccifer00 use .split("");
that will divide it at each number
luccifer00
@luccifer00
yep, but still divide as string ["1","2","3","4"...]
anyways i was cheking the console.log wrong, so i can try new posibilities... i was a mistake as console.log(file1).Split("); lol thanks @Hijerboa
CamperBot
@camperbot
:cookie: 285 | @hijerboa |http://www.freecodecamp.com/hijerboa
luccifer00 sends brownie points to @hijerboa :sparkles: :thumbsup: :sparkles:
Nick Cleary
@Hijerboa
@camperbot np mate
Hey can anyone explain to me how this has an infinite loop?
function sumPrimes(num) {
    var isPrime = true;
    var counter = 1;
    var sum = 0;
    while(counter <= num){
      if(counter >= 3){
        for(i=3; i<=(counter/2); i+2){
          if(Number.isInteger((counter/i))){
            isPrime = false;
            i = ((counter/2)+1);
          } else {
            isPrime = true;
          }
        }
      } else if(counter >= 2){
        isPrime = false;
      }
      if(isPrime){
        sum += counter;
        counter++;
      }else{
        counter++;
      }
    }
    return sum;
  }