how to use a function in a class in javasctip code example Example: variables in js class constructor(){ this.foo = bar }