#advancedjavascript — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #advancedjavascript, aggregated by home.social.
-
flatMap Can Filter AND Transform?!
flatMap is a SECRET WEAPON! Return empty array to REMOVE items, return array with value to KEEP. One pass does filter AND map together! This trick will make your code 10x cleaner!
#javascript #javascripttricks #flatmap #arrayfilter #arraytransformation #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascripttips #functionalprogramming #advancedjavascript
-
Promise.resolve UNWRAPS Thenables?!
Promise.resolve has RECURSIVE unwrapping! Any object with a 'then' method gets called. Nested thenables unwrap ALL the way down until a real value appears. This automatic unwrapping will confuse your async code!
#javascript #javascripttricks #promise.resolve #thenables #asyncunwrapping #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #promisequirks #advancedjavascript
-
Arrow Functions Have NO arguments?!
Arrow functions BREAK arguments! They don't have the arguments object. This will cause ReferenceError when you try to use it. Regular functions work, arrows don't!
#javascript #javascripttricks #arrowfunctions #argumentsobject #thisbinding #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #functiondifferences #advancedjavascript
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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