Menu
DNS: The internet's phone book, but slower.
Home
Hot
Random
Search
Browse
AI
AWS
Agile
Algorithms
Android
Apple
Backend
Bash
C++
Cloud
Csharp
All Categories
HTTP 418: I'm a teapot
The server identifies as a teapot now and is on a tea break, brb
HTTP 418: I'm a teapot
The server identifies as a teapot now and is on a tea break, brb
Weak-typing Memes
Posts tagged with Weak-typing
Compute Fibonacci In JavaScript
Javascript
Programming
Debugging
Webdev
3 months ago
326.0K views
0 shares
JavaScript's type coercion strikes again. Someone tried to compute the Fibonacci sequence but forgot that adding strings together doesn't do math—it does concatenation. So instead of getting 1, 1, 2, 3, 5, 8, 13, you get "1", "11", "111", "1111"... just progressively longer strings of ones. It's like watching someone try to do arithmetic with duct tape. The best part? The code probably ran without errors. JavaScript just silently nodded and said "yeah, this seems fine."
This Is Javascript
Javascript
Programming
Webdev
Frontend
3 months ago
338.4K views
2 shares
Someone enthusiastically introduces their favorite language, and JavaScript immediately demonstrates why it's both loved and mocked in equal measure. The plus operator does string concatenation ("11" + 1 = "111"), while the minus operator coerces to numbers ("11" - 1 = 10). Totally logical and not confusing at all. JavaScript's type coercion is like that friend who tries to be helpful but just makes everything worse. The language sees a plus sign and thinks "maybe they want strings?" but sees a minus sign and goes "definitely numbers here." It's the programming equivalent of a chaotic neutral alignment.
Today's picks
FNIRSI 2C53T Upgraded Handheld Oscilloscope, 50MHz Bandwidth, 3IN1 Digital Oscilloscope Multimeter DDS Generator, 250MS/s Sampling Rate, 19999 Counts, Voltage, Current, Capacitor, Resistor, Diode Test
Affiliate
$84.99
GearScouts.com
Sponsored
Power stations
pls no more
Programming
63.4K views
2 years ago