Javascript String nbsp()

Description

Javascript String nbsp()


/*jshint globalstrict: true, devel: true, esversion: 6 */
'use strict';//  w  ww.  j av  a 2s.co  m

String.prototype.nbsp = function() {
 return this.replace(/(\s[aiouwz])\s/g, function(p1) {
  return p1 + ' ';
 });
};

var tekst = 'Ala i As poszli w las';
console.log(tekst.nbsp());



PreviousNext

Related