Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 24th, 2007, 08:48 AM
Registered User
 
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Factorial of numbers 1 to 5

Factorial of numbers 1 to 5

 
Old May 24th, 2007, 09:31 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

The following code creates an array of factorial 1 to 5...
Code:
var facs = [1];
for(var i = 2; i < 6; i++){
   facs[i - 1] = facs[i - 2] * i;
}
HTH,

Chris






Similar Threads
Thread Thread Starter Forum Replies Last Post
Ref numbers RubyRue ASP.NET 2.0 Basics 2 January 16th, 2008 11:29 AM
Factorial of numbers 1 to 5 sivakak BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 May 24th, 2007 08:42 AM
1000000 Factorial new_bie BOOK: Beginning Java 2 1 October 29th, 2004 12:01 PM
Concatenate numbers fs22 Javascript 1 April 25th, 2004 06:51 AM
doing a factorial using a for loop mattrd Javascript How-To 1 July 28th, 2003 05:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.