LOGIN
Steven Reubenstone
Mechanical Engineer & Tinkerer of Things. Collaborizm Roundtable.
Steven Reubenstone
51
Mechanical Engineer & Tinkerer of Things. Collaborizm Roundtable.
· New York, NY, USA
QUESTION

noob js question

Am I do something fundamentally wrong with my string search or if statements? I can’t get dog to log anything.

app.post('/sms', async (req, res) => {
  console.log('post body', req.body);

    var signup = req.body.Body;
    var isSignup = submit.includes("signup");

    var get = req.body.Body;
    var isGet = submit.includes("get");

    var submit = req.body.Body;
    var isSubmit = submit.includes("submit");

    let dog = 0;

        if (isSignup) {
              dog = 0;
              

        } else if (isGet) {
              dog = 1;
              

        } else if (isSubmit) {
               dog = 2;
               
        }
        else
        
            dog = 3;

            
    }

);
1 like
Like
Award Contribution
Ranjan Dailata
92
Solution Architect. Collaborizm Roundtable.
· Mysuru, Karnataka, India

The code basically checks for submit includes a text… You need to make one small change 😃

Change from - var signup = req.body.Body;
To - var submit = req.body.Body;

Like
2 likes
Award Contribution
Steven Reubenstone
51
Mechanical Engineer & Tinkerer of Things. Collaborizm Roundtable.
· New York, NY, USA

wow its amazing how noob devs make these mistakes

Like
Award Contribution
Leave a reply...
DISCOVER
CHAT
HIRE
ACTIVITY
FEED
Chat with us!
Help
Write something before you submit it!
Photo updated
Request Sent!
Updated
Copied to Clipboard