javascript - JSHint with ECMAScript6: method is not defined -


i'm implementing client-side application using ecmascript6 , use jshint static code analysis. use following pattern in code:

class myclass {      constructor() {         //this how call mymethod         mymethod();          //this how should call mymethod make jshint analysis pass         this.mymethod();     }      mymethod(){         //implementation     } } 

my primary language java expect calling mymethod() should ok. without adding this method call i'm getting "'mymethod' not defined" warning jshint. questions are:

  1. is correct make calls without this in such situation? (e.g. in php need add $this-> non-static method call)
  2. if that's correct make calls without this there way (any .jshintrc flag) turn off warning in jshint?

no, , never correct in javascript. methods need called on receiver explicitly make this work, , need referred using property access notation because methods functions on properties in javascript. they're not available functions in scope of other methods. it's same properties, btw.

jshint right here, , there's no reason turn warning off. if may possible, executing program in spite of make not work.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -