text: 'use strict';
  
  /* ------------------------------------------------------------------------------------------------
  CHALLENGE 1 - Review
  
  Write a function that iterates over an array of people objects 
  and creates a new list of each person's full name using the array method 'map'.
  Each object will have the shape {firstName:string, lastName:string}
  E.g. [ { firstName:"Jane", lastName:"Doe" }, { firstName:"James", lastName:"Bond"}]
  should convert to ["Jane Doe", "James Bond"]
  Note the space in between first and last names.
  You can assume that neither firstName nor lastName will be blank
  ------------------------------------------------------------------------------------------------ */
  const toLastNames = people => {
    // Solution code here...
    let array = people.map(value=>{
      return value.firstName+ ' ' + value.lastName;
    });
    return array;
  };
  
  /* ------------------------------------------------------------------------------------------------
  CHALLENGE 2
  
  Write a function named validatePin that uses a regular expression pattern to validate a PIN.
  
  If the PIN is four numerical digits long, return true. Otherwise, return false.
  ------------------------------------------------------------------------------------------------ */
  
  const validatePin = (pin) => {
    // Solution code here...
    let regex = /\b\d{4}\b/g;
    if(regex.test(pin)){
      return true;
    }else{
      return false;
    }
  };
  
  /* ------------------------------------------------------------------------------------------------
  CHALLENGE 3
  
  Write a function named validateWord that uses a regular expression pattern to validate that a word is between 5 and 10 characters long.
  
  If the word is between 5 and 10 characters long, return true. Otherwise, return false.
  ------------------------------------------------------------------------------------------------ */
  
  const validateWord = (word) => {
    // Solution code here...
    return (word.toString().match(/^[a-z]{5,10}$/i)) ? true : false;
  };
  
  /* ------------------------------------------------------------------------------------------------
  CHALLENGE 4
  
  Write a function named hasNumber that uses a regular expression pattern to determine if a string has one or more letter followed by one or more digit.
  
  If it does, return true. If not, return false.
  ------------------------------------------------------------------------------------------------ */
  
  const hasNumber = (string) => {
    // Solution code here...
    let regex = /[a-z]+[0-9]+.*/i;
    return (regex.test(string))?true:false;
  };
  
  /* ------------------------------------------------------------------------------------------------
  CHALLENGE 5
  
  Write a function named validateEmail that takes in an email address and validates it based
  on several rules:
    - one word, or two words separated by a period, before the @ symbol
    - can contain numbers
    - can have any of the following top-level domains: .net, .com, or .org
    - no other special characters
    - no subdomains, ports, etc: must be of the form name@place.com, not name@sub.place.com:3000
  
  Return either true or false.
  
  Note: if you ever need to validate an email using a regex in practice, the Internet has the actual regex you should use. It's many many lines long.
  ------------------------------------------------------------------------------------------------ */
  
  const validateEmail = (email) => {
    // Solution code here...
    let regex = /^(((([a-z]*[0-9]*)*\.)?)([a-z]*[0-9]*)\w+)\@([a-z]*[0-9]*)\.(com||net||org)$/g;
    return regex.test(email);
  };
  
  /* ------------------------------------------------------------------------------------------------
  CHALLENGE 6
  
  Write a function named validatePhoneNumber that accepts a phone number and determines if it is valid.
  
  Acceptable formats include:
   - (555) 555-5555
   - (555)555 5555
   - 555 555-5555
   - 555-5555555
   - 555-555 5555
   - 555-555-5555
   - 555 555 5555
   - 555555-5555
   - 5555555555
  
  Your function should include a single regular expression pattern that matches any of these formats.
  
  Return either true or false.
  ------------------------------------------------------------------------------------------------ */
  
  const validatePhoneNumber = (phoneNumber) => {
    // Solution code here...
    let regex = /^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})*(?:[-])?([0-9]{4})$|^[0-9][0-9][0-9]\s[0-9][0-9][0-9]\s[0-9][0-9][0-9][0-9]$/g
    return regex.test(phoneNumber);
  };
  
  /* ------------------------------------------------------------------------------------------------
  CHALLENGE 7 - Stretch Goal
  
  Write a function named findTagNames that iterates over an array of HTML strings and uses a regular expression pattern to return the closing tags.
  
  For example, findTagNames(['<h1>Hello, world!</h1>', '<p>Welcome to my site</p>']) returns ['/h1', '/p'].
  findTagNames(['<div><h1>Hello, world!</h1></div>', '<p>Welcome to my site</p>']) returns ['/h1', '/div', '/p'].
  ------------------------------------------------------------------------------------------------ */
  
  const findTagNames = elements => {
    // Solution code here...
  };
  
  /* ------------------------------------------------------------------------------------------------
  TESTS
  
  All the code below will verify that your functions are working to solve the challenges.
  
  DO NOT CHANGE any of the below code.
  
  Run your tests from the console: jest solutions-11.test.js
  ------------------------------------------------------------------------------------------------ */
  
  describe('Testing challenge 1', () => {
    test('It should convert object to full name string', () => {
  
      const people = [{ firstName: "Jane", lastName: "Doe" }, { firstName: "James", lastName: "Bond" }];
  
      expect(toLastNames(people)).toStrictEqual(["Jane Doe", "James Bond"]);
  
    });
  });
  
  describe('Testing challenge 2', () => {
    test('It should validate a PIN of exactly four digits', () => {
      expect(validatePin(1234)).toBeTruthy();
      expect(validatePin(123)).toBeFalsy();
      expect(validatePin(12345)).toBeFalsy();
      expect(validatePin('abcd')).toBeFalsy();
      expect(validatePin('7890')).toBeTruthy();
      expect(validatePin('0789')).toBeTruthy();
      expect(validatePin(789)).toBeFalsy();
      expect(validatePin('0000')).toBeTruthy();
    });
  });
  
  describe('Testing challenge 3', () => {
    test('It should validate a word between 5 and 10 characters', () => {
      expect(validateWord('Hello')).toBeTruthy();
      expect(validateWord('Bob')).toBeFalsy();
      expect(validateWord(12345)).toBeFalsy();
      expect(validateWord('abcdefghijkl')).toBeFalsy();
      expect(validateWord('cookie')).toBeTruthy();
      expect(validateWord(789)).toBeFalsy();
      expect(validateWord('Code301')).toBeFalsy();
    });
  });
  
  describe('Testing challenge 4', () => {
    test('It should return true if a string has one or more word characters followed by one or more digits', () => {
      expect(hasNumber('Hell0')).toBeTruthy();
      expect(hasNumber('Bob')).toBeFalsy();
      expect(hasNumber(12345)).toBeFalsy();
      expect(hasNumber('abcdefghijkl')).toBeFalsy();
      expect(hasNumber('c00kie')).toBeTruthy();
      expect(hasNumber(789)).toBeFalsy();
      expect(hasNumber('Code301')).toBeTruthy();
      expect(hasNumber('99Code')).toBeFalsy();
    });
  });
  
  describe('Testing challenge 5', () => {
    test('It should match a basic email', () => {
      expect(validateEmail('joe@codefellows.com')).toBeTruthy();
    });
  
    test('It should match if the email contains a period', () => {
      expect(validateEmail('joe.schmoe@codefellows.net')).toBeTruthy();
    });
  
    test('It should match if the email contains other top-level domains', () => {
      expect(validateEmail('joe@codefellows.org')).toBeTruthy();
    });
  
    test('It should match if the email contains a period and other top-level domains', () => {
      expect(validateEmail('joe.schmoe@codefellows.net')).toBeTruthy();
    });
  
    test('It should fail things that aren\'t email addresses', () => {
      expect(validateEmail('justastring')).toBeFalsy();
      expect(validateEmail('missing@adomain')).toBeFalsy();
      expect(validateEmail('@noname.com')).toBeFalsy();
      expect(validateEmail('.@noname.com')).toBeFalsy();
      expect(validateEmail('nolastname.@sadness.net')).toBeFalsy();
      expect(validateEmail('canadaisnotreal@canada.ca')).toBeFalsy();
      expect(validateEmail('missing.atsymbol.net')).toBeFalsy();
      expect(validateEmail('looksgood@sofar.comohnowaitthisisbad')).toBeFalsy();
      expect(validateEmail('no.middle.names@foryou.com')).toBeFalsy();
    });
  });
  
  describe('Testing challenge 6', () => {
    test('It should match the acceptable phone number formats', () => {
      expect(validatePhoneNumber('(555) 555-5555')).toBeTruthy();
      expect(validatePhoneNumber('555 555-5555')).toBeTruthy();
      expect(validatePhoneNumber('555-555-5555')).toBeTruthy();
      expect(validatePhoneNumber('555 5555555')).toBeTruthy();
      expect(validatePhoneNumber('5555555555')).toBeTruthy();
      expect(validatePhoneNumber('234 567 8910')).toBeTruthy();
    });
    test('It should not match unacceptable phone number formats', () => {
      expect(validatePhoneNumber('abcdefghij')).toBeFalsy();
      expect(validatePhoneNumber('222 222 2222 ext. 2222')).toBeFalsy();
      expect(validatePhoneNumber('(222 222-2222')).toBeFalsy();
      expect(validatePhoneNumber('222 222-2222-')).toBeFalsy();
      expect(validatePhoneNumber('(222 222- 2222')).toBeFalsy();
      expect(validatePhoneNumber('(222 222 -2222')).toBeFalsy();
      expect(validatePhoneNumber('523 555--5555')).toBeFalsy();
      expect(validatePhoneNumber('55555555555')).toBeFalsy();
      expect(validatePhoneNumber('55555555555')).toBeFalsy();
      expect(validatePhoneNumber('55555555555')).toBeFalsy();
      expect(validatePhoneNumber('55_55_5555')).toBeFalsy();
    });
  });
  
  xdescribe('Testing challenge 7', () => {
    test('It should return the closing tags', () => {
      expect(findTagNames(['<h1>Hello, world!</h1>', '<p>Welcome to my site</p>'])).toStrictEqual(['/h1', '/p']);
    });
    test('It should work if there are multiple closing tags in a single string', () => {
      expect(findTagNames(['<div><h1>Hello, world!</h1></div>', '<p>Welcome to my site</p>'])).toStrictEqual(['/h1', '/div', '/p']);
    });
  });
  