Remove unneeded line
the line " if (n === 0) return 1 " can be omitted, because the ' product = 1 ' and the loop won't run if 'n = 0' and the returning result will be '1'
This commit is contained in:
		
							parent
							
								
									c4301bbd9c
								
							
						
					
					
						commit
						9fe3c909b0
					
				| 
						 | 
					@ -21,7 +21,6 @@ const power = function(a, b) {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const factorial = function(n) {
 | 
					const factorial = function(n) {
 | 
				
			||||||
  if (n === 0) return 1;
 | 
					 | 
				
			||||||
  let product = 1;
 | 
					  let product = 1;
 | 
				
			||||||
  for (let i = n; i > 0; i--) {
 | 
					  for (let i = n; i > 0; i--) {
 | 
				
			||||||
    product *= i;
 | 
					    product *= i;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue