Created
September 6, 2017 21:07
-
-
Save adyngom/2d0dbd1ee9b070665fe98d5f05887c7e to your computer and use it in GitHub Desktop.
es6-int-classes-initial-code
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
'use strict'; | |
const Felidea = function() { | |
const bigCats = ['tiger','lion','jaguar', 'leopard', 'snow leopard']; | |
const midSize = ['clouded leopard', 'sunda clouded leopard']; | |
let species = Object.freeze([...bigCats, ...midSize]); | |
return species; | |
} | |
const Panthera = function(kind, name, options) { | |
// check if the kind belong to the species list | |
if (!kind || !Felidea().includes(kind.toLowerCase())) { | |
let message = `The specified species: ${kind} does not belong to the family of Felidae.`; | |
throw new Error(message); | |
} | |
this.kind = kind; | |
this.name = name || 'Kitty Doe'; | |
this.options = options || {}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment