Array-Like to Array

JavaScript Medium 2 views
Back to Questions

Problem Description

You get a JSON object having numeric keys and a length. Build a real array of that length. If a key is missing, keep null there. Print the array as JSON.

Input Format

One line JSON object with keys and length.

Output Format

One line JSON array.

Sample Test Case

Input:
{"0":"a","2":"b","length":4}
Output:
["a",null,"b",null]

Constraints

0

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next