DEV Community

Discussion on: Simplest way to compare two numbers array in JS

Collapse
 
patricktingen profile image
Patrick Tingen

What's the advantage of using the "hack" over the more straightforward way of adding .toString? The advantage of .toString is that it makes your intent more clear, which might be a tiny bit more maintenance friendly

Collapse
 
0shuvo0 profile image
Shuvo

There are two types of people in this world.

  1. People who like hacks
  2. Other people
Collapse
 
patricktingen profile image
Patrick Tingen

Haha, fair enough, but type-1 people then better keep working in 1-person teams

Thread Thread
 
0shuvo0 profile image
Shuvo

Yes in corporate/serious project you have some rules to follow

Collapse
 
blackr1234 profile image
blackr1234 • Edited

I won't consider that a "hack" because as a Java developer I always write +"" instead of toString(), but I would consider stringifying the arrays and comparing them a hack for array comparison.

Thread Thread
 
0shuvo0 profile image
Shuvo

Owh nice to know