Learning JavaScript with WAT

  Рет қаралды 6,967

Dylan Beattie

Dylan Beattie

Күн бұрын

Пікірлер: 63
@DragoniteSpam
@DragoniteSpam 4 ай бұрын
Looking back I find it a bit amusing how "write once, run/debug anywhere" was the motto for Java, and Oracle used to make a big stink about how Java wasn't JavaScript, and yet it was JavaScript where that promise actually won out in the long run
@allesarfint
@allesarfint 3 ай бұрын
either way we are f*cked, and that poor island in Indonesia has it worst
@oserodal2702
@oserodal2702 3 ай бұрын
Oracle owns the JavaScript name anyway, so 🤷
@MrFluteboy1980
@MrFluteboy1980 3 ай бұрын
2:00 I can't be the only person who saw that and thought of Brainfuck.
@Zainjerr
@Zainjerr 4 ай бұрын
These videod are just sooo good Please don't stop making them 🙏
@rolandcsaszar5479
@rolandcsaszar5479 4 ай бұрын
Oh, I thought this would be about WASM-WAT (WAsm Text format).
@LaMirah
@LaMirah Ай бұрын
8:15 if it's on paper, the classic sign for a space is a lowercase "b" woth a slash through it. On electronic media, it's often represented by a middle dot. Both can be easily used without causing (much) confusion with the rest of the ASCII character set.
@ShadowKestrel
@ShadowKestrel 4 ай бұрын
you can take this to an extreme and obfuscate *any javascript program* into only using the characters []()!+ i love javascript, masochistically
@nataliemreow
@nataliemreow Ай бұрын
it's called JSFuck
@jb31842
@jb31842 3 ай бұрын
JavaScript: The Ugly Parts ...aka the parts that make you go "WAT???!!!!"
@RichardCarlsson
@RichardCarlsson 3 ай бұрын
For some reason I feel like starting a fire.
@DavidLindes
@DavidLindes 3 ай бұрын
harkens back to the IOCCC. Love it[0]. :) Bonus assignment: capitalize the b and the j with as few changes as possible. :) [0] as a fun exercise, not to be used (as you say) in production code, or even anything resembling that.
@raffriff42
@raffriff42 2 ай бұрын
Zero-based footnote indexing, love it.
@DavidLindes
@DavidLindes 2 ай бұрын
@@raffriff42 but of course! (Thanks! 😊)
@espertalhao041
@espertalhao041 Ай бұрын
A small edge-case you missed about falsey-ness: - If you run [] == false, you get true. - If you run !![], you also get true. In short, an empty array is truthy and falsey depending on how you check it.
@DotArve
@DotArve 4 ай бұрын
Dunno when, but from the WAT talk, things have changed.. {}+[] and []+{} now both return '[object Object]' in NodeJS
@rafal06
@rafal06 4 ай бұрын
the first one returns 0 in firefox
@DotArve
@DotArve 4 ай бұрын
@@rafal06 It does and doesn't, actually. If you just evaluate it on its own in the console, it returns 0. If you use it as the right-hand sign of an assignment expression, e.g let a={}=[]; console.log(typeof a, a), it will print "string [object Object]" - it only shows 0 when it's there as a naked expression in the console. The same applies in Chromium-based browsers and Safari. In NodeJS, this changed somewhere in the 13.x release cycle. The safe way to get 0 is {}|[]
@DylanBeattie
@DylanBeattie 3 ай бұрын
{}+[] (and {}+"", which I talk about briefly in the video) are misleading, because they return something different depending whether you evaluate them as an expression or run them as a program. As a program, they're both an empty block {} and then, separately, an expression with a unary plus operator + and an empty array/string, which is zero. If you wrap them in parentheses - or run them in nodeJS, which I assume interprets them as a single expression for some reason - the {} becomes an empty object, it tries to add that to whatever's on the right hand side and the only way to make that not explode is to make them both strings, so you get "[Object object]" plus the empty string. I ❤ JavaScript.
@andreidei
@andreidei 4 ай бұрын
idea for javaScript update: !Nan = "number"; !"number" = String; String*String = "crossword"...
@laurenouellette6592
@laurenouellette6592 3 ай бұрын
This is like the opposite of Hacker's Delight. Hacker's Horror?
@TheGeoffable
@TheGeoffable 4 ай бұрын
🤣 That's brilliantly ridiculous! And what I'm hearing is that this process could generate working Rockstar code?
@DylanBeattie
@DylanBeattie 4 ай бұрын
Oh, no, Rockstar takes things a step further. In Rockstar 2.0 you can add, subtract, multiply and divide strings. No NaNs to worry about.
@michaeltrillium
@michaeltrillium 4 ай бұрын
Oh no, it’s ridiculously brilliant… What looks like a complete silliness actually teaches you JS syntax!!!
@andreasgierstorfer8046
@andreasgierstorfer8046 4 ай бұрын
Could it be that this notion of truthiness was pioneered in Perl? Perl 5 came in 1994, Javascript appeared in 1995 (according to Wikipedia). But, I see that Javascript could have it's own industrial-grade obfuscated programming contests 😀
@menachemsalomon
@menachemsalomon 2 ай бұрын
Truthiness goes back at least to C, as in *if (c = getchar()) {* _/* assign to c, check if assigned 0 */_
@versacebroccoli7238
@versacebroccoli7238 4 ай бұрын
I hate that empty arrays are truthy in JS. They are falsey in Python and that seems reasonable.
@househall
@househall 4 ай бұрын
For me as a former C/C++ developer they are obviously truthy because they are not nulls. For the same reason type of null is obviously an object because of type of "Object *obj" is still an object pointer even if it's value is null.
@rafal06
@rafal06 4 ай бұрын
@@househall what's null if not null pointer? and null pointer is just 0 casted to a pointer. It points to nothing, there is no Object. Also, 0 is equivalent to false. and what is an empty array? you can't malloc(0)
@woosix7735
@woosix7735 4 ай бұрын
The hole concept of truthyness for anything other than booleans is heresy
@caerphoto
@caerphoto 4 ай бұрын
@@woosix7735 tell that to the C programmers. They don't even have an actual boolean type.
@rafal06
@rafal06 4 ай бұрын
@@woosix7735 I agree
@woosix7735
@woosix7735 4 ай бұрын
NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
@NikkyAI
@NikkyAI 3 ай бұрын
the automatic translation by google to 'Yes' is extra funny, NaN should not be truthy
@Huntracony
@Huntracony 4 ай бұрын
Aww, my prediction was wrong. I _almost_ correctly interpreted ({}+"")[!""+!""] as indexing 2 from the string "Object Object" (forgetting the square brackets), which would've been 'j', and predicted the entire expression would evaluate to "javascript"
@minigamer4262
@minigamer4262 4 ай бұрын
classic jsfuck
@minigamer4262
@minigamer4262 4 ай бұрын
actually not even true jsfuck
@Domitianvs
@Domitianvs 4 ай бұрын
@@minigamer4262 so... truthy jsfuck, I guess?
@WaterTimeLapse
@WaterTimeLapse 4 ай бұрын
I was like, wat? Wat is awesome? Yes.
@TesterAnimal1
@TesterAnimal1 3 ай бұрын
I detect a reference to KOHUEPT.
@Stoney_Eagle
@Stoney_Eagle 4 ай бұрын
Madness 😂
@rojokongen
@rojokongen 4 ай бұрын
Hahaha! Excellent! 👌
@feicodeboer
@feicodeboer 4 ай бұрын
What did I just watch? I looked like a pile of loose sand shifting ...
@tkay42
@tkay42 Ай бұрын
Yea.... the logic of JavaScript ist totaly intuitiv and clean with basic abstract rules, where everything else you can adapt from.....🙄
@mathiaz943
@mathiaz943 3 ай бұрын
😂😂😂😂
@DrCoomerHvH
@DrCoomerHvH 4 ай бұрын
Just as Brendan Eich saw it
@DavidBeaumont
@DavidBeaumont 4 ай бұрын
I'm sorry, but JavaScript is in no sense elegant. Elegance of a system is a measure of how well it suits the problem it's trying to solve. Elegant languages have low impedance for use. JavaScript is for sure a simple language, but it was designed in a few weeks by essentially one person. You cannot expect elegance from that.
@caerphoto
@caerphoto 4 ай бұрын
It can be elegant, if you avoid the root of all of these problems: type coercion.
@NeunEinser
@NeunEinser 4 ай бұрын
JavaScript is not a good language, it's a necessary and at this point pretty much irreplaceable language. The idea of just running code without needing to compile, in a way that can just be interpreted by all browsers is obviously grand. Just the design of the language itself is unfortunately pretty mediocre.
@janhofmann3499
@janhofmann3499 4 ай бұрын
PHP: hold my beer! (I know, different beast but also something that became somewhat relevant despite its questionable design..)
@peterlinddk
@peterlinddk 4 ай бұрын
And would that "mediocre design" by any chance have anything to do with not requiring declared types or class definitions, and having automatic coercion? As seems to be the standard complaints about the "garbage JavaScript language" that seem to flow from every other "internet coder" out there, who dont' care to read specifications, and declare any language behaving other than whatever they learned first, as "bad". Or are there any actual design problems in the language that prevents it from being "good"? I'm honestly curious, because I've only ever heard whining about the way it handles types.
@madshorn5826
@madshorn5826 4 ай бұрын
Is that critique really fair? Having a messy origin story and heroically standing by the past by ensuring backwards comparability isn't automatically disqualifying in my book. The latest version of ECMA script has cleaned up quite a bit as I understand it. What is the verdict if you follow best modern practice?
@NeunEinser
@NeunEinser 3 ай бұрын
​@@peterlinddk These are all valid complaints yes. All of these things (well besides classes) can pretty effectively be avoided by using TypeScript (or jsdoc if you don't want to compile an interpreted language), though. The thing about js is that it's pretty bad in doing what it's made for, making a webpage interactable. You basically need some sort of framework if you want to have any kind of complex data rendered on a webpage in a maintainable way. I really dislike the size and overhead of these frameworks, which is unfortunately not avoidable without native support by the language. The way it handles types natively is a pretty good indication of the mindset this language was created with though, and the kind of legacy it holds. It's not possible to get rid of this legacy though. In general, I personally prefer static typing, and more hardware close languages. I recently started learning Rust, which I really enjoy. I dislike a lot of the design choices you have to deal with as a web dev.
@VRchitecture
@VRchitecture 3 ай бұрын
Javascript is bad, Python is slow. The funny thing is… “There are only two kinds of languages: the ones people complain about and the ones nobody uses” (c) Bjarne Stroustrup It’s easy to be that categorical when your knowledge of something is mediocre (or worse) 🤷🏻‍♂
The Evolution of Web Apps 1992-2024
14:01
Dylan Beattie
Рет қаралды 34 М.
Fractals, Factories and Fast Food - Dylan Beattie - NDC Porto 2022
44:54
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 1,9 МЛН
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 55 МЛН
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 16 МЛН
From NUL to DEL: Why 7 Bit ASCII IS Actually Really Clever
16:25
Dylan Beattie
Рет қаралды 27 М.
Please Stop Making These JavaScript Mistakes
14:04
Conner Ardman
Рет қаралды 21 М.
Text Encodings Revisited: Let's Read The Comments!
17:53
Dylan Beattie
Рет қаралды 7 М.
EEPROM Traps! (Combinational logic / TTL Computer microcoding)
8:26
Cases, Code Points and Collations
13:05
Dylan Beattie
Рет қаралды 7 М.
javascript is dumb
46:04
Theo - t3․gg
Рет қаралды 117 М.
D is for DOS
16:09
Dylan Beattie
Рет қаралды 7 М.
The Mötley Crüe Guide to Unicode Normalization
14:35
Dylan Beattie
Рет қаралды 10 М.
Code Pages and Kohuepts: The Chaos of 8 Bit Extended ASCII
11:46
Dylan Beattie
Рет қаралды 10 М.
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 1,9 МЛН