Commit 5b72d1b2 authored by Anastasia Helfinstein's avatar Anastasia Helfinstein Committed by Commit Bot

[Switch Access] Copy array more efficiently

Instead of iterating through the array to make a copy, use the ES6
spread operator.

AX-Relnotes: n/a.
Bug: None.
Change-Id: Ia0e1a8d738c5c9480bf991ba9de4a50bb4fca482
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2391506
Auto-Submit: Anastasia Helfinstein <anastasi@google.com>
Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Commit-Queue: Anastasia Helfinstein <anastasi@google.com>
Cr-Commit-Position: refs/heads/master@{#807242}
parent 56cd8570
......@@ -51,10 +51,8 @@ class GroupNode extends SAChildNode {
asRootNode() {
const root = new SARootNode();
const children = [];
for (const child of this.children_) {
children.push(child);
}
// Make a copy of the children array.
const children = [...this.children_];
children.push(new BackButtonNode(root));
root.children = children;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment