Just by making this video I'm already a better JavaScript Developer. Thanks to everyone for sharing their knowledge and correcting where I was incorrect. That was actually a big goal of mine in making this video and putting myself out there - to learn. A lot of individuals that post on social media want to act like they know everything, when in reality, they don't. I'm not talking about the commenters here, I'm talking about people trying to up themselves. But in doing so, they won't learn just as I did by making this video - even the simple things, like how JavaScript has classical inheritance and not just prototypal inheritance lol. Hope you enjoyed this video and learned something along the way.
@jeff pentagon You can change the built-in objects or classes just for the existing session not forever. So it's actually like in Java. Try for example to change at Math how it shows the PI value. Make it 5, for example. To see what has Math under his belt, you simply first run console.dir(Math) ; // which is *display interactive* and shows you a tree structure of Math (or of any other built-in // or not // object, class, function if needed, be it Date, Array, Object, Boolean - or everything else you can think of) Then ... surprise ... surprise ... run this code: Math.PI = 5; // it's 5 now -- you can check that by using directly console.log(Math.PI = 5) // 5 console.log(Math.PI); // 3.1415.... yep, it's again the default value, even at the very next line of code. For @ForrestKnight Javascript is the only language that runs in the browser - therefore the reason for its huge adoption. Actually it runs on 3 various environments: browser (as vanila Javascript alone , or plus its 'friends' : react, vue, angular, you name it/them); in Node, which is another environment, or finally in Unity (gaming development). It's pretty nice to have such coverage, in my opinion, for a single programming language (even if in several flavors). By the way, I wrote earlier below a comment even before watching your entire video, about the 'extends' word - which also exists in Java - and am curious about your insight in that matter.
@jeff pentagon TS was probably just a way to use a hand from the neighbors, to fill a gap (like was "use strict" for example in ES6). Many languages borrowed from other ones, it's a fact. About Math.PI, it's very simple, we 'consume' at runtime like a PI shadow, not the original one, an image of the built-in stuff (else every hacker could permanently alter our browser API and invade our computers). As time as we ask again the Math it delivers a fresh 3.14 PI. Therefore it's elasticity not plasticity the specific of the way in which the built-in entities are stored in the browser. We can always reuse the clean version. It's like the meaning of var or let, they are conceived to be modified after initial assignment - because everything in browser must be used through either browser events as onload or human interaction as onfocus, onclick, on change, etc) - think as initial or future state in React. Funny thing, in initial specification of JS, at times when html4 was still spread, one could select an element directly by name or id, with prevalence for the name, if existed. Very revolutionary, I could say, so you wouldn't need the ugly sentence document.getElementById("demo").innerHTML = "Wow"; - because you could write (as you today can , too) directly demo.innerHTML = "Wow"; as time no other JS variable would be called again 'demo' of course to overwrite our div identifier. But at that time there were no modules whatsoever, no third-party external scripts, no CDNs, not even the age when Yahoo started to deliver us viruses through their infamous advertising banners loaded in s (where bad guys changed their original jpegs into bad things :^) Today we shouldn't complain too much, as we have Babel to make code work in any client (as we have SASS or jQuery meant to generate compliant CSS or JS code for each vendor browser)
This is an automated comment to display likes & dislikes for the video you're currently watching, since RU-vid decided to disable the dislike count on videos. Views: 17574 Likes: 1064 Dislikes: 27 Ratio: 97.5% Last Updated: Dec-29-2021 RU-vid, please don't ban or shadowban me. I learned how to do this from your own docs. Lol thanks.
@@fknight extends is best and really current practice and prototype is well... legacy. You now use extends and explicity inherit properties and methods from the parent/base class by calling super.
@@fknight definitely you should use this new class syntax just because it is much cleaner, however objects created with this method are still based on prototypes that are just 'hidden' inside modern syntax.
@@fknight To expand on what others have said, the class keyword in JS doesn't add any new functionality - behind the scenes, you're still using the prototyping that you use in this video - only in a cleaner, newer syntax. And as a java developer, you will find that syntax much more familiar than the method you had been employing.
@@fknight The class method with the extends keyword is the new syntax. In the background, it is just a syntactic sugar on top of the prototypical inheritance, so it is still good to understand prototypical inheritance. But in general, just use the class syntax as it is the more modern way.
The Java does look neat, but I would recommend that you write Javascript classes the ES6 way. Like so: class Bike { constructor(wheels = 2) { this.wheels = wheels; } } class Dirtbike extends Bike { constructor(engine = 125) { super(); this.engine = engine; } } const ktm = new Dirtbike(); console.log(`Amount of wheels: ${ktm.wheels}`); console.log(`Engine size: ${ktm.engine}`);
JavaScript, as a language, seems poorly-designed language. Java is great because it is modeled after C, which is the gold standard of all programming languages.
@@theblindprogrammer well javascript is also designed over c/c++ the for, while, do-while loops are same if-else, switch-case etc are same and the simplest object oriented method to create an object by simply using a function (factory function) and inheritance is just so easy with Object.assign() method in js no classes no syntactic sugar its well designed and maintained with well written docs on MDN, u just have to learn it the JS way
@@killerdroid99 JavaScript as a language is not special, anything you can do with JS, Python or PHP can do it better. If you want to write optimized iOS app you use either Swift/Objective-C, Java/Kotlin for Android, web-apps for Python/or PHP, Anything low level C/C++ dominate; so what the hell does JS is good for? JavaScript is good example for language that wants to be everything for everyone, but in reality it turns out to be nothing to no one.
My tip for learning JS is: Don't strictly follow paradigms. Javascript is a multiparadigm language, you can use whatever paradigm you like in it. As you start learning JS, you'll se that most modern JS relies on functional patterns, such as HOFs, closures and functors.
While it might be multi-paradigm (most popular GPLs are tbf) language but some of the support for those paradigms as has been mentioned, (like OOP) aren't the best in JS compared to other languages.
imagine me, i came into university and learned python the first year then java... the transition... oh my... i've only dabbled in javascript, but it seems like its as if java and python had a baby. tbh nowadays i find python super handwavy so i totally understand the part where u talk about python being a dynamic typing language!
@@balwamaargaming You won't be able to change it's value type. You can have something like: const arr = []; //empty array; Then you can use arr.push(2) //arr = [2] and it will work because the type of arr is still an array.
I've been using java and c# for years and when a js user teaches me something I can't avoid to think to myself "Look what they need to mimic a fraction of our power"
Java makes me feel like a Senior Developer (even though I am not) and Javascript makes me feel like a Junior developer. every time I run into bugs like 'undefined' or some creepy bugs because of Javascript's dynamic variables thingy. But I still like how Javascript is. I hate es6 classes, so I just use functional programming style Javascript, because I don't understand the 'this' keyword. Or maybe I am just dumb.
I'm a java developer so don't know anything about JS version of 'this'- but does it not just hold a reference to the object from within which code is currently being executed? I.e. it refers to itself
Honestly wouldn't mind more videos on this topic of you continuing to use JS, would be cool to see you work on some of your projects being relatively new to JavaScript.
I mainly develop using javascript, both in the work environment and personal stuff. I do remember loving SML in college because I was good at it and I could just solve problems easier with it. Never committed to it because I didn't think I'd find a job in SML. Great video as always!
Point 1 about types: You are right. Types in JS are terrible. TypeScript was invented to fix that problem in JavaScript. Point 2 about classes: ES6 introduced JS classes that is roughly the same as the Java version of classes.
To me, such a big difference between JavaScript and Java is the “typelessness” of JavaScript vs. the strict typing of Java. I feel like that alone makes the approach I take with JavaScript more of an “on the fly”/“ehhh I’ll let it handle this at runtime” approach vs. with Java you have to have things much more strictly defined and organized because it is typed and you have to compile it. Furthermore, I feel like with those approaches, I tend to just write functions for my repeatable code in JavaScript (maybe that’s not the correct way, but it’s my way😊) vs. with Java I’m more likely to create a class for something repeatable. Lastly, when I approach something with JavaScript, it’s most likely going to be front end interacting with a UI, so to me it’s a much more trial and error, visual, UX, creative/right brained process, so I am hacking away at it until I get it right or am pleased with it, but with Java it’s more about planning and thinking in a more left brained way. That being said, I guess that’s why I tend more towards just writing functions with JavaScript and creating classes with Java. Maybe I should do more planning and create classes with my JavaScript, but at the end of the day if you have a solution that works for what you’re trying to achieve, I believe that’s what matters most. Just my two cents. Great video, got me thinking!
There are 3 words you should not use in JavaScript unless you are forced to: class, prototype and this. You have closure and first class functions. Use them!
I would love to see a follow-up video to this saying your thoughts on TypeScript as a Java Developer. Your two main gripes with JS are the types issue and the classes issue. TS fixes the types issue and ES6 classes fix the classes issue. You say you already have some projects that use TS on the front end so you could maybe request to work on the FE of those projects for a bit to get a feel for it. Alternatively you can convert the JS project you made for this video to a TS project. Converting a JS project to a TS project is more difficult to get the types working than working with TS from the start though.
@jeff pentagon I'm working on converting our component library to TS at the moment. I need to try to avoid making any breaking changes. I need to write some pretty gnarly types to get it working for some components 😬
So... JS has a class keyword. That kind of feels like a major miss here on such a quick comparison. If you thought that was a TS feature, it's not. You seem to imply that JS and TS are very different but they are exactly the same except for type annotations. It sounds like you should just... add TS to your JS projects. 🤷♂️
I do as well. I work with JS because it's literally everywhere. But the loose rules with non-static typing, function hoisting, == vs ===, strange functional implementations, and ambiguities with local & global variables are obnoxious. It doesn't feel like I'm programming. It feels like a kid told me rules to his game; the rules aren't consistent, logical, or standarized with other languages. I'd say C, Java, and maybe C++ are my favorite languages to work with. I do know Python and quite a bit of JS fundamentals. But that's just because they're so contemporary.
I watch your videos since I started learning programming and you become one of my models, and watching this video really makes me happy because I don't know a lot stuff, haven't build anything big but I know some stuff and still learning. People act like they know everything at best and when you follow that people you think that you're stupid and you try to learn more other stuff and you get lost but this is wrong. You're a Java developer, a good one I assume (I don't know much about Java) but just not best at JavaScript, does it make you more less programmer? No. And now I see, I can somehow become a closer version of one my models makes me feel great. I hope you continue working on JavaScript, maybe making video series? Not comparing to Java but trying to make project(s). I don't know it feels really good when a good programmer leaves their comfort zone and try something new and share it with people like me. Btw, I feel like I'm better than you at JavaScript concepts but you'll easily do better if we both try to build a JavaScript project which makes you more valuable for industry and me still being end up learning more about JavaScript's prototype based model.
Bro thanks, I've been a learning a lot from your vids keep it up!. Also congrats for you brand new podcast. I was wondering if you could make a video about how to network in the tech industry. It would be very helpful.
I use CONST 99.9% of the time. And I often apply functional paradigm with JS vs OOP. JS OOP isn’t the same as the classical OOP we see with Java. And I really do not like using prototypal syntax. ES6 makes it more manageable but why use it? We can use composition instead of inheritance. JS is far more natural to use as functional vs OOP. Keep mutations down to the minimal and you will rarely if ever run into the issue of assigning variables from string to num and etc. I avoid using let and var unless I know specifically where and when I need to reassign that variable. And usually never more than 2 times. The reassignment happens 1-3 lines below the declaration of the variable.
Start using const for variables that aren't being reassigned. You can even see the creator of React in interviews very recently saying that he doesn't even care about const vs let, however const is definitely the safest way to catch yourself reassigning by accident.
Regarding having to explicitly write String in Java, since Java 10 (or so) it's been possible to just say var myVar = "Hello, World!"; in cases where the compiler can infer the type (e.g. a method returns an ArrayList, so a variable assigned to the result value will always be an ArrayList). The type of the variable is still String, but you don't need to specify it. As for JavaScript - my absolute favourite thing about it is how you can mess around with functions in ways that are super cumbersome in many other languages (like Java's Lambda syntax is way harder to do). Pass a function as an argument to a function? Sure, no problem! Return a function from a function? Sure! You can do pretty much anything with them, which is super great but also easy to mess up with 😎 It's also a pain in the ass, because JavaScript is so lax about types and such, but when it works for you, it really works for you.
what you are referring lomobk is automatically doing for you just by using annotations. In JS there is a similar concept called decorators. Best advice is to use Typescript which is superset of Javascript and eslint rules
They are very different languages, and i think the main difference is the asynchronous programming 1. dynamic VS static 2. JSON(many things is just data, doesn't become new types) VS Classes for everything (UserDetailsRepositoryReactiveAuthenticationManager etc) 3. more functional VS very object oriented 4. asynchcronous (either callbacks, or async/await, or reactive programming) VS syncrhonous(threads or virtual thread now) Javascript as exception using typescript can be static looking, and easier to write object oriented code. Java as exception can be more functional with streams and with reactive programming can be asynchronous(after project loom will be reduced even more)
I'm coming out of a Java bootcamp, and as I try to see why Node or Java are chosen for a project, I mostly hear poeple advocating for Node because of the minimal boilerplate. But now that we have things like copilot and tabnine does this mean there's even lesser excusses no to choose Java. What if I want to build a personal project and hopefully turn it into a product with millions of users (lol i know) is Java the way to go ?
I have an amateur question. Can you do front end development, especially for the web, with Java alone. I’m learning Java, and have a little experience with Python. I know you can use Django with Python for web apps, but my limited understanding/belief is that you “must” use JavaScript/HTML/CSS for front end/web development, even if you program in Java or any other language. Thanks
TL;DR - no, you cannot build a front end purely out of Java code. HTML, CSS, and JavaScript (optional, but will make your site/app far more usable) are all a browser understands. ------ You cannot create a front end with java alone, in that browsers only understand HTML, CSS, and JavaScript. The JavaScript is optional, although it makes things MUCH faster and gives a much better experience with it for the end user. If you don't use JavaScript, you're likely going to be using (for example) Django (using python), or Rails (using Ruby) or something equivalent to render the HTML on the page. However, the issue with that is every time you do just about anything on the site, it will have to refresh the page to render the new state. (In a nutshell) JavaScript makes it faster and easier because it can dynamically change the HTML that is already rendered in the browser, instead of having to refresh the entire page. Hopefully this all makes sense haha. I don't know if Java has a Django equivalent.
Depends. JS still is dominating for modern web stuff. With Java alone I think not, at least not in todays landscape. There’s probably some way to “compile” frontend code from Java but at the end it gets “compiled” to js/html/css. Maybe at some point it’ll be possible through web assembly, but that itself is pretty uncommon and in early stages.
@@dieselfreak28 I feel like you skipped the fact that just as you can use Django with Python or Rails with Ruby, you can use Spring with Java to make SSR web apps. Same limitations, obviously, no dynamic behavior and all that, but I feel like you only made your point more confusing by bringing other languages into the topic.
@@EthanStandel I mentioned at the end of my comment that I wasn't sure if Java had an equivalent or not. I'm not really a Java dev so I wasn't sure. I brought up Django because the original comment mentioned it and it seemed like I could use that to help my explanation. You're probably right that I should have left rails out maybe though. Apologies if I made things a little confusing. My TL;DR still stands though I think.
@@dieselfreak28 yeah, nothing you said was inherently wrong, but now most Java applications today are web apps, but oftentimes it's just services that don't actually have a frontend though they do have the ability to SSR
I hear these arguments a lot, and I some what get them but at the same time my mind goes to "why would you even try to combine or redefine into different types". Seeing you use proto in JS reaffirms my belief that JS is just poorly taught by most people. There are SEVERAL other ways of doing that same thing that model the way classes are created in Java. For someone only knowing one way I see why this would be difficult. The best way of learning JS in my experience is Douglas Crawfords videos here on YT followed up by Eric Elliots articles on Medium.
I also don't understand how anyone can say Java looks more appealing over Javascript but maybe I'm biased too as Js developer. Because of all the keywords and types like string public void before you even log something to the console. I would quit if I were to start from Java.
coming from an amateur java developer, java is just extremely consistent and logical. everything is part of a class, even the main function. this way, there are only class functions and instance functions. if you dont like it, you can just straight up ignore the class containing the main method. it really depends on what youre used to
@@legitlinus9052 The same can be said about JavaScript/TS where everything is an object or part of a object and the functions you are using are methods on these objects or instances of functions, which also are objects. There is no main method, you have the global window object and you can do whatever you want, wherever you want. It is as logical, just different.
Totally agree ! It's same hideous extra verbosity in front of each variable name as in php where everywhere you see the $ sign in front of the variable name instead of the clean names as in JS. I don't say that the verbosity in Java isn't somehow needed, but I suppose that instead of repeating as crazy that verbosity one could better just apply some simpler syntax // or naming // convention (as is in Underscore JS where you see things as _.name or _.price or _.length). I'm not saying that JS is perfect, because even here you have idiotic ways of naming the things -- as is writing the word `extends` instead of something better. Imagine how nice would be to write class Car { constructor(wheels) { this.wheels = wheels; } } // followed by class ElectricCar uses Car { // which is more logical than `EXTENDS` // some code here, too } because ElectricCar is another Car that doesn't actually extend anything, it's not giving any extra `arms and legs` to the initial Car. Obviously, it just import, applies, uses the old stuff from the ancestor Car, for ITS own use. ElectricCar just begs (and receives stuff from the merciful Car), not the other way around. Saying Car extends ElectricCar sounds like saying that a Beggar giving something to ElonMusk :))))) I could accept to see isExtendedBy or From but never the stupid extends. It does not "extends" anything because the ElectricCar is a different thing and the older Car stays imutable as it was in the beginning, despite the fact that a younger brother of it is just born. It's not something as `let x = 2;` followed by ` /*you know what ? */ x = 5; /*from now */ ` :) Sadly in a world that might be construed on the absolute precision, even the words that are called to explain the stuff in the clearest form are sometimes like damaged. Consider also other stupid naming, for example in CSS, where you say that a child has "position: absolute" compared to its parent (and the parent is having position instead "relative"), while in reality we shouldn't care where is the parent, because we only care that the child is 2 px towards left side relatively to the parents' position. Obviously someone from CSS Working Group never heard of Einstein and his theory of the relativity concept (related to // compared to // in relation to someone or something // the observable relative to the zero point of reference, etc). It's a pity that when even the mere [ humble dwarf ] html5 introduced the revolutionary semantic keywords when evolving from html4, the [big giants] programming languages didn't align themselves to clean the nonsensical garbage from their own verbiage. Or the MySQL the stupid thing of keeping that nonsense of third party logic (instead of dual as is in boolean logic) since E.F. Codd wrote it in the 12 principles of relational databases (3. Null values must be uniformly treated as “missing information,” not as empty strings, blanks, or zeros.). The discussion could go on. I remember that even about OOP some great coder (I think it was the Erlang creator) said something controversial but really funny and having some real ground : *when you ask a variable value in OOP is like you ask a banana and instead of receiving one you see coming to you a gorilla not only with the banana but with trees and basically the entirely jungle behind it just to bring you that banana* ROFL - www.johndcook.com/blog/2011/07/19/you-wanted-banana/
One the surface yes java is oop based and js feels more functional programming baised but js also has a traditional oop way of writing code so you really dont have mutate your variable object rather you can create a class
Hi, forest knight. I’m from New York City there is a job market for Java. Basically, I love the language and I wanted to know from your experience. Do you need college in order to find a job knowing Java? At the moment I am a beginner and I’ve been learning JavaScript and some Python and recently I played around for 2-3 weeks Java using Eclipse and I like the language, what are your thoughts?
you don't need a degree. just need to know your stuff and prove that you can do the job. if you choose to learn java then learn core java and after that learn the spring framework
I like to think of programming languages and technology in general as tools. Every tool in my box has certain strengths and weaknesses. Some tools are more general and may overlap in their use cases, others are highly specific. A knife for example can be used for many things but I would prefer a hammer to place a nail into the wall. Sure, I may be able to use a spoon for that, but it will be much harder to do.
to my knowledge jest is the most popular test runner, with some great mocking features. Java/.Net feels to heavy for me. full stack js/ts developping is like the sweet spot for me
Man i just bought Java Programming Masterclass covering Java 11 & Java 17 It is over 80 hours , would you still recommend learning Java in 2022 and for the upcoming years , and if you could please please upload a video comparing Java Vs Java Script And Why Is java or Java Script better, Best regards!
Hey man , no issue that is a great course and i am following it myself . But you can always switch to other language plus the course you bought will always remain there whether you complete it now or sometime in future. The confusion is normal I have it too and guess what other developers out there too , good this means you are serious about this. Learn what interests you and don't limit yourself with one tool or language . If you want to switch to js then do it and later when you want to do full stack you can come back to Java or python or node.js . The only factors are time and consistency, time you will have a lot and consistent is something that's in your hand . Have a great learning and career
Is 2nd Generation core i5 8GBB DDR3 RAM 240GB SATA SSD good for Coding/Software development? Like: MySql, VMware,Kotlin, Android studio, Java, NetBeans,Sql, vs cose, intellij idea
Weird, when I have comments sorted by top, I can't see your automated message at all, but if I sort by newest and go to the bottom, then I can. Might be just me tho.
I will never go back to plain Javascript after having used Typescript, especially for newer projects. The type safety that Typescript provides makes it impossible for me to use plain Javascript nowadays. Also, since Typescript is just a superset of Javascript, everything you can do in Javascript you can do in Typescript. There are literally no downsides to using Typescript over Javascript in my opinion.
Once you lean java other shi ts looks so simple in my opinion. Especially you practiced java with android development then it seem a lot easier to learn front end.
This was one of your more frustrating videos. For more than half the video you drill the disclaimer that your not used to javascript then you do a sponsor bit. Then you spend maybe 10% of the video actually talking about your opinion and say...I geuss ill end it there. WTF man if its a 13 min video atleast give a 10 min opinion/ expierience video.
@ForrestKnight i think if you are in web app dev it is good to have at least some basic javascript knowledge regardless of the language you are actually using because it will be actually helpful and will help you push ur skills and what you can do to the next level
"I want to dig a hole, now I know we have excavators, but that's not the point. I wanted to dig the hole with a shovel because... why not?" Jokes aside, great that you want to learn JS, but I would not recommend this to anyone. TS just solves so many issues that JS has had since it was created, and I'd never go back unless I had no choice.
I'm exploring how to do this with python as well. I saw this during an interview I had, I was so lost because I had never seen this done in python. I didn't pass the interview lol
I would argue JavaScript is the most versatile language, even if it's not the best thing for most scenarios. I think it's a good starter if you want to engineer software, but not a great start for general computer science.
I’ve been seeing a lot more front-side videos pop up. One of my classes just had us do a semester project that runs a web app in Spring Boot, is there any need for junior software engineers to know that? Sometimes I wonder if I need extensive front-end skills to get a good job
@@outofboundsbro Do they specialize in Spring Boot or are they SE jobs that require Spring Boot knowledge to do the job?! Sorry if this is a silly question
@@samuelcarter8021 I'm gonna say both. Also do personal projects in something that interest you by yourself or a group of friends so you have something to show when you graduate. Also internships good luck! 👍
To me Javascript is ok as long as no one decides to use js for desktop applications. The very reason discord experience sucks is because no one wants a ram hogging js app to voice chat with friends during a intense game
inheritance is literally something you can do in javascript. what you showed in java is literally something you can do in javascript, with out the proto stuff. did you just never try it or what?
Maybe you should call this video My *first experience with JS as a senior Java dev... xD also side note : 5 mins for snowflake warning and sponsors are too long mannn :/
JavaScript and web programming are horrible. I think it is overrated in terms of flexibility, modularization, access to the local system, etc. How the web survived without the current frameworks? Difficult to tell...