Rudimentary Uncaught SyntaxError: Invalid or unexpected token [closed] - javascript

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I get the following error with the Hello world syntax in the Google Chrome Development Console.
JavaScript
console.log("Hello World');
Error Message
Uncaught SyntaxError: Invalid or unexpected token
Could you tell me the cause?

you have open your text with double quotes and close with single qoation markā€¦
console.log("Hello World");
works fine

Related

javascript/jquery syntax differences, declaring new a variable [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
My code in javascript causes an error at the following line:
var tries:int=GetCallAttemptCount();
The error message says Error in Script Unexpected token : , Line 3
Line 3 is where the error appears. The script was originally in jquery, so I wonder is there a difference in how a variable is declared in Javascript and Jquery?
I'm computer literate, but I am a beginner with Javascript.
Thanks all, Adam
That's not javascript, this looks like typescript, in JS:
var tries = GetCallAttemptCount();

Javascript Unterminated string constant syntax [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I am trying to get a js file to convert a .h file to a .cs file. I go to this point and it says "gencsinc.js(26, 153) Microsoft JScript compilation error: Unterminated string constant" the line that is 26 is below.
fout.Write('using System;\r\n\namespace PortableDeviceConstants\r\n\{\r\n\class PortableDevicePKeys\r\n\{\r\n\static PortableDevicePKeys()\r\n\{\r\n\');
You are escaping last quote character:
...\');
Just remove the slash \ to close the string.

Getting error: Uncaught Syntax Error: Unexpected token [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I need to add class to all the links that have "href=login". And i tried to use this javascript
jQuery(document).ready(function($){
$(.pageWidth).find('a[href*="/login/"]').addClass('OverlayTrigger');})
Unfortunately, i tried so many times and it always getting this error
Uncaught Syntax Error: Unexpected token
How can i fix this? What's the problem here?
Thank you!
You are missing quotes in your jQuery selector:
jQuery(document).ready( function($) {
$('.pageWidth').find('a[href*="/login/"]').addClass('OverlayTrigger');
} )

What is correct syntax for Jquery done()? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have the following syntax:
And am receiving the following error on line 6:
Uncaught SyntaxError: Unexpected token {
I read the api docs on done() and I can't see what I am doing wrong here.
$.post(path).done(funtion(data) { ....
^----notice any missing characters here, a "c" perhaps?
JS is trying to call a function called "funtion", which means that the { afterwards is illegal syntax. Since it parses out that syntax error first, it doesn't get to the point of being to able to tell you that "funtion" doesn't exist.
You wrote funtion instead of function.
$.post(path).done(function(data) { console.log(data) });

String and Uncaught Error: Syntax error, unrecognized expression [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have this code, where getURLParamter returns the value of a url parameter and I use that value to select on an input.
var urlParam = getURLParameter('a'),
selectedInput = $('input[id="custom-156[' + urlParam + ']"');
This has worked without problem through many rounds of cross-browser testing. However, there have been sporadic error reports from users including, finally, a co-worker. Chrome's console showed this error:
Uncaught Error: Syntax error, unrecognized expression: input[id="custom-156[1]"
My coworker uses the same model computer and the same version of Chrome. I don't have this error but he does. Why would this be and what is the cause of the error? I think it is a problem with the single double quotes within the pair of single quotes. What is a better way to write this?
There is no closing square bracket on the selector. you'll need
input[id="custom-156[' + urlParam + ']"]'
For the points ;)

Categories