Hasty Briefsbeta

Bilingual

JavaScript Chose Violence

10 months ago
  • #JavaScript
  • #Programming
  • #Humor
  • JavaScript was created in 10 days and has some quirks.
  • Date type in JS subtracts 1900 from years, making historical dates incorrect.
  • Months in JS are zero-based, unlike most numbering systems.
  • Floating-point arithmetic in JS can lead to precision errors (e.g., 0.1 + 0.2 ≠ 0.3).
  • Equality in JS can be tricky; always use triple equals (===).
  • NaN is NaN in JS, but Number.isNaN() is the correct way to check.
  • parseInt() should include a radix parameter to avoid octal parsing issues.
  • Avoid eval() due to security risks and poor practice.
  • JS classes are syntactic sugar and don't fully support OOP.
  • finally block overrides try block return values, unlike other languages.
  • Math.min() and Math.max() behave unexpectedly without arguments.
  • Primitives like numbers can't have methods called on them directly.
  • Arrays in JS can have non-index properties, acting like hidden rooms.
  • Despite its flaws, JS has improved and is widely used with tools like TypeScript.