From ebe9e8f66ff5e11bb5a689d727a9fbf4f1b4798a Mon Sep 17 00:00:00 2001 From: celticaire <42580254+celticaire@users.noreply.github.com> Date: Thu, 21 Mar 2019 12:53:40 -0400 Subject: [PATCH] Fixed awkward wording (#28320) --- guide/english/javascript/with/index.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/guide/english/javascript/with/index.md b/guide/english/javascript/with/index.md index ff1964edae..c7347f85bb 100644 --- a/guide/english/javascript/with/index.md +++ b/guide/english/javascript/with/index.md @@ -3,7 +3,7 @@ title: With --- ## With -JavaScript's `with` statement is a shorthand way for editing several properties on one object. Most developers discourage usage of `with`, and you are best not using this keyword. +JavaScript's `with` statement is a shorthand way to edit several properties on one object. Most developers discourage its usage, with best practice being not to use `with`. See Alternatives below for other approaches. **Note**: `"strict mode"` in ECMAScript 5 forbids usage of `with`. @@ -16,13 +16,13 @@ with (expression) ### Example Usage -In JavaScript, you can individually modify an object's properties like below: +In JavaScript, you can individually modify an object's properties as below: ```javascript let earth = {}; earth.moons = 1; earth.continents = 7; ``` -`with` gives you a shorthand to modify the properties on an object: +`with` gives you a shorthand way to modify the properties on an object: ```javascript with (earth) { moons = 1; @@ -30,7 +30,7 @@ with (earth) { } ``` -While this example is contrived, you can understand use cases of `with` more if you have larger objects like below: +While this example is contrived, you can understand cases of `with` better if you use larger objects as below: ```javascript earth.continents.australia.geography.ocean = "Pacific"; earth.continents.australia.geography.river = "Murray"; @@ -38,7 +38,7 @@ earth.continents.australia.geography.mountain = "Kosciuszko"; ``` ### Alternatives -You should not use `with` as it has subtle bugs and compatibility issues. A highly recommended approach is to assign the object to a variable, and then modify the variable's properties. Here is an example using a larger object: +You should not use `with`, as it has subtle bugs and compatibility issues. A highly recommended approach is to assign the object to a variable, and then to modify the variable's properties. Here is an example using a larger object: ```javascript let earth = { continents: {