# freeCodeCamp Challenge Guide: Multiply Two Decimals with JavaScript

**URL:** <https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-multiply-two-decimals-with-javascript/301173>\
**Category:** freeCodeCamp Contributors\
**Tags:** guide\
**Created:** [August 3, 2019, 5:45am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-multiply-two-decimals-with-javascript/301173 "2019-08-03T05:45:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![camperbot](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/camperbot/32/18364_2.png) [@camperbot](https://forum.freecodecamp.org/u/camperbot)\
**Post date:** [August 3, 2019, 5:45am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-multiply-two-decimals-with-javascript/301173/1 "2019-08-03T05:45:54Z")

</div>

# [Multiply Two Decimals with JavaScript](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript)

* * *

## Problem Explanation

JavaScript uses the `*` symbol for multiplication. Multiplying floats is the same as multiplying integers. JavaScript only has the _number_ type, which serves both integer and floating point numbers, it does not have a specific type for integers.

For example, if you were to multiply 2 integers, the numbers 3 and 5, then you could simply type:

```javascript
var product = 3 * 5; // product is 15

```

Now if we were to multiply two floating point numbers, 3.4 and 5.7, the product would be a float as well:

```javascript
var product = 3.4 * 5.7; // product is 19.38

```

* * *

## Hints

### Hint 1

Think about what decimal number, when multiplied by 2.0, would equal 5.0.

* * *

## Solutions

> **Solution 1 (Click to Show/Hide)**
>
> ```javascript
> var product = 2.0 * 2.5; // product is 5.0 because 2.5 * 2.0 = 5.0
> 
> ```
> 
> #### More Information
> 
> - [DigitalOcean - How to do Math in JavaScript with Operators](https://www.digitalocean.com/community/tutorials/how-to-do-math-in-javascript-with-operators)

---

<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 8, 2025, 3:59pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-multiply-two-decimals-with-javascript/301173/2 "2025-01-08T15:59:12Z")

</div>

Closed on January 8, 2025, 3:59pm UTC


