Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict'
- let words = ["NEUTRAL", "INDIFFERENT", "READABLE", "CLASSIC", "PLAIN", "DULL"];
- function pickRandomChar(word) {
- let chars = word.split("")
- let randomIdx = Math.floor(Math.random() * chars.length)
- return chars[randomIdx]
- }
- function removeCharacter(word) {
- let letter = pickRandomChar(word)
- console.log(letter)
- const newString = word.split(letter).join(" ")
- return newString
- }
- words = words.map(removeCharacter)
- /* for(let i = 0; i < words.length; i++) {
- let newCharacter(words, "E");
- }*/
- //word = removeCharacter(word, "A");
- console.log(words);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement