Characters and ASCII Code

Published by BijogFc24 in

Write a function that transforms an array of characters into an array of objects, where:

  1. The keys are the characters themselves.
  2. The values are the ASCII codes of those characters.

Examples

toObj(["a", "b", "c"]) ➞ [{a: 97}, {b: 98}, {c: 99}]

toObj(["z"]) ➞ [{z: 122}]

toObj([]) ➞ []

Notes

N/A

Watch a quick demo on how Edabit works.