Javascript Tutorials

JavaScript Syntax​Error: missing ) After Argument List

Let us understand SyntaxError: missing ) after argument list error in JavaScript. This error occurs when a function is called in JS. It can occur due to various reasons.

Error Reasons:

  • missing operator
  • typo error
  • unescaped string

Check out some examples

As you can see we are trying to generate a random number using Math.random() method In the below example. However, this method won’t work because we are missing “+” operator in the console.log() method.

console.log('Random Number: ' Math.random());

// Output: SyntaxError: missing ) after argument list

Let us fix this SyntaxError: missing ) after argument list error in JavaScript by putting "+" operator and check out the output below.

console.log('Random Number: ' + Math.random());

// Output: some random number between 0 and 1

SyntaxError: Invalid or unexpected token

console.log('"Hello" + "World"");

// Output: SyntaxError: Invalid or unexpected token

As we can see JavaScript throw SyntaxError: Invalid or unexpected token error because of missing " ' ".

console.log('"Hello" + "World""');

// Output: "Hello" + "World""

I am Digamber, a full-stack developer and fitness aficionado. I created this site to bestow my coding experience with newbie programmers. I love to write on JavaScript, ECMAScript, React, Angular, Vue, Laravel.

Recent Posts

React Redux Handle API Calls with Thunk Middleware Tutorial

In this post, we will learn how to work with HTTP requests in the Redux…

1 day ago

Node AJAX Retrieve Records from MySQL Database Tutorial

MySQL is a relational database management system based on SQL – Structured Query Language, and…

4 days ago

React Manage REST API State Globally with Context API Tutorial

React Js Handle Rest API data globally with Context and useState hook tutorial. In this…

1 week ago

How to Delete Data from MySQL Database using Node Js

Node js delete data from MySQL database tutorial; Throughout this guide, you will ascertain how…

1 week ago

Node Import CSV File Data to MySQL Database with HTML Form

In this tutorial, you will discover how to import CSV file into MySQL database using…

2 weeks ago

How to Handle Global State in React js using Context API

React Js Global state management with createContext hook example; In this tutorial, we will help…

2 weeks ago