Kyle Simpsons talk for Forward 2 attempts to “pull out the crazy” from JavaScript. He wants to help you produce cleaner, more elegant, more readable code, then inspire people to contribute to the open source community.
JavaScript Training from NewCircle: http://crcl.to/72rru
http://forwardjs.com/
Original source
33 responses to “What the… JavaScript?”
14:00
Wouldn't null mean empty, in other words, "0" when compared to an empty string?
Then undefined means that there is absolutely nothing, which is why it would be NaN?
would 14:41 have anything to do with 9:30 ?
Enjoy your talks but your intros are always way too verbose.
Great video, it actually helps me like JavaScript, you have a good way of presenting the counter intuitive design of these various statements. Thanks also for your contribution to GNU-Linux and opensource. Peace among men of goodwill.
I really do like the flexibility that the JS provides. Just need to know the what's happening behind the code
Just found out that:
Number([]);
-> 0
Number([,]);
-> 0
Number([,,]);
-> NaN
35:34 why is there a "function" instead of class and a semicolon after a class declaration. I thought extends is used with classes not functions!! wtf?
Isn't MIN_VALUE the same thing called 'epsilon' in other languages? The smallest value you can add to 1.0 to get something different. So why doesn't JS call it EPSILON?
The proto.__proto.call(this) is unnecessary and purposely verbose at 38:16.
Px.prototype.another.call(this) would work
hello i need a script about automatique click and thank you
27:03 I just tested this in the console in Chrome v56 and the behavior is different from what Kyle shows here. For me, it.next(25) resumes the generator and logs out "c:25", then returns {value: 7, done: true}. So is falling out of the finally clause 'fixed' now? Or is this ES7 behavior or something else? wtf js?
Websites are built on JS. No surprise websites act as weird as JS.
Wow you really know JS
Am I the only one who thinks semicolons where a good idea in 1980 but a step backwards nowadays. I really liked the ECMAScript standarization made them optional and I encourage everyone to stop using them (except, of course, on minified code). Don't know why virtually every open source js project still uses semicolons. Am I really the only one who is desperate from dropping them out of every language??
This video is exactly like your books. Bullshit clickbait.
36:00 Thinking that stealing class functions is sane is the real WTF. The possibility of that is the real WTF.
I am disappointed, most of the WTFs that seem to tick him off are not WTFs at all, especially after the middle of the video where it was supposed to actually get "crazy". Destructuring order of names is key:alias and makes total sense, especially when you apply it to deeper structures – the json syntax stays on the right side. Temporal dead zone is a WTF name but it is completely logical. Yes it is inconsistent with the old approach, but that is on purpose. Why would we even want a new way of declaring variables if it worked just like the old way? The goal is to phase out var and only have let in the future, and the transition period can seem like a WTF but it is needed.
The "default" case falling through is completely natural and consistent. Missing "return" in a finally not meaning "return undefined" – completely natural. Breaking out of a "finally" block – yeah it's odd and can get messy, perhaps it is a WTF that it is allowed. But once you accept it is allowed at all, the way it works is completely natural and consistent, even in generators.
Speaking of generators, in older versions of the spec you had to catch an exception to know when the generator was over, which was a huge WTF. But now there are some other WTFs left, like the redundant star syntax in declaring them – presence of yield is a sufficient indicator; or the fact that they start in a paused state, which is completely pointless, and makes the parameter of the first resume call meaningless; or the fact that they went with the half-hearted single-stack-level generators which greatly hampers their use in lambas in forEach or map and such, when they could have gone the full monty with lua-like coroutines able to yield across multiple stack levels.
There are even bigger WTFs in JS that I expected to be mentioned: the still half-assed attempt at meta-programming, i.e. Proxy class or prototype chain mutation as specific examples, but more generally just being constantly countered by other language developments like pointless access control on properties, static analysis and performance optimization in engines, etc; the ability to override String and Number coercion but not Boolean coercion, leading to impossibility of falsey objects; the inability to make a function-like callable object (except with the mentioned lame Proxy class); native Promise performance; the async/await syntactic sugar they plan in the next version (which sucks because it's based on generators with single-stack-level limitation);
the so called wtf's are for advanced users using javascript to make Ai apps or libraries/frameworks
it's a fun video about "WTF JS"… but, let be serious a moment, nobody code some things like that… or you're can"t distinguish you fantasms and your work or passion… if you code like that, you're an asshole or a fuckin' troll !
Great video by Kyle, everything he produces is of an amazing value
Good thing that ES6 fixes all of this.
I thought this is about "what is JavaScript " When I saw and heard him for 10 seconds I knew he was one of those. Too advanced for me. He didn't even start by explaining what JavaScript is? All I see is, WTF, WTF, WTF, etc.
Alot of the things you are suggesting would break javascript even more
for some reason, I don't really like him.
It's a funny video.
"js tries to do the best possible thing that it can rather than just throwing errors everywhere" – that's a recipe for disaster, imho
There is a good reason why destructuring is done that way. Look at this example:
function foo() {
return { foo: { x: 1, y: 2 } };
}
var { foo: { x, y } } = foo();
If we reverse alias/value we would get something weird like this:
var { { x, y } : foo } = foo();
That that would be real WTF.
The syntax is not only fine, but great. You can think this way: the left side must have same structure as returned object, but with variables instead of values.
Switch/default makes perfect sense and here's an example where it's useful:
switch (value) {
default:
// fallback to default option and log warning
console.warn('This should not happen');
case 'A':
// do something
break;
case 'B':
// do something else
break;
}
If you say "not a wtf" every time he says "wtf", and "wtf" every time he says "not a wtf" then this actually is a pretty useful talk.
15:19 line 4, I think String([undefined]); is treated as an undefined array entry, so stringifying it would assume that the array entry would be returned. And it would not print whats undefined in the array when printing the entry or entries. Am I way off??? Or even making sense
Give me your braaaain
Is it a good idea for a language to "try to make a best guess?" To me, that is one of the reasons why there's so much effort to make JS more rigid. We would rather have errors than best guesses. It makes sense when you think of the context of what JS was meant to do a long time ago, but not as much today. Especially now that people want to write JS for servers and desktops.
Coercion seems nice. But the rules that define the behaviours are so wild that to say "just learn it" seems like a herculean task.
If you like this, Kyle is giving a workshop in London next month. More info at https://ti.to/cooperpress/kyle-simpson-workshop/ 🙂