About the author

Comments

  1. Don't forget to mention a python like solution to multiple inheritance. 🙂
    Raymond Hettinger – Super considered super! – PyCon 2015
    Video: https://www.youtube.com/watch?v=EiOglTERPEo
    Article: https://rhettinger.wordpress.com/2011/05/26/super-considered-super/

  2. javascript has private members. Here's an example I wrote using the class keyword. Give it a try.

    class PrivateTest
    {
    constructor()
    {
    // Use var to make a private member variable
    var privateVariable = 123;

    // Define a function here in the constructor to make a private function
    // This function can call other private members
    function privateFunction()
    {
    console.log(`test: privateVar = ${privateVariable}`);
    }

    // This public function defined in the constructor can reference private members
    this.publicFunction = function()
    {
    privateFunction();
    privateVariable = 234;
    privateFunction();
    }
    }

    // This public function CAN'T reference private members
    anotherPublicFunction()
    {
    }
    }

    var privateTest = new PrivateTest;
    privateTest.publicFunction();

  3. JS has no class.

    I just remembering figuring out at some point; classes, yeah don't do that. Thanks for making it more clear as to why.

  4. Reminds me of Ramda.js trying to bring currying into JS. Or, basically, ML style programming into JS. Although I really like it, it really isn't traditional JS. At the same time though they do make it more JS-like rather than bringing a strict interpretation of other languages into JS.

    So, the OO guys do it and the functional crowd does it. I lean towards the functional crowd, so JS overlords, please bring us native currying!

  5. where did the name fun fun function come from ? im always thinking about someone stuttering while trying to say function lol

    and yes I know that its about fun and not stuttering

  6. Why is JS still trying to imitate Java? New learners should deal with the new paradigm of the language. This "syntactic sugar" doesn't even help them learning JS properly. JS should finally get rid of "Java" and change its name back to LiveScript.

  7. Would it have been more palatable to call it something else? It doesn't seem to have many real problems with how it works, more just the word "class" being potentially confusing.

    The exceptions are private and protected members, but those aren't difficult to implement in the module pattern and it's not like you lose the legibility of "class." Classes are generally used on export.

  8. This "clean needles" metaphor made me laugh so hard. What a great way to phrase that idea. It's almost like the committee was scheming saying "no, no come to JavaScript. It's a wonderful language. See, we even have classes". But the best part of your phrasing was aligning class inheritance to meth hahaha Best things I've heard in a while! Keep up the great work!

  9. QuokkaJS is cool but have you ever heard of js-playgrounds? (npm install –global js-playgrounds)

  10. What are your thoughts on languages that compile down into JavaScript like TypeScript or CoffeeScript? (Especially as TypeScript is used for Angular now)

  11. hello ur channel is so amazing i like the why you talk about programming even if i don't understand any thing hhhh i have i rec west i startes learning HTML/CSS this is my first week of learning journey can u please please give a beginners like me an advice please ….i hope that u make video for beginners about learning and some advice please please please

  12. I really want a mug that has that yellow strip with the words "When in Rome learn JavaScript" on it.

  13. Hi, thank you for your informative and funny videos, I'd like to ask you what websites do you visit daily to learn something about JavaScript, do you have a few or there are a lot of them? I get stuck learning really quickly because there are so much info about JS that I don't know if one website is better than the other and how to know if provided content is high quality? Any suggestions?

  14. Please come out with some udemy courses on ES6, functional JavaScript, react etc. I will buy them all

  15. This ES6 syntax is great for "newbies" to Javascript that are actually experienced in Java/C++ etc. But what about for actual newbies like myself who are learning Javascript as a first language. I got my head around ES5 and prototypal inheritance and now I'm expected to learn both ways of thinking to accommodate "Experienced" programmers who apparently can't do the same thing. And it's not even optional. I won't be able to get a job without doing it. Thanks professionals for not being able to do what a 2 month newbie now has to do. You guys so smart!

  16. Awesome explanation! Thank you so much!

    Which IDE are you using? I love that it shows you what the variables will evaluate to directly in the IDE. Is that a package or plugin for an IDE?

  17. I got the golden star as I guessed the talk.bind before you even started hinting or maybe started writing Dog.prototype.talk. Ummm..what can be be possibly doing with it ?

    Hehe.

    But yes, no specific use of class keyword without private property and all that etc. Liked the re-inforcement of "classes do not exist/ or are fake".

    Gotta watch Composition over inheritance for Wisdom. Waiting how it differs from prototypical inheritance which purely makes sense.

    However, I got super() first time since the recent inception of React learning.:D

  18. "This video… oh my god. I just found f***ing gold."
    This topic has been entirely confusing to me for almost a year now, which is to say 'since I started learning Javascript'
    Thank you, mpj.

  19. I used to be pro-class-keyword when I first learned about it, having come from a Java background. I thought: "This will make things more organized! Woot!" But as time went on and I began learning more JS, it started to feel very constricting and boilerplatey.

  20. This series was very useful, but I feel the videos are too bloated. You repeat yourself too much and the content could be condensed a bit more.

  21. I had been reading the documentation for JS classes and just couldn't wrap my head around `super()` for some reason. Thanks for explaining it so succinctly and clearly – that super() is effectively the constructor of the inherited classes – and arguments passed into it are passed as into that constructor!

  22. MPJME, we are both wearing same glass frames 🙂 secondly you are giving me heart attack, i am starting hating classes, although i never used it in js so far, i use function objects. You have made me rethinking in every aspect of JS programming.

  23. I'm find it pretty confusing that methods in classes aren't separated by semicolons, like properties in standard objects. It hurts when you forget to place semicolons in objects and now it hurts just as much when you 'recall' to use them inside a class.

  24. What I don't understand is why so many modern libraries seem to lean on constructors and classes, even when employing functional concepts, factories, etc. Somewhere along the line, usually as the single top level access to the api, or the actual thing that you require from the the NPM package, there it is, an uppercased (by convention) function you need to use new with.

    Maybe it's because fluent api's are (arguably) slightly easier (or harder) to write with classes, I don't know — but every time I try to figure it out, my deep fear of new, class, and this seems to grow only deeper. I feel less alone when I watch these videos.

    But at some point I am going to fail a job interview though, because I cant remember the difference in this binding between arrow functions and function functions and lexical variable descriptors, and I am going to blame you for reaffirming my suspicions that closure makes it all moot.

  25. Thank you for a wonderful explanation. Finally, i do feel relieved. That 'class' keyword has been really bothering me and now I'm happy to know that it's actually just a sugar keyword for basic prototypal inheritance.

  26. class is not syntactic sugar, extends is deeply magical in that it is the only way to create instances that are callable. theres no other way to create a class C such that (new C)() doesnt throw exception that its not a function. so much for javascript is a functional language(everything is a callable) .

  27. I come from OOP background and I think that whoever designed Javascript must have escaped from a mental asylum

  28. i am backend developer with node and i want to know that why we follow object oriented programing in javascript what are its advanteg

  29. class Foo {}

    var myFoo = new Foo()
    console.log(myFoo)

    // is printing out: Foo {}
    // instead of: {}

    why?

  30. I realize this video is really old, but I'm curious — if you're so against classes/OOP in Javascript, then what do you think of React and its Component classes, for example?

  31. @mpj or anyone who can help. React uses classes for every component that you make extending React.Component. Is it losing speed or performance for using the "inheritance" and "class" keyword?

  32. I used to understand classes in js, but then I looked up self object in js, and in stead of that, this was all yt had to offer. so I thought, fine, I'll watch it. now I have no idea what classes in js are, and still don't know a thing about self object…

  33. All this is of course super cool but can you please show real world examples )) Mb some cool stuff from Spotify ) And of course thank you for your Work

  34. It is very fortunate at least for someone like me, that JavaScript does not have class and we are not forced to read those kinds of codes.

  35. Public and private field declarations are an experimental feature (stage 3) proposed at TC39, the JavaScript standards committee. Support in browsers is limited, but the feature can be used through a build step with systems like Babel.

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes

  36. terrible instructor. can't focus on the code because he's barking and making everything to get some attention as a little child instead of focusing what really matters.

  37. great video, as always. i do have a problem with the meth analogy, as needle programs are actually extremely helpful to get people out of meth, and it seemed like you implied that they're a bad thing, and i don't really agree with that.

    still just a detail that has nothing to do with the actual subject of the video, but i still felt like i should point it out

  38. I'm trying to pass an object that I created using this method and the variables are changed, but the variables for the object always reset when the object is used again.

  39. UPDATE! Private class fields coming soon.
    More about it:
    https://developers.google.com/web/updates/2018/12/class-fields

    In short, now fields in classes can have # hash before their name, making them private, and not accesable from anywhere else than the class itself.

  40. As a beginner I've noticed one irritating tendency amongst all youtuber geeks -"wannabe funny guys"!
    Leave it, it's UNNECESSARY!

  41. You look and joke like Johnny Depp I swear, please make new content about JS for beginners + and elements that gives us headache.

  42. Im starting with javascript but i dont get when apply class in my regular website. In practice i can apply class animal and make objects like dog, cat or bear. But in a job website i dont know how to apply classes.

  43. I'm kind of doing the opposite. I am a JS beginner, and this idea was fed into me that classical inheritance is bad, by Medium articles by Eric Elliot (i hear he is notorious, but I have no idea if that is the case). So I really became focussed about learning prototypes well (at least it led to something fruitful, eh?), and now that I have a somewhat decent idea of it, it's still quite new for me and I don't wanna confuse myself and ruin my weeks (2 at least) of hard work by trying to understand classes in JS.

    So I think I will completely avoid classes for nor, and make do with the old school of using prototypes until I am comfortable with those fully. Then I will move onto classes. So, after covering 6 of the 7 videos on this series, I will pause here, and leave without watching the last one. Hopefully, I will be back before long, when its time, and then finally watch this, and add another tool to my arsenal. Happy learning folks :3

Leave a Reply

Your email address will not be published. Required fields are marked *