title: How to define functions within a function in typescript?
body: <p>I know basic Javascript, but am confronted with a problem in a Typescript file. I'm using Ionic framework to test a page where a user can theoretically "swipe" like they're on Tinder, just for fun. </p>
  
  <p>I have all the JS written, because I'm moving this over from Codepen, but I can't seem to get past Typescript's syntax. </p>
  
  <p>The Javascript: </p>
  
  <pre><code>var tinderContainer = document.querySelector('.tinder');
  var allCards = document.querySelectorAll('.tinder--card');
  var nope = document.getElementById('nope');
  var love = document.getElementById('love');
  
  function initCards(card, index) {
    var newCards = document.querySelectorAll('.tinder--card:not(.removed)');
  
    newCards.forEach(function (card, index) {
      card.style.zIndex = allCards.length - index;
    }
  }
  </code></pre>
  
  <p>The Typescript (that I put together using Google and SOF answers):</p>
  
  <pre><code>export class TestPage {
  
    constructor(public navCtrl: NavController) {
    }
  
    tinderContainer = document.querySelector('ion-content');
    allCards = document.querySelector('.tinder--card');
    nope = document.getElementById('nope');
    love = document.getElementById('love');
  
    declare initCards(card,index) {
      newCards = document.querySelectorAll('.tinder--card:not(.removed)');
  
      newCards.forEach((card,index)) {
        card.style.zIndex = allCards.length - index;
      }
    } 
  }
  </code></pre>