Reserved Word error - javascript

I have the following piece of code in Coffee-script
class #Badge
setIssues: (count)->
#count = count
#render()
When I run my script, I get the following error ,
Uncaught Syntax-Error: Unexpected reserved word
I am complete newbie in Coffee-script , so totally off-guard as of how to fix this error
I tried removing the word 'class' , hence removing the first line(including #Badge), as it is mentioned here , that 'class' is a reserved word . On doing so , it resulted in the error ,
Uncaught SyntaxError: Unexpected token >
How can i fix this error ?

Your two errors:
Uncaught Syntax-Error: Unexpected reserved word
Uncaught SyntaxError: Unexpected token >
suggest that you're trying to run CoffeeScript code as though it was JavaScript. You need to compile your CoffeeScript to JavaScript before you can run it in a JavaScript environment.
See the fine manual for details:
Usage
"text/coffeescript" Script Tags

Related

Unexpected property: 'cookieStoreId' in tabs.create()

chrome.tabs.create({cookieStoreId:"4"})
When i am trying to use above code in chrome extension it is showing following error:
Uncaught TypeError: Error in invocation of tabs.create(object createProperties, optional function callback): Error at parameter 'createProperties': Unexpected property: 'cookieStoreId'.
at :1:13
I am following documentation of :
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/create
https://docs.w3cub.com/web_extensions/api/tabs/create
I have also included permissions of cookies in manifest.

How to fix the jest SyntaxError: Unexpected token '||='

Here is my code which work nice in browser:
addon.addonRun ||= () => { };
But when I run unit tests in jest, I get this error:
SyntaxError: Unexpected token '||='
How to fix this error ?

Script errors after moving wordpress to a new domain

I've moved my wordpress from a domain to another. On the first domain everything worked fine. On the second i get a bunch of JS errors logged to the console. The url of the website is https://dexport.co.uk
The errors I have been getting look like this:
Uncaught SyntaxError: Invalid or unexpected token
jquery.js:3 Uncaught SyntaxError: Invalid or unexpected token
jquery-migrate.js?ver=1.4.1:752 Uncaught ReferenceError: jQuery is not defined
at jquery-migrate.js?ver=1.4.1:752
(index):1 Uncaught SyntaxError: Unexpected identifier
at layerslider.kreaturamedia.jquery.js?ver=6.7.6:13
(index):1 Uncaught SyntaxError: Invalid or unexpected token
at layerslider.transitions.js?ver=6.7.6:13
jquery.themepunch.tools.min.js?ver=5.4.8:23 Uncaught ReferenceError: jQuery is not defined
at jquery.themepunch.tools.min.js?ver=5.4.8:23
at jquery.themepunch.tools.min.js?ver=5.4.8:23
jquery.themepunch.revolution.min.js?ver=5.4.8:7 Uncaught ReferenceError: jQuery is not defined
at jquery.themepunch.revolution.min.js?ver=5.4.8:7
gtm4wp-form-move-tracker.js?ver=1.8.1:1 Uncaught ReferenceError: jQuery is not defined
at gtm4wp-form-move-tracker.js?ver=1.8.1:1
add-to-cart.js?ver=3.4.5:2 Uncaught ReferenceError: jQuery is not defined
at add-to-cart.js?ver=3.4.5:2
woocommerce-add-to-cart.js?ver=5.5.4:1 Uncaught TypeError: window.jQuery is not a function
at woocommerce-add-to-cart.js?ver=5.5.4:1
(index):1315 Uncaught ReferenceError: jQuery is not defined
at (index):1315
(index):1415 Uncaught ReferenceError: jQuery is not defined
at (index):1415
(index):1449 Uncaught ReferenceError: jQuery is not defined
at (index):1449
core.min.js?ver=1.11.4:11 Uncaught ReferenceError: jQuery is not defined
I added a few lines to my wp-config:
define('FORCE_SSL_LOGIN', true);
define('FORCE_SSL_ADMIN', true);
define( 'CONCATENATE_SCRIPTS', false );
define( 'SCRIPT_DEBUG', true );
But no succes
The error messages say: Uncaught ReferenceError: jQuery is not defined
I suppose you are storing those libraries in your server and you are not using CDN.
Verify that the path that leads to libraries such as jQuery, is properly defined in your installation and that file permissions are properly set.
1) Open your Active theme’s header.php file
2) Paste below script
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
just after the head tag.
3) Save your file.

Syntax error on async function as object field

I'm have a problem on the simple Getting started tutorial of FeathersJS.
I copy/past both code and run the server, but it return me a Syntax Error on client.js line 5:
app.use('todos', {
async get(name) {
^^^^^^^^^^^^^^^^^
> Uncaught SyntaxError: Unexpected identifier
What did I miss ?
EDIT: I forgot to say that error come from the browser after I run
http-server public/

yuicompressor error, not sure what is wrong?

Very confused here, trying out the yuicompressor on a simple javascript file.
My js file looks like:
function splitText(text)
{
return text.split('-')[1];
}
The error is:
[INFO] Using charset Cp1252
[Error] 1:20:illegal character
[Error] 1:20:syntax error
[Error] 1:40:illegal character
[Error] 1:49:missing ; before statement
[Error] 1:50:illegal character
..
..
[Error] 7:3:missing | in compound statement
[error] 1:0:compilation produced 38 syntax errors
...
Can someone please explain to me what is wrong?
Your encoding of the actual file YUICompressor is acting on is the issue. Open the file in notepad++ and change to ANSI & it should work.
[http://extjs.com/forum/showthread.php?t=27732][1]

Categories