Комментарии:
I was thinking not not use js on backend for any reasons at all
now You gave me more clarity why I was thinking that
8 more reason I never want to have to learn javascript.
ОтветитьJS doesn't do anything the best. It's quite literally a mistake.
ОтветитьI'm imagining javascrip will add a ==== operator at some point that's the same as === except "NaN ==== NaN" is true.
Ответитьand in a number of cases a JSON responses from a server will omit JONS keys with values of undefined. Which is why you'll often see null in JSON data over undefined.
ОтветитьThis is “wat” all over again
ОтветитьThe more I watch this the more I an conviced to not use Javascript at all. Design flaws are not "features". Javascript type Management is worse than working with C pointers
Ответитьtypescript is useful because arr.prototype.sort() actually WORKS because you can make just a number[]. My editor (actually a game) throws an error if you try to use number[] outside typescript.
It doesn't support typescript.
Great!
ОтветитьIs JS reeeeally used that much of are people using frameworks of JS cause they dont actually want to use JS but there is no alternative?
ОтветитьSo, I started my adventure as a programmer with JS and I got used to it.
It has its quirks, but I don't see it as a problem when moving to other languages, most are really similar and don't change much between them.
Although personally JS makes a little more logical sense to me in some cases, it also has many useful mechanics (spread operator) that make working with objects much easier.
I'm not saying that JS is the only right language, everyone likes something different and everyone specializes in something different.
I think it is also worth mentioning the TS which is trying to at least partially correct some errors (while creating millions of others).
This is a good video for beginner JS-haters to learn the talking points about hating JS without having to actually code in JS, so they can be one of the cool kids at the office lunch table once they find a job in Golang or Rust or whatever is cool these days. I guess not Golang. Fact is, it's entirely disingenuous to call JS a programming language in the first place. You shouldn't expect JS to behave like other programming languages. JS stands for, and I swear this is true, Java*Script*. As in, scripting language. As in bash, PHP, Perl. You know. SCRIPTING. The fact that it was turned into a general-purpose programming language meant that it needed a lot of baggage that it just didn't have by virtue of that kind of thing not being necessary. Hell, you showed an example of classes, and classes are new to JS! When I learned JS 5 ye -- I mean, 10 y -- is it really 2024 already, damn, 12 years then, 12 years ago. When I learned JS 12 years ago, there were no classes; you had to use prototypes. There was no let and const either; it was var this and var that. OK, not var this; this is a reserved keyword. I guess it was var self = this.
Point is, while JS definitely has its... quirks, they generally match its original purpose as a scripting language for web pages, and it's only after people started bringing it to new contexts that it somehow became weird for it to have, for example 5 == "5". Seriously, why should you have to do all these parsing steps to get from the string to the number? It's a website. There's a form on it. You type a 5. That's a string in the HTML text box element. You need it to be a number. So it is a number, end of story, done. No need to worry about converting between the 5 that the user clearly typed into the box and the number 5. That's kind of the point of JS; you don't want to have to worry about types because they just get in the way of making your 1990's-era webpage. And now it's used as an enterprise language so you need all this stuff to be able to use it, including Typescript transpilers to add types to your language with a deliberately minimalist type system. The weird behavior with adding and subtracting strings and whatnot is, really, completely expected if you understand what it's trying to do. It will generally do the thing you want it to do, and if it doesn't, you can easily coerce it with unary + to force a number or adding "" to force a string.
This raises the question: is JS "good enough" to be used as an enterprise language, then? That's kind of a dumb question. Lots of enterprises do use it. I can understand why people who aren't used to it would complain about it, because the features you get by using JS aren't necessarily comparable to the features you lose by not using whatever other language. In my job we use Java, and Java is great for when you don't want your teammates to use your code incorrectly. You can force people to use the right arguments to your method by labeling its types. I want to add an argument to some basic functionality everyone is already using; well, I add the argument and now doing things the old way gives a syntax error. No need to wait for users to email support to find out that it doesn't work! But that doesn't make JS invalid or even bad. Fact is, it requires a different way of thinking. If you're thinking in JS, you can write good JS code, yes, even in an enterprise. Features and tools have been added to the language over time to make this work. But it doesn't make sense to complain that JS doesn't do things like other general-purpose programming languages when it's always been and is meant to be a scripting language for the Web.
As a person who designs all of their apps and web-servers entirely in Python, JavaScript is one of those things I always dread writing. Only time I've ever thought maybe C would be easier.
ОтветитьI wanna a video about this on js
ОтветитьI think if language allow you subtract and add number with text, it's pretty logical that adding will result string, but subtracting will result number. Never used java, and hear it first time, and don't see where is confusion. Tho it's probably because most of my programming experience based on Visual Basic, which is not very strict about such things too.
ОтветитьStill my favourite language tho.
ОтветитьBy the way an empty string is always equal to false in Python too. In fact if you want to check if a string is empty, you do if not string, which makes sense
ОтветитьThe production value is good, but please move on to more advanced topics
ОтветитьGreat explanation why it's a bad PL.
ОтветитьThe Nan thing seems reasonable though? How else would you implement it?
ОтветитьYea… js was never intended to be used for enterprise applications.
ОтветитьThat last class issue can be completely avoided so it prints only the name its instantiated with no matter what its called with by defining the methods in the constructor as properties on the this keyword, but binding them to this: `this.method = function(){}.bind(this)`
ОтветитьExcellent explaining Thanks
ОтветитьThat was an interesting video, i also didnt know the difference between "let" and "var"
Ответитьdoing 10 + "foo" is just concatenation, java lets you do the same, that's not addition
ОтветитьYou forgot: it can't get you a job as a junior.
ОтветитьES 6 was a mistake. Adding in the "class" keyword was a huge mistake. There are no classes in javascript.
ОтветитьThese "JS is bad, here's why" videos always bring up the same things, and always end up bringing up something about floating point to show how JS "can't even do math" when the behavior is actually correct according to spec and similar non-issues. And all the parts that are brought up are JS v1.0 features which I can agree is bad, but it's not the language I use. I never use "var", how "var" works doesn't matter since the language is great without it. If you learn JS from looking at ancient and bad code then you will of course learn the wrong things. The reason JS is popular is because it's fast, runs everywhere and actually is a great language. Modern JS !== ancient JS. It's not ancient JS that people love and make it popular, so the flaws don't really affect the quality of the language. Would be nice to rename the language and just remove backwards compatibility, but why bother?
I do use == instead of === pretty much always though, and never have bugs because of that. I just don't mix types unless it has some real advantage, and if so I type check first.
And same for arithmetic and values being truthy or falsy, just don't start an concatenation expression with numbers and don't try to do math on strings unless you have checked formatting first and preferably called an explicit number parsing function. A lot of errors can only happen if you just have no clue whatsoever what the variables are for and try stuff randomly.
What a funny walkthrough ❤😂
ОтветитьU call it curses! or flaws. I say they are pretty cool features that no other programming languages can give🔥. Only people that don't understand say those are flaws.
Ответитьpoor NaN(ny)...
ОтветитьHow do you have all those fancy colors and icons in your terminal? like where it says what app your running and stuff
ОтветитьMay I ask what plugin are you using for your status line?
ОтветитьI'm disappointed you didn't talk about the object prototype model in Javascript (everything is an object, every object has an object prototype). You can do some weird things with that...
ОтветитьThat's what I always like to say, Javascript is a scripting language, it always has been. It's just v8 made it so fast it's feasible to be backend, but it really isn't meant to be used as a anything that couldn't afford downtimes.
ОтветитьI like your videos so much! How Do you create your videos? Is this all done with Linux?
ОтветитьReally like your terminal. Can you pls make a video about your setup))
ОтветитьCursed language indeed.
Ответитьit's just a little bit cursed
ОтветитьI love video without music
Ответитьthe way you present the js features after telling how other languages do is very hilarious 😂😂😂
ОтветитьPurists will note the language is named ECMAScript but people who know will call it Java--.
ОтветитьSince JavaScript was made for being run interpreted in the client, there is no compilation step to barf up warnings to the developer; any errors will appear when it runs in the client. And while you should of course test your code before pushing it; having it fail and write an error that nobody can see in a log on some users computer is not very useful, especially when it's possible to do something useful. Also it might work perfectly and all types are correct in testing but since it runs interpreted in all sorts of weird browser with all sorts of poor internet connectivity; values that always are number in the 5 browsers you test on with a fully functional internet connection; might randomly become string in some other context. So the type coercion makes a lot of sense, if it's at all possible to do so it's in most cases better to do something a bit weird than completely crash for no apparent reason. For instance defaulting to string comparison for sorting is a good default because everything can be meaningfully coerced to a string, and occasionally having a list be sorted "ascii-betical" is way better than having the website crash whenever a table contains a stray value. And for debugging it's much better to have some kind of sorting than no sorting at all. But if you supply your own comparison function you can choose how much error handling you want.
Some of these complaints smells a lot of a backend programmer used to strict strongly and explicitly typed languages complaining about a weakly typed language being weakly typed as if that's a bug when it's actually a feature. I personally hate strongly typed languages that complain about doing arithmetic operations on two types of number; since in 99% of the time of course I wanted the result to be the one type that can contain the result most accurately. I think it probably should be either some compiler option and/or some decoration syntax in the language to indicate if I do want it to complain about such issues and want all type casting to be explicit.
There are of course some genuine unfortunate choices, especially in the 28 year old first specification; but that's why we use linters to avoid these ugly parts that has to be there for backwards compatibility. E.g. overloading + to mean both arithmetic and concatenation was probably mostly a mistake, especially with it's arcane rules for how the operands is coerced; a more sensible default if you wanted to have this overloading would be that if any operand is not a number both sides are treated like strings. But that's why modern lint rules prefer string interpolation over concatenation.
Omg, I know what it is strange, but never thought how much. Thank you, now I am sure what I don't want to deal with js.
Ответитьthere is a reason i use js to explain my feelings towards x86
ОтветитьWhat a nice language, we should make the Web run on it.
ОтветитьWatching this makes me really feel like I should move to Rust or something like that.
ОтветитьYEah. I'd like a whole video about this in JS;
But can someone explain to me why JS couldn't call sayName() when he let sayName = person.sayName ???
I always think of Null as "There will never be/was anything here" and Undefined as "There currently isn't anything here, but something could be here eventually."
Ответить