What the... JavaScript?

  Рет қаралды 230,040

InfoQ

InfoQ

Күн бұрын

Пікірлер: 203
@groberti
@groberti 9 жыл бұрын
I'd rather have an error message than a guess by the js intepreter. That is just one reason why it is sometimes hard to work with JS. It won't give you an error message when it clearly should.
@rarelyviral5274
@rarelyviral5274 9 жыл бұрын
This also causes sloppy code, as the compiler does not force the programmer to actually provide an actual value
@michaelmarquez7980
@michaelmarquez7980 7 жыл бұрын
Improper coding style cause lack of error handling. You should never come across an error you cannot understand.
@Zaphodox
@Zaphodox 7 жыл бұрын
You obviously never tried writing in assembler then ;)
@toordog1753
@toordog1753 7 жыл бұрын
Zaphodox still never had an issue. it's all about understanding computers and what you're writing
@Zaphodox
@Zaphodox 7 жыл бұрын
Then you are a far greater programmer than I ^^
@anler2b
@anler2b 8 жыл бұрын
"js tries to do the best possible thing that it can rather than just throwing errors everywhere" - that's a recipe for disaster, imho
@hemiacplurge3572
@hemiacplurge3572 8 жыл бұрын
I'm hip to your mantra. Don't powder my little behind and kiss my forehead when I *(#$& up, TELL ME! I will fix it with the same brain I made the mistake with and thereby improve my brain! Smart brain good!
@qvtkc
@qvtkc 7 жыл бұрын
I disagree. It means that you have to say exactly what you want, otherwise random shit will happen. The only problem is that people start relying on said random shit.
@Rauli788
@Rauli788 7 жыл бұрын
If the language would throw errors instead of returning random shit, people would have to fix their code.
@austinsojka7917
@austinsojka7917 7 жыл бұрын
I agree
@xbsidesx
@xbsidesx 3 жыл бұрын
Not when your intent is to show interfaces to a public that are not programmers, like the web. There was a time when a JavaScript error or just console.log broke your entire code. It's still a script code first.
@DrSpooglemon
@DrSpooglemon 2 жыл бұрын
22:47 - It makes sense that the effect(however bad it may be) of overriding the return of the try block with the return of the finally block doesn't happen if you don't put a return in the finally block - because you didn't put a return in the finally block. The default return of a function does not override the return in the try block, only the return placed inside the finally block does that.
@qvtkc
@qvtkc 9 жыл бұрын
21:15 but... it's not a crazy loop thing. "default" just means "case ", it's a normal case and needs a break if you don't want fall-through. Actually I can see how this could be very useful!
@Elrinth
@Elrinth 7 жыл бұрын
yeah I thought the same
@bobafullsugar
@bobafullsugar 7 жыл бұрын
but how would it trigger a case that it doesnt fit in?
@baldomo11
@baldomo11 7 жыл бұрын
qvtkc you can just copy in the default the code inside one of the cases, tho i can't see why you would do that, the default is code that executes only when the other cases aren't met
@qvtkc
@qvtkc 7 жыл бұрын
Jason it's called fallthrough. The switch statement finds the first matching case and then runs until it finds a break, even if that means passing into another case. And default is just a case that matches everything other cases don't.
@qvtkc
@qvtkc 7 жыл бұрын
@Baldomo yes, you could do that, but restructuring the switch means that you don't need to write as much.
@sindarin1350
@sindarin1350 8 жыл бұрын
I think it's pretty obvious that the average programmer gets confused by all the coercion even if you can explain how it gets to the seemingly bizarre results. A language should not help programmers make subtle mistakes!
@teckyify
@teckyify 9 жыл бұрын
It's just a plain dangerous approach that's defended here. Yes, that stuff is in the spec but it's just not wise or even stupid to use expression which are not obviously clear and correct and have some subtle nuances in special constellations. This implicit making the "best" possible thing instead of raising an error is exactly the shitty parts of JavaScript. It's not the "best" possible behavior, it's almost the worst behavior, beside giving random results.
@stevik999
@stevik999 8 жыл бұрын
the second warmup does makes sense: 3 > 2 > 1 means it compares 3 > 2 which is "true" and since true = 1 it cannot be greater than 1
@mattarriola277
@mattarriola277 8 жыл бұрын
yeah he threw in a few of those. whatever you think of switch statements with fallthrough, i think the default case falling through the 10 and into the 20 made perfect sense
@thpion
@thpion 8 жыл бұрын
I totally agree. Also most of the finally examples seemd very reasonable to me (not all, though).
@kynikersolon3882
@kynikersolon3882 8 жыл бұрын
I think it is bad. Just taking a boolean and use it as number looks like a very badly designed type system to me.
@thpion
@thpion 8 жыл бұрын
Kyniker Solon well yeah...but that's the whole premise of JS
@kynikersolon3882
@kynikersolon3882 8 жыл бұрын
Do you think this availability of quick hacks is worth sacrificing a decent type checker at compiletime? I'm genuinly curious I have not much experience with JavaScript.
@MikeFoss18
@MikeFoss18 7 жыл бұрын
17:20 Looks like Chrome has fixed this. "new Array(3)" now produces "[empty x 3]".
@saeedbaig4249
@saeedbaig4249 6 жыл бұрын
Just because it's explainable, doesn't mean it's not a WTF. If the language specification says something that is totally counter-intuitive and incoherent to programmers, it's still a WTF.
@coolworx
@coolworx 8 жыл бұрын
Folks that have been forced into Javascript by way of attrition, have my sympathy. Who knew that Eich's 10 day Frankenstein of Lispy, C-syntaxy, Globally fucked by a variable monster would morph and pupate into the dominate runtime that is native to nearly every consumer computational device on the planet? But, as Crockford declared, it has its good parts. And I'd say that if the publishers hadn't nixed it, Doug would have called it Damn Good Parts. Stop hating and start learning to love.
@deboayangbile1689
@deboayangbile1689 8 жыл бұрын
+Noah Namey One engineer here. Honestly, i'm already having JS fatigue.
@core36
@core36 7 жыл бұрын
my biggest wtf moment with javascript was the fact that in javascript, in the date object, i.e. month nr 8 is not august. in php 1 is jan and 12 is dec, but in javascript jan is 0 and dec is 11. i made a calendar and had to post a selected date to php, when suddenly my month only had 30 days when i expected it to be 31 days, because i expected javascript to be at the right month.
@gabrielbuonomano
@gabrielbuonomano 5 жыл бұрын
That one IS weird.
@PaterEcstaticus888
@PaterEcstaticus888 5 жыл бұрын
I'm so tired of the JavaScript fans, who try so hard to persuade everyone (themselves included) that JavaScript isn't a language for amateurs. Here's what its creator Brendan Eich had to say about JS back in 1998: "There were people who argued strongly that Java's fine for programmers who build components, but there's a much larger audience of people who write scripts or maybe copy a script from somebody else and tweak it. These people are less specialized and may be paid to do something other than programming, like administer a network, and they write scripts part-time or on the side. If they're writing small pieces of code, they just want to get their code done with the minimal amount of fuss... We agreed that this new language should look like Java, but be a scripting language." web.archive.org/web/20060507162841/cgi.netscape.com/columns/techvision/innovators_be.html
@fwyae
@fwyae 8 жыл бұрын
i learned more about javascript in this then any tutorial in years :)
@tarekghosn3648
@tarekghosn3648 2 жыл бұрын
i believed you so i watched it
@SvitlanaShepitsenaTemplates
@SvitlanaShepitsenaTemplates 9 жыл бұрын
Well, this guy is AWESOME. His way of teaching JS and the original view on JS is the best I watched. Now when Mr Crockford sounds a bit weird (if not crazy) - Kyle is the only one to watch.
@tzetzo_tzetzov
@tzetzo_tzetzov 7 жыл бұрын
Just found out that: Number([]); -> 0 Number([,]); -> 0 Number([,,]); -> NaN
@Nike-iv2ni
@Nike-iv2ni 2 жыл бұрын
I think he wants us to read his book. And I also think that he may have a whole series but I am not quite sure. Maybe he hasn't mentioned it often enough yet.
@martijnvankekem
@martijnvankekem 5 жыл бұрын
Some of these things aren't really the downside of JavaScript. This, for example, IS a weird flaw: null > 0 returns false. null == 0 returns false. null >= 0 returns true. Huh?
@henke37
@henke37 8 жыл бұрын
36:00 Thinking that stealing class functions is sane is the real WTF. The possibility of that is the real WTF.
@tonybrown7847
@tonybrown7847 9 жыл бұрын
Kyle knows his JS, I like most of what I've learned from his "You Don't know JS" books
@ryanfleming2448
@ryanfleming2448 3 жыл бұрын
Cool talk, coming from a c/++ developer. I don't quite agree with the switch-case statement though. Traditionally in c/++ we always place a break with the default case for consistency, its also just gets optimized out once compiled. Just like other case statements, if a break is not used this can be very advantageous for doing multiple case statements, for example: switch (t) { case 1: cout
@gosnooky
@gosnooky 6 жыл бұрын
13:50, the undefined and null issue makes perfect sense if you understand how C deals with nulls. The null value is 0x00 in ASCII and is used to terminate strings among other things, so with an ascii value of 0, it makes sense that JS would equate it to 0. Undefined is just that, no way to coerce a number from something that is not defined on the stack or heap.
@henriquebecker2713
@henriquebecker2713 2 жыл бұрын
No, you are confusing 'nul' (the character, with just one 'l') with NULL (the C constant, used for null pointers).
@QwertyNPC
@QwertyNPC 9 жыл бұрын
About the coersion of undefined and null - according to the dictionary right here: dictionary.reference.com/browse/null there are many reasons to coerce null to 0. Also it makes sense to separate undefined and null like that, because there is nothing in undefined that would suggest a relation to 0.
@mecdos
@mecdos 8 жыл бұрын
+MrLewhoo yes, as i understood it, undefined means that it doesn't exist at all. while null does exist but it has no value which makes sense to be 0. var i i = undefined var i = null i = nothing
@niklastreboun8561
@niklastreboun8561 7 жыл бұрын
null should be numerical void, not 0
@mecdos
@mecdos 8 жыл бұрын
a lot of these actually make sense. ei in String([null]), you are defining an Array with a value of null which = to []. therefore String([null]) == String([]) which == to ""
@KirbyLWallace
@KirbyLWallace 8 жыл бұрын
If the spec is that Number.MIN_VALUE is the smallest positive number possible, then there is nothing WTF about "Number.MIN_VALUE < 0 //false". Or am I missing his point? This is not limited to JavaScript. Java, and other languages do the same thing with these expressions. C# will throw an exception given such a statement.
@saeedbaig4249
@saeedbaig4249 6 жыл бұрын
I think what he was getting at was that a lot of newbies (who aren't familiar with JavaScript and haven't necessarily read the spec) would be surprised that Number.MIN_VALUE isn't actually negative. I know it surprised me when I first learnt about it!
@bernardleech5007
@bernardleech5007 7 жыл бұрын
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?
@darioc23c
@darioc23c 7 жыл бұрын
Too many rules which I think could be avoided at the beginning (now it's too late), one of them is == vs ===
@fakkmorradi
@fakkmorradi 8 жыл бұрын
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
@jamdonut
@jamdonut 9 жыл бұрын
*sees language* *does everything to break it* *writes a book*
@teunissenstefan
@teunissenstefan 5 жыл бұрын
Imo the switch behaviour is exactly what you would expect since you didn't put a break; there.
@jaschardomann
@jaschardomann 6 жыл бұрын
Two options: 1. Fix that horrible language. 2. Replace it with a clean designed language.
@ChumX100
@ChumX100 5 жыл бұрын
Well yeah, they tried. Except that 1) Many performance-critical applications depend on the horrible properties of the language. 2) By design, there is no alternative for the web (wasm is going places though). Also, there is this weird phenomenon with software tools: Once a certain level of popularity is reached, it will NEVER die, no matter how lacking they are (think PHP for example).
@zackiles
@zackiles 9 жыл бұрын
Funny guy, interesting presentation, but what's even funnier is I haven't encountered most of what he talked about. Really never found man spots where I'm doing heavy operand stuff like this tbh,
@kitsunde
@kitsunde 9 жыл бұрын
I struggle to think of a way finally would work that would be more reasonable than the current behavior, it was completely obvious to me what would happen in each case and seems expected. Finally interrupts all flow control by design. If it was the case that you would want to keep the return from inside of the try{} block around somewhere that would seem to be an extension onto how finally works in any language I'm aware of. If you were meant to receive that value it should share the same syntax as catch (or possibly have a second parameter for the return value) i.e. try{ return 5; }finally(returnValue){ console.log(returnValue)}. Returning to limbo without any supporting method of recovering the value seems like the only valid choice.
@dmitriyobidin6049
@dmitriyobidin6049 8 жыл бұрын
About => : wtf are you talking about? What about lexical this?
@asdqwe4427
@asdqwe4427 8 жыл бұрын
+Wilkong Lexical scoping is the only good thing that we got from it
@user-sw1wq8lh2w
@user-sw1wq8lh2w 8 жыл бұрын
+asd qwe and implicit returns
@evald80
@evald80 7 жыл бұрын
The behaviour with the "finally" keyword is really a wtf and very dangerous one!
@planktonfun1
@planktonfun1 9 жыл бұрын
ECMAScript syntax is relaxed to enable it to serve as an easy-to-use scripting language. I. E. a variable is not required to have its type declared nor are types associated with properties, and defined functions are not required to have their declarations appear textually before calls to them. That's why we have this wtf error, the script assumes the declared value as something else, you can fix this by specifying the type you intended to use
@planktonfun1
@planktonfun1 9 жыл бұрын
+Paulo Castro This is what javascript differs from C, it has its tradeoffs
@horridohobbies
@horridohobbies 8 жыл бұрын
+Paulo Castro Python is a great, easy-to-use scripting language, but it doesn't have any of this WTF nonsense.
@planktonfun1
@planktonfun1 8 жыл бұрын
+Richard Eng yup, phython's typing discipline is strong, less guessing, less errors.
@nacs
@nacs 8 жыл бұрын
+Richard Eng Oh come on, python has it's own set of WTF nonsense like all the significant white-space, forced indentation and other python-isms. Both languages have their pros/cons but let's not pretend python is perfect.
@horridohobbies
@horridohobbies 8 жыл бұрын
+nacs You're right, ALL programming languages have their warts. But JS has far more warts than any other language in wide use. Just look at the many lists of WTFs available; I've shown some of them here: medium.com/javascript-non-grata/javascript-is-a-dysfunctional-programming-language-a1f4866e186f. Let's not pretend that JS is in any sense normal.
@AmxCsifier
@AmxCsifier 8 жыл бұрын
Guys, plz recommend a programming talk, something you had fun watching, thank you
@boriseng
@boriseng 7 жыл бұрын
What's actually wrong at 23:24? Seems to make sense.
@DarkSwordsman
@DarkSwordsman 7 жыл бұрын
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 ?
@paokalexthes
@paokalexthes 2 жыл бұрын
watching this in 2022 and I got to say, The part at 31:05 with object destructuring alias:value which is reversed when destructuring has been bugging me forever. I legit never remember what's the correct order and just do it randomly and I then go to see if I get an error to see if I chose the wrong order.
@knife_wizard
@knife_wizard 7 жыл бұрын
I'm hearing a lot of rationalization here... 9:21 "You're taking it from a truthy value to false" IMMEDIATELY raises nonsense flags in my head. What the hell does any of that mean? The line states that you are comparing an empty array to whatever the 'not' of an empty array is. He justifies this by stating that, 'in the spec' things get converted to a number before they're compared. Any good reason for that? I would argue that they should NEVER be converted to numbers in the first place. What the hell is the reasoning for that? I keep hearing how the book explains it in a way that's rational, but the rationalizations done by a book are fucking meaningless to me. Javascript consistently misuses mathematical notation to fit it's own conception of reality, which would almost me amenable, if it had anything even approaching a feasible type system. I'm also super drunk, and these issues are STILL blindingly obvious. All I'm seeing is rationalization for bad behavior that does not deserve or warrant any defense. EDIT: Also hadn't seen beyond the gross rationalization segment when I wrote this comment. The rationalization is STILL gross and unacceptable, but, he does eventually leverage some criticisms against the language.
@matthewwarren3758
@matthewwarren3758 3 жыл бұрын
even if they do; 0 == !0 huh?
@vapeurdepisse
@vapeurdepisse 3 жыл бұрын
I remember in the 90s when we used JavaScript to animate a "cool" drop-down navigation menu. It should have not gone any further. Wasm for the win.
@greenarrow6996
@greenarrow6996 6 жыл бұрын
Good video, but I have to make this comment... Kyle Simpson says that most WTFs arise from lack of understanding of the language spec, of how things should work, of the reasoning behind the spec. There is probably some method to the madness but he says he can’t see it. And, still, he encourages people to use JavaScript. WTF?!! Excuse me, but why should I want to use a language whose spec is so obtuse that I can't easily understand the reasoning behind it, or how things are supposed to work? What kind of language requires so much special scrutiny, so much extra effort to understand? He says JavaScript has greatness to it. I'm not so sure about that, but even if I accept it, there are other languages that can do what JavaScript does without all the ugly baggage. The ONLY reason to use JavaScript is because, for programming the web browser, you have no choice. You must use JavaScript, or at least a language that transpiles to JavaScript. Removing choice is hardly a ringing endorsement for the JavaScript language.
@CheefCoach
@CheefCoach 5 жыл бұрын
That is the proper question, why somebody who doesn't want to spend the time to learn JavaScript is using JavaScript? Those are the people who are calling js a bad language, even tho most of the problems come out of their own lack of knowledge of the language. It is not a baggage, but a lack of it. js don't force you to spend your time on defining the variables like some other programs do. Or force you to write a class to create an object. Maybe it should exist a version of js that is doing that for long and complex websites, but there are a lot of websites that require small codes for working. I believe that js is designed to program small codes quickly.
@xybersurfer
@xybersurfer 5 жыл бұрын
it looks like this guy has been corrupted by JavaScript and he doesn't even realize it
5 жыл бұрын
The default/break is not a WTF at all. This is how switches work. This is how they work as well in languages like C or Java.
@codi0dio
@codi0dio 9 жыл бұрын
At first, I disagreed with you. But after listening, I realize that you are asking yourself "how should things be?" instead of "How can I fix this?" This is what Steve Jobs did, I respect you.
@DrunkenUFOPilot
@DrunkenUFOPilot 7 жыл бұрын
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?
@xynyde0
@xynyde0 2 жыл бұрын
what language calls min_value epsilon lol
@rastaarmando7058
@rastaarmando7058 2 жыл бұрын
@@xynyde0 C, C++ and C# do, I think.
@gillianbc
@gillianbc 6 жыл бұрын
Great books and Kyle's a great speaker too. Absolute legend.
@supernewuser
@supernewuser 9 жыл бұрын
Good well informed talk. Only downside was trying to get a WTF chant going whenever a slide came up.
@uthoshantm
@uthoshantm 7 жыл бұрын
Any system or machinery intended to be used by a human being should be intuitive and logically consistent. That is not the case for JS. How many books should be read to learn all the quirks of a single programming language? Three? Is this an efficient use of scarce resources?
@martinalcala4823
@martinalcala4823 3 жыл бұрын
17:28 ........ What about Array.from({ length : 3 }); ?
@justchaz
@justchaz 7 жыл бұрын
I really do like the flexibility that the JS provides. Just need to know the what's happening behind the code
@hamzahajji5814
@hamzahajji5814 7 жыл бұрын
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?
@gabrielbuonomano
@gabrielbuonomano 5 жыл бұрын
In JS, there are no classes. The class syntax is just function syntax underneath.
@1DJLNR
@1DJLNR 8 жыл бұрын
hey kyle wheres your other vids?
@AyhanSipahi
@AyhanSipahi 9 жыл бұрын
link to slide: speakerdeck.com/getify/what-the-javascript Download: speakerd.s3.amazonaws.com/presentations/a7e67313cb884cfe83951d2096015f4a/wtjs.pdf
@HoD999x
@HoD999x 6 жыл бұрын
"read the spec" problem: it's 850 pages or so. compare that to simple and yet very powerful languages (clojure) and you see why javascript is hard to work with.
@kicknotes
@kicknotes 7 жыл бұрын
I fail to understand why some people can't simply take these talks at face value versus turning them into flame wars. Whether you agree or disagree is beside the point. Did you learn anything? I think there are always useful bits to glean from every talk/book/etc., and instead of bashing the guy or the talk, just take the bits you found useful and let them serve to improve your development. The majority of those folks who respond with "this guy sucks!" or whatnot have contributed nothing positive of their own to the dev. community and likely never will.
@radadadadee
@radadadadee 4 жыл бұрын
I learned that JS is shit
@jondbarrow
@jondbarrow 5 жыл бұрын
23:07 I don't see how that's a "wtf". What did you expect, that not defining a return in 'finally' would return undefined? How would that make sense? If that's how it functioned, then any function that used 'finally' would return undefined unless given the return in the 'finally'. But then that prevents the ability to run code after the function returns, which is something you mention as being useful just seconds before.
@smintgames3973
@smintgames3973 9 жыл бұрын
i have a weird javascript sending me random shit messages like: 1 more thing if you are wathing a vid say "you video sucks". reminder. When i see this i am scared
@joonhasebring
@joonhasebring 9 жыл бұрын
I'm seeing a lot of confusing code scenarios that look like someone is trying to be esoteric for the sake of entertainment rather than providing value for the programmer. I would just lint this shit and be done with it.
@DrunkenUFOPilot
@DrunkenUFOPilot 7 жыл бұрын
None of those examples look like anything working programmers in the real world would ever write, except beginners and show-off smartasses.
@niklastreboun8561
@niklastreboun8561 7 жыл бұрын
all those examples are snapped from popular libraries. The problem is that there isn't any syntax checking, so when somebody writes something and it accidentally work, they think it works, so it must be true.
@thewildmangotrader4943
@thewildmangotrader4943 5 жыл бұрын
@@user-if1de8pt2j I agree with you, he is actually looking for very stupid and specific conditions that you can easily avoid.
@AdroSlice
@AdroSlice 5 жыл бұрын
"The spec sais so." Well the spec is arbitrary asf. I want to be able to learn a programming language, not the spec for that language. Things should make sense, and if you write something that wouldnt make sense, don't twist it into something that "According to the spec" does.
@LennoardRai
@LennoardRai 5 жыл бұрын
typeof NaN = "number"
@ahm951
@ahm951 9 жыл бұрын
if your code doesn't make sense then don't expect answer that make sense
@thewildmangotrader4943
@thewildmangotrader4943 5 жыл бұрын
@Evil Eric Wrong, if you know your data and the expectations, why would you rely on the interpreter to give you an error, means you do not know what you are doing. If the code does not make sense to you, then, WTF are you doing programming? Do you expect the compiler/interpreter to slap your face? Tell me one reason why you would write a piece of code that does not make sense to you in the first place and then "have every expectation the interpreter wont understand it either"?, Really!!
@xybersurfer
@xybersurfer 5 жыл бұрын
@@thewildmangotrader4943 it's normal for humans to make mistakes while writing code. you can't convince me that you don't make mistakes. the problem is exactly that the bad language spec "thinks" too often that it does understand these mistakes
@chrisnewey
@chrisnewey 5 жыл бұрын
@@thewildmangotrader4943 The problem is when the code DOES make sense to you but is incorrect. Or have you never written code at 3 AM?
@jennifer7chan
@jennifer7chan 7 жыл бұрын
Wow you really know JS
@Viral757_
@Viral757_ 3 жыл бұрын
omg.. this is horrible. i'm glad i never left the love bubble of C++.
@poamrongrith1563
@poamrongrith1563 6 жыл бұрын
Ooh great. Even in '18
@rndszrvaltas
@rndszrvaltas 6 жыл бұрын
Object destructuring is not a wtf at all, what's more, this is the consistent way to do it. For the sake of == being commutative, after the assignment, foo() == {x:BAM, y:BAZ} and {x:BAM, y:BAZ} == foo(). Moreover, if two objects are equal, we assume that they have the same values on the same properties. {x:BAM, y:BAZ}.x == foo().x, which is right, BAM == XX.
@armanb9778
@armanb9778 7 жыл бұрын
Kyle Simpson rocks.
@igronus
@igronus 5 жыл бұрын
I think most of the examples is not from of actual projects' code but about of monkeys copypastes which probably should be denied on linter's level.
@NobleNobbler
@NobleNobbler 4 жыл бұрын
Also, his not wtf's are all wtfs, with the exception of being wtfs he understands and likes
@jakechan5796
@jakechan5796 9 жыл бұрын
wow those books are free online... cool
@georginikoloff9280
@georginikoloff9280 8 жыл бұрын
Great video by Kyle, everything he produces is of an amazing value
@brianbutton6346
@brianbutton6346 2 жыл бұрын
Content starts at 6:00
@Poneglyph
@Poneglyph 4 жыл бұрын
Coercing empty string and whitespace to 0 isn't unreasonable? Yes it is! It's absolute travesty!
@cyberparadise4365
@cyberparadise4365 8 жыл бұрын
19:30 LOL IM DYING.
@BLOOMS
@BLOOMS 9 жыл бұрын
"I don't like classes."
@CzipperzIncorporated
@CzipperzIncorporated 9 жыл бұрын
BLOOMS oop
@coolworx
@coolworx 8 жыл бұрын
+BLOOM JS is more OOP than Java. Actually it''s the OOP, nothing but the OOP - no classes needed. I create one object, then BAM I extend it with another - no intermediary needed. No Platonic boilerplate class needed. I create something useful from the getgo, and extend and learn from there, instead of creating a mass of theoretical taxonomy (which is doomed to be an ill fit when all is hashed about) before practically wading into the problem.
@theaninova
@theaninova 5 жыл бұрын
Cool, a switch loop!
@DmitryFomin
@DmitryFomin 7 жыл бұрын
well, with ClojureScript you will never have such problems with code readability :)))
@NastySasquatch
@NastySasquatch 5 жыл бұрын
Damn I haven't written any books and I can explain most of the ones he can't....
@Ganesh-ph4gm
@Ganesh-ph4gm 7 жыл бұрын
Websites are built on JS. No surprise websites act as weird as JS.
@NamanGoel34
@NamanGoel34 9 жыл бұрын
That talk was terrible. Full of expected behaviour being called WTF, and unexpected behaviour being given a pass.
@LGtheCat
@LGtheCat 6 жыл бұрын
Haha actually I got one of these not long ago and can relate to a huge headache it gave me
@DwayneCreates
@DwayneCreates 9 жыл бұрын
Not a WTF. Read my book. Not a WTF. Read my book. WTF. Read my book. WTF. Read my book. I don't like classes. I can't stand this guy. A completely arrogant sell-out, you should see the way he talks when he Tweets, the arrogance is so strong anyone that questions his claims he immediately will fire at them on all cylinders. Some of the stuff he spoke about, he was right. He definitely knows things about Javascript, but he is no Douglas Crockford.
@SudeepMakwana
@SudeepMakwana 9 жыл бұрын
***** Agreed ... I have learn lots of things from this Man +kyle
@dalewyngaard
@dalewyngaard 9 жыл бұрын
where's a good place to start if I would like to create a Javascript App?
@dalewyngaard
@dalewyngaard 8 жыл бұрын
***** Thanks mate
@a8lg6p
@a8lg6p 3 жыл бұрын
...return { x: XX, y: YY} const { x: BAM, y: BAZ} = ... "Alias value, alias value..." Maybe I've been doing too much ES6, but this doesn't seem weird to me. I can see how it could be confusing, because they can look identical, but in my brain, object literals and object destructuring are just completely different things. In the first case, there are no "aliases" involved...it's KEY and value pairs. If the key is the same as the variable you're assigning it to, collapsing both sides of the : into one thing is a nice, pretty, convenient syntax sugar. In destructuring, it's like you're extracting the keys, and optionally renaming them, so...while maybe reversing it would be just as well and maybe more consistent...the way it is seems to make sense in a way. Maybe it's because they're on opposite sides of the equal sign, so it seems logical it would be a mirror image.
@BehruzbekOtayev
@BehruzbekOtayev 2 жыл бұрын
Js came a long way....
@sbacon92
@sbacon92 6 жыл бұрын
@10:00 No.
@mironmajkes3965
@mironmajkes3965 6 жыл бұрын
number.MIN_VALUE < 0 false - is ok. 0 is the minest value :) But -number should be true here. '42 .toFixed(2);' is cause JS engine works it immediately conwert number to string - it just do that.
@szeredaiakos
@szeredaiakos 5 жыл бұрын
3x levels of inheritance ... WTF is wrong with people?
@simonpeggboard4004
@simonpeggboard4004 2 жыл бұрын
Javascript needs a rewrite .
@StaviKay
@StaviKay 7 жыл бұрын
i find most of the wtf's actually not a wtf at all. im 4 years experienced in actrionscript3.0 and by looking at these... they appear totally normal and reasonable.
@StaviKay
@StaviKay 7 жыл бұрын
as for the whole "best guess" thing... um, err.. ERR. ERROR!
@macheads202
@macheads202 9 жыл бұрын
What the fuck!
@boblefest
@boblefest 5 жыл бұрын
Oof. It's really sad to see people learn just a single language in depth. Sure, this guy probably knows JS damn well, but he does not know software development at all, and as such should not be writing books on any programming topic, including JS.
@edgeeffect
@edgeeffect 2 жыл бұрын
I don't get how you can just brush over "fewer characters = more readable" .... This is the "most wrong" thing I've heard for at least a couple-a days... If your colleagues are espousing this idea to you, you owe it to humanity to humiliate them publicly!! On the subject to improvements to society... encouraging the audience to curse loudly and publicly is brilliant! "'dear god, give us often such rascals' - Voltaire" - Paul Morley.
@UltimatePerfection
@UltimatePerfection 6 жыл бұрын
There are only two type of code. Code you understand that you understand and code written by someone else.
@ube-23s
@ube-23s 8 жыл бұрын
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.
@jsonkody
@jsonkody 5 жыл бұрын
Everything in JS makes perfect sense .. I can see no WFTs whatsoever :)
@irfanbaig1888
@irfanbaig1888 8 жыл бұрын
It's a funny video.
@agentjeb4103
@agentjeb4103 4 жыл бұрын
The whole philosophy is f*cked. A language should beat the devs ass for being unclear and trying to be clever.
@Bigdaddy91982
@Bigdaddy91982 8 жыл бұрын
for some reason, I don't really like him.
@ThePandaGuitar
@ThePandaGuitar 8 жыл бұрын
For some reason, I really don't like you.
@theodorep.5501
@theodorep.5501 7 жыл бұрын
Me neither
@dasten123
@dasten123 9 жыл бұрын
wtf
@widebandrecords902
@widebandrecords902 8 жыл бұрын
the so called wtf's are for advanced users using javascript to make Ai apps or libraries/frameworks
JavaScript Scope Chains and Closures
56:24
InfoQ
Рет қаралды 46 М.
СОБАКА ВЕРНУЛА ТАБАЛАПКИ😱#shorts
00:25
INNA SERG
Рет қаралды 2,5 МЛН
Это было очень близко...
00:10
Аришнев
Рет қаралды 7 МЛН
Motorbike Smashes Into Porsche! 😱
00:15
Caters Clips
Рет қаралды 22 МЛН
Advanced Async and Concurrency Patterns in JavaScript
39:43
Hack Reactor
Рет қаралды 141 М.
Looking Under the Hood of JavaScript
6:34
ThePrimeagen
Рет қаралды 186 М.
Douglas Crockford: The JavaScript Programming Language
1:49:55
YUI Library
Рет қаралды 490 М.
No Calculator Allowed || 99% of Students Failed This Tricky Math Test || #maths
9:25
Netflix JavaScript Talks - RxJS + Redux + React = Amazing!
37:14
Netflix Engineering
Рет қаралды 395 М.
JavaScript Pro Tips - Code This, NOT That
12:37
Fireship
Рет қаралды 2,5 МЛН
Pitfalls of Unified Memory Models in GPUs
40:37
InfoQ
Рет қаралды 314
Douglas Crockford: Really. JavaScript.
46:10
JSConf
Рет қаралды 81 М.
СОБАКА ВЕРНУЛА ТАБАЛАПКИ😱#shorts
00:25
INNA SERG
Рет қаралды 2,5 МЛН