X interview question

How would you modify the String prototype in Javascript so that it printed out spaces in between every character?

Interview Answers

Anonymous

29 Apr 2016

String.prototype.toSpaceString = function(){ var s = [], c=0; while(c

Anonymous

7 Jun 2016

String.prototype.toSpaceString = function() { return this.split('').join(' '); }