Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax Error: let is disallowed as a lexically bound name

I am using vue.js and getting this error "Uncaught SyntaxError: let is disallowed as a lexically bound name". When I debug it shows a blank screen and this error in the console.

I have Googled but nothing helpful was found.

Here is my Vue code:

    let Task = {
      props: ['task'],
      template: `
       <div>
        <div class="tasks">
          {{ task.body }}

        </div>
       </div>
    `

    },

     let Tasks = {
       components:{
         'task': Task
       },

       data: {
         return {
           tasks: [
            {id: 1, body: 'Task One', done: false }
           ],
         }
       },

       template: `
        <div>
       <task></task>
           <form action="">
             form
           </form>
      </div>
      `
     },

      let app = new Vue({
        el:'#app',
        components: {
         'tasks': Tasks
         'task': Task
       }
     })
like image 965
horcrux88 Avatar asked Oct 23 '17 17:10

horcrux88


People also ask

What is a syntax error and how to fix it?

A syntax error occurs when you make a mistake while writing the code. What happens when this error occurs? When this error takes place the compiler becomes unable to process the file. And then it fails to display your website.

What is syntax error unexpected path in WordPress?

And when you pick a piece of code from somewhere or try the demonstrated thing on your website then at times it displays an error message ‘Syntax Error, Unexpected………..path…….’. This means that a syntax error has occurred on your WordPress website.

How to fix syntax error in AutoCAD?

1 First of all you have to download FileZilla. ... 2 In the syntax error message there must be a path. ... 3 After this you will be able to determine exactly which file or folder is the root cause of this error. ... 4 Once you are done with making . ... 5 Here, you have to click on ‘Ye . ...

Why do parentheses and brackets cause syntax errors in the code?

If the parentheses and brackets have not been used in a balancing manner in the command then it can cause a syntax error in the code.


1 Answers

If you are separating your declarations with commas, you should not repeat let. either remove let from each declaration, or use semi-colons instead.

Example:

let a = {}, b = 5, c = function(){}; // OK
let a = {}; let b = 5; // OK
let a = {}, let b = 5; //Not OK -- error
like image 56
Brian Glaz Avatar answered Oct 01 '22 03:10

Brian Glaz