input: Write a python function to sort an array of dictionaries by a given key.
  assert sortArrayByKey([{"name": "Alice", "age": 25}, {"name": "Bob", "age": 20}], "age") == [{"name": "Bob", "age": 20}, {"name": "Alice", "age": 25}]
  assert sortArrayByKey([{"name": "Tom", "score": 90}, {"name": "Jerry", "score": 85}], "score") == [{"name": "Jerry", "score": 85}, {"name": "Tom", "score": 90}]
  assert sortArrayByKey([{"name": "Eve", "height": 160}, {"name": "Adam", "height": 170}], "height") == [{"name": "Eve", "height": 160}, {"name": "Adam", "height": 170}]
output: def sortArrayByKey(arr, key):
      return sorted(arr, key=lambda x: x[key])