You need Login/Signup to run/submit the code.
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
developer.addSkill('javascript');
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
developer.addFramework('react');
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
developer.removeSkill('html');
removeFramework
// Method that removes a framework
// can be chained
developer.removeFramework('react');
Methods could be chained too
const developer = new Developer('elon');
developer
.addSkill('javascript')
.addSkill('html')
.addSkill('css')
.addFramework('reactjs')
.addFramework('vuejs')
.removeSkill('css')
.removeFramework('vuejs');
developer.getSkills(); // 'javascript,html'
developer.getFrameworks(); // 'reactjs'