Earlier quoted context omitted.
Typescript doesn’t save you from all the weird things happening at runtime. A missing check at a context boundary and you can have a wild time (been there).
Context boundary meaning where it interfaces with javascript?
JavaScript Is Weird
251–260 of 383 posts
Re: JavaScript Is Weird
#252I’ve taught programming to people who struggled because they were misusing JS and the answer they were getting back coincidentally worked for some inputs but not others. Imagine trying to explain to them that this was their fault? Even trying to find the words to explain what happened made me feel bad that their first experience programming was tarnished by a language that will gladly allow you to do nonsense.
Re: JavaScript Is Weird
#253UX nit: would have preferred question-by-question feedback on right answer and overall score, quite a lot to get through 25 questions before you get any reward for your effort :)
When is the last time you took an in-person test where the proctor told you if you were right/wrong after every question?
You need to grade current knowledge. In fact, I would have removed the multiple choice altogether for this test and had a input(type=text)
EDIT: OK, ok: I get it, it is just a fun website, not the BAR.
Re: JavaScript Is Weird
#254Earlier quoted context omitted.
I had that experience with Swift for maybe the first 2 days I used it. Nowadays I really appreciate Swift’s strictness. It just helps prevent so many stupid mistakes. I worked on a high-profile project for my company under a strict deadline and Swift was a major part in ensuring we delivered a rock-solid implementation in record time.
The only part of the type system that I feel gets tedious is dealing with numbers, where you're continually casting back and forth between Int, Float, Double, CGFloat (at least the latter is being addressed). I get why it's strict about it due to loss of precision and the madness of floating-point numbers, but sometimes you just don't care
Re: JavaScript Is Weird
#255UX nit: would have preferred question-by-question feedback on right answer and overall score, quite a lot to get through 25 questions before you get any reward for your effort :)
I don't think it is a UX nit. You would have started to catch on and learn if you had immediate feedback. When is the last time you took an in-person test where the proctor told you if you were right/wrong after every question? You need to grade current knowledge. In fact, I would have removed the multiple choice altogether for this test and had a input(type=text) EDIT: OK, ok: I get it, it is just a fun website, not…
Re: JavaScript Is Weird
#256Earlier quoted context omitted.
Which is why we use Typescript
The fact that there has to be a different language on top of your language to make it same days all that needs saying really.
The fact that there has to be a different language on top of your language to make it sane says all that needs saying really.
Re: JavaScript Is Weird
#2570.2 + 0.1 === 0.3 That's not really a JS problem, that's a floating point problem. Plenty of languages will have the same issue. +!![] "" - - "" (null - 0) + "0" Calling these things weird is fair enough but I can't help thinking this is code you'd never actually write outside of the context of a "Look how weird JS is!" post. It's like picking examples from the Annual Obfuscated C Contest to show how hard it is to un…
If a user does need to do scientific computing, they could use a "# use-floating-point" pragma or something so that literals get interpreted as floating point. Otherwise, we map them to rationals.
Of course, doing rational arithmetic is much slower (for example, Gaussian elimination is exponential for arbitrary precision rationals, while it's famously O(n^3) for floating point), so there's a danger of people accidentally using it in triply nested loops etc., but I have a feeling that if you need to do that kind of thing you know that you might run into performance issues and you think twice.
Re: JavaScript Is Weird
#258Re: JavaScript Is Weird
#259> JavaScript is a great programming language, but ... Why are we so afraid to call trash "trash"? It's not attacking the creator, but just how can we make progress if things are not perceived as they are? https://wtfjs.com
We are not saying this because we are afraid to say it, but because it is not true. JS is a great programming language with a lot of quirks and footguns, most of them easily avoidable by enforcing good coding styles, using easily available and widespread tooling. And most language have linters or compilers that issue coding-style related warnings, including C, so this is not specific to Javascript.
Re: JavaScript Is Weird
#260I’ve taught programming to people who struggled because they were misusing JS and the answer they were getting back coincidentally worked for some inputs but not others. Imagine trying to explain to them that this was their fault? Even trying to find the words to explain what happened made me feel bad that their first experience programming was tarnished by a language that will gladly allow you to do nonsense.
Can it be that JS is not good starting language then? Maybe strongly typed compiled languages would be a better fit? One can argue that if you want to program it might be too much information for starters - but IMO basic types are such a fundamental concept that it would be better to teach that concept early on. It also clears up a lot of newbie confusion as you cannot assign string to an int by mistake with strongly…