@@ark_knight i know. past 4 years i PHYSICALLY removed ever ppl from my life. Non of the btches saw it coming (arrogance). Nor did they belive me I WILL eventually throw commies out, no matter how close they are. Trainwashed, TshemTrailed brains, 5G androids (They are not human anymore.) But I stop whining. I actually wanted to say that *space does not exist. Space is a shadow.*
Prime : "I don't buy the readability argument for ++ or -- vs += or -=" Prime, seconds later : "hey chat, is a+++b post or pre increment, betcha don't know"
"Bottom values" at 9:45 is a real term in discussions of programming language semantics. Although, its use in this article is weird. Meaning of terms in a language are represented as elements of an ordered set. These sets usually have a smallest element, i.e. a "bottom", because inequality is typically drawn as a slanted arrow pointing upwards in diagrams. The bottom value is the meaning of terms that do not evaluate to anything, i.e. an error or an infinite loop. They have "minimal" impact on the program because you can replace them with any other term, without changing the result of the program, if it originally ran successfully. But Javascript's null and undefined act more like Rust's None (without the safeties), because you can still pass them to functions and do equality tests on them. Unlike actual "bottom values", they are not interchangable with each other, so you run into problems when using one instead of the other. And if they were interchangable, there would be no need for two.
Right. In Typescript and PHP the bottom type is called 'never'. As you say it's the return type functions that cannot return e.g. because they always throw or loop or exit. I'm not sure how you could have a bottom type without some static typing so it doesn't exist in Javascript.
@@barneylaurance1865 That's not quite the same concept, unfortunately. Both (meanings of) terms and types can be ordered, the latter by subtyping, so T
12:30 nope - you DON'T. You will always read at least the same amount as you write, but it much much more likely, almost certain, than you read more than write. When writing - you are reading the stuff you write. So if you read anything else besides the code you just wrote (so if you re-read the same line after you wrote it, or you read code from someone else) - you just read more than you wrote. Unless you somehow write without looking, then there is no way to write more than you read.
To me x+1 has a different meaning than x++. When I write x+1 it's because the number 1 is arbitrary, it could conceivably be something else and the code would still work fine. I write x++ when It has to be incremented by 1 or the code wouldn't make sense, like iterating over a list.
Well yes, x++ is the same as x = x + 1(aka reassign the value of x to its own value plus 1). While simply x + 1 is an expression which by default is not assigned to anything. For example: let a = 1; let b = a + 1; //which tells the browser: //assign to b the value of a + 1 console.log(a)//1 console.log(b)//2 let x = 1; let y = x++; //which tells the browser: //assign to y the value of x(which still is 1 atm) and then increment the value of x by 1 console.log(x)//2 console.log(y)//1 Now if the increment sign was before instead of later (let y = ++x) both x and y would log 2 since x would be reassigned before assigning its value to y but i believe the earlier example proves my point better, which is, they litterally are 2 different things, not only to you.
9:33 semicolon is not required after variable definition statements, but before expressions starting with ( or [, since it is ambiguous whether it is a function call/index operator or expression group/array init.
"You know distance Relatively beteen atoms is greater than the distance between planets. You are more empty than space. Space is empty yeah you're even emptier." @ThePrimeTimeagen ❤
The extra new line at the end of the file is a Vim thing. If you write the file using code editor sublime, or maybe with printf, you can make it not appear. Vim always adds a new line at the end of files.
I came to say the same thing. When doing Advent of Code, I noticed that I would get the extra newline if I copy/pasted the input into vim, but I wouldn’t if I downloaded the file directly.
You can write js without any semicolons - Except where the line starts with an open bracket. Then you simply prefix it with a semicolon. For example ()(() => {})() becomes ;()(() => {})()
It's good to notice that many type coercions are also not specific to JS. After your video of yesterday, which also discussed JS lang design issues, I felt inspired to try things in VB language dialects and in Powershell. In both of these you can coerce a null value into a negative number by just typing a minus sign in front of it. And a string digit plus a numeric type digit concatenates them into a string, while minus or multiply actually performs numeric arithmetic. Really great. So coercions are kind of bad in general. Also note that PHP knew those problems as well, but it was also far earlier than JS with introducing triple length operators. So that whole solution did not originally come from JS either.
i literally use x == null or x != null its the only scenario where i use "==" instead of "===" its so much shorter compared to x === null || x === undefined
I learned JS 15+ years ago from video lessons recorded by some nerdy professor The first things he said were literally: 1. JS is weakly typed so you can do crazy stuff (like adding strings to numbers) 2. It comes with tradeoffs, because you have to know how implicit type conversion works (shows the ParseInt of 0.0000005 example) So in order to use the language properly and do all the crazy things it allows to do, you have to learn it deep enough. Everyone who has problems with JS has skill issues.
That is very true. As long as you can get to the intended result & know how to get there, job done. A lot of people are deluded & think a perfect language exists.
There's probably a wall powered "dummy" battery available for your camera if you search for it. That way you'll not run out of power unless the grid goes.
the comparing string with number makes a lot of sense to exist in js BUT it is wild that the creator made it the default rather than say a ?= for a looser alternative especially if that wasnt the initial implementation/original vision for ==
I didn’t know JS was this bad. I think the problem with JS is that it has a monopoly in its domain. We should be able to run precompiled code in a browser somehow. Like a modified version of C, with access to the DOM and the browser, capable of transmitting and receiving data to & from the server. Not only would it run faster, it would be more reliable and consume less memory. Less requests and smaller file size as well.
PHP has always had loose and strict equality operators. A long-standing PHP idiom is that many functions that return false on failure may return another "empty" value (false, null, 0, "") on success.
I like loose equality bc it makes if statements easier for empty strings or null or undefined, it's easy to always use === without forcing casting. eslint js standard linter catches all semicolon issue which is only before () or []. null is user assigned undefined which let's you tell apart missing property or set
I've fallen into semicolon issue 3 or 4 times for the same reason: Placing a self-invoking function after a line that doesn't end with a semicolon. Always takes a moment to figure out what has happened.
parseInt() needs a radix; parseInt(1, 10). Regarding '' values in your array from the file, you could use Array.filter() on those empty values first and THEN use Array.map()
Using trim on the initial string also helps against the final newline. Still screwed if there are newlines in the middle, in which case your solution will work nicely.
You could just inline your map callback as (el)=>parseInt(el) The error is caused by the fact that map also provides index(and array) as parameters which get fed into parseInt and result in NaN - cause you ask it to interpret 3 as a number in base 3 which isn't possible.
It's kind of crazy to me that there could be developers that don't know IEEE 754 at least in concept. I thought that was just something you learned in your first two months. But I guess things are different in Javascript land
I knew about it but not until I actually came across it in a real world problem. I don't have a CS degree and have no formal software training outside of building things and learning while building. In my experience, when the organization asked me to build an internal web app in JS/React, I started with small tutorials and worked my way up, and unfortunately no where in those tutorials did IEEE 754 come up.
@@xBiggs it is indeed devs who don't have related cs degree. I mean, if some cs grads don't even know it, then it's more likely someone without cs degree don't know it.
16:18 It would work a lot better to do .map((v) => parseInt(v)) because parseInt can take 2 arguments (value, radix), and .map passes I think 3 arguments (value, index, array), so it's parsing digits that are impossible for the radix/base being specified for that example, which results in NaN i.e. parseInt('3', 3) returns NaN because there is no 3 in a base 3 number system
My friend gifted me the book "You Don't Know JS (yet)", which I believe this article is related to, and man, what a waste of dead trees. There's good JS books out there but this one feels like it was written by somebody with a month or two of experience and all the confidence of a 10 year senior dev
This article is not related to YDKJSY in any way. If anything, it's quite obvious that the author of the article has never read it. Regardless, what exactly is wrong with the book? Kyle has way more than 10 years of experience, so this critique doesn't sound particularly valid. And his book is on GH, so if there's inaccurate information, you can easily point it out. Edit: I want to make clear, that I didn't read YDKJSY in its entirety, so my question is genuine, not a usual shitposting.
@@svenzverg7321 Hey thanks for the clarification. I just jumped to conclusions based on the tone of the article. My problems with the book was where it was going over the boring criticisms of js with all the type coercion which is just the boring repeated stuff you hear about. Also calling JS "weakly typed" - which I believe is one of those academic "technically wrong" since all the type coercions are precisely defined. Briefly skimming through it on GH I see how it talks about how there are legitimate uses of `var`, which I find debatable. Now that I'm looking through the book again, I think I was so put off by that stuff in the early chapters that I just tuned it out and didn't bother to read the rest. I don't plan to, but maybe there's OK stuff out there
b + +a works too. b++ returns it's value and then adds 1, different than ++b that adds 1 before returning it's value. b is already an integer, so it doesn't matter if you poth both + after it or not.
I was looking for a pro's insight before starting to learn this stuff. This reminds me of all the rule exceptions that need to be memorized in Chemistry.
i've been using javascript without semicolons for like 6 years. It's not required anywhere. there is one case in which you would have to use them though, because the inference can't figure it out functionCall(); [1, 2, 3, 4].forEach(doSomething) in this case ()[] makes it think that you're trying to access an index in an array if there's no ; separating them as statements there also may have been another case similar to this but I can't remember it right now edit: oh yeah it's the thing in the video, if you're wrapping random whole statements in () for some reason (but why would you be?), then it thinks you're trying to use a function of the previous line I don't know why his claim is "you run into this a lot". I've only ran into this maybe a dozen times, generally because I'm defining one-use arrays after a function call, which is kind of hacky it's better to have named variables. Why would you start new lines with () even? That sounds even worse!
I just wanted to watch some videos to relax after almost crying while making a small JS plugin for a Unity project, but now I'm having seizures, thanks
Shoutout to the chatter who said "Vtuber" when talking abojt types of bottoms at 10:08 Not sure if that's what they meant or if they were talking about the southpark puppet avatar prime has going on, but it fits lol
There's a worryingly massive overlap between people who code in javascript and people who have no idea how binary floating point works. Almost as if web development attracts the most unscrupulous types.
There shouldn't be a need for that if you take software trends to heart. The overwhelming majority of developers don't know machine codes of systems they operate on, which wasn't the case 60 years ago... I wouldn't mind if every adept of every particular discipline was super-competent in adjacent matters, but at some point, human life span limitations start kicking in and you have to sacrifice (abstract away) fundamentals in return for expediency and/or getting anything done at all.
When you do CS, you learn to manipulate floats in various radixes with pen and paper. Then, you tend to do the hard stuff. The others who are 100% self-taught fall mainly in the light backend apps and frontend. There is a vast difference between a BootCamp and a bachelor's degree in computing. 😂 Ask those same people when writing a simple FSA over using a RegExp is preferable. I'm not sure they even understand the question. And that's a question one should be able to answer after the introductory courses. (few first months)
@@programaths indeed, in university ee get taught a 100, unrelated to the job, subjcts but are fundamental to know. Just the simplest thing like you mentioned, doing conversations on pen and paper for example. (But oh god do I not want to to redo writing assembly on pen and paper x.x)
Sometimes I love messing with JavaScript and making some crazy syntactical soup, and every time I come back to JavaScript to mess with something, I always run into something weird when parsing data that takes up most of my time.
the ++ thing is because most devs don't know what i++ do and what ++i do, and it is easy to make bugs if you don't understand the code. and the ++ was for the days where we(i am so old sigh) didn't have strings in C, and we used char arrays, we use chars[i++] = 'a';chars[i++] = 'b'; to make a string and here it was gold, as chars[i] = 'a'; i +=1; chars[i] = 'b'; was not great. and to 95% of devs out there the placement of the ++ is when it return the value, so ++i add 1 and return and i++ return and then add 1.
thought this was gona be piece on how the writer of "You don't know JS" is unemployed for serveral months now......i guess it takes one to know one (ba-dum-ptis)
I really hope the editor found a way to automate the mouth flaps here and didn't do all this manually. Good grief! >_< (Either way -- awesome video! Props!)
Honestly because I switch between languages with and without unary inc/dec I just stoped using unary in languages that support it because I'm less likely to put it in one that doesn't.
Instead of just ranting we should be amazed that some one was able standarize this quirks and all implementations of JavaScript engines behave the same way.... JavaScript is probably only language wich has this, C/C++ are not (or maybe were, maybe it is better now) so consistent even they also have a standarts.
I used JS with JSON with Ajax ( overkill , WTH 🤦♀️, no clue what I was doing) for a restful web service, for async data . And then I used JEST ( also written in JS) to test it! Lol 😂 question 🙋♀️: do we have a trim() 16:21 ?? - Amy
@ThePrimeTime 15:00 I tried the same thing you did, but I got the correct amount of items in the array. Not 1 more as you did. Tested it on a windows 10 (Version 22hH) based machine with node v20.0.0
That's because it is a Vim thing. It adds a new line to the end of the file. He spits to the floor when he says JS but makes that mistake. You did well to test this yourself. Always take tech-influencers with a pinch of salt.
Ah makes sense, thanks for clarifying it. But also weird that it happens. I like to fact check when I'm taking in advice from expirienced people, since they can always tell me some bs without me knowing due to my inexpirience.@@elgalas
If you are using ++ or -- then, that should let you know that the thing being modified is literally mean to be a number that doesn't go up or down more than a single value at a time. If you put ```number += 1``` then, that tells me 1 can be changed and really should likely be a constant more like ```number += STEP_SIZE``` but none of that is in the back of the mind as possible paths that can be taken when starting with ```number++```
a lot of people like to point to goofy ways js deals with undefined behavior but it's because they are too dumb to do the same with C++ or other languages.
JS needs a prime equality operator where the number of consecutive '=' characters can be any prime number. A longer operator is always stricter than a shorter one, and there are infinitely many. Excluding sequences of composite length prevents ambiguity, e.g. "======" (6 equals signs) is forbidden, as it might be either two triple equalities or three double equalities concatenated. This solves two major problems: loose typing, and not typing enough equals signs. Think about it. It makes perfect sense. JS already has equality operators for the first two prime numbers, obviously adding more is the endgame.
Props to that editor officially graduating and becoming a South Park animator.
I thought it was some feature of his setup, which inserted him in the absence of the live camera feed. It didn't occurred to me it was added later 😅.
@@marcelo-ramossame. either way, brilliant effort!
It's basically a "PNG-tuber"
Now, we know for a fact that the primagen is not Canadian 🤣🤣
I bet this is not just editing. The opening of his mouth must be automated depending on the level of his voice 😂.
"You are more empty space than space. Space is empty. You are even emptier." My new insult.
except the smart insult may not land on a dumb person
"That's a human insult. It's devastating. You're devastated right now."
@@ark_knight i know. past 4 years i PHYSICALLY removed ever ppl from my life. Non of the btches saw it coming (arrogance). Nor did they belive me I WILL eventually throw commies out, no matter how close they are. Trainwashed, TshemTrailed brains, 5G androids (They are not human anymore.) But I stop whining. I actually wanted to say that *space does not exist. Space is a shadow.*
@@ark_knightskill issue
@@TrueHolarcticfeature incomplete
Prime : "I don't buy the readability argument for ++ or -- vs += or -="
Prime, seconds later : "hey chat, is a+++b post or pre increment, betcha don't know"
I've spent years studying the weird parts of JS to ace any interview, there is quite literally nothing I don't know at this point.
that is pretty good duck hunt
Could you explain why would someone use two nested with statements?
@@marcelo-ramos I cannot explain that
@@marcelo-ramos he knows, but if he tells you he'll need to get rid of you after
@@marcelo-ramos so if the first one crashes it will run again duh /badjoke
"Bottom values" at 9:45 is a real term in discussions of programming language semantics. Although, its use in this article is weird. Meaning of terms in a language are represented as elements of an ordered set. These sets usually have a smallest element, i.e. a "bottom", because inequality is typically drawn as a slanted arrow pointing upwards in diagrams.
The bottom value is the meaning of terms that do not evaluate to anything, i.e. an error or an infinite loop. They have "minimal" impact on the program because you can replace them with any other term, without changing the result of the program, if it originally ran successfully. But Javascript's null and undefined act more like Rust's None (without the safeties), because you can still pass them to functions and do equality tests on them. Unlike actual "bottom values", they are not interchangable with each other, so you run into problems when using one instead of the other. And if they were interchangable, there would be no need for two.
Right. In Typescript and PHP the bottom type is called 'never'. As you say it's the return type functions that cannot return e.g. because they always throw or loop or exit. I'm not sure how you could have a bottom type without some static typing so it doesn't exist in Javascript.
@@barneylaurance1865 That's not quite the same concept, unfortunately. Both (meanings of) terms and types can be ordered, the latter by subtyping, so T
It's funny that such a big part of the world runs on two school projects equivalent languages, php and js.
12:30 nope - you DON'T. You will always read at least the same amount as you write, but it much much more likely, almost certain, than you read more than write.
When writing - you are reading the stuff you write. So if you read anything else besides the code you just wrote (so if you re-read the same line after you wrote it, or you read code from someone else) - you just read more than you wrote. Unless you somehow write without looking, then there is no way to write more than you read.
As someone who has never programmed in JavaScript, I have to agree with the title
To me x+1 has a different meaning than x++. When I write x+1 it's because the number 1 is arbitrary, it could conceivably be something else and the code would still work fine. I write x++ when It has to be incremented by 1 or the code wouldn't make sense, like iterating over a list.
Well yes, x++ is the same as x = x + 1(aka reassign the value of x to its own value plus 1).
While simply x + 1 is an expression which by default is not assigned to anything.
For example:
let a = 1;
let b = a + 1;
//which tells the browser:
//assign to b the value of a + 1
console.log(a)//1
console.log(b)//2
let x = 1;
let y = x++;
//which tells the browser:
//assign to y the value of x(which still is 1 atm) and then increment the value of x by 1
console.log(x)//2
console.log(y)//1
Now if the increment sign was before instead of later (let y = ++x) both x and y would log 2 since x would be reassigned before assigning its value to y but i believe the earlier example proves my point better, which is, they litterally are 2 different things, not only to you.
9:33 semicolon is not required after variable definition statements, but before expressions starting with ( or [, since it is ambiguous whether it is a function call/index operator or expression group/array init.
"You know distance Relatively beteen atoms is greater than the distance between planets. You are more empty than space. Space is empty yeah you're even emptier." @ThePrimeTimeagen ❤
The extra new line at the end of the file is a Vim thing. If you write the file using code editor sublime, or maybe with printf, you can make it not appear. Vim always adds a new line at the end of files.
I came to say the same thing. When doing Advent of Code, I noticed that I would get the extra newline if I copy/pasted the input into vim, but I wouldn’t if I downloaded the file directly.
Why not get a dummy battery that you plug into the AC for the camera? It usually exist for most cameras on the market.
He said the AC doesnt supply enough power for it to stay operational.
@@ark_knightthats an amperage issue with the power supply it came with and not what is being suggested.
You can write js without any semicolons - Except where the line starts with an open bracket. Then you simply prefix it with a semicolon. For example ()(() => {})() becomes ;()(() => {})()
Why is it so? And why do you know it??!!
Fun fact at 15:00, most (maybe all) built-in node modules are imported by default by their package name in the repl (e.g. fs and crypto)
11:52 iirc, the global isNan() isn't recommended as it attempts to coerce the argument to a number
My takeaway from this is that, me feeling empty makes sense now.
It's good to notice that many type coercions are also not specific to JS. After your video of yesterday, which also discussed JS lang design issues, I felt inspired to try things in VB language dialects and in Powershell.
In both of these you can coerce a null value into a negative number by just typing a minus sign in front of it. And a string digit plus a numeric type digit concatenates them into a string, while minus or multiply actually performs numeric arithmetic. Really great. So coercions are kind of bad in general.
Also note that PHP knew those problems as well, but it was also far earlier than JS with introducing triple length operators. So that whole solution did not originally come from JS either.
Who's gonna tell ThePrimeagen that the global isNaN() and Number.isNaN() do not produce the same return values?
Ain't no fking way
16:00 it looks like JS is just straight up hallucinating a newline at the end of that file.
Ouch.... Ouch...20:46 I REALLY DID NOT KNOW IT... Amazing what you can learn from a fun video =]
i literally use
x == null or x != null
its the only scenario where i use "==" instead of "===" its so much shorter compared to
x === null || x === undefined
yes, its a nice feature... but its annoying with linters sometimes :)
Title: "You don't know JavaScript"
Me: "True and I'm glad I don't"
dude, u hit me with so many more gotcha's than i've found myself and i taught this for years. also love javascript
You forgot to talk about how a Regex with global flag maintains a hidden start index between calls and results in the most confusing behaviour.
I learned JS 15+ years ago from video lessons recorded by some nerdy professor
The first things he said were literally:
1. JS is weakly typed so you can do crazy stuff (like adding strings to numbers)
2. It comes with tradeoffs, because you have to know how implicit type conversion works (shows the ParseInt of 0.0000005 example)
So in order to use the language properly and do all the crazy things it allows to do, you have to learn it deep enough. Everyone who has problems with JS has skill issues.
That is very true. As long as you can get to the intended result & know how to get there, job done.
A lot of people are deluded & think a perfect language exists.
It's Primetime.
It is.
Primetime.
There's probably a wall powered "dummy" battery available for your camera if you search for it. That way you'll not run out of power unless the grid goes.
Bro didn't know about the mantissa
EDIT: He did know about the mantissa
the comparing string with number makes a lot of sense to exist in js BUT it is wild that the creator made it the default rather than say a ?= for a looser alternative especially if that wasnt the initial implementation/original vision for ==
I didn’t know JS was this bad.
I think the problem with JS is that it has a monopoly in its domain.
We should be able to run precompiled code in a browser somehow.
Like a modified version of C, with access to the DOM and the browser, capable of transmitting and receiving data to & from the server.
Not only would it run faster, it would be more reliable and consume less memory. Less requests and smaller file size as well.
literally wasm
Don't forget that people stumbling over these "issues" have skill issues.
PHP has always had loose and strict equality operators. A long-standing PHP idiom is that many functions that return false on failure may return another "empty" value (false, null, 0, "") on success.
Puppet prime is the best
Canadian prime (south park, reference)
Wonder who's hands up his a**
The fact that I have scroll through like 10 comments to see this comment says something wrong in the world
The moving mouth😭😭
its freaky
I like loose equality bc it makes if statements easier for empty strings or null or undefined, it's easy to always use === without forcing casting. eslint js standard linter catches all semicolon issue which is only before () or []. null is user assigned undefined which let's you tell apart missing property or set
the .000000005 thing is going to keep me up at night
To all those who were wondering what happened when camera went off , The Primeagen was replaced by The Limeagen
I've fallen into semicolon issue 3 or 4 times for the same reason: Placing a self-invoking function after a line that doesn't end with a semicolon. Always takes a moment to figure out what has happened.
5:17 I died laughing for a few minutes on this one literally rofling over here
class Person {}
> undefined
console.log(typeof Person);
> function
Everyone else: 8==D
Javascript: 8===D
Above average 💪
parseInt() needs a radix; parseInt(1, 10).
Regarding '' values in your array from the file, you could use Array.filter() on those empty values first and THEN use Array.map()
Using trim on the initial string also helps against the final newline. Still screwed if there are newlines in the middle, in which case your solution will work nicely.
You could just inline your map callback as (el)=>parseInt(el)
The error is caused by the fact that map also provides index(and array) as parameters which get fed into parseInt and result in NaN - cause you ask it to interpret 3 as a number in base 3 which isn't possible.
It's kind of crazy to me that there could be developers that don't know IEEE 754 at least in concept. I thought that was just something you learned in your first two months. But I guess things are different in Javascript land
I knew about it but not until I actually came across it in a real world problem. I don't have a CS degree and have no formal software training outside of building things and learning while building. In my experience, when the organization asked me to build an internal web app in JS/React, I started with small tutorials and worked my way up, and unfortunately no where in those tutorials did IEEE 754 come up.
I remember first learning about this in college. Maybe devs who don't go to school never encounter it
@@xBiggs it is indeed devs who don't have related cs degree. I mean, if some cs grads don't even know it, then it's more likely someone without cs degree don't know it.
Given im not a programmer, your title is accurate
16:18 It would work a lot better to do .map((v) => parseInt(v))
because parseInt can take 2 arguments (value, radix), and .map passes I think 3 arguments (value, index, array), so it's parsing digits that are impossible for the radix/base being specified for that example, which results in NaN
i.e. parseInt('3', 3) returns NaN because there is no 3 in a base 3 number system
My friend gifted me the book "You Don't Know JS (yet)", which I believe this article is related to, and man, what a waste of dead trees. There's good JS books out there but this one feels like it was written by somebody with a month or two of experience and all the confidence of a 10 year senior dev
This article is not related to YDKJSY in any way. If anything, it's quite obvious that the author of the article has never read it. Regardless, what exactly is wrong with the book? Kyle has way more than 10 years of experience, so this critique doesn't sound particularly valid. And his book is on GH, so if there's inaccurate information, you can easily point it out.
Edit: I want to make clear, that I didn't read YDKJSY in its entirety, so my question is genuine, not a usual shitposting.
@@svenzverg7321 Hey thanks for the clarification. I just jumped to conclusions based on the tone of the article. My problems with the book was where it was going over the boring criticisms of js with all the type coercion which is just the boring repeated stuff you hear about. Also calling JS "weakly typed" - which I believe is one of those academic "technically wrong" since all the type coercions are precisely defined.
Briefly skimming through it on GH I see how it talks about how there are legitimate uses of `var`, which I find debatable.
Now that I'm looking through the book again, I think I was so put off by that stuff in the early chapters that I just tuned it out and didn't bother to read the rest. I don't plan to, but maybe there's OK stuff out there
@@inzanozulu I see.
b + +a works too.
b++ returns it's value and then adds 1, different than ++b that adds 1 before returning it's value. b is already an integer, so it doesn't matter if you poth both + after it or not.
his jaw being animated automatically while the picture is still is the most uncanny thing I came across in a while
"Regular bottoms and power bottoms?" Ha! Got eeeem
String.prototype.concat is slower than +
I was looking for a pro's insight before starting to learn this stuff. This reminds me of all the rule exceptions that need to be memorized in Chemistry.
i've been using javascript without semicolons for like 6 years. It's not required anywhere.
there is one case in which you would have to use them though, because the inference can't figure it out
functionCall();
[1, 2, 3, 4].forEach(doSomething)
in this case ()[] makes it think that you're trying to access an index in an array if there's no ; separating them as statements
there also may have been another case similar to this but I can't remember it right now
edit: oh yeah it's the thing in the video, if you're wrapping random whole statements in () for some reason (but why would you be?), then it thinks you're trying to use a function of the previous line
I don't know why his claim is "you run into this a lot". I've only ran into this maybe a dozen times, generally because I'm defining one-use arrays after a function call, which is kind of hacky it's better to have named variables. Why would you start new lines with () even? That sounds even worse!
I just wanted to watch some videos to relax after almost crying while making a small JS plugin for a Unity project, but now I'm having seizures, thanks
Man. Him randomly blurting out the chat's comments is hilarious. Just "Yo momma" outta nowhere. lmfaoo
FLIP IS THE MAN! OMG IM ROLLING. WELL DONE SIR!
This is one of my favourite videos. More javascript weirdness please, I love these
16:22 nooooooo
2:50 that's just C syntax. Unary postfix increment, binary addition, unary sign. That's not JS's fault, it's not even a fault.
Shoutout to the chatter who said "Vtuber" when talking abojt types of bottoms at 10:08
Not sure if that's what they meant or if they were talking about the southpark puppet avatar prime has going on, but it fits lol
Canadian Primeagen is the best primeagen, I'll fight you on this!
Prime 0
Camera 1,000
W Camera 🔥
I didn't realise how deadly eggshells I was walking on.
There's a worryingly massive overlap between people who code in javascript and people who have no idea how binary floating point works. Almost as if web development attracts the most unscrupulous types.
Maybe because they tell most students and such its the easiest to get into and start making money?
Im not sure tho
There shouldn't be a need for that if you take software trends to heart.
The overwhelming majority of developers don't know machine codes of systems they operate on, which wasn't the case 60 years ago... I wouldn't mind if every adept of every particular discipline was super-competent in adjacent matters, but at some point, human life span limitations start kicking in and you have to sacrifice (abstract away) fundamentals in return for expediency and/or getting anything done at all.
Not just JavaScript. More often than not, pogrammers in general just don't know it.
When you do CS, you learn to manipulate floats in various radixes with pen and paper. Then, you tend to do the hard stuff.
The others who are 100% self-taught fall mainly in the light backend apps and frontend.
There is a vast difference between a BootCamp and a bachelor's degree in computing. 😂
Ask those same people when writing a simple FSA over using a RegExp is preferable. I'm not sure they even understand the question.
And that's a question one should be able to answer after the introductory courses. (few first months)
@@programaths indeed, in university ee get taught a 100, unrelated to the job, subjcts but are fundamental to know.
Just the simplest thing like you mentioned, doing conversations on pen and paper for example.
(But oh god do I not want to to redo writing assembly on pen and paper x.x)
Sometimes I love messing with JavaScript and making some crazy syntactical soup, and every time I come back to JavaScript to mess with something, I always run into something weird when parsing data that takes up most of my time.
the ++ thing is because most devs don't know what i++ do and what ++i do, and it is easy to make bugs if you don't understand the code.
and the ++ was for the days where we(i am so old sigh) didn't have strings in C, and we used char arrays, we use chars[i++] = 'a';chars[i++] = 'b'; to make a string and here it was gold, as chars[i] = 'a'; i +=1; chars[i] = 'b'; was not great.
and to 95% of devs out there the placement of the ++ is when it return the value, so ++i add 1 and return and i++ return and then add 1.
at least knowing if a number is odd is easy
21:39 return statements require semicolon so it gets auto inserted at the end of the line. You read that 13 minutes earlier.
You're definitely reading more code than writing mate - at bare minimum you read what you've written and then some :)
thought this was gona be piece on how the writer of "You don't know JS" is unemployed for serveral months now......i guess it takes one to know one (ba-dum-ptis)
6:12 - sweet baby jesus can someone explain to me why when he highlights a sentence or block of text he does not include the first and last character?
Now we know for a fact that theprimagen is not Canadian!
This channels video editor should be the next president
I really hope the editor found a way to automate the mouth flaps here and didn't do all this manually. Good grief! >_< (Either way -- awesome video! Props!)
i do like fixed point or intgerized calculations for performance
My brain fell into confusion and almost a daze when prime disappeared
I had to check my settings to see whether playspeed wasn't increased for some reason. It wasn't.
ThePrime mouth moving after the camera died, so freaking hilarious
Haha. Didn't realise that you'd switched to Thunderbird mode when your camera choked at @4:05 Could this be a new phase of “...a gen“?
IDontHaveACamera-agen is my favorite
Honestly because I switch between languages with and without unary inc/dec I just stoped using unary in languages that support it because I'm less likely to put it in one that doesn't.
16:24 javascript is difficult.. for real?
.toString().split("
").filter(Boolean).map(Number)
Instead of just ranting we should be amazed that some one was able standarize this quirks and all implementations of JavaScript engines behave the same way....
JavaScript is probably only language wich has this, C/C++ are not (or maybe were, maybe it is better now) so consistent even they also have a standarts.
Thank you Prime, and thank you Flip for this masterpiece.
I used JS with JSON with Ajax ( overkill , WTH 🤦♀️, no clue what I was doing) for a restful web service, for async data . And then I used JEST ( also written in JS) to test it! Lol 😂 question 🙋♀️: do we have a trim() 16:21 ?? - Amy
10:39 I love bottom values. You know what’s better than one bottom??
@ThePrimeTime
15:00 I tried the same thing you did, but I got the correct amount of items in the array. Not 1 more as you did.
Tested it on a windows 10 (Version 22hH) based machine with node v20.0.0
That's because it is a Vim thing. It adds a new line to the end of the file. He spits to the floor when he says JS but makes that mistake.
You did well to test this yourself. Always take tech-influencers with a pinch of salt.
Ah makes sense, thanks for clarifying it.
But also weird that it happens.
I like to fact check when I'm taking in advice from expirienced people, since they can always tell me some bs without me knowing due to my inexpirience.@@elgalas
If you are using ++ or -- then, that should let you know that the thing being modified is literally mean to be a number that doesn't go up or down more than a single value at a time.
If you put ```number += 1``` then, that tells me 1 can be changed and really should likely be a constant more like ```number += STEP_SIZE``` but none of that is in the back of the mind as possible paths that can be taken when starting with ```number++```
I like how Prime became MattPat 5 minutes into the video.
All hail Canadian Prime!
lets goo, staying up till 1am is worth
Just watch the next morning
I-don't-have-a-camera-Agen has done it again...
:))) what camera are you using? there are some "fake" batteries that makes your camera think it is a battery, but it is actually a power adapter
HAVE YOU TRIED HELIX EDITOR?
a lot of people like to point to goofy ways js deals with undefined behavior but it's because they are too dumb to do the same with C++ or other languages.
I pefer to use `${var}text` to include variables in strings, especially when using style tags in vue
Typed arrays get sorted numerically, because they are guaranteed to be all numbers.
Shout out to editor! Bravo..
JS needs a prime equality operator where the number of consecutive '=' characters can be any prime number. A longer operator is always stricter than a shorter one, and there are infinitely many. Excluding sequences of composite length prevents ambiguity, e.g. "======" (6 equals signs) is forbidden, as it might be either two triple equalities or three double equalities concatenated.
This solves two major problems: loose typing, and not typing enough equals signs. Think about it. It makes perfect sense. JS already has equality operators for the first two prime numbers, obviously adding more is the endgame.
9:03 I always do the opposite. I remove all semicolons unless they are explicitly required. Semicolons are unnecessary bloat.
9:36 They aren’t required after let statements. But required because of the weirdness on the next line.