Olga27,
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<script>
const sogl = ['Б', 'В', 'Г', 'Д', 'Ж', 'З',
'Й', 'К', 'Л', 'М', 'Н', 'П', 'Р', 'С', 'Т', 'Ф', 'Х', 'Ц',
'Ч', 'Ш', 'Щ', 'Ъ', 'Ь'];
const glasn = ['А', 'О', 'Э', 'Е', 'И', 'Ы',
'У', 'Ю', 'Я'];
let word = 'лес';
function showInfo(word) {
let s = sogl.slice(0).sort(_ => .5 - Math.random() );
let g = glasn.slice(0).sort(_ => .5 - Math.random() );
let length = 16 - word.length;
let endWord = Array.from({length}, (_, i) => i % 2 ? s[--i/2] : g[i/2])
return word.split("").concat(endWord)
}
</script>
</head>
<body onload="alert(showInfo(word));">
</body>
</html>