Finding whether a number is rational

I need to find whether a number is rational or not in javascript.

could somebody help?

I’d take a look at the number one google search for “rational number javascript” which is a port to JS of some PHP code
http://satchamo.com/blog/coding/fractions-javascript

The link just shows addition of fractions and not determining whether a number is rational.

Did you know that anything that is able to be represented as a fraction, is a rational number?
Also, that computers can not store irrational numbers as actual numbers.

So, you’ll need to pick what range of denominator you are willing to use as a maximum size for a rational number, and then determine whether any possible denominator results in an integer nominator.

Good luck with your assignment there.