Is the underscore prefix in JavaScript only a convention, like for example in Python private class methods are?
From the 2.7 Python documentation:
import/export
is now doing the job with ES6. I still tend to prefix not exported functions with _
if most of my functions are exported.
If you export only a class (like in angular projects), it's not needed at all.
export class MyOpenClass{
open(){
doStuff()
this._privateStuff()
return close();
}
_privateStuff() { /* _ only as a convention */}
}
function close(){ /*... this is really private... */ }