How to overcome syntax error issue while Injecting Javascript code from angularjs controller

I am trying to add the following javascript code through one angular controller

    const script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.type = 'text/javascript';
    script.async = false;

    script.setAttribute('src', './exampleJSCode.js');

The exampleJSCode file contains javascript functions but when I run this code I get lots of syntax errors (around 54) but the exampleJSCode file is formatted correctly.

How to escape that character which is causing syntax error?