I did the program as per instructions but I am not getting an output.I am stucked. Attaching the code here .Please help me to find out the error.
Silly story generator
Hi there @adithyan_rajeev, and welcome to our community!
So … there are quite a lot of problems with your code as it stands. I think what I’ll do for now is give you some general tips that you can use to get rid of the major problems, then you can have another go at it:
- In JavaScript, text strings need to have quotes around them.
- In arrays (
[]
), you need to separate the different items inside an array with commas (,
) - You can’t use a variable value before you have initialized it. Have a look at the order of the instructions inside the
result()
function. You need to start off by creating thenewStory
. - I’m not sure what you’re trying to do with
randomValueFromArray(weight) = '94 fahrenheit'
— there is no array calledweight
, and you can’t assign a value to a function call. - To replace the placeholder values inside the story string with “real” values, you need to use the string
replace()
method.
I think that will do for now. Have another go, and see where you get to.
All the best.
1 Like
thank you for your response…