The code provided by AI doesn't work. I specified that it should be compatible with the JavaScript engine. How can I make it function?