From 7530f987502b1cdacb23d3ee4bfb9b84d9c5f50c Mon Sep 17 00:00:00 2001
From: absentMindedDeveloper
<35352701+absentMindedDeveloper@users.noreply.github.com>
Date: Mon, 5 Nov 2018 15:03:52 -0800
Subject: [PATCH] Numbers within strings (#20969)
* Numbers within strings
Added a short entry on how numbers function inside of strings as well as how to convert a number inside of a string into a number which you can perform operations on in a normal fashion.
* Change a string in the example to a number
---
guide/english/javascript/numbers/index.md | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/guide/english/javascript/numbers/index.md b/guide/english/javascript/numbers/index.md
index 8cbb9c7373..50619d0511 100644
--- a/guide/english/javascript/numbers/index.md
+++ b/guide/english/javascript/numbers/index.md
@@ -68,6 +68,18 @@ foo.toFixed(2); // "47.69"
```
>Type `Number.prototype` in your browser and see other available methods yourself.
+Numbers in strings are treated differently than normal numbers.
+
+```javascript
+var foo = "12" + 18; // "1218"
+```
+In order to convert a string into a number you must run it through a ```Number()``` function.
+
+```javascript
+var foo = "12";
+var bar = Number(foo) + 18; // "30"
+```
+
#### More Information:
1. MDN
2. JavaScript Numbers