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:38
    @bjorno43 banned @minitechtips_twitter
  • May 14 22:37
    @bjorno43 banned @real-action
  • Feb 01 00:26
    @bjorno43 banned @Ndoua
  • Jan 07 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • May 10 2019 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 25 2019 17:12
    @mstellaluna banned @cmal
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:09
    thecodingaviator commented #31179
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:07
    thecodingaviator commented #31182
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator commented #31190
  • Apr 01 2019 18:05
    thecodingaviator commented #31157
  • Apr 01 2019 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

Max
@maxiwer
@imRadioactive thank you but I'm still don't understand
CamperBot
@camperbot
maxiwer sends brownie points to @imradioactive :sparkles: :thumbsup: :sparkles:
:cookie: 297 | @imradioactive |http://www.freecodecamp.com/imradioactive
Ahmed Ramy
@Shadilix
@kumquatfelafel like 0!=1 ?
Sai Chand Duppala
@saichandd
@maxiwer what is that you didnt understand
@Shadilix yes 0! = 1
Julianne Cho
@jucho893
function fizzBuzz(number) {    
    var results = [];

    for(var i = 1; i <= number; i++) {

        if((i % 3 !== 0) && (i % 5 !== 0)) {
            results.push(i);

        } else if (i % 3 === 0) {
            results.push("FIZZ");

         } if (i % 5 === 0){
         results.push("BUZZ");

     }  if((i % 3 === 0) && (i % 5 === 0)){
        results.push("FIZZBUZZ");
    }
    return results;
}
Ahmed Ramy
@Shadilix
easy , an if statement where if num == 0 , return 1
@kumquatfelafel
kumquatfelafel
@kumquatfelafel
@Shadilix nothing to do with that. The value num is changing as you go through your for loop, right? But does the value of 0 ever change?
Ahmed Ramy
@Shadilix
ummm ... no
kumquatfelafel
@kumquatfelafel
currently, you're trying to start 5! with 1 and going up. What if we started 5! with 5 and went down?
Ahmed Ramy
@Shadilix
i tried that but here is the problem
its setting i
like in a for loop
for ( var i ; ?? <= num ; i--)
am stuck with this one so thats why i tried the other way around which is a definite infinite loop
Nick Cleary
@Hijerboa
quick question: is there a way to use .replace() in order to replace any non-alphanumberic character with null, or must I use .replace() for each and every one seperately?
Manish Giri
@Manish-Giri
@Hijerboa you can use a regex
kumquatfelafel
@kumquatfelafel
@Shadilix
With regards to starting point: Say we're doing 5!. What is num?
With regards to condition (when to stop): For the factorial of anything, do we multiply by 0? How about 1?
Nick Cleary
@Hijerboa
@Manish-Giri ok thank you
CamperBot
@camperbot
hijerboa sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6136 | @manish-giri |http://www.freecodecamp.com/manish-giri
Ahmed Ramy
@Shadilix
num is the number we want to factoralize in case of 5! , num = 5
and no we dont multiply any factorial by 0 but 1 is viable but expendable
kumquatfelafel
@kumquatfelafel

1 is viable but expendable

good. Not everyone might catch that ;)

@Shadilix So if we're starting at end and working backwards, could num give us our starting point?
Joseph
@revisualize
Hey hey.
Ahmed Ramy
@Shadilix
thanks :D
i am trying something , will show u in a bit
kumquatfelafel
@kumquatfelafel
hi
Ahmed Ramy
@Shadilix
function factorialize(num) {
  if (num === 0)
    {
      return 1;
    }
  for (var i = num ; i >=2 ; i--)
    {
      num *= i;
    }
}
ohh that also didnt work
kumquatfelafel
@kumquatfelafel
@Shadilix
1.where's your return?
2.what happens when num = 1?
Joseph
@revisualize
@Shadilix You know.. It's actually better to count up than to count down.
Saif Ur Rahman
@saifsmailbox98
@Shadilix you are not returning after the for loop and you can put the for loop inside an else.
Joseph
@revisualize
@Shadilix If you count down you could end up with a problem where you break below the loop.
@Shadilix You also don't have a return statement for your function.
@Shadilix You have one if the value of num is 0. But, you don't have one for anything else.
Ahmed Ramy
@Shadilix
opps yea i forgot the return
but when i used the counting "up" ... i ended up with an infinite loop
Stephen James
@sjames1958gm
@Shadilix And you are multiplying by num twice
@Shadilix Did you grow num and try to stop at num?
Ahmed Ramy
@Shadilix
@Shadilix Did you grow num and try to stop at num?
what ? XD
Saif Ur Rahman
@saifsmailbox98
@Shadilix you are also multiplying num with num in the first run
Stephen James
@sjames1958gm
@sjames1958gm i < num while also doing num *= i
kumquatfelafel
@kumquatfelafel
@Shadilix he means, did you have something like i <= num or whatever... which you had
Ahmed Ramy
@Shadilix
um shouldnt that code be like
num = 5
then
i = 5
then what happens in the loop is
543*2?
Saif Ur Rahman
@saifsmailbox98
5 * 5 * 4 * 3 * 2
kumquatfelafel
@kumquatfelafel
@Shadilix num is already 5, so this happens ^^^
Ahmed Ramy
@Shadilix
function factorialize(num) {
  if (num === 0)
    {
      return 1;
    }
  for (var i = num -1 ; i >=2 ; i--)
    {
      num *= i;
    }
  return num;
}

factorialize(1);
that worked ! :D
Stephen James
@sjames1958gm
@Shadilix :+1: