SOLVED Issue with glitch


So, I am making a random name generator. The code that I made works in 3 different software I use but it does not work in here. Please help,

1 Like

Hello @ezkurzak, welcome to the Glitch forum!

In order to be able to help you at all we at least need to know what errors you’re encountering. Beyond that we may need to see the code that’s generating whatever errors you see, and finally we may need to know your project’s name.

If you care to provide any of those details perhaps someone can provide some guidance in return.


Here is my Java Code, I know it works because it works in all my other software. Also the file is named “nice-age”

const firstNames = ["Hope", "Launa", "Katherine", "Walker", "Moses", "Tayna", "Rosia", "Yahaira", "Tommy", "Elwanda", "Clorinda", "Sheron", "Kayla", "Clementina", "Rene", "Rex", "Kathy", "Latoya", "Shirleen", "Shoshana"];

const secondNames = ["Chauncey", "Houchins", "Lama", "Frasca", "Houston", "Ake", "Shankles", "Cantor", "Mizell", "Cleland", "Maltby", "Tirrell", "Cary", "Mace", "Horta", "Charlile", "Deegan", "Torrez", "Humfeld", "Helgeson"];

const getRandomNumber = (max) => Math.floor(Math.random() * max);

const getRandomName = () => 
`${firstNames[getRandomNumber(firstNames.length)]} ${secondNames[getRandomNumber(secondNames.length)]}`;

const setRandomName = () => {
  document.getElementById('random-name').innerText = getRandomName();

document.getElementById('generate').addEventListener('click', setRandomName);


MOD EDIT: formatting


you should not call the setRandomName at the bottom +
it is spelled setRandonName(); , it should be setRandomName

1 Like

I am still having issues with it. I dont know what wrong. Like I have said it works in my other softwares, it could be something with your website.


Hey @ezkurzak looking at!/nice-age?path=script.js:16:0, you still have a typo in your function call. As @Jonyk56 mentioned, if you change that line to say setRandomName(); instead of setRandonName(); you should have better luck.


Even with that fixed the code still doesnt work. I seriously think it is something with you website. My codes is perfectly fine now. (I think)


It looks as though your function call is now pointed at the right function, but I don’t see anywhere in your HTML file that you’re linking to the script.js file anywhere.

I’ve Remixed your project and!/navy-yacht?path=index.html:1:0 shows an HTML file that works as I think you expect.