index.ts 395 B

12345678910111213141516171819202122232425
  1. /*
  2. * The type script comes here
  3. */
  4. import { Dog } from './js/Dog';
  5. import { Cat } from './js/Cat';
  6. let animals = [
  7. new Dog('nora', 'noa'),
  8. new Dog('shoën', 'noa'),
  9. new Dog('medor', 'noa'),
  10. new Cat('felix')
  11. ];
  12. let template = '<ul>';
  13. for (let animal of animals) {
  14. template += '<li>'+animal.greet()+'</li>';
  15. }
  16. template += '</ul>';
  17. document.body.innerHTML = template;