To make a JavaScript class with a public method I\'d do something like:
function Restaurant() {} Restaurant.prototype.buy_food = function(){ // something
You can do this now with es10 private methods. You just need to add a # before the method name.
#
class ClassWithPrivateMethod { #privateMethod() { return 'hello world'; } getPrivateMessage() { return #privateMethod(); } }