Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

While loop factorial function in javascript

function myfact(number) {
   var fact = 1;
    var i = 1;
    while (i <= number) {
        fact = fact * i;
        i++;
    }
    return fact;
}
console.log(myfact(6));
//Output: 720
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to append values to dropdown using jquery 
Javascript :: wait for ajax to finish 
Javascript :: import react icons 
Javascript :: how to handle navigation between multiple stack react native 
Javascript :: for range python javascript 
Javascript :: call javascript function use array 
Javascript :: js onchange input value event listene 
Javascript :: javascript change background color 
Javascript :: jquery today date 
Javascript :: string contains character javascript 
Javascript :: access variable outside for loop javascript 
Javascript :: Could not find the drag and drop manager in the context of ResourceEvents. Make sure to wrap the top-level component of your app with DragDropContext app.js 
Javascript :: javascript to remove duplicates from an array 
Javascript :: javascript rupiah currency format 
Javascript :: add event listener on width screen resize 
Javascript :: jquery select2 how to make dont close after select 
Javascript :: regex char and number 
Javascript :: vscode css lint 
Javascript :: get hover element js 
Javascript :: javascript pick random attribute from object 
Javascript :: get the first word of a string javascript 
Javascript :: jquery replace html 
Javascript :: javascript websocket 
Javascript :: jquery ajax on fail 
Javascript :: react font awesome 
Javascript :: jqueryreplace content of div 
Javascript :: dictionary in javascript 
Javascript :: vue axios catch error 
Javascript :: open cypress window 
Javascript :: await in angular 8 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =