How to implement a Developer Builder Interface? | Frontend Problem Solving | JavaScript Interview Question
@Devtools Tech

In this question, the candidate must implement the Developer interface that can be used to create a new developer instance and exposes different methods.

const developer = new Developer('yomesh');
  • addSkill
// Method that takes a skill (string) as input.
// Adds the provided skill to the developer
// throws an error if skill already exist
// can be chained
  • addFramework
// Method that takes a framework (string) as input.
// Adds the provided framework to the developer
// throws an error if framework already exist
// can be chained
  • getSkills
// Method that returns all skills as a comma-separated string
developer.getSkills(); // 'javascript'
  • getFrameworks
// Method that returns all frameworks as a comma-separated string
developer.getFrameworks(); // 'react'
  • hasSkill
// Method that returns a boolean indicating if a skill exists
developer.hasSkill('html'); // true / false
  • removeSkill
// Method that removes a skill
// can be chained
  • removeFramework
// Method that removes a framework
// can be chained

Methods could be chained too

const developer = new Developer('elon');


developer.getSkills(); // 'javascript,html'

developer.getFrameworks(); // 'reactjs'

Loading IDE...