This project implements the classic FizzBuzz problem using TypeScript and HTML. The application provides two functionalities: single FizzBuzz result and detailed results for a range of numbers.
FizzBuzz Logic:
- Outputs Fizz if a number is divisible by 3.
- Outputs Buzz if a number is divisible by 5.
- Outputs FizzBuzz if a number is divisible by both 3 and 5.
- Outputs the number itself if none of the above conditions are met.
- Includes input validation to ensure the number is between 1 and 100.
- Offers two result options:
- Single Result: Displays the FizzBuzz result for a specific number.
- Detailed Results: Displays FizzBuzz results for all numbers from 1 up to the entered number.
Before running this project, ensure you have the following installed on your system:
-
Node.js and npm
Download and install the latest version of Node.js from [Node.js Official Website] (https://nodejs.org).
Verify the installation by running: bash node -v npm -v -
TypeScript Compiler (tsc) Install the TypeScript compiler globally to compile .ts files into .js. Use the command: npm install -g typescript
Confirm the installation with: tsc -v
Installation Steps
-
Clone the repository to your local machine: git clone https://github.com/albertfast/firstcodeday.git
cd repository-name
-
Install the project dependencies:
npm install
-
Compile the TypeScript files:
tsc
-
Open the index.html file in your preferred web browser to view the application.
Run the Project To run and test the application locally:
- Open your terminal in the project directory.
- Compile TypeScript files using tsc
- Open the index.html file in your preferred web browser.
Example Usage
- Enter a number in the input field and press "Check Single Result" to get the FizzBuzz output for that number.
- Press "Check Detailed Results" to see FizzBuzz outputs for all numbers from 1 to the entered number.