From cb1ae0f4aa6a69ed9262644442c31f0cede6ca1e Mon Sep 17 00:00:00 2001 From: Paul Allen Date: Sat, 26 May 2018 10:40:27 -0600 Subject: [PATCH] Update no-side-effects-in-computed-properties.md Provide more details on working with arrays inside computed properties. --- docs/rules/no-side-effects-in-computed-properties.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/rules/no-side-effects-in-computed-properties.md b/docs/rules/no-side-effects-in-computed-properties.md index 36066d823..e8966625f 100644 --- a/docs/rules/no-side-effects-in-computed-properties.md +++ b/docs/rules/no-side-effects-in-computed-properties.md @@ -16,7 +16,7 @@ computed: { return `${this.firstName} ${this.lastName}` }, reversedArray () { - return this.array.reverse() // <- side effect + return this.array.reverse() // <- side effect - orginal array is being mutated } } ``` @@ -29,7 +29,7 @@ computed: { return `${this.firstName} ${this.lastName}` }, reversedArray () { - return this.array.slice(0).reverse() + return this.array.slice(0).reverse() // .slice makes a copy of the array, instead of mutating the orginal } } ```