Skip to content

4/10 done need to finish #288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 51 additions & 29 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const artists = [
},
{
"id": 8,
"name": "Vincent van Dough",
"name": "Vincent van Gough",
"years": "1853 - 1890",
"genre": "Post-Impressionism",
"nationality": "Dutch",
Expand Down Expand Up @@ -209,7 +209,7 @@ Practice accessing data above by console.log-ing following items:

//(1) Name of the first artist (0th index) in the array


console.log(artists[0].name);

//(2) Bio of the third artist (2nd index) in the array

Expand All @@ -230,11 +230,11 @@ Use getArtistByIndex to do the following:

🌟 EXAMPLE: if getArtistByIndex is invoked with the artists array and the number 0, it will return `the artist at index 0 is Amedeo Modigliani` */

function getArtistByIndex(/*Your Code Here*/) {
/*Your Code Here*/
}

function getArtistByIndex(array, number) {
return `the artist at index ${array[number].id} is ${array[number].name}`

}


/* 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 4: 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀
Use copy to do the following:
Expand All @@ -244,10 +244,12 @@ Use copy to do the following:
🌟 EXAMPLE of return: ["Amedeo Modigliani", "Vasiliy Kandinskiy", "Diego Rivera"....]
*/

function listOfNames(/*Your Code Here*/) {
/*Your Code Here*/
}

function listOfNames(array, name){
let nameArray = [];
for(let i = 0; i < array.length; i++){
nameArray.push(array[i].name)
} return nameArray
}


/* 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 5: 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀
Expand All @@ -259,31 +261,39 @@ Use removeArtist to do the following:
5. Return the resulting copied array
🌟 EXAMPLE: if removeArtist is invoked with the artists array and the number 0, it will return the resulting array with Amedeo Modigliani removed from our dataset. */

function removeArtist(/*Your Code Here*/) {
/*Your Code Here*/
function removeArtist(array, number){
array.splice(number, 1);
return array
}





/* 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 6: 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀
Use addArtist to do the following:
1. Receive the the artist array as an argument passed from the FIRST parameter
2. Recieve a string (name), a string (years), a string (genre), a string (nationality), and a string (bio) as arguments passed from the SECOND, THIRD, FOURTH, FIFTH, and SIXTH parameters, repsectively.
3. Create an object with the following format:
Use addArtist to do the following:
1. Recieve a string (name), a string (years), a string (genre), a string (nationality), and a string (bio) as arguments passed from the SECOND, THIRD, FOURTH, FIFTH, and SIXTH parameters, repsectively.
2. Create an object with the following format:
{
id: 20,

name: Your Name Here,
years: Your Birth Year - current day,
genre: Web Design,
nationality: Your Nationality Here
bio: Add 1-2 sentences (or use lorem ipsum)
}
4. Return the array
3. Return the array
🌟 EXAMPLE: Invoking addArtist(artists, 'John Doe', '1988-2022', 'Full Stack Development', 'African American', 'I have a background in customer service at Big Retail Chain. I am attending BloomTech to become a Frontend Developer.') should return the artists array with the above object added to the end of the array. */

function addArtist(/*Your Code Here*/) {
/*Your Code Here*/
}
function addArtist(array, name, years, genre, nationality, bio,) {
array.push({
name,
years,
genre,
nationality,
bio,
}); return array
}



Expand All @@ -295,12 +305,16 @@ Use lotsOfArt to do the following:
🌟 EXAMPLE: lotsOfArt(artists) will return ["Amedeo Modigliani", "Rene Magritte", ... "Albrecht Dürer"]
*/

function lotsOfArt(/*Your Code Here*/) {
/*Your Code Here*/
function lotsOfArt(array, paintings) {
let moreArt = [];
for(let i = 0; i < array.length; i++){
if(array[i].paintings >= 100){
moreArt.push(array[i].name)
}
}return moreArt
}



/* 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 8: 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀
Use artistInfo to do the following:
1. Receive the artist array as an argument passed from the FIRST parameter
Expand All @@ -311,10 +325,13 @@ Use artistInfo to do the following:
"Frida Kahlo de Rivera (Spanish pronunciation: [ˈfɾiða ˈkalo]; born Magdalena Carmen Frida Kahlo y Calderón; 6 July 1907 – 13 July 1954) was a Mexican artist who painted many portraits, self-portraits and works inspired by the nature and artifacts of Mexico. Inspired by the country's popular culture, she employed a naïve folk art style to explore questions of identity, postcolonialism, gender, class and race in Mexican society. Her paintings often had strong autobiographical elements and mixed realism with fantasy. In addition to belonging to the post-revolutionary Mexicayotl movement, which sought to define a Mexican identity, Kahlo has been described as a surrealist or magical realist.Born to a German father and a mestiza mother, Kahlo spent most of her childhood and adult life at her family home in Coyoacán, La Casa Azul, now known and publicly accessible as the Frida Kahlo Museum. She was disabled by polio as a child. Until a traffic accident at age eighteen caused lifelong pain and medical problems, she had been a promising student headed for medical school. During her recovery, she returned to her childhood hobby of art with the idea of becoming an artist."
*/

function artistInfo(/*Your Code Here*/){
/*Your Code Here*/
function artistInfo(array, name){
for(let i = 0; i < array.length; i++){
if(array[i].name === name){
return array[i].bio
}
}
}



/* 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 9: 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀
Expand All @@ -326,8 +343,13 @@ Use artistByCountry to do the following:
🌟 EXAMPLE: Invoking artistByCountry(artists, 'Spanish') will return: [ 'Salvador Dali', 'Pablo Picasso', 'Francisco Goya']
*/

function artistByCountry(/*Your Code Here*/){
/*Your Code Here*/
function artistByCountry (array, nation){
let nationArray = [];
for(let i = 0; i < array.length; i++){
if(array[i].nationality === nation){
nationArray.push(array[i].name)
}
} return nationArray
}


Expand Down