# Generate Random Fractions with JavaScript

**URL:** <https://forum.freecodecamp.org/t/generate-random-fractions-with-javascript/149008>\
**Category:** General\
**Created:** [September 20, 2017, 3:13pm UTC](https://forum.freecodecamp.org/t/generate-random-fractions-with-javascript/149008 "2017-09-20T15:13:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajasekharkothuru](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rajasekharkothuru](https://forum.freecodecamp.org/u/rajasekharkothuru)\
**Post date:** [September 20, 2017, 3:13pm UTC](https://forum.freecodecamp.org/t/generate-random-fractions-with-javascript/149008/1 "2017-09-20T15:13:00Z")

</div>

**Tell us what’s happening:**

**Your code so far**

```auto
function randomFraction() {

  // Only changera code below this line.
 
  return math.random();
  
  }

  // Only change code above this line.

```

**Your browser information:**

Your Browser User Agent is: `Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36`.

**Link to the challenge:**

> **[Learn to code with free online courses, programming projects, and interview...](https://www.freecodecamp.org/challenges/generate-random-fractions-with-javascript)**
>
> Learn to code with free online courses, programming projects, and interview preparation for developer jobs.

---

<div class="post-metadata">

**Author:** ![anon52159105](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@anon52159105](https://forum.freecodecamp.org/u/anon52159105)\
**Post date:** [September 20, 2017, 3:27pm UTC](https://forum.freecodecamp.org/t/generate-random-fractions-with-javascript/149008/2 "2017-09-20T15:27:34Z")

</div>

Could you let us know what the issue is so we can help?

---

<div class="post-metadata">

**Author:** ![kevinSmith](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kevinsmith/32/72934_2.png) [@kevinSmith](https://forum.freecodecamp.org/u/kevinSmith)\
**Post date:** [September 20, 2017, 5:52pm UTC](https://forum.freecodecamp.org/t/generate-random-fractions-with-javascript/149008/3 "2017-09-20T17:52:16Z")

</div>

As said, you should be more specific with what the problem you are having is.

But a quick look at your code, I see the line,

```auto
  return math.random();

```

The `Math` object in JavaScript is capitalized.

There should have been a clue in the little black output window below the buttons and above the checkmarks - it should say _ReferenceError: math is not defined_ - that’s because there is no object called “math” - it is called “Math”. Capitalization is important in JS.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:39pm UTC](https://forum.freecodecamp.org/t/generate-random-fractions-with-javascript/149008/4 "2021-01-17T20:39:22Z")

</div>


