From 7d226d00788c54f0d3359c22c83b36cb90b5bbc5 Mon Sep 17 00:00:00 2001 From: kViking Date: Fri, 23 Nov 2018 23:30:12 -0800 Subject: [PATCH] Added variable addition example (#23047) Added an example showing storing values in variables before adding them. Also added syntax highlighting to original code snippet. --- .../add-two-numbers-with-javascript/index.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/guide/english/javascript/tutorials/add-two-numbers-with-javascript/index.md b/guide/english/javascript/tutorials/add-two-numbers-with-javascript/index.md index f665c42fd3..5362f38e1b 100644 --- a/guide/english/javascript/tutorials/add-two-numbers-with-javascript/index.md +++ b/guide/english/javascript/tutorials/add-two-numbers-with-javascript/index.md @@ -3,4 +3,15 @@ title: Add Two Numbers with JavaScript --- JavaScript uses the `+` symbol for addition. It can also be used instead of `parseInt()` but that is beyond this. - var sum = 10 + 10; \ No newline at end of file +```javascript +var sum = 10 + 10; +``` + +Variables can be added in a similar fashion. + +```javascript +var x = 10; +var y = 10; +var z = x + y; +console.log(z); // Will print 20 to the console +```