Please Help: Silly Story Generator

Hello! Please, I need some help :grinning: I am at the point in the instructions:

Silly Story Instructions ( Create three new variables called xItem , yItem , and zItem ,)

I do not know where to insert this. I am lost at this point. This is what I have thus far:
const customName = document.getElementById(‘customname’);

const randomize = document.querySelector(’.randomize’);

const story = document.querySelector(’.story’);

function randomValueFromArray(array) {

const random = Math.floor(Math.random() * array.length);

return array[random];

}

let storyText = “It was 94 fahrenheit outside, so :insertx: went for a walk. When they got to :inserty:, they stared in horror for a few moments, then :insertz:. Bob saw the whole thing, but was not surprised — :insertx: weighs 300 pounds, and it was a hot day.”

let insertX = “Willy the Whale Big Daddy Father Christmas”

let insertY = “the soup kithcen Disney Land White house”

let insertZ = “spontaneously combusted melted into a puddle on the sidewalk turned into a slug and crawled away”

randomize.addEventListener(‘click’, result);

function result() {

let newStory = storyText;

let xItem = randomValueFromArray()

let yItem = randomValueFromArray()

let zItem = randomValueFromArray()

if (customName.value !== '') {

    let name = customName.value;

}

if (document.getElementById("uk").checked) {

    let weight = Math.round(300);

    let temperature = Math.round(94);

}

story.textContent = ;

story.style.visibility = 'visible';

}

Hello @LADY_SWAN

you doing great

first it better to share your code in codepen or jsfiddle or any online service as it easy to debug

you missing many semicolon at the end of line even if the browser fix it but it always good practice to use them
and randomValueFromArray function take array which you did supply when you call it

let xItem = randomValueFromArray()

let yItem = randomValueFromArray()

let zItem = randomValueFromArray()

you did not set value for

story.textContent = ;

so make it equal to newStory after updating it by replacing all inserx and temp and length stuff

use the replace all to replace part of the story to new value
for example

newstory.replaceAll(":insertx:", xItem);

when you debug your code right click on the page then bring the developer tool then go to the console and see if it complain about anything

also use console.log(with any string or variable) to check if it behave as it should be or not . it will bring the value of it to the console

fix those and check the console

hope that help and have a nice day :slight_smile: