const jonas = [
  "Jonas",
  "Schmedtmann",
  2037 - 1986,
  "developer",
  ["Nika", "Joanne", "Eva"],
];

const types = [];
const types1 = [];

for (let i = 0; i < jonas.length; i++) {
  types[i] = typeof jonas[i];
  types1.push(typeof jonas[i]);

  if (Array.isArray(jonas[i])) {
    const array = jonas[i];
    for (let j = 0; j < array.length; j++) {
      console.log(array[j]);
    }
  } else {
    console.log(jonas[i]);
  }
}

console.log(types);
console.log(types1);

const years = [1991, 1986, 1985, 1970, 2018];

const calcAge = years => {
  const arrayOfAges = [];
  years.forEach(element => {
    const age = new Date().getFullYear() - element;
    arrayOfAges.push(age);
  });
  return arrayOfAges;
};

const ages = calcAge(years);
console.log(ages);

const arrayOfStrings1 = [];
// Only strings
for (let i = 0; i < jonas.length; i++) {
  if (typeof jonas[i] !== "string") continue;

  arrayOfStrings1.push(jonas[i]);
}

console.log(arrayOfStrings1);
// Break witch number
const arrayOfStrings2 = [];
for (let i = 0; i < jonas.length; i++) {
  if (typeof jonas[i] === "number") break;

  arrayOfStrings2.push(jonas[i]);
}

console.log(arrayOfStrings2);
