for it to work do i have to have 2 questions on the javascript code

No, you do not necessarily have to have two questions in the JavaScript code for it to work. The number of questions in the code would depend on what you are trying to achieve and how you are implementing the code. It is possible to have a JavaScript code with only one question or multiple questions, depending on the requirements of your program.