Uncaught TypeError: (intermediate value)(…) is not a function

前端 未结 7 1930
不思量自难忘°
不思量自难忘° 2020-12-02 10:42

Everything works fine when I wrote the js logic in a closure as a single js file, as:

(function(win){
   //main logic here
   win.expose1 = ....
   win.expos         


        
7条回答
  •  心在旅途
    2020-12-02 11:19

    Error Case:

    var userListQuery = {
        userId: {
            $in: result
        },
        "isCameraAdded": true
    }
    
    ( cameraInfo.findtext != "" ) ? searchQuery : userListQuery;
    

    Output:

    TypeError: (intermediate value)(intermediate value) is not a function
    

    Fix: You are missing a semi-colon (;) to separate the expressions

    userListQuery = {
        userId: {
            $in: result
        },
        "isCameraAdded": true
    }; // Without a semi colon, the error is produced
    
    ( cameraInfo.findtext != "" ) ? searchQuery : userListQuery;
    

提交回复
热议问题