Stellar-Junior-Dev / cocktailMasters-cosmin

0 stars 0 forks source link

[Learning Task] Create the following JS functions #21

Open emilianraduu opened 1 year ago

emilianraduu commented 1 year ago
  1. Create a function that receives the following array as a parameter and returns only the numbers from it. Use the .filter function. const array = ["1", 2, "party", "grill", 3, "12"];

  2. Create a function that receives the following array of object as a parameter and checks returns true/false if all the objects are favorites.

const arrayObj = [ { name: "Game of Thrones", favorite: true }, { name: "Succession", favorite: true } ];

  1. Create a function that receives the following array of objects as a parameter and returns an array of the "name" property. Use the .map function.

const arrayObj = [ { name: "Game of Thrones", favorite: true }, { name: "Succession", favorite: true } ];

  1. Create a function that receives 2 parameters, the first one should be a string, and the last one an array, and check if the array includes the string. Then, iterate over the "arrayObj" element and for each "name" property, check if it is included in the watchedShows array.

const watchedShows = ["Game of Thrones", "South Park"];

const arrayObj = [ { name: "Game of Thrones", favorite: true }, { name: "Succession", favorite: true } ];