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
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;
  }
FCC says there's an infinite loop at the if(counter >= 3) part
Coy Sanders
@coymeetsworld
your for loop has a bug
@Hijerboa
Nick Cleary
@Hijerboa
@coymeetsworld does it have to do with the statement i<=(counter/2) ?
Coy Sanders
@coymeetsworld
no
the logic looks complicated though, i don't like that you are modifying i in other places, it opens yourself to bugs
Nick Cleary
@Hijerboa
ohhhhh its the i+2
it should be i+=2... corrrect?
Coy Sanders
@coymeetsworld
yes
but the other times you may change i could cause issues too
there may be an inf loop there too
i would rethink this
Nick Cleary
@Hijerboa
ok... Legitimate question: how else would I break out of the for loop?
or should i not use a for loop at all?
because thats the only way i can think of to test for primes
Manish Giri
@Manish-Giri
@Hijerboa return inside a for loop would terminate it..
Gersho
@Gersho
wouldn't that stop the function too ?
Nick Cleary
@Hijerboa
@Manish-Giri as @Gersho it would stop the function... and im trying to add all primes for one of the challenge
Coy Sanders
@coymeetsworld
use break to break out of the loop
Manish Giri
@Manish-Giri
then use break
besides, I did say "terminate", didn't I?
Gersho
@Gersho
you did, but it terminates more than intended :P
Nick Cleary
@Hijerboa
@coymeetsworld @Manish-Giri I honeslty had no idea break existed....
Manish Giri
@Manish-Giri
terminate was meant as terminate the function.
Gersho
@Gersho
break and continue are both keyword usable within a loop @Hijerboa
Nick Cleary
@Hijerboa
@Gersho @Manish-Giri @coymeetsworld TIL... thanks guys
CamperBot
@camperbot
hijerboa sends brownie points to @gersho and @manish-giri and @coymeetsworld :sparkles: :thumbsup: :sparkles:
:cookie: 404 | @gersho |http://www.freecodecamp.com/gersho