Questions tagged [unexpected-token]

213 questions
-1
votes
1 answer

How to fix Unexpected token, expected ";" error in React

Pretty new to React so the problem might be very simple but I am getting the following error: Unexpected token, expected ";" error . The error occurs where the render() function is. How can I resolve this? import React, {Component} from…
-1
votes
1 answer

Uncaught SyntaxError: Unexpected token s in JSON at position 4

I check other similar questions but i really cant understand my case. I need to get sensors values from json and put them in html. This is the html code.
-1
votes
1 answer

Unexpected token ';' in a random generator when trying to use if else to decide DOM maniulation

I've been fiddling with programming from time to time for few years and have decided to give it a proper go with some simple, personal projects. I'm trying to make a randomizer for a pen and paper RPG that samples from an array an option at random…
-1
votes
1 answer

React native gives "Unexpected token, expected '...' " , but can not understand why?

The error appears in the line where I define onIncrease and onDecrease. Following a class on React-native I coded the same code as it was in class but I get this error. Could anybody please help.. import React, {useState} from 'react'; import {View,…
-1
votes
2 answers

Why am I getting an unexpected token when using logical AND in an if statement?

I am trying to loop through an array which holds instances of a constructor with multiple property values in, using an if statement. I am using the logical AND operator to make sure 2 conditions are met, but I keep getting a message of Uncaught…
Phil
  • 27
  • 1
  • 8
-1
votes
1 answer

In Javascript, the parsing error occurs. "Unexpected token funds"

I'm trying to practice js code. In line 1, parsing error occurs. I think there's no error(actually the code works), but I want to know what is wrong with my code. Thank you. let funds = 50; let round = 0; while(funds > 1 && funds < 100){ …
-1
votes
1 answer

ReactJS syntax error: unexpected token '<'

I was following a course on udemy on react components and I was met with this Syntax error. I have the following dependencies installed using yarn: "dependencies": { "babel-preset-env": "1.5.2", "babel-preset-react": "6.24.1" …
-1
votes
1 answer

syntax error near unexpected token 'fi'"

if [ $pass = "123456" ] ; then mysql -u root -p$pass "create database newdb"; use newdb; CREAT TABLE user ( name char (30) , lname char (40) ); echo "creat table succesful" fi When I run it it outputs start and then says Syntax error: "("…
m.taba
  • 1
  • 2
-1
votes
4 answers

"Uncaught SyntaxError: Unexpected token ) "in console in JavaScript. What am I missing?

This is the code: $(document).ready(function(){ function(dataObj){ $.each(dataObj,function(n){ if(dataObj.stream=="null"){ var channelName=dataObj.display_name; }else{ var channelName=dataObj.stream.display_name; …
-1
votes
1 answer

Function definition not being recognized by function body

I've created a class called Payload, and have a std::vector in a class called LineShape. I've also created a function inside LineShape to get a Payload from the std::vector at a given index. This is Payload: payload.h class Payload…
Alaanor
  • 37
  • 1
  • 7
-1
votes
1 answer

Inadequate Ecmascript-6 / es6 support for enide / eclipse "Unexpected token" for import / export

I've installed enide studio 2015 that supports es6, so this error shouldn't appear? How do I get rid of these error messages?
Folaht
  • 1,053
  • 1
  • 13
  • 32
-2
votes
1 answer

I tried to run this program in c++ but it didn't work. It said error: expected primary-expression before ‘{’ token

#include #include #include using namespace std; map> dp; vector howSum(int& target, vector& nums, vector temp){ if (target == 0) return temp; if (target < 0) return {}; if…
-2
votes
2 answers

SyntaxError: Unexpected token }

the code worked until line 48, after which it no longer worked. I would like to implement the switch on the "move" button on line 50-62, but this gave me the error Error: Uncaught SyntaxError: Unexpected token } …
-2
votes
1 answer

JavaScript Code Appears Well Formatted, Except for, "Uncaught SyntaxError: Unexpected token :"

Goodmorning folks! I've been testing my JavaScript code via the Google Chrome developer console, and fixed all of the errors, except one that says,"Uncaught SyntaxError: Unexpected token :" I found similar questions on Stack Overflow, but my…
codebwoy
  • 145
  • 3
  • 20
-3
votes
1 answer

React Native/ES6 - unexpected token, expected ";" error

I'm working on trying to only render a header when a collections is present and to not render it when it is empty. A simple fix but I've been receiving this Unexpected Token syntax error and I can't seem to find the issue. Any help would be greatly…
1 2 3
14
15