ExFAANG Engineer Watches ExFAANG Take JavaScript Quiz | Prime Reacts

  Рет қаралды 171,934

ThePrimeTime

ThePrimeTime

Ай бұрын

Recorded live on twitch, GET IN
Reviewed video: • ex-FAANG Developer vs ...
By: / @connerardman
/ theprimeagen
Become a backend engineer. Its my favorite site
boot.dev/?promo=PRIMEYT
This is also the best way to support me is to support yourself becoming a better backend engineer.
MY MAIN YT CHANNEL: Has well edited engineering videos
/ theprimeagen
Discord
/ discord
Have something for me to read or react to?: / theprimeagenreact
Kinesis Advantage 360: bit.ly/Prime-Kinesis
Hey I am sponsored by Turso, an edge database. I think they are pretty neet. Give them a try for free and if you want you can get a decent amount off (the free tier is the best (better than planetscale or any other))
turso.tech/deeznuts

Пікірлер: 464
@theondono
@theondono Ай бұрын
I love that I have pretty much 0 experience with JS, and yet I can get every single question right by asking myself “what would be the craziest possible result here?”
@kiattim2100
@kiattim2100 Ай бұрын
Yeah they should've thrown some normal curve ball questions, so people don't automatically default to answer with the craziest possible choices.
@jfernandez76
@jfernandez76 Ай бұрын
This exactly happened to me as well
@mitigamespro8757
@mitigamespro8757 Ай бұрын
Except they did.. there were some normal expected ones there.@@kiattim2100
@sophiacristina
@sophiacristina 28 күн бұрын
Just like in high-school, hahha...
@Reverberie
@Reverberie Ай бұрын
javascript feels like when i try to interpret my dreams
@brianviktor8212
@brianviktor8212 Ай бұрын
And it works, but in mysterious ways.
@kiattim2100
@kiattim2100 Ай бұрын
Javascript was a mistake.
@complexity5545
@complexity5545 26 күн бұрын
This joke made me crack a rib.
@tylerlaprade642
@tylerlaprade642 Ай бұрын
“I am currently a FAANG developer at this moment” - this was foreshadowing
@DudeWatIsThis
@DudeWatIsThis Ай бұрын
The interview: "Invalid octal 018 that defaults to decimal minus valid octal 015" The job: "Should I try to add this through more polymorphism or slap a Visitor pattern into all these classes?"
@fredoverflow
@fredoverflow Ай бұрын
Uncaught SyntaxError: Octal literals are not allowed in strict mode.
@TheTigerus
@TheTigerus Ай бұрын
@@fredoverflow hello this is CORS and fuck your app and especially those octal craps, I don't like them
@Blaisem
@Blaisem Ай бұрын
perfect profile pic for this comment btw
@cloudPvP
@cloudPvP 21 күн бұрын
When you can go Visitor, always go Visitor
@itsteelworks
@itsteelworks Ай бұрын
It is truly amazing how much of JavaScript you miss out on by not doing aggressively stupid things with it
@and_I_am_Life_the_fixer_of_all
@and_I_am_Life_the_fixer_of_all Ай бұрын
100% this
@RichardRemer
@RichardRemer Ай бұрын
Yeah, I love how people who go on endlessly about weird JS auto-casting decisions. Why are you relying on automatic casting, then? It's a "problem" you inflict on yourself by not explicitly casting things.
@ben_clifford
@ben_clifford Ай бұрын
I just gave this comment its 70th like. Sorry about that.
@arthurmoore9488
@arthurmoore9488 13 күн бұрын
@@RichardRemer The largest problem is the same issue I have with PHP not running in strict mode. Even if I'm coding in TypeScript, at runtime an API could return the wrong type! It's a philosophy decision. JavaScript and PHP are deliberately designed to continue execution with garbage data rather than fail.
@shell_jump
@shell_jump Ай бұрын
I finally understand the rust people. Its javascipt devs who got out of a toxic relationship and now they want to date the opposite person.
@xXYourShadowDaniXx
@xXYourShadowDaniXx Ай бұрын
The borrow checker might be annoying, but have you ever programmed in Javascript? - Rust devs
@hamm8934
@hamm8934 Ай бұрын
And after dating their opposite, theyll balance out in the middle, Go. Or they take another detour and go elixir for a year
@KondoIsami_
@KondoIsami_ Ай бұрын
It's more like they have pathological tendencies and can't avoid toxic relationships, they went from idealizing JS to idealizing Rust.
@seand7603
@seand7603 Ай бұрын
Nah most of them go TS. Once they dip into the crazy they're hooked for life.
@SimonBuchanNz
@SimonBuchanNz Ай бұрын
Funnily enough, I really like both JavaScript and Rust. They complete each other.
@colin_actually
@colin_actually Ай бұрын
In a javascript quiz the answer is always "why"
@svenmify
@svenmify Ай бұрын
I find that applies more to languages like rust where everything is “ugh” and “why” and “do I really have to do all this and write macros for something that would be 1 line in c# or js”. (Sorry, just learning rust and not having a great time. JavaScript looks pretty nice right now)
@gabrielmonpereveutpasqueje9018
@gabrielmonpereveutpasqueje9018 Ай бұрын
quiz is the answer. why is the question
@testacals
@testacals Ай бұрын
@@svenmify rust is comparatively low level than c# or js. That's why.
@svenmify
@svenmify Ай бұрын
@@testacals oh I know that. But something like Swift is also lower level (arguably a little less than rust), but way easier to code in. A lot of the stuff I dislike about rust are design decisions
@capivaracafeinada
@capivaracafeinada Ай бұрын
For the Raw string question, in Python, we often use raw strings to type regex. They are already complicated enough, and we don't want to make them even more complicated by having to escape all the backslashes
@ty.davis3
@ty.davis3 Ай бұрын
It's also much nicer in Python because you just have to prepend an 'r' and you're good
@qwfp
@qwfp Ай бұрын
And in Python you have to prepend 'f' to get variable formatting inside the string. (which you can combine with 'r' to get that French strings 🥖)
@and_I_am_Life_the_fixer_of_all
@and_I_am_Life_the_fixer_of_all Ай бұрын
*python2 flashbacks*
@apollolux
@apollolux Ай бұрын
Sounds like a skill issue. Real programmers escape all the backslashes and charge their employers for the time spent doing it. ;)
@dealloc
@dealloc 20 күн бұрын
Same main reason why String.raw was introduced in JS; to be used to create regex patterns as strings that can be compiled to RegEx objects later that can be processed. Before this you'd have to escape the escapes, e.g. /Hello World/ into `Hello\ \ World`.
@daniellundqvist2926
@daniellundqvist2926 Ай бұрын
Alternative title: "When you create a language over a weekend"
@fredoverflow
@fredoverflow Ай бұрын
10 days actually
@meltygear5955
@meltygear5955 29 күн бұрын
@@fredoverflow 🤓
@peter8261
@peter8261 Ай бұрын
It must be fun living in Prime's house hearing the muffled screams of "I KNEW IT" coming from his room throughout the house.
@mattmmilli8287
@mattmmilli8287 Ай бұрын
lol he updated the title cause he left Netflix 😂
@spicybaguette7706
@spicybaguette7706 Ай бұрын
I love this one even more: String('123') instanceof String
@daniellundqvist2926
@daniellundqvist2926 Ай бұрын
JS is truly a language of all time
@itsteelworks
@itsteelworks Ай бұрын
Pure rage.... But also, you construct new String objects with `new String()` and the fact that it doesn't crash when you do that without new is the part that's actually weird and wrong
@SimonBuchanNz
@SimonBuchanNz Ай бұрын
​@@itsteelworksof course. String is a function that converts things to primitive strings, and new String is a constructor that creates String instances. You can even do this with your own types, just check new.target in your functions or constructors and return a value to use instead! Just remember that you can't return a primitive if the caller used new, or it will ignore the value and return the this value it created for you. It's so simple and nice! 🫠
@yoz0__
@yoz0__ Ай бұрын
But Object('123') instanceof String is true same for new Object() Javascript, I love it
@RichardRemer
@RichardRemer Ай бұрын
This is really easy to understand behavior though. It's quite consistent. Without "new", the function acts as a cast; with "new" it acts as a constructor. I think the real problem lies in developers who are sloppy with their "new"s, and the many dual-purpose constructor/factories that accommodate them.
@ruanpingshan
@ruanpingshan Ай бұрын
I don't know about Javascript, but in other languages, the main use cases I've seen for raw strings are: 1. Writing regexes without having to escape \ 2. Pasting the contents of a multi-line text file into a string literal. 3. Writing GLSL shaders or other dynamically compiled code from a different language, so they don't need to be shipped as separate files. 4. Writing multi-line strings for whatever other reason.
@oleg4966
@oleg4966 Ай бұрын
It cares more about debugging and foundational understanding than pure DS&A. I have to admit, against my better judgment, I like this quiz.
@KyleHarrisonRedacted
@KyleHarrisonRedacted Ай бұрын
I am pretty sure the title changed from “FAANG engineer reacts to ExFAANG engineer” right after the announcement on the main channel lol
@sannfdev
@sannfdev 10 күн бұрын
This is why I love the ThePrimagen: he turned an 11 minutes video into a 30 minute reaction. He's not just sitting there in the corner; he actually adds to the content. Love it.
@gilligan87
@gilligan87 Ай бұрын
Hey man, just wanted to thank you. I'm learning to code and despite working in tech for over a decade, there's a part of me that has always resisted/dreaded coding because in my mind it has always seemed like the epitome of postmodern desk slavery. But you make it fun. You're always super hyped and having fun with coding. I'm not really learning that much from you, but listening to you having so much fun with it just makes it seem less soul sucking and has helped me have more positive associations with coding, which has really motivated me to do more learning in my spare time. Just a fellow anon or here appreciating your passion. Never change!
@cameron7374
@cameron7374 Ай бұрын
This is really interesting to me. Since in my mind code was always the thing that lets me make the computer do things. Like, it's the stuff that video games are made out of and the fact that I know how to do that now would probably make 5 year old me happy. (and also makes me happy now :) )
@gilligan87
@gilligan87 Ай бұрын
@@cameron7374 yeah I'm coming to see it more like this now, largely thanks to prime and LLL. It's weird - I had his experience with manufacturing first. When I started working with startups and got to see how things are made behind the scenes, actually going to suppliers, operating high tech machinery, working with vacuum chambers and plasma and lasers and CNC machines etc, it gave me a massive appreciation for the whole process. I was instantly hooked. But software always seemed like the drab side of things. Working with hardware was interesting and seemed like it had more room for creativity; coding just seemed laborious, just stitching together the hardware with boring 1s and 0s. It took actually taking a coding class and building some CLI apps in C to give me that same feeling about code. I see now how much of a rush it can be to problem solve with code, how intellectually stimulating it can be, and above all else how rewarding it is to build something that really works. I'm taking a break from studying at the moment because my daughter was just born a few months ago, but watching prime and keeping up my practice on sololearn has me excited to get back to my comp eng classes.
@toifel
@toifel Ай бұрын
I'll have to lay down after this
@wojciechosinski5927
@wojciechosinski5927 Ай бұрын
I love that after 20min of bamboozling there was a phrase in an explanation to one of the questions: “if you do this instead you’d get a result you would have expected from the beginning”. You can’t expect anything after that
@user-wf7uf2jp8x
@user-wf7uf2jp8x Ай бұрын
HE CHANGED THE TITLE OMG
@ThatBidsh
@ThatBidsh Ай бұрын
Non-FAANG Engineer Watches FAANG Engineer watching ExFAANG Engineer take JavaScript Quiz
@StinkyCatFarts
@StinkyCatFarts Ай бұрын
I love that you would never actually run into these problems if you code properly
@jfftck
@jfftck Ай бұрын
The best part is JavaScript added “use strict” and none of these are addressed by this flag, you would think that octals would have required the 0o syntax. Maybe they should add a “really use strict” flag!?
@snakefinn
@snakefinn Ай бұрын
"For real this time"
@Sandromatic
@Sandromatic Ай бұрын
May I introduce you to Perl's pragmas :P
@fredoverflow
@fredoverflow Ай бұрын
Both 015 and 018 do throw errors in "strict mode" though?
@jfftck
@jfftck Ай бұрын
@@fredoverflow You’re right, but how many people use “use strict” because of the limited improvements that come with it? I tried using “use strict” in REPL mode (both console and Node) and that doesn’t work, I should have written it in a file to test. It should have made coercion apply to only one side of the comparison and only be applied once, arrays should have required to be the same type for all elements, and add boxing of values. With the number of people who create videos like this, it shows that removing these problematic behaviors would lead to less errors for developers.
@RichardRemer
@RichardRemer Ай бұрын
​@@jfftckyou don't need to "use strict" if you use modern JS with modules. If you're still coding in 2015 with Common.js or AMD or something, it's pretty easy to add a build step to add "use strict" to the top of every file.
@MrOboema
@MrOboema Ай бұрын
@14:15 theprimeagen: *concentrating very hard to follow the exact logic behind Javascript's blackmagik type conversion* chat: uh-huh-huhhuh...he said "bang array" 😂
@rahil_rehan
@rahil_rehan Ай бұрын
I'm going thru like a worst phase of my life! Both professionally ans personally. Watching your videos makes my day. Thanks Prime.
@vorant94
@vorant94 Ай бұрын
Need to update the title as there are two ex-FAANG-ers here now))
@JSHyCS
@JSHyCS Ай бұрын
now it's an ex-faang developer watches ex-faang developer take javascript quiz
@ratman505
@ratman505 Ай бұрын
~26:40 - The rule is not completely consistent, at least not at first glance. Java uses a String pool for optimization and Strings that are referenced multiple times are therefore the same instance and `==` returns true. However that is not the case for all methods that can create new Strings. I do not know which methods create separate instances and which do not
@Rongmario
@Rongmario Ай бұрын
It also differs based on JVM implementations, such as OpenJ9 having stricter string interning. You should definitely always use `.equals` when comparing strings, it short-circuit checks refs in the equals implementation anyway!
@chbrules
@chbrules Ай бұрын
This is why I left Javascript and went back to C.
@JLarky
@JLarky Ай бұрын
I like how Prime says "ha ha, look at chat in disbelief" and continues to be in disbelief for the next question himself 😔
@JSmith73
@JSmith73 Ай бұрын
If you grew up with a typewriter (before eg graduating to a Vic20), the newline+return sequence makes perfect sense as they were two very distinct actions. 😂 Greatly enjoyed this episode.
@markosth09
@markosth09 Ай бұрын
From the ECMAScript spec: 7.2.14 IsLooselyEqual ( x, y ) The abstract operation IsLooselyEqual takes arguments x (an ECMAScript language value) and y (an ECMAScript language value) and returns either a normal completion containing a Boolean or a throw completion. It provides the semantics for the == operator. It performs the following steps when called: 1. If Type(x) is Type(y), then a. Return IsStrictlyEqual(x, y). 2. If x is null and y is undefined, return true. 3. If x is undefined and y is null, return true. 4. NOTE: This step is replaced in section B.3.6.2. 5. If x is a Number and y is a String, return ! IsLooselyEqual(x, ! ToNumber(y)). 6. If x is a String and y is a Number, return ! IsLooselyEqual(! ToNumber(x), y). 7. If x is a BigInt and y is a String, then a. Let n be StringToBigInt(y). b. If n is undefined, return false. c. Return ! IsLooselyEqual(x, n). 8. If x is a String and y is a BigInt, return ! IsLooselyEqual(y, x). 9. If x is a Boolean, return ! IsLooselyEqual(! ToNumber(x), y). 10. If y is a Boolean, return ! IsLooselyEqual(x, ! ToNumber(y)). 11. If x is either a String, a Number, a BigInt, or a Symbol and y is an Object, return ! IsLooselyEqual(x, ? ToPrimitive(y)). 12. If x is an Object and y is either a String, a Number, a BigInt, or a Symbol, return ! IsLooselyEqual(? ToPrimitive(x), y). 13. If x is a BigInt and y is a Number, or if x is a Number and y is a BigInt, then a. If x is not finite or y is not finite, return false. b. If ℝ(x) = ℝ(y), return true; otherwise return false. 14. Return false. ℝ(x) stands for the mathematical value of x, which normalizes +0 and -0 into 0 and is not defined for non finite values.
@cameron7374
@cameron7374 Ай бұрын
4. NOTE: This step is replaced in section B.3.6.2. EXCUSE ME?
@RealRatchet
@RealRatchet Ай бұрын
I actually got wrecked by sort implicitly casting to string once. Worst part was that I wasn't actually the one writing the frontend I wrote the backend that consumed the sorted array.
@xelspeth
@xelspeth Ай бұрын
tbf if you expect a sorted array and the client does not send a sorted array, that's an FE issue not a BE issue. But also there probably shouldn't be the need for a sorted array and the BE should sort the array itself regardless
@IndigoTeddy
@IndigoTeddy Ай бұрын
​@@xelspeththis. Everything should be done in the backend except fetch requests, storing cookies/temporary identifier variables, and DOM manip unless you have a specific edge case (such as using WASM or somehow not having a backend for your calculator website). If your company doesn't have control over the full tech stack though, then you're gonna have to contact the frontend devs to redesign your protocols for what data to send over the wire.
@EpicRag
@EpicRag Ай бұрын
Hearing expert JavaScript developers talk about its type system is a prime example of Stockholm Syndrome.
@Ba-gb4br
@Ba-gb4br Ай бұрын
""""" type system """""
@mxruben81
@mxruben81 Ай бұрын
"I am currently a FAANG developer at this moment"
@BachPhotography
@BachPhotography Ай бұрын
Very interesting video, I got almost all of them wrong, except for the String.raw I've had to use String.raw before when parsing JSON where some of the object attributes are also JSON (doubly stringified!), to avoid the backslashes in the double stringified json being used as escape characters
@telephonedude
@telephonedude Ай бұрын
I am unreasonably perturbed by the fact that `[]` can be coerced into both `true` and `0` depending on the type chosen.
@jefferymuter4659
@jefferymuter4659 28 күн бұрын
"I am currently a FAANG developer... as of this moment" Bro was telling us the writing on the wall.
@atiedebee1020
@atiedebee1020 Ай бұрын
Javascript makes C's undefined behaviour look sane
@DeadOce4n
@DeadOce4n 12 күн бұрын
String.raw can be used to get syntax highlighting for the code inside a string, for example, make a function named "yaml" and just return String.raw from it, call the function somewhere, write some yaml inside the backticks and you get yaml syntax highlighting, at least if you use neovim with treesitter.
@Maskrade
@Maskrade Ай бұрын
now it will have to be an ExFAANG
@ifscho
@ifscho Ай бұрын
I love the title change. 😄
@abtix
@abtix Ай бұрын
21:50 In the case that you're saying you don't know how to use it because you don't understand it, since it's raw but not really because it still evaluates the variables, the best way I can explain it is that that's only due to the backticks (``) surrounding the text, which I assume tells Javascript to evaluate the variables, and String.raw doesn't really interfere with this process. If it had the single or double quotes, it would have included the ${varOne} and ${varTwo}. And in the other case where you are wondering why you would need to use String.raw at all, I have found myself needing to use this at times when I was trying to either be able to log out the raw thing in LLM responses, since I was trying to figure out if it was giving or alone. I bet there's some dynamic finetuning data generation use cases too.
@owensohmer1084
@owensohmer1084 Ай бұрын
I wish I could go back to the beginning of this video to prevent myself from learning of a third even more absurd null representation in Javascript
@MessioticRambles
@MessioticRambles Ай бұрын
I understood most of these, and I can accept most of the ones I got wrong, but the fact that string literals are not instances of strings despite their prototype being string makes me incredibly angry.
@MichelBarakat-yc5rj
@MichelBarakat-yc5rj Ай бұрын
you'd use the constructor String in a case where you have a defined array of objects holding type/value pairs (i.e. a configuration map) and you want to map over it in your runtime and create the variables. here's a one liner: `const data=[{t:String,v:'my string'},{t:Number,v:12}];const instances = data.map(({t, v}) => new t(v));`
@t6hp
@t6hp Ай бұрын
Hot take, everything in this video makes sense. You need to remember that JS was designed for the browser, not the server. This means, its top priority is to handle bugs in a way that does not break up the UI of anything you're interacting with, yes, even at the cost of correctness. You need to have a wider mental model of what its purpose is. Obviously, if you use it without any restrictions for that initial environmental model, it will be your own fault.
@Akz666
@Akz666 28 күн бұрын
God! This is the best video I watch since the beginning of 2024
@willsawyerrrr
@willsawyerrrr Ай бұрын
Updated title: “ExFAANG Engineer Watches ExFAANG Take JavaScript Quiz”
@NicolasPimprenelle
@NicolasPimprenelle Ай бұрын
If JS was not trying so hard to not throw, it could have been so much better
@kaltwarraith5172
@kaltwarraith5172 Ай бұрын
i use js for all kinds of things, including scripting serial ports. And i've used the string constructor to ensure proper type conversion in mozilla rhino
@pranavbadrinathan6693
@pranavbadrinathan6693 Ай бұрын
I love how he says he is "currently" a FAANG developer, knowing full well in the coming week or two he would not be one anymore. Good luck, Prime! Context: kzbin.info/www/bejne/i4jFYpetlNCVrNE
@itsteelworks
@itsteelworks Ай бұрын
The only reason to use a string constructor is if you've monkeypatched or extended String with additional methods, which you shouldnt do 99% of the time
@randomdamian
@randomdamian Ай бұрын
I did some Performance testing because I have no hobbies, and I was generating giant tables of data with millions of elements. So doing new Array(1000000) reserves the memory cells in your ram to be used for this Array. So you have values that are next to each other. Same when you do some filtering with like while(len){array[len] = --len} it will allocate the values next to each other. If you do an array without a length then push to it, the array can have different adresses so like have gaps in it used by other variables.
@RichardRemer
@RichardRemer Ай бұрын
I've used a String constructor inside a Transform stream to tag the strings. s = new String(s); s.position = 23; s.line = 2; Then I can use that info in error messages generated during parsing. And they all get turned back into literals before returning to the caller.
@ThePrimeTimeagen
@ThePrimeTimeagen Ай бұрын
oh.... that is interesting!
@alexm9104
@alexm9104 Ай бұрын
It's kinda entertaining to see chat slowly become completely hysterical, ngl.
@Tobi-ci3ns
@Tobi-ci3ns Ай бұрын
You can use "new String" to make strings with the same value which are not equal to each other: let a = new String("foo") let b = new String("foo") a == "foo" // true a == b // false
@killermonkey1392
@killermonkey1392 Ай бұрын
JS's type coercion is a crime against humanity. Most of these questions should just TypeError…
@RichardRemer
@RichardRemer Ай бұрын
You gotta remember the context. All the type casting is designed to interact with HTML form data. These values can only be strings. Brendan Eich's original design actually works very well in this context. If you're not working with HTML forms, then why are you relying on type coercion? Cast explicitly and there are no issues.
@asdfasdfasdf1218
@asdfasdfasdf1218 Ай бұрын
Besides regex, raw strings can also be for windows paths.
@ivorybanana2183
@ivorybanana2183 6 сағат бұрын
You could use the String constructor to convert a value of type `unknown` to a string, because such values do not have the `.toString()` method. Though this is more of TS thing
@diegolikescode
@diegolikescode Ай бұрын
Prime is laughing so hard that he's face is all red
@nathangwyn6098
@nathangwyn6098 Ай бұрын
In the 2nd one remember 0 is a falsey value. Doesn't matter if it's 0 or '0'.
@GuRuGeorge03
@GuRuGeorge03 Ай бұрын
we had something similar as an exam in school. the results were literally that 25% of answers were correct. Which means the results of the entire class were the same that you would expect if everybody just answered randomly.
@DevlogBill
@DevlogBill Ай бұрын
JavaScript and its weird parts remind me of that old show Unsolved Mysteries, the output is a mystery.
@arafays
@arafays Ай бұрын
Edit: ExFAANG Engineer Watches ExFAANG Take JavaScript Quiz
@vitorlima9383
@vitorlima9383 Ай бұрын
i came here just to comment that, hahahaa
@QTA-20
@QTA-20 Ай бұрын
When did he retire?
@arafays
@arafays Ай бұрын
@@QTA-20 he didnt retire he left netflix last week and gone full time content creator hence the ExFAANG
@QTA-20
@QTA-20 Ай бұрын
@@arafays That's really cool. Thanks
@sfulibarri
@sfulibarri Ай бұрын
Principle of most surprise lmao. Actually insane that js became so dominant.
@nedalturas
@nedalturas Ай бұрын
Conner is actually an instructor from AlgoExpert!
@apollolux
@apollolux Ай бұрын
I got I think 7/10 following along with this video even after studying JS since 1998. The octal one tripped me up because I didn't know offhand how JS would treat the unquoted value 018 given how relatively recent support for octals was finalized (and I don't actively use octals in my own JS anyways). Truthy-falsy ones only trip me up if I don't know which direction JS converts or coerces first when booleans are already involved because I made it a point to drill on that for hours based on this one particular article (from IIRC some Google/Opera dev like Hakon Wium-Lie or maybe jQuery creator John Resig or something) aggregating JS truthiness cases years ago (an article I'm trying to find, with the earliest search results giving me some Stack Overflow answers from 2013 or so instead) and I've literally never intentionally done "bool + bool" in my entire 25+ years of JS anyways. Finding out about empty array truthiness in this video was genuinely fascinating, BTW.
@archtard
@archtard Ай бұрын
octal mentioned 🗣🔥
@mattias3668
@mattias3668 Ай бұрын
Apropos \f (also known as ^L or "form feed"): fun fact, GNU source code is partitioned with form feeds. I haven't see anyone else do that, but it's extremely common in GNU projects.
@lydianlights
@lydianlights 20 күн бұрын
omg the fact that I knew all of these even without multiple choice just shows how little hope is left for me in my javascript-rotted brain, lol
@tjhooperofficial
@tjhooperofficial 28 күн бұрын
javascript is the definition of "just because you can doesn't mean you should"
@hextech687
@hextech687 Ай бұрын
![ ] summons Skrillex
@insert9124
@insert9124 Ай бұрын
The raw string stuff is used when using regex in a language using strings. Everything needs to be backslashed to count in regex, so it need to stay and not "dissapear" as it would in a real string. I did it in python tho so I dont know about javascript, but I assume its the same
@benjaminfortune2707
@benjaminfortune2707 Ай бұрын
At 6:50 ish -- As far as I can find, even though it's counter-intuitive, I believe it actually tries to convert the string argument to a number to do the comparison. If you try 5 == '5.00000' it returns true. If it was as simple as the number argument being converted into a string, these would not be loosely equal. Instead '5.00000' becomes 5 *Edit* : Should've watched further, didn't think he'd come back to it. Prime talks about it again around the 9 minute mark
@danielmellado5942
@danielmellado5942 Ай бұрын
In the question 4, 0 == '0', '0' is converted to a number. The specs: Abstract Equality Comparison (==) The comparison `x == y,` where x and y are values, produces true or false. Such a comparison is performed as follows: 1. If `Type(x)` is the same as `Type(y)` then 1. 1. Return the result of performing Strict Equality comparison x === y. 2. If x is null and y is undefined, return true. 3. If x is undefined and y is null, return true. 4. If `Type(x)` is Number and `Type(y)` is String, return the result of comparison `x == ToNumber(y)` 5. If `Type(x)` is String and `Type(y)` is Number, return the result of comparison `ToNumber(x) == y` 6. If `Type(x)` is Boolean, return the result of the comparison `ToNumber(x) == y` 7. If `Type(y)` is Boolean, return the result of the comparison `x == ToNumber(y)` 8. If `Type(x)` is either String, Number or Symbol and `Type(y)` is Object, return the result of the comparison `x == ToPrimitive(y)`. 9. If `Type(x)` is Object and `Type(y)` is either String, Number or Symbol, return the result of the comparison `ToPrimitive(x) == y`. 10. Return false.
@Shananiganeer
@Shananiganeer Ай бұрын
Java will not duplicate strings in the heap when created with double quotes, so "foo" == "foo" will return true even though it is technically comparing references instead of values. You have to explicitly create additional objects with new String() to break the equality.
@danielmichel7000
@danielmichel7000 Ай бұрын
3:10 the exact same question was in my midterm a couple of days ago and my smartass for some reason thought that typeof would return a sort of Wrapper class so like actually Number not a string (Java reference)...but that turned out incorrect obviously...
@sacredgeometry
@sacredgeometry Ай бұрын
JS is responsible for a whole generation of programmers thinking this sort of shit is acceptable and you can see it in their code.
@pepkin88
@pepkin88 Ай бұрын
7:12 here's a way how to test it: false == '00' // -> true 0 == '00' // -> true String(0) == '00' // false Edit: Aah, he came back to it at 9:10 with the same test as mine 😅
@jonathanjacobson7012
@jonathanjacobson7012 Ай бұрын
I suppose that JS victims may use raw strings to genererate dynamic code that includes a call that prints out a new line, for instance.
@shampoable
@shampoable Ай бұрын
That raw string thingy would be useful for Latex, I've just done that in py when needing some formulas in graph annotations
@Telhias
@Telhias Ай бұрын
You know what Javascript should do with floating points? Make them do a fuzzy comparison with precision to the highest number of decimal places in the equation. Just to be different and make people stop using that example.
@jfftck
@jfftck Ай бұрын
In Python, you use raw strings for RegEx or SQL queries to remove the need to escape everything. So for Python it is as easy as just putting an r in front of the string literal like this r’/t’, but JavaScript has so much more to type that it isn’t reducing the amount you need to type and I would argue that it isn’t making it that much easier to read.
@shaunpatrick8345
@shaunpatrick8345 Ай бұрын
const r = String.raw I can't see that causing any problems...
@youtubeforcinghandlessucks
@youtubeforcinghandlessucks 26 күн бұрын
There are regex literals for the first case :p But you are right, there actually are custom JS regex implementations as well as sql libraries that use this "tagged string literal" syntax - and the tag used for them is custom and typically shorter (like @shaunpatrick8345 showed, it can be any name in scope). It can be used in any context where you want a custom language string parser or transformer, such as latex, markdown, htmlx, jsx, etc... A tag's implementation has access to and can chose to use both the normal string version as well as the "raw" version in case it doesn't want the backslash escapes to have their regular string meaning. It also has access to interpolated values (parts that are in ${}) so it can escape them as it wants or even bind them as sql statement parameters or use them as jsx attrs or what have you.
@jacovinus
@jacovinus Ай бұрын
the meme is becoming real: reacting the reaction of the one who reacts 😂
@LewisRidyard
@LewisRidyard Ай бұрын
its sudoku time
@Gennys
@Gennys Ай бұрын
I actually kind of like those special empty items Prime was talking about with js arrays.
@kevinkkirimii
@kevinkkirimii Ай бұрын
I am too stupid for FAANG, however question 6, really!!! Just extend the array and move on with life?!! JS is pure magic. I concede
@dipereira0123
@dipereira0123 Ай бұрын
Being real, if you are in a situation where you need to consider those situations, your code is already f*ucked from at least 2 sprints ago 😂
@meatcow417
@meatcow417 Ай бұрын
lmao, that was a short-lived title.
@abergod280
@abergod280 Ай бұрын
I can't understand how someone could ever think of Javascript as a backend language. It does whatever the hell it wants, whenever the hell it wants it
@Tony-dp1rl
@Tony-dp1rl Ай бұрын
"new Array" in JS can take a long walk off a short pier
@Arthur-cx3ow
@Arthur-cx3ow Ай бұрын
Feels like to build css to IE6. Working around all those skill issues...
@Ethan-pc3bv
@Ethan-pc3bv Ай бұрын
"currently, at this moment"
@Brad_Script
@Brad_Script Ай бұрын
String.raw is useful for storing long windows path if you're too lazy to escape the backslashes
@ayumuaikawa
@ayumuaikawa Ай бұрын
and that my friend, is why i love javascript 😅
@lukemarshall1892
@lukemarshall1892 Ай бұрын
'A very confusing conversion system' is what you tell someone just starting to learn js to give them a heads up without spoiling how atrocious everything is.
@KyleHarrisonRedacted
@KyleHarrisonRedacted Ай бұрын
9:04 I incorrectly guessed it would be true, just because of the loose equivalence operator instead of a strict one. In my head I figured js would go the extra mile and either round to the same floating point placement or just chop off. But I was wrong lol
@ChilenonetoYoutube
@ChilenonetoYoutube 25 күн бұрын
that raw could be used on a template stuff I guess... to avoid extra processing on manipulation, but don't know if it makes sense at all...
@balazsbordas1214
@balazsbordas1214 Ай бұрын
holy shit, I'm so glad I never had to deal with javascript professionally.
10 javascript Changes You Missed in 2023 | Prime Reacts
17:07
ThePrimeTime
Рет қаралды 61 М.
MAXIMUM CRINGE Programming Language Tier List | Prime Reacts
22:45
ThePrimeTime
Рет қаралды 468 М.
ШЕЛБИЛАР | bayGUYS
24:45
bayGUYS
Рет қаралды 632 М.
когда одна дома // EVA mash
00:51
EVA mash
Рет қаралды 11 МЛН
Ауылға қайт! | АСАУ | 2 серия
33:16
Qarapaıym Qanal
Рет қаралды 1 МЛН
Data Analysis Masterclass (Day 1), May 2024 || Pizza Place Case Study
2:45:11
Jamie Woodruff Cyber Security Speaker | Why Every Company Will get Hacked in the Next 5 Years
24:10
Interview With A Sr JavaScript Dev | Prime Reacts
24:43
ThePrimeTime
Рет қаралды 145 М.
React is Holding Me Hostage!!! | Prime Reacts
28:44
ThePrimeTime
Рет қаралды 98 М.
How To Get Into Software | Prime Reacts
16:34
ThePrimeTime
Рет қаралды 102 М.
600 Rejections  Finding A Job In Tech | Prime Reacts
48:58
ThePrimeTime
Рет қаралды 251 М.
Single Language Productivity Is Fake
41:06
ThePrimeTime
Рет қаралды 155 М.
I Am Impressed By Chat GPT4o
27:51
ThePrimeTime
Рет қаралды 156 М.
Code Review: C
10:14
TheVimeagen
Рет қаралды 31 М.
Google I/O 2024 - ИИ, Android 15 и новые Google Glass
22:47
Эффект Карбонаро и бумажный телефон
1:01
История одного вокалиста
Рет қаралды 1,9 МЛН
How Neuralink Works 🧠
0:28
Zack D. Films
Рет қаралды 28 МЛН