[Nazmus-Sakib007]: Number comparator #329
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Project Name:
Number comparator
Description
📌 Summary
This pull request introduces a simple Number Comparator App built using HTML, TailwindCSS, and JavaScript.
The app compares two numbers entered by the user and displays whether the first number is larger, the second number is larger, or both numbers are equal.
🚀 Features Added
Two numeric input fields (number1, number2)
A Compare button to check which number is greater
A Reset button to clear inputs and results
A display section to show comparison results
Fetch input values using DOM selectors
Convert values to float using parseFloat()
Compare two numbers using conditional statements
Display output messages dynamically
Reset inputs and result on button click
🧩 Steps Implemented (Technical Breakdown)
-
area
-
<script src="https://cdn.tailwindcss.com"></script>Created the HTML structure
Added a centered container
Added two input fields for the numbers
Added Compare and Reset buttons
Allocated a results
Linked TailwindCSS via CDN
Used:
- Connected JavaScript file
<script src="number-comparator.js"></script>Captured DOM Elements
const numberInput1 = document.getElementById("number1");
const numberInput2 = document.getElementById("number2");
const result = document.getElementById("result");
Added Compare Logic
Parse values
Check:
If number1 > number2
If number1 < number2
If both are equal
Display the corresponding message
Added Reset Logic
Reset inputs to 0
Clear result text
Fig. 01: UI of the Number comparator
QA Steps