Javascript createSelectOptions function The function createSelectOptions should exist. The function createSelectOptions returns undefined if no data parameter is provided. The function createSelectOptions returns an array. The function createSelectOptions returns an array with the correct length. The function createSelectOptions returns an array of option elements. The function createSelectOptions assigns the related user id to the value attribute of the options elements. The function createSelectOptions assigns the related user name to the textContent attribute of the options elements. createSelectOptions a. Test users JSON data available here: https://jsonplaceholder.typicode.com/users b. For testing (not in function) you may want to define users with the test data. c. Receives users JSON data as a parameter
Javascript
createSelectOptions function
-
The function createSelectOptions should exist.
-
The function createSelectOptions returns undefined if no data parameter is provided.
-
The function createSelectOptions returns an array.
-
The function createSelectOptions returns an array with the correct length.
-
The function createSelectOptions returns an array of option elements.
-
The function createSelectOptions assigns the related user id to the value attribute of the options elements.
-
The function createSelectOptions assigns the related user name to the textContent attribute of the options elements.
createSelectOptions
a. Test users JSON data available here: https://jsonplaceholder.typicode.com/users
b. For testing (not in function) you may want to define users with the test data.
c. Receives users JSON data as a parameter
d. Returns undefined if no parameter received
e. Loops through the users data
f. Creates an option element for each user with document.createElement()
g. Assigns the user.id to the option.value
h. Assigns the user.name to the option.textContent
i. Return an array of options elements
Do you need the HTML page?
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images