DrSchool Learn coding, fast.
EN AR BN CS DE EL Search

Classes / Objects — Example 103

Quick explanation + ready code for: Classes / Objects.

ActionScript Classes / Objects Back to examples
Back to language
Syntax: Classes / Objects in ActionScript. ID: #103

Code

class User{ constructor(name){this.name=name} hi(){return "Hi "+this.name} }
console.log(new User("A").hi());

Notes

You can copy this snippet and adapt it. For advanced, add real-world inputs, edge cases, and tests.