Skip to content

Instantly share code, notes, and snippets.

@adyngom
Created September 6, 2017 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adyngom/2d0dbd1ee9b070665fe98d5f05887c7e to your computer and use it in GitHub Desktop.
Save adyngom/2d0dbd1ee9b070665fe98d5f05887c7e to your computer and use it in GitHub Desktop.
es6-int-classes-initial-code
'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