I was making graphs in node, and finally got it working. In my code I have to define node which is an number for each label / node in the graph.

This graph has node set to 15:

And when I set node to 5:

This took me so long. It finally works :3

Here is 198, which is the limit. Just because I feel like generating this:

And here is 2 nodes:

The problem

Then I thought, what is the other limit? I think 1 will crash, let’s try it:

Well looks like that worked. Funny. Thought I would have to write a hardcoded way around this.

Okay, then 0. 0 should give my a Devision by 0 exception Since I divide by the amount of nodes somewhere. minutesDifference / amount. Okay so let’s try 0 nodes:

What? I mean this is the result I want, but where is the exception? This is weird. Okay let’s try -1 nodes. Just cause funy and I want it to crash.

-1 nodes:

Hoh?? how? What? Why?

This should give me an error, Like why am I not getting errors????

Okay let’s try 3.14 nodes (cause in#code/javascript an float and int are both number):

WHAT?? I never told it to round up?? WHY is this happening???

Okay let’s try null for shits n giggles:

Okay about as expected, but also not, since it’s not a number. how can 1234/ null = a number???

Okay let’s try NaN nodes:

HOW DOES IT NOT CRASSHHHH????

Okay let’s try undefinded nodes:

Okay I hate this, Let’s see what I can find that does make it crash.

results

I made a table with these scuffed results.

valueoutcomeis this a logical result?
11 nodeyes
0empty graphyes
199CRASHESyes
-1empty graphno
NaNempty graphno
nullempty graphno
undefinedempty graphno
“henk”empty graphno
{}empty graphno
{“henk”: false}empty graphno
[]empty graphmaybe
[“henk”, “henk”]empty graphno
true1 nodekinda
falseempty graphkinda

Okay so why did I write this?

Javascript handles way too much, okay true and false being turned into 1 and 0 is fair enough, but IN WHAT WORLD DOES NOT A NUMBER aka NaN == 0. Or I’d expect that it would look at the lenght of the list with ["henk", "henk"], cause if you are going to handle this, that seems the most logical, but no it is equal to / less than 0. OK??

I actually was mentally prepared to limit what the user is allowed to request, but I don’t need to apparently. I HATE THIS AAHHAHAHAHHAHA