There are common errors that are (or were) once so common that we’ve built tools to help us avoid them. So I was a little surprised to see this JavaScript from Annie‘s co-worker.

toggleField() {
    this.updateToggle(, this.toggle).subscribe(data=> {
      if (data.status = "success") {
        this.showToast('Toggle updated successfully');

This code handily ensures that the user will always be told that the toggle updates successfully. Note the “condition”- data.status = "success". It’s an assignment, not a condition.

This is a super common mistake, easy to make, which is why Annie’s team uses a linter as part of their CI process to ensure they don’t slip through. Unfortunately, the developer responsible for this code also changed the CI job settings to ensure that this stopped giving them an error, because obviously making the error go away is more important than fixing it.

Annie fixed the code, but admits: “The user experience was always positive, but it’s about to get worse.”

[Advertisement] Otter – Provision your servers automatically without ever needing to log-in to a command prompt. Get started today!

Remy Porter

Source link

You May Also Like

Won’t Wonder Around – People Of Walmart

That’s one way to keep your kids close. The post Won’t Wonder…

My Parents Managed To Be A Part Of The Photo

“My sister’s prom photo featuring our double-exposed parents watching over her.” (submitted…

leakers – John Thomas, Humor Times

Supreme Court Justice Roberts desecrates every Law he touches. Roberts should investigate…

The video is called Bicycle Race

Tags: music, queen, freddie mercury, damn thats interesting 2127 points, 99 comments.…