fill out empty space untill its at a specific length string js code example Example: js fill string with n characters var str = new Array(len + 1).join( character );