#javascriptwtf — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #javascriptwtf, aggregated by home.social.
-
Math.min() > Math.max() Returns TRUE?!
⚠️ YOUR BRAIN WILL EXPLODE! Math.min() is GREATER than Math.max()! This breaks EVERY rule of mathematics! The answer will shock you. 97% of developers get this wrong!
#javascript #javascripttricks #codingchallenge #math.min #math.max #javascriptquiz #javascriptweird #javascriptwtf #mindblown #javascriptbugs #codingtips #javascriptshorts
-
Reflect API Shows HIDDEN Properties?!
Reflect.ownKeys REVEALS secrets! It shows non-enumerable properties that Object.keys hides. This is how you see ALL properties, even hidden ones!
#javascript #javascripttricks #reflectapi #propertyenumeration #hiddenproperties #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #reflection #advancedjavascript
-
void Operator Returns WHAT?!
🤯 MIND BLOWN! The void operator ALWAYS returns undefined, no matter what! void(1+2+3) = undefined! This ancient JavaScript feature is still used in modern code. 95% of devs don't know this exists!
#javascript #javascripttricks #codingchallenge #voidoperator #javascriptoperators #javascriptquiz #javascriptweird #javascriptwtf #javascriptsecrets #codingtips #javascriptshorts
-
Constructor Can Return DIFFERENT Object?!
Constructors can LIE about what they create! If you return an object, it REPLACES the instance. The 'new' keyword becomes USELESS. instanceof returns false! This breaks OOP principles!
#javascript #javascripttricks #constructor #classsyntax #instanceof #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #oopquirks #advancedjavascript
-
typeof Works in Temporal Dead Zone?!
Temporal Dead Zone has a LOOPHOLE! typeof works on undeclared variables (returns undefined) but throws ReferenceError for let/const. This inconsistency is INSANE!
#javascript #javascripttricks #tdz #temporaldeadzone #typeof #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #variablehoisting #advancedjavascript
-
Array(3) vs [,,,] Are NOT The Same!
Creating arrays in JavaScript has a hidden trap! Array(3) and [,,,] look identical but behave completely differently. Mind blown!
#javascript #javascripttricks #codingtips #programmingtutorial #arrayconstructor #javascriptquiz #codingchallenge #javascriptshorts #javascriptbugs #sparsearrays #javascriptwtf #arraycreation
-
Comma Operator Returns LAST Value Only?!
⚠️ THIS IS INSANE! The comma operator evaluates ALL expressions but returns ONLY the last one! (1,2,3,4,5) = 5! Used in for loops everywhere but nobody notices. Tag a dev who needs this!
#javascript #javascripttricks #codingchallenge #commaoperator #javascriptoperators #javascriptquiz #javascriptweird #javascriptwtf #forloops #codinginterview #javascriptshorts
-
with() Changes Variable Scope?!
💥 DEPRECATED BUT STILL WORKS! The 'with' statement changes your scope and makes variables magically refer to object properties! Banned in strict mode but still in old codebases. This caused HUGE security bugs!
#javascript #javascripttricks #codingchallenge #withstatement #scope #javascriptquiz #javascriptweird #javascriptwtf #deprecated #javascriptbugs #javascriptshorts
-
with() Changes Variable Scope?!
💥 DEPRECATED BUT STILL WORKS! The 'with' statement changes your scope and makes variables magically refer to object properties! Banned in strict mode but still in old codebases. This caused HUGE security bugs!
#javascript #javascripttricks #codingchallenge #withstatement #scope #javascriptquiz #javascriptweird #javascriptwtf #deprecated #javascriptbugs #javascriptshorts
-
with() Changes Variable Scope?!
💥 DEPRECATED BUT STILL WORKS! The 'with' statement changes your scope and makes variables magically refer to object properties! Banned in strict mode but still in old codebases. This caused HUGE security bugs!
#javascript #javascripttricks #codingchallenge #withstatement #scope #javascriptquiz #javascriptweird #javascriptwtf #deprecated #javascriptbugs #javascriptshorts
-
with() Changes Variable Scope?!
💥 DEPRECATED BUT STILL WORKS! The 'with' statement changes your scope and makes variables magically refer to object properties! Banned in strict mode but still in old codebases. This caused HUGE security bugs!
#javascript #javascripttricks #codingchallenge #withstatement #scope #javascriptquiz #javascriptweird #javascriptwtf #deprecated #javascriptbugs #javascriptshorts
-
with() Changes Variable Scope?!
💥 DEPRECATED BUT STILL WORKS! The 'with' statement changes your scope and makes variables magically refer to object properties! Banned in strict mode but still in old codebases. This caused HUGE security bugs!
#javascript #javascripttricks #codingchallenge #withstatement #scope #javascriptquiz #javascriptweird #javascriptwtf #deprecated #javascriptbugs #javascriptshorts
-
Object Keys Get AUTO-SORTED?!
Object key order is NOT guaranteed! Numeric string keys get SORTED before other keys. You add 'b' first but '1' appears first in Object.keys()! This auto-sorting will DESTROY your expected order!
#javascript #javascripttricks #object.keys #keyordering #numerickeys #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #objectquirks #advancedjavascript
-
new Function() Ignores Local Scope?!
Function constructor is DANGEROUS! It always runs in GLOBAL scope, ignoring any variables in the enclosing function. Your local 'x' becomes invisible. This scoping behavior will cause HIDDEN bugs!
#javascript #javascripttricks #functionconstructor #globalscope #variablescope #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #scopequirks #advancedjavascript
-
Tagged Template Does MATH in Strings?!
Tagged templates can EXECUTE CODE! The tag function receives values and can transform them. This one DOUBLES every number. String interpolation becomes code execution!
#javascript #javascripttricks #taggedtemplates #templateliterals #stringinterpolation #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #templateprocessing #advancedjavascript
-
typeof Never Throws Error?!
typeof is INDESTRUCTIBLE! It works on undeclared variables WITHOUT throwing ReferenceError. Both declared undefined AND never-declared return 'undefined'. You can't tell them apart! This is INSANE!
#javascript #javascripttricks #typeof #undeclaredvariables #referenceerror #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #typechecking #advancedjavascript
-
Spread Operator Works on STRINGS?!
Spread operator is MAGIC! It works on strings (splits to chars) but NOT on objects. This inconsistency will cause bugs when you least expect it!
#javascript #javascripttricks #spreadoperator #stringiteration #objectiteration #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #iterableprotocol #advancedjavascript
-
Nullish Coalescing vs Logical OR?!
?? and || are DIFFERENT! Nullish coalescing only checks null/undefined. Logical OR checks ALL falsy values. 0 and '' behave differently! This matters!
#javascript #javascripttricks #nullishcoalescing #logicalor #falsyvalues #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #operatordifferences #advancedjavascript
-
Labels Can Break ANY Block?!
JavaScript has GOTO in disguise! Labels with break can exit ANY block, not just loops! This code jumps OUT of nested blocks instantly. Most developers have NEVER seen this syntax!
#javascript #javascripttricks #labels #breakstatement #controlflow #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #hiddenfeatures #advancedjavascript
-
Array Methods Work on NON-Arrays?!
Array methods are DECEPTIVE! They work on any object with length property. This object isn't an array, but map() works on it! JavaScript lies about types!
#javascript #javascripttricks #arraymethods #arraylikeobjects #typecoercion #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #ducktyping #advancedjavascript
-
String Primitives Have Methods But No Properties?!
Strings are DECEPTIVE! They have methods (auto-boxing) but you can't assign properties. Properties disappear immediately. This is primitive vs object confusion!
#javascript #javascripttricks #stringprimitives #autoboxing #propertyassignment #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #primitivetypes #advancedjavascript
-
Array Holes Are NOT undefined?!
MIND BLOWN! An empty slot in an array is NOT the same as undefined. The hole doesn't exist as a property! map() SKIPS holes but processes undefined. This invisible difference will break your code!
#javascript #javascripttricks #arrayholes #sparsearrays #undefined #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #arraymethods #advancedjavascript
-
Array.fill() Shares Same Reference?!
This is a TRAP! Array.fill() with an object puts the SAME object in every slot. Change one, change ALL! Every element points to the same memory location. This silent mutation will destroy your data!
#javascript #javascripttricks #array.fill #objectreference #mutationbugs #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #referencetypes #advancedjavascript
-
Object Keys Get REORDERED Automatically?!
🚨 THIS IS INSANE! JavaScript silently reorders your object keys! Numbers get sorted, but '01' vs '1' behave differently. Your API response order might be LYING to you! This causes real security bugs!
#javascript #javascripttricks #codingchallenge #javascriptobjects #objectkeys #javascriptquiz #javascriptweird #javascriptwtf #javascriptbugs #codinginterview #json #javascriptshorts
-
void Operator ERASES Any Value?!
The void operator is JavaScript's BLACK HOLE! It takes ANY expression and returns undefined. Even when the function returns 42, void turns it into NOTHING! This ancient operator will confuse everyone!
#javascript #javascripttricks #voidoperator #undefined #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #operatorquirks #javascriptbugs #advancedjavascript
-
RegExp lastIndex Mutates Global Matches?!
Global regex has MEMORY! The lastIndex property remembers where it stopped. Reset it to 0 and the same regex matches DIFFERENTLY. This mutation behavior will cause bugs you'll never find!
#javascript #javascripttricks #regexp #lastindex #globalregex #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #regexmutation #advancedjavascript
-
finally{} OVERRIDES return Statement?!
💥 WATCH THIS NOW! finally block KILLS your return statement! try returns 'A', but finally returns 'B' - guess which one wins? This silent behavior has caused millions in production bugs! Share this NOW!
#javascript #javascripttricks #codingchallenge #trycatchfinally #returnstatement #javascriptquiz #javascriptweird #javascriptwtf #javascriptbugs #codinginterview #errorhandling #javascriptshorts
-
WeakMap REJECTS Primitive Keys?!
WeakMap has a SECRET rule! It ONLY accepts objects as keys. Try to use a string and it FAILS silently. This hidden restriction will cause bugs you'll never find!
#javascript #javascripttricks #weakmap #objectkeys #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #weakreferences #javascriptbugs #advancedjavascript
-
Tagged Template Literals Have RAW Property?!
Template literals have a SECRET! The raw property shows escape sequences as LITERAL characters. \n becomes TWO characters, not one newline. This hidden feature will blow your mind!
#javascript #javascripttricks #templateliterals #taggedtemplates #rawproperty #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #stringescaping #advancedjavascript
-
Proxy Returns Function That Executes Itself?!
This Proxy BREAKS all rules! When you access ANY property, it returns a function that executes immediately. The property name becomes the function result. This is INSANE behavior that will break your brain!
#javascript #javascripttricks #proxy #gettrap #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #proxytraps #javascriptbugs #advancedjavascript
-
Object.freeze Is SHALLOW?!
Object.freeze LIES about immutability! It only freezes the top level. Nested objects are STILL mutable! This shallow freeze will cause bugs!
#javascript #javascripttricks #object.freeze #shallowfreeze #immutability #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #objectmutation #advancedjavascript
-
Array.from() With Sparse Arrays?!
Array.from() has hidden behavior with sparse arrays! Creating arrays this way creates something unexpected. Watch this!
#javascript #javascripttricks #codingtips #programmingtutorial #array.from #javascriptquiz #codingchallenge #javascriptshorts #javascriptbugs #sparsearrays #javascriptwtf #arrayconversion
-
Symbol.species Controls Constructor?!
Symbol.species is POWERFUL! It controls what constructor methods return. Your custom array methods return plain Array, not your subclass! This breaks inheritance!
#javascript #javascripttricks #symbol.species #constructorcontrol #subclassing #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #classinheritance #advancedjavascript
-
Generator yield* Delegates to Another?!
Generators can DELEGATE to other generators! The yield* syntax passes control to another generator. This creates generator chains that will confuse you!
#javascript #javascripttricks #generators #yield* #delegation #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #generatorchains #advancedjavascript
-
Symbol.iterator Creates INFINITE Sequence?!
Custom iterators can generate INFINITE sequences! This object never ends, but spread operator can slice it. This is how generators break the rules of finite data!
#javascript #javascripttricks #symbol.iterator #generators #infinitesequences #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #iterators #advancedjavascript