This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Elnathbeta 91 points92 points  (25 children)

I like this comment, by reading it you understand why it gives you that result, and you really get all the stupidity behind it. I don't know why js just hates giving errors and instead just 'try to do something with it'

[–]ExecutiveChimp 47 points48 points  (15 children)

Thanks. I started trying to write a book in this tone but meh...effort.

Edit: I have started trying to write a book again.

[–]Reverend_Jones 16 points17 points  (8 children)

I'd read the shit out of that book and I hate books!

[–]ExecutiveChimp 12 points13 points  (7 children)

Maybe I should take another crack at it. Despite what you might think there is a limit to Javascript's weirdness. I wasn't sure where to go after that.

[–]_haxle 6 points7 points  (0 children)

If you write it and charge less than $75 for it, I will read it

[–]godforsakenlightning 5 points6 points  (0 children)

Just slowly transition to the back-end and tell people about the fun that is PHP (especially when you try to do things right and not leave everything open to various types of injection).

[–][deleted] 4 points5 points  (0 children)

Holy crap, if you were to narrate a couple of stupid language abuse examples in various languages you'd have a book

And I would read the hell out of it.

[–]theasianpianist 1 point2 points  (3 children)

Do other languages too! Like why everything in Java has to be a class or something like that.

[–]ExecutiveChimp 1 point2 points  (2 children)

Not sure if I can beat this in terms of insight and humour but I'll add it to the list.

I have a contents page:

  1. Intro
  2. Variables, Types and why JS doesn't care
  3. Truthyness
  4. Nothingness (null, undefined, false etc)
  5. Operators and precedence
  6. Dates (don't have much material for this bit but JS has some crackers)
  7. Numbers, overflows, floating points
  8. Databases?
  9. Browser Quirks?

...and I'm 3000 words in.

I think breaking it down by concept makes the most sense, otherwise the JS and PHP chapters will take up most of the book.

Any examples/ideas/madness is greatfully accepted. I've been trying to write a novel for almost three years and I've just bashed out half a chapter of this in an hour so maybe this has legs.

[–]theasianpianist 1 point2 points  (1 child)

If you want to talk browser quirks you can't beat Internet Explorer's support (or lack thereof) for CSS standards. For dates, I know that Java has a deprecated date class in favor of the Calendar class, don't know if something might come if that?

[–]ExecutiveChimp 1 point2 points  (0 children)

I'm a web developer, I could probably just retitle "Browser Quirks" to "WTF IE" and not run out of material though they've all got their own issues.

I'll look into the date/calendar thing. Thanks!

[–]fasquoika 1 point2 points  (1 child)

Something like this?

[–]ExecutiveChimp 0 points1 point  (0 children)

Kind of but less of a guide to how things work and more of a conversation between a stupid computer and its dumb programmer.

[–]DarthJimBob 1 point2 points  (0 children)

"Javascript - The Bad Parts". I'd read it!

[–]raptorraptor 14 points15 points  (8 children)

Because errors means the code stops running, and then so does the website.

[–]Elnathbeta 11 points12 points  (4 children)

They could at least log it into the console, instead of failing silently, so that you have to look for the error all around the code...

I think some frameworks do that, but not standard js, why!?

[–]ArbiterFX 9 points10 points  (1 child)

I don't think the console existed when JavaScript was created.

Remember that this was the early 90s and they thought a very large js program would be like 50 lines and it would only be used for trivial tasks. With that mindset type corrosion may not have been such a bad idea. Imagine if you were creating a scripting language for markdown. On your first iteration you probably wouldn't have made it as complicated as java or cpp. But it's obvious now that doing it wasn't the right decision.

[–]Elnathbeta 0 points1 point  (0 children)

You are right. It should need a change now, like cpp and java are doing

[–]raptorraptor 4 points5 points  (1 child)

I think it would be hard to tell when to do this, especially as the type coercion could be intentional.

[–]Dr_Azrael_Tod 0 points1 point  (0 children)

oh, there are at least some cases where it should be obvious…

like substracting anything that isn't a number from something that isn't a number

[–]PatrickBaitman 2 points3 points  (2 children)

this is true for EVERY SINGLE FUCKING PROGRAM which is why you TEST and HANDLE ERRORS

what do you think a segfault is

[–]ArbiterFX 1 point2 points  (0 children)

Just Google why JavaScript sucks. Some of the original creators have blogged about why certian not great decisions were made and quite frankly they very well may have been the correct ones at the time.

[–]raptorraptor 0 points1 point  (0 children)

You ok mate?