Should checking if a variable is a number the responsibility of a function named isOdd?

Attached: odd function.png (439x497, 19K)

Other urls found in this thread:

ecma-international.org/ecma-262/6.0/index.html#sec-number.min_safe_integer
ecma-international.org/ecma-262/6.0/index.html#sec-number.max_safe_integer
twitter.com/SFWRedditImages

>safe integer
Is JavaScript memory unsafe?

>===
Disgusting.

require("is-even");
require("is-odd");
require("is-number");
require("is-variable");
require("is-object");
require("is-bytes");
require("is-silicon");
require("is-??????");
require("stop-using-javascript");

npm install numberchecker

It can be if the interpreter is broken. Otherwise it is safe, but weak dynamic typing language is retarded anyway.

Attached: is-odd.png (1009x3612, 467K)

Yes, because it needs to know that before trying to figure out whether it's odd or not.

Should it be legal to put a licence on a function of a single line?

Attached: dry.png (438x284, 10K)

The license was probably added automatically.

"Safe" I assume means "exactly representable". Javascript doesn't actually have integers, only doubles. So if an integer result would be bigger than 2^53 or so, some of the lower bits get lost in the conversion to double.

I'm gonna throw up

>abs() for seemingly no reason
>redundant type checks
>bitshift by zero for seemingly no reason
>double bitwise not in case it still isn't a number
>double logical not in case the actual parity check still isn't a boolean
>I'm still not sure if it's the right type. Let's use the identity operator to make it more safe
At least some of this retardation was changed along the way, but damn what an abomination.

Attached: 1475192828721.jpg (349x389, 35K)

I fixed it

Attached: is-even-is-odd.png (1024x706, 25K)

Hi, it's me, Jon Schlinkert, programmer, public speaker and author of more than 1,100 code projects. I have published code projects in several different languages, but most are JavaScript. 90+ of my projects receive more than 10 million downloads/month, with the total exceeding 3.9 billion downloads/month.

Attached: c61.png (800x750, 106K)

kek

will it cause a stack overflow?

Attached: SmugFujiwaraChika.jpg (768x768, 190K)

Let value = -2,147,483,648
n = math.abs(value)
n = 2,147,483,648

Value exceeds maximum safe interger

Work on your code user. Also what happens if you pass a non number to abs?

>you pass a non number
see 'expected a number' part
>exceeds maximum safe interger
see 'value exceeds maximum safe integer'

Yes but -2,147,483,648is a safe interger so it should be processed as such and you are passing a number to abs before the if statements so if abs cant handle the exception youll have a problem and if it does handle it then the if is redundant.

>Cnile thinks javascript has actual integers
ecma-international.org/ecma-262/6.0/index.html#sec-number.min_safe_integer
ecma-international.org/ecma-262/6.0/index.html#sec-number.max_safe_integer

>Cnile
lol

Attached: smug_nanako.jpg (336x331, 25K)

newfag

Wtf why would you use thos garbage. Also ive never used C but any language ive seen has an int as 2^64

>Javascript doesn't actually have integers, only doubles.
every time I learn something about this language I'm horrified in new and different ways

Attached: 1549311509562.png (492x1460, 345K)