Javascript Node.js-在满足条件之前请求用户输入?

Javascript Node.js-在满足条件之前请求用户输入?,javascript,node.js,Javascript,Node.js,我是Node.js的新手。我试图执行以下代码来重复if-then-else循环,直到用户输入正确的数据。但是,在最后一个“else”中调用了该函数,但在调用该函数之前不会显示该消息。有人能帮我吗 intents.matches('Work type', [ function xyz(session,args) { builder.Prompts.text(session ,"How much is the square feet . Please type \n\n 1 for

我是Node.js的新手。我试图执行以下代码来重复if-then-else循环,直到用户输入正确的数据。但是,在最后一个“else”中调用了该函数,但在调用该函数之前不会显示该消息。有人能帮我吗

intents.matches('Work type', [
    function xyz(session,args) {
    builder.Prompts.text(session ,"How much is the square feet . Please type \n\n 1 for >2000 sq ft \n\n 2 for <2000 sq ft");
    },
    function abc(session, results) {
        var res = results.response;
        if (res == 1)
            {
                session.send('You can go for Dr. Fixit Newcoat \n Is is a heavy duty terrace waterproof coating system. \n \n 1.Solid Content \n\n 2.Hardness Shore A:  ASTM D 2240 2002 \n\n 3.Tensile Strength N/mm2:ASTM D 412 2002 \n\n 4.Elongation at Break:ASTM D 412 2002 \n\n 5.UV Resistant - Accelerated:ASTM G 154 2000 \n\n Are you satisfied with the solution ?');
            }
        else if (res == 2)
            {
                session.send('You can go for Dr. Fixit New Coat Ezee    \n \n Area of Application- Building roofs/terrace - Flats and Sloping  \n\n OverExisting cementicious waterproofing treatments like \n\n 1.Brickbat \n\n 2.Coba \n\n 3.Concreet screeds \n\n 4.Acrylic coating etc. \n\n Available package : \n\n 1. 4 ltrs : Rs 2000 \n\n 2. 12 ltrs : Rs 5000 \n\n Are you satisfied with the solution ?');   
            }
        else
            {
                session.send('You have entered an in correct input . Please input 1 or 2 as per your requirment');
                abc(session, results);
            }

   }
])
intents.matches('工作类型'[
函数xyz(会话,参数){

builder.Prompts.text(session,“平方英尺是多少。请键入\n\n 1以获取>2000平方英尺\n\n 2以获取调试/console.log返回的内容?我尝试使用session.send(“”);命令进行调试。但不知怎的,函数调用abc(session,results)和session.send()不能一起工作。我需要对它们中的任何一个进行注释以检查流程。您能展示整个示例吗?