Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Malware / Trojaner / VirenMacSync Malware Uses Public iCloud Calendars to Target Mac Users(28.09.2026 um 15:41 Uhr)
••••
AI & KI NachrichtenIs Connecticut Writing the AI Regulations Major Companies Want?(28.09.2026 um 22:22 Uhr)
•
AI & KI NachrichtenAMD will acquire Fei-Fei Li’s World Labs for $8.2 billion(28.09.2026 um 22:39 Uhr)
•••••
Malware / Trojaner / VirenMacSync Malware Uses Public iCloud Calendars to Target Mac Users(28.09.2026 um 15:41 Uhr)
••••
AI & KI NachrichtenIs Connecticut Writing the AI Regulations Major Companies Want?(28.09.2026 um 22:22 Uhr)
•
AI & KI NachrichtenAMD will acquire Fei-Fei Li’s World Labs for $8.2 billion(28.09.2026 um 22:39 Uhr)
•••••
Intelligence View
⚡ tsecurity.de Intelligence

Starting My Frontend Development Journey: Day 3 of #100DaysOfCode 💻🚀

Hey Dev Community! 👋 Continuing my #100DaysOfCode journey, today I deeply practiced all essential JavaScript Arithmetic Operators (+, -, *, /, %, **, ++, --) using real-world scenarios like shopping carts, grocery bills, game timers, and …

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Hey Dev Community! 👋



Continuing my #100DaysOfCode journey, today I deeply practiced all essential JavaScript Arithmetic Operators (+, -, *, /, %, **, ++, --) using real-world scenarios like shopping carts, grocery bills, game timers, and savings logic.



Here is a breakdown of what I built and learned today! 💡







💡 TL;DR:





  • Basic Arithmetic (+, -, *, /): Handles core logic like totals, discounts, and averages.


  • Modulo (%): Perfect for converting units (e.g., total seconds into hours/minutes/seconds).


  • Exponentiation (`):** Powers & exponential growth calculation (2 ** 5 = 32`).


  • Post vs Pre Operators (x++ vs ++x): Post uses old value first; Pre updates immediately.










🛒 1. Shopping Cart & Grocery Bill Logic



Practiced addition, subtraction, multiplication, division, and .toFixed() for financial calculations.




// Grocery Bill Calculation
const milk = 2 * 200;
const bread = 3 * 150;
const sugar = 1 * 180;

let subtotal = milk + bread + sugar;
let discount = (10 / 100) * subtotal;
const deliveryFee = 50;

let finalBill = subtotal - discount + deliveryFee;
let avgCost = subtotal / 3;

console.log("Subtotal: Rs.", subtotal);
console.log("Final Bill: Rs.", finalBill);
console.log("Average Cost Per Item Type: Rs.", avgCost.toFixed(2));













⏱️ 2. Game Playtime Converter (Modulo % & Division /)



Converted total raw game seconds (7485s) into Hours, Minutes, and Seconds using remainder arithmetic.




const totalSeconds = 7485;

// Extract Hours
let remainingAfterHours = totalSeconds % 3600;
let hours = (totalSeconds - remainingAfterHours) / 3600;

// Extract Minutes & Seconds
let remainingSeconds = remainingAfterHours % 60;
let minutes = (remainingAfterHours - remainingSeconds) / 60;

console.log(`Time: ${hours}h ${minutes}m ${remainingSeconds}s`);
// Output: Time: 2h 4m 45s













📈 3. Savings Growth with Exponentiation (**)



Calculated compound money doubling over time using the exponentiation operator.




let initialAmount = 10;
let multiplier = 2;
let years = 5;

// Formula: Initial * (Multiplier ^ Years)
let totalSavings = initialAmount * (multiplier ** years);
console.log("Total Savings after 5 years:", totalSavings); // Output: 320













⚡ 4. Increment (++) & Decrement (--) Operators






🔹 Post-Op (itemCount++, itemCount--)



Uses the current value first, then updates in the background.




let itemCount = 1;
let displayedQuantityAdd = itemCount++; // Displays 1, updates DB to 2










🔹 Pre-Op (++completedOrders, --activeOrders)



Updates the value immediately, then returns the result.




let completedOrders = 9;
let totalOrdersForBonus = ++completedOrders; // Immediately becomes 10













📝 Arithmetic Operators Quick Reference






























































Operator Name Example Output / Behavior
+ Addition 10 + 5 15
- Subtraction 10 - 5 5
* Multiplication 10 * 5 50
/ Division 10 / 5 2
% Modulo (Remainder) 10 % 3 1
** Exponentiation 2 ** 3 $2^3 = 8$
x++ Post-Increment let a = x++
a gets old value
++x Pre-Increment let a = ++x
a gets new value








📂 Source Code & Repository



Check out the full working code for all 5 exercises on GitHub:

🔗 GitHub Repository: https://github.com/CodeWithSehar/js-logic-building









🧠 Quick Quiz for You!



What will be the output of this JavaScript snippet? Drop your answer in the comments below! 👇







javascript
let x = 4;
let result = x++ + ++x;
console.log(result);


2. Cyber Threat Intelligence & Forensik

CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Starting My Frontend Development Journey: Day 3 of #100DaysOfCode 💻🚀

Thematisch verwandte Begriffe: Starting, Frontend, Development, Journey · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-54710 | FreePBX is an open source IP PBX. Prior to versions 16.0.40 and 17.0.7, …
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag