← All Exercises

Typed Array Map Operation

basictypescript~10min

Background

Typed array operations leverage TypeScript generics to provide type-safe transformations without losing type information.

Problem

Write a TypeScript function that takes an array of numbers and returns an array of strings where each number is formatted as "Value: N".

Input

An array of numbers (number[]).

Output

An array of strings (string[]) with formatted values.

Sample tests

Sample 1

Input: [1, 2, 3]
Expected: ["Value: 1", "Value: 2", "Value: 3"]

Your solution

Learning objective

Understand typed array transformations using map with TypeScript generics.