Permalink
Browse files

use Array#join instead of String concatenation

  • Loading branch information...
1 parent c2a8772 commit d3e4ad1f42a2763fffa7fb01a75bee921882e7ed @jlaire jlaire committed Mar 30, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 src/core/base.js
View
@@ -79,16 +79,15 @@ jasmine.MessageResult = function(values) {
};
jasmine.MessageResult.prototype.toString = function() {
- var text = "";
+ var strings = [];
for (var i = 0; i < this.values.length; i++) {
- if (i > 0) text += " ";
if (jasmine.isString_(this.values[i])) {
- text += this.values[i];
+ strings.push(this.values[i]);
} else {
- text += jasmine.pp(this.values[i]);
+ strings.push(jasmine.pp(this.values[i]));
}
}
- return text;
+ return strings.join(" ");
};
jasmine.ExpectationResult = function(params) {

0 comments on commit d3e4ad1

Please sign in to comment.