Created
February 21, 2017 19:40
-
-
Save khaled0fares/be7ead404423bd1dee82393fc9419f87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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