⊗jsOpBsMP 6 of 60 menu

Method Parameters in OOP in JavaScript

Methods can take parameters. Let's pass two parameters to our method as an example:

class User { show(name, surn) { return name + ' ' + surn; } }

Let's create an object of our class:

let user = new User;

Let's call our method, passing the parameters to it:

console.log(user.show('john', 'smit'));

Pass the employee's name and salary to your test method.

ruuzcnlidro