Home › Forums › JavaScript › [Solved] Simpler way to write this snippet? › Reply To: Simpler way to write this snippet?
September 24, 2013 at 9:40 pm
#151144
__
Participant
I have proper names in my app code… just used the letters for a primitive test case.
Honestly, it makes more sense to have “proper names” in the test case – that’s where it’s going to be looked at. In your production code, things can (should) be minimized.
Also, it makes a lot more sense now that I know a
, b
, and c
are in a different scope than d
.
You’ll notice the code snippet is used in both the right and left test functions. Is there a way to possibly just use it once without have to be redundant?
You could make it into a method (of your test
object, or it could be a bare function if you want to use it globally).