These clouple lines could be simplified like this:

```javascript
var mask = new Array( value.lenght ).join("*");
```