The code shows an API for a JavaScript “Screen” class. I’ve already implemented the methods. It is up to you to create the constructor and accessors so that the execution works: class Screen { diagonal() { return Math.sqrt(Math.pow(this.width, 2) + Math.pow(this.height, 2)); } dimensions(definition) { let dimensions = definition.split(‘x’) this.width = parseInt(dimensions[0]); this.height = parseInt(dimensions[1]); console.log(this.height + “x” + this.width) }}
//execution
let screen = new Screen(0, 0);screen.dimensions(‘500×300’);screen.width = 400;console.log(screen.diagonal()); // Should print 500