Modifying Array.prototype Affects ALL Arrays?!

Array.prototype is GLOBAL! Adding methods affects EVERY array in your code. This global pollution will break other code. This is why you never modify prototypes!

#javascript #javascripttricks #array.prototype #prototypepollution #globalmodification #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #prototypechain #advancedjavascript

https://www.youtube.com/watch?v=DRyZtMDoHDU

Modifying Array.prototype Affects ALL Arrays?! #javascriptweird

YouTube

Getter That MODIFIES Itself When Called?!

This getter is ALIVE! Every time you access it, it CHANGES its own behavior. First call returns one value, second call returns something completely different. This self-modifying code will break your logic!

#javascript #javascripttricks #getters #object.defineproperty #selfmodifyingcode #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #propertydescriptors #advancedjavascript

https://www.youtube.com/watch?v=JPf0Ue1UDkc

Getter That MODIFIES Itself When Called?! #JavaScript

YouTube

Static Block Runs at Class Definition?!

Static blocks are SECRET! They run when the class is defined, not when instantiated. This is how you initialize static properties with complex logic!

#javascript #javascripttricks #staticblocks #classinitialization #staticproperties #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #classsyntax #advancedjavascript

https://www.youtube.com/watch?v=DKOkZlkX3Rw

Static Block Runs at Class Definition?! #classinitialization

YouTube

Object.is() vs === Are DIFFERENT?!

Object.is() and === are NOT the same! There's a hidden difference that will shock you. This breaks equality checks! Watch!

#javascript #javascripttricks #codingtips #programmingtutorial #object.is #javascriptquiz #codingchallenge #javascriptshorts #javascriptbugs #equality #javascriptwtf #strictequality

https://www.youtube.com/watch?v=z068cvJD1AM

Object.is vs Are DIFFERENT?! #JavaScript

YouTube

Async Generator Yields Promises?!

Async generators are NEXT LEVEL! They yield Promises that resolve asynchronously. You need for-await-of to consume them. This is async iteration!

#javascript #javascripttricks #asyncgenerators #forawaitof #asynciteration #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #async/await #advancedjavascript

https://www.youtube.com/watch?v=FVbFMcLs5bg

Async Generator Yields Promises?! #javascripttricks

YouTube

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

https://www.youtube.com/watch?v=C5b4x5M_WD8

Spread Operator Works on STRINGS?! #codingchallenge

YouTube

Symbol.toPrimitive Changes Object Math?!

This object LIES about its value! Symbol.toPrimitive lets objects control how they convert to numbers/strings. When you add 5, JavaScript asks the object what it wants to be. The result will SHOCK you!

#javascript #javascripttricks #symbol.toprimitive #typecoercion #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #objectcoercion #javascriptbugs #advancedjavascript

https://www.youtube.com/watch?v=YCOygXVLitc

Symbol.toPrimitive Changes Object Math?! #objectcoercion

YouTube

Closure in Loop Prints SAME Value?!

Closures CAPTURE variables by reference! All setTimeout callbacks share the SAME i variable. They all print 3, not 0, 1, 2! This is the classic closure trap!

#javascript #javascripttricks #closures #loops #settimeout #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #asyncclosures #advancedjavascript

https://www.youtube.com/watch?v=ojVEQm9ypyw

Closure in Loop Prints SAME Value?! #loops

YouTube

Symbol.toPrimitive Changes Object Math?!

This object LIES about its value! Symbol.toPrimitive lets objects control how they convert to numbers/strings. When you add 5, JavaScript asks the object what it wants to be. The result will SHOCK you!

#javascript #javascripttricks #symbol.toprimitive #typecoercion #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #objectcoercion #javascriptbugs #advancedjavascript

https://www.youtube.com/watch?v=YCOygXVLitc

Proxy has Trap HIDES Properties?!

Proxy can LIE about properties! The has trap controls the 'in' operator. Property b exists but 'in' returns false. This breaks property detection!

#javascript #javascripttricks #proxy #hastrap #propertydetection #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #proxytraps #advancedjavascript

https://www.youtube.com/watch?v=u6w6OsWuqXY

Proxy has Trap HIDES Properties?! #codingchallenge

YouTube