Feat/add guide article for javascript (#34007)

This commit is contained in:
Vel Kumric
2018-11-04 01:05:54 -05:00
committed by Nishant Mishra
parent cdb8d72db8
commit bc879e14d2
2 changed files with 53 additions and 29 deletions

View File

@ -1,10 +1,30 @@
---
title: Multiply Two Decimals with JavaScript
---
## Multiply Two Decimals with JavaScript
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.
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
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
```
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
### Hint 1
Think about what decimal number, when multiplied by 2.0, would equal 5.0.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
> *try to solve the problem now*
## Spoiler Alert!
__Solution Ahead!__
### Code Solution
```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)