Search

SearchSearch
    • NextJS Parallel Routes
    • Accept Reject Algorithm
    • Active Record vs Data Mapper
    • Beef
    • Browserslist Defaults
    • CA Certificate Trust Issue
    • CA Client Verification Process
    • CA Verify Domain Identity ACME Challenge
    • CIDR
    • Cloudflare Tunnel Pros and Cons
    • Coffee Types
    • Cookie SameSite
    • Core Web Vitals CLS
    • CORS Preflight Request
    • CORS Request with Credential
    • CORS Simple Request
    • Counting Sort
    • Cross Site Tracking
    • Cross Site Tracking Cookies
    • CSP Content Security Policy
    • CSRF Protection Approaches
    • Database ACID
    • Dom Based XSS
    • Duration Calculation Implementation
    • Factorial
    • Full Binary Tree vs Complete Binary Tree
    • Git Rebase Cleanup Commits
    • Heap Sort Heapify
    • Heap Sort Sortdown
    • HTTP Code 301 vs 302
    • HTTPS Handshake
    • HTTPS Mechanism
    • Insertion Sort
    • Intel N100
    • Intel Processor Suffix
    • Intel Processor Xeon
    • Javascript Arrow Function Call Bind Apply
    • Javascript Arrow Function setTimeout
    • Javascript Arrow Function This
    • Javascript Check Null or Undefined
    • Javascript CommonJS CJS
    • Javascript Engine vs Runtime
    • Javascript ES Module ESM
    • Javascript forEach
    • Javascript globalThis
    • Javascript Loop await async
    • Javascript Module ES6 vs CommonJS
    • Javascript Promise Create
    • Javascript This Called from Different Context
    • Javascript This Function Context
    • Javascript typeof null
    • JWT Refresh Token
    • Latte Macchiato
    • LTT Dispatch VAT EU Handling
    • LTT Dispatch Workflow
    • LTT GraphQL
    • LTT LaunchLab Artwork Workflow
    • LTT VAT EU Handling
    • Ma On Shan Bus Stop
    • Merge Sort
    • NextJS Client Components
    • NextJS Image Benefits
    • Nitro
    • NodeJS ESM Module
    • Nuxt
    • Nuxt ISR
    • Nuxt SWR
    • OAuth 2 Grant Type Authorization Code
    • OAuth 2 Grant Type Authorization Code Link
    • OAuth 2 Grant Type Implicit
    • OAuth 2 Grant Type Implicit Security
    • Option Example Alibaba
    • Option Example HSBC
    • P5JS Example Asteroids
    • P5JS Example Stochastic Tree with Perlin noise
    • PageSpeed vs Lighthouse
    • Persistent XSS
    • Pinia Getter Access Another Getter
    • PLpgSQL
    • Pork
    • Postgres Row Level Security
    • Postgres vs MySQL
    • Prisma Advantage
    • Quick Sort
    • Radian
    • React GitHub Contribution Graph Implementation
    • React Timer Implementation
    • Reflected XSS
    • Rotational Force
    • Routine
    • Row Level Security
    • SAML vs OpenID vs OAuth
    • SAML Workflow
    • Selection Sort
    • Shell Sort
    • Shenzhen Control Point 深圳口岸
    • Short Term Goals 2024
    • Special Character Name
    • SSL Mechanism
    • SSL vs TLS
    • Standard Deviation
    • Tailwind
    • Tailwind Layer
    • TanStack Query StaleTime vs gcTime
    • TanStack Query Status
    • TCP Four-way Handshake
    • TCP Three-way Handshake
    • TIMESTAMP vs TIMESTAMPTZ
    • Token Explanation
    • Typescript Function Overload Caveat
    • Typescript Generic Function Constraint
    • Typescript Generics Golden Rule
    • Typescript noImplicitThis
    • Typescript Non Null Assertion Operator
    • Variable Fonts
    • Vue Async Components
    • Vue Async Components Vue 2
    • Vue Component Different Approaches
    • Vue Deep Watchers
    • Vue Ref
    • Vue ref vs useState vs Pinia
    • Vue Scoped Slot
    • Vue SFC Script Setup
    • Vue SSR Cross Request State Pollution
    • x-www-form-urlencoded vs form-data
    • XSS Prevention
    • XSS vs CSRF
Home

❯

Factorial

Dec 13, 2025, 1 min read

  • #factorial

Factorial §

Example §

// iterative
var factorial = function (n) {
  var result = 1;
  for (var i = 1; i <= n; i++) {
    result = result * i;
  }
  return result;
};

Example §

// recursive
var factorial = function (n) {
  if (n === 0) {
    return 1;
  }
  return n * factorial(n - 1);
};

Reference §

https://www.khanacademy.org/computing/computer-science/algorithms/recursive-algorithms/a/the-factorial-function

  • Factorial
  • Example
  • Example
  • Reference

Backlinks

  • No backlinks found

Created with Quartz v4.1.2, © 2025

  • GitHub
  • Discord Community