0

Using the data retrieved, create an array using the map method to return just the title of every item and print the result in the console.

Code:

fetch('https://jsonplaceholder.typicode.com/todos').then(response => response.json()).then(data => {console.log(data)})

fetch('https://jsonplaceholder.typicode.com/todos').then(response => response.json()).then(data => {console.log(data)}) Using the data retrieved, create an array using the map method to return just the title of every item and print the result in the console.

1 Answer 1

1
fetch('https://jsonplaceholder.typicode.com/todos').then(response => response.json()).then(data => {
   data.map((elem) => {
    return elem.title 
  })
})

You store the result (of data.map) in whatever variable you like (it returns an array) Basically just returning the title of the object using Map().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.