Skip to content

Conversation

@pearmini
Copy link
Collaborator

@pearmini pearmini commented Sep 26, 2025

/**
 * ============================================================================
 * =                           What the f*ck JavaScript?                      =
 * ============================================================================
 *
 * JavaScript is a powerful language, flexible syntax and a large ecosystem
 * with a great community. However, it also has some quirks and unexpected
 * behaviors that can be dangerous but funny.
 * 
 * Here are some of the examples from https://github.com/denysdovhan/wtfjs.
 */

//➜ true
echo([] == ![]);
// https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#-is-equal-

//➜ false
echo(0.1 + 0.2 === 0.3);
// https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#precision-of-01--02

//➜ "baNaNa"
echo("b" + "a" + +"a" + "a");
// https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#banana

//➜ "fail"
echo(
  (![] + [])[+[]] +
  (![] + [])[+!+[]] +
  ([![]] + [][[]])[+!+[] + [+[]]] +
  (![] + [])[!+[] + !+[]]
)
// https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#its-a-fail

//➜ 15
echo(parseInt("f*ck", 16));
// https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#parseint-is-a-bad-guy

//➜ "1,2,34,5,6"
echo([1, 2, 3] + [4, 5, 6]);
// https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#adding-arrays

//➜ "first"
foo: {
  echo("first");
  break foo;
  echo("second");
}
// https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#labels

//➜ 1
//➜ 2
//➜ 3
//➜ 4
//➜ 5
a: b: c: d: e: f: g: echo(1), echo(2), echo(3), echo(4), echo(5);
// https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#labels

//➜ [ 1, 10, 3 ]
echo([10, 1, 3].sort());
// https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#default-behavior-arrayprototypesort

@pearmini pearmini added the Example Add a new example label Sep 26, 2025
@cloudflare-workers-and-pages
Copy link

Deploying recho with  Cloudflare Pages  Cloudflare Pages

Latest commit: bcff7fc
Status: ✅  Deploy successful!
Preview URL: https://a9358bbc.recho.pages.dev
Branch Preview URL: https://what-the-fxck-javascript.recho.pages.dev

View logs

@pearmini pearmini merged commit 93ef049 into main Sep 26, 2025
2 checks passed
@pearmini pearmini deleted the what-the-fxck-javascript branch September 26, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Example Add a new example

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant