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

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

with Changes Variable Scope?! #javascriptwtf

YouTube

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

https://www.youtube.com/watch?v=yK-u-WHxO0o

Object Keys Get AUTO-SORTED?! #javascriptquiz

YouTube

Yโ€™knowโ€ฆ itโ€™d be super-fun if there was a way to have @pomโ€™s moon avatar photo change/update to actually follow the phases of the moon!

(Sadly, I lack the skills to do it.)

I wonder if anyone knows how, or knows someone whoโ€ฆ ๐Ÿคทโ€โ™‚๏ธ

cc @paul @beep @zeldman
@eeeps

#Moon #PhasesOfTheMoon #Mastodon #Avatars #MastoArt #AskFedi #Coding #CodingChallenge #Javascript #Programming #Fun #Ideas

PHP strcmp vs == Comparison

Stop scrolling! PHP strcmp() and == compare differently. See '10' vs '10.0'. The difference will shock you!

#php #phptricks #codingtips #programmingtutorial #phpstrcmp #stringcomparison #phpstrings #phpquiz #codingchallenge #phpshorts #stringfunctions #phpcomparison

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

PHP strcmp vs Comparison #phpstrcmp

YouTube

Labels Let You BREAK NESTED Loops?!

๐Ÿ”ฅ SECRET FEATURE! You can break out of nested loops using labels! outer: for... break outer; This skips BOTH loops at once! Senior devs don't even know this. Save this for your next interview!

#javascript #javascripttricks #codingchallenge #labeledstatements #breakstatement #nestedloops #javascriptquiz #javascriptweird #codinginterview #codingtips #javascriptshorts

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

Labels Let You BREAK NESTED Loops?! #codingtips

YouTube

Boolean Conversion Of Empty List

Empty list equals False! Watch bool([]) and understand Python's truthiness rules!

#python #pythontricks #booleanconversion #pythontruthiness #codingchallenge #pythonshorts

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

Boolean Conversion Of Empty List #pythonshorts

YouTube

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

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

new Function Ignores Local Scope?! #javascriptwtf

YouTube

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

https://www.youtube.com/watch?v=9VcxL27MZGQ

Tagged Template Does MATH in Strings?! #javascripttricks

YouTube

PHP Magic Constants Behavior

Watch this! PHP magic constants change based on context. See __LINE__ and __FUNCTION__ in different scopes. Perfect for debugging!

#php #phptricks #codingtips #programmingtutorial #phpmagicconstants #phpdebugging #phpconstants #phpquiz #codingchallenge #phpshorts #phpfeatures #debugging

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

PHP Magic Constants Behavior #phpconstants

YouTube

Three-Valued Logic: AND - OR With NULL?!

SQL has THREE truth values: TRUE, FALSE, and UNKNOWN (NULL)! AND/OR with NULL creates logic that breaks everything! Watch!

#sql #sqltricks #database #sqltutorial #threevaluedlogic #null #sqlquiz #codingchallenge #sqlshorts #sqlbugs #booleanlogic #sqlwtf

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

Three-Valued Logic: ANDOR With NULL?! #sqlwtf

YouTube