0

When I compiled my code:

script
(function() {
  var uv = document.createElement('script'); 
  uv.type = 'text/javascript'; 
  uv.async = true;
  uv.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'widget.uservoice.com/MY_API_KEY.js';
  var s = document.getElementsByTagName('script')[0]; 
  s.parentNode.insertBefore(uv, s);
});

The compiler shows the error as:

Jade:9
7|    var s = document.getElementsByTagName('script')[0]; 
8|    s.parentNode.insertBefore(uv, s);
9|    });

missing ) in parenthetical

Any help would be appreciated, i'm not very good at Jade framework

nwytAnon
  • 1
  • 2

1 Answers1

0

Here we have up to 3 errors:

  • Jade Syntax x2

    1. Missing dot before the script tag.

    2. Bad indentation

  • Javascript x1

    1. The function is never gets called/executed because a missing () at the end.

.script  // the dot
  (function() {    // indent  all the js in the script tag.
    var uv = document.createElement('script'); 
    uv.type = 'text/javascript'; 
    uv.async = true;
    uv.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'widget.uservoice.com/MY_API_KEY.js';
    var s = document.getElementsByTagName('script')[0]; 
    s.parentNode.insertBefore(uv, s);
  })(); // missing ()
jmingov
  • 13,553
  • 2
  • 34
  • 37