From a9622d8b00c55c62456702ec19fa234782617763 Mon Sep 17 00:00:00 2001 From: Mau Di Bert Date: Thu, 27 Jun 2019 09:39:00 -0300 Subject: [PATCH] Update article.md --- .../01-property-descriptors/article.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/1-js/07-object-properties/01-property-descriptors/article.md b/1-js/07-object-properties/01-property-descriptors/article.md index 7768b355..c977e62f 100644 --- a/1-js/07-object-properties/01-property-descriptors/article.md +++ b/1-js/07-object-properties/01-property-descriptors/article.md @@ -122,6 +122,10 @@ user.name = "Pete"; // Error: Cannot assign to read only property 'name'... Now no one can change the name of our user, unless they apply their own `defineProperty` to override ours. +```smart header="Errors appear only in use strict" +In the non-strict mode, no errors occur when writing to read-only properties and such. But the operation still won't succeed. Flag-violating actions are just silently ignored in non-strict. +``` + Here's the same operation, but for the case when a property doesn't exist: ```js run @@ -239,10 +243,6 @@ Object.defineProperty(user, "name", {writable: true}); // Error */!* ``` -```smart header="Errors appear only in use strict" -In the non-strict mode, no errors occur when writing to read-only properties and such. But the operation still won't succeed. Flag-violating actions are just silently ignored in non-strict. -``` - ## Object.defineProperties There's a method [Object.defineProperties(obj, descriptors)](mdn:js/Object/defineProperties) that allows to define many properties at once.