Skip to content

Instantly share code, notes, and snippets.

@khaled0fares
Created February 21, 2017 19:40
Show Gist options
  • Save khaled0fares/be7ead404423bd1dee82393fc9419f87 to your computer and use it in GitHub Desktop.
Save khaled0fares/be7ead404423bd1dee82393fc9419f87 to your computer and use it in GitHub Desktop.
const createStudentCalsses = function(...classes){
console.log(classes.length)
if(classes[0].length < 1) throw new Error("You should enroll in at least two classes")
const privateObj = {}
privateObj.classes = classes;
const studentClasses = {
getClasses(){ return privateObj.classes}
}
return studentClasses;
}
const student = new createStudentCalsses("math", "biology", "OS")
console.log(student.getClasses())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment