I'm developing an Angular Application.. for that I am using node.js express as backend. but I'm getting an error. I know that I'm getting this error in that if condition statement where I have applied condition

Is this the correct way of checking whether an field in json exist or not?

```
(!( typeof result[0].fUserPwd == undefined ))

```

I have included error below this code snippet.

```
var express = require('express');
var router = express.Router();
var sql = require('mssql');
var db = require('../db/db');
let jwt = require('jsonwebtoken');

router.get('/login/:fUserID/:fUserPwd', async function (req, res) {
    var strquery = "select fUserPwd from tblUser where fUserID ='" + req.params.fUserID + "'";
    console.log(strquery);
    const result = await db.executeQuery(strquery, res);
    if (!( typeof result[0].fUserPwd == undefined )){
        var pwd = result[0].fUserPwd
    if (req.params.fUserPwd == pwd) {
        let User = {
            strUserID : req.params.fUserID,
            strUserPwd : req.params.fuserPwd };
        let token = await jwt.sign(User, global.config.secretKey, {
            algorithm: global.config.algorithm,
            expiresIn: '180m'
        });
        console.log("Token Generated :  " + token);

        res.status(200).json({
            token, auth: true 
        });
    } else {
        res.status(401).json({
           token: '0' , auth: false 
        });
    }

    } else{
        res.status(401).json({
            token: '0' , auth: false 
         });

    }

});

```

> 
> (node:5048) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'fUserPwd' of undefined
>  at /home/naseef/Desktop/ClearDesk/CD\_ERP/backend/routes/clsCommon.js:11:29
>  (node:5048) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
> 
> 
>