1

I am making a website using HTML5 Javascript and Django 1.8 , Python 3.5 and I am getting the following error

Uncaught SyntaxError: Unexpected identifier

class User {
  constructor(nothing) {
    //doNothing
  }

  function myFunction(p1, p2) {
    return p1 * p2; // The function returns the product of p1 and p2
  }


  function afunc() {
    var mydata = "kk";

    return (mydata);
  }
}
var abc = new User();
var kk = abc.myFunction(1, 2);
console.log(kk);

EDIT

Is there any debugger for Javascript in Pycharm latest version(2018) like we have a debugger for Java in netbeans we can add breakpoints see values of variables etc

1 Answer 1

2

remove the function from the class methods. class methods don`t use function declarations as its methods.

class User {
    constructor(nothing){
        //doNothing
    }
    myFunction(p1, p2) {
        return p1 * p2;
    }

    afunc() {
        var mydata="kk";

        return (mydata);
    }
}
var abc=new User();
var kk=abc.myFunction(1,2);
console.log(kk);

Sign up to request clarification or add additional context in comments.

4 Comments

Question edited if u answer it I will accept your anser
1) Pycharm Professional - JS debugging 2) I think you could also use a @classmethod decorator.
Also I would like to mention that you should limit your questions to the scope of the original question. If zabusa's answer did resolve your question please accept.
@dddar change to vscode dont use pycharm for javascript.dont mess python with javascript

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.