← Back to challenges

Characters and ASCII Code

JavaScriptHardobjectshigher_order_functions

Instructions

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

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Palindromic Dates