S
S
Svyatoslav2015-10-04 16:52:45
JavaScript
Svyatoslav, 2015-10-04 16:52:45

Why does a function return NaN in JS?

there is a function:

function intDiv(x,y){
    return [(x-x%y)/y,x%y];
  };

So everything is fine
console.log(intDiv(2/2));
And so (NaN,NaN):
var a = 2;
var b = 2;
console.log(intDiv(a/b));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sanex3339, 2015-10-04
@trixy

console.log(intDiv(a, b));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question