Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Unintentional mutations #96

Open
Jwhiles opened this issue May 11, 2017 · 0 comments
Open

Unintentional mutations #96

Jwhiles opened this issue May 11, 2017 · 0 comments

Comments

@Jwhiles
Copy link

Jwhiles commented May 11, 2017

This line bookInfo = bookInfo.sort((a, b) => is dangerous.

calling .sort on an array mutates the original array. This means that reassigning bookInfo to a sorted version of itself is a redundant.

More importantly this could cause very weird and hard to track down bugs if you later expand this piece of code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant