Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 19 2020 20:09
    @krisb1220 banned @Gastony
  • May 14 2020 22:38
    @bjorno43 banned @minitechtips_twitter
  • May 14 2020 22:37
    @bjorno43 banned @real-action
  • Feb 01 2020 00:26
    @bjorno43 banned @Ndoua
  • Jan 07 2020 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)

Ahmed Ramy
@Shadilix

function factorialize(num) {

  for (var i = 1; i <= num ; i++)
    {
      num = num *i;
      if (i == num)
      {
        break;
      }
    }
  var factor;
  num = factor;
  return factor;
}

factorialize(5);
@kumquatfelafel
Flashtzu
@Flashtzu
ok thanks
Sai Chand Duppala
@saichandd
@maxiwer to get all the number properties you write a loop and call contacts[i].number
kumquatfelafel
@kumquatfelafel
@Shadilix num is likely increasing faster than i, ergo infinite loop
Ahmed Ramy
@Shadilix
aw man ...
kumquatfelafel
@kumquatfelafel
@Shadilix 5! = 5 * 4 * 3 * 2 * 1, right?
Ahmed Ramy
@Shadilix
yea
Brittani
@Carowyn
thanks @imRadioactive
CamperBot
@camperbot
carowyn sends brownie points to @imradioactive :sparkles: :thumbsup: :sparkles:
:cookie: 296 | @imradioactive |http://www.freecodecamp.com/imradioactive
Brittani
@Carowyn
thanks @kumquatfelafel
CamperBot
@camperbot
carowyn sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 374 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
Brittani
@Carowyn
Finally got my head wrapped around it. :)
kumquatfelafel
@kumquatfelafel
so... what if we started at the end and tried going towards 0? @Shadilix
Julianne Cho
@jucho893
Hi guys,
are multiple if statements allowed?
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.