diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/object-oriented-programming/use-an-iife-to-create-a-module/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/object-oriented-programming/use-an-iife-to-create-a-module/index.md index 4bacba9572c..ecc1f147eca 100644 --- a/guide/english/certifications/javascript-algorithms-and-data-structures/object-oriented-programming/use-an-iife-to-create-a-module/index.md +++ b/guide/english/certifications/javascript-algorithms-and-data-structures/object-oriented-programming/use-an-iife-to-create-a-module/index.md @@ -45,3 +45,21 @@ let funModule = (function() { })(); ``` + +### Solution 2 + +If using ES6, the same can be rewritten as: + +```javascript +let funModule = ( () => { + return { + isCuteMixin: (obj) => { + obj.isCute = () => { true; }; + }, + singMixin: (obj) => { + obj.sing = () => { console.log("Singing to an awesome tune"); } + } + + } +})(); +``` diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally/index.md index c675927909b..158d35b6e0f 100644 --- a/guide/english/certifications/javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally/index.md +++ b/guide/english/certifications/javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally/index.md @@ -21,3 +21,14 @@ function Bird() { } ``` + +### Solution 2 + +In ES6 syntax we can make the function a bit less verbose: + +``` +function Bird() { + let weight = 15; + this.getWeight = () => weight; +} +```