From fc87d56cc0e914c6259fe4b91c6ac11b23afca48 Mon Sep 17 00:00:00 2001 From: JT Coates Date: Fri, 11 Mar 2022 14:39:14 -0700 Subject: [PATCH 1/2] 4/10 done need to finish --- index.js | 56 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/index.js b/index.js index ee63b8bf4..ba442215f 100644 --- a/index.js +++ b/index.js @@ -81,7 +81,7 @@ const artists = [ }, { "id": 8, - "name": "Vincent van Dough", + "name": "Vincent van Gough", "years": "1853 - 1890", "genre": "Post-Impressionism", "nationality": "Dutch", @@ -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 @@ -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: @@ -244,8 +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) { + for(let i = 0; i < array.length; i++) + if(array[i].name > 100){ + return array[i] = name[i](); + } + return artist[i].name } @@ -259,30 +263,30 @@ 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) { +array[0].slice } /* πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€ 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, id, name, years, genre, nationality, bio,) { + return (array.unshift(id = 20, name = 'jt', years = 2001 - 2022, genre = WebDesign, nationality = american, bio = 'i love playing video games. I enjoy watching and playing lacrosse')); + } @@ -295,8 +299,10 @@ 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) { + for(let i = 0; i < array.length; i++){ + const lotsOfArt = array[i].paintings + } } @@ -311,8 +317,9 @@ 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(name){ + return "Kazimir Severinovich Malevich (February 23 [O.S. 11] 1879 – May 15, 1935) was a Russian avant-garde artist and art theorist, whose pioneering work and writing had a profound influence on the development of non-objective, or abstract art, in the 20th century. Born in Kiev to an ethnic Polish family, his concept of Suprematism sought to develop a form of expression that moved as far as possible from the world of natural forms (objectivity) and subject matter in order to access \"the supremacy of pure feeling\" and spirituality.Early on, Malevich worked in a variety of styles, quickly assimilating the movements of Impressionism, Symbolism and Fauvism, and after visiting Paris in 1912, Cubism. Gradually simplifying his style, he developed an approach with key works consisting of pure geometric forms and their relationships to one another, set against minimal grounds. His Black Square (1915), a black square on white, represented the most radically abstract painting known to have been created so far and drew \"an uncrossable line (…) between old art and new art\"; Suprematist Composition: White on White (1918), a barely differentiated off-white square superimposed on an off-white ground, would take his ideal of pure abstraction to its logical conclusion. In addition to his paintings, Malevich laid down his theories in writing, such as \"From Cubism and Futurism to Suprematism\" (1915) and The Non-Objective World: The Manifesto of Suprematism (1926).Malevich's trajectory in many ways mirrored the tumult of the decades surrounding the October Revolution (O.S.) in 1917. In its immediate aftermath, vanguard movements such as Suprematism and Vladimir Tatlin's Constructivism were encouraged by Trotskyite factions in the government. Malevich held several prominent teaching positions and received a solo show at the Sixteenth State Exhibition in Moscow in 1919. His recognition spread to the West with solo exhibitions in Warsaw and Berlin in 1927. Upon his return, modern art was falling out of favor with the new government of Joseph Stalin. Malevich soon lost his teaching position, artworks and manuscripts were confiscated, and he was banned from making art. In 1930, he was imprisoned for two months due to suspicions raised by his trip to Poland and Germany. Forced to abandon abstraction, he painted in a representational style in the years before his death from cancer in 1935, at the age of 56." + } @@ -326,8 +333,9 @@ 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 (){ + const nationality = artist.find(artist.nationality === 'Spanish') + const resultValue = nationality['Spanish'] } From 6ca0fbe431870ba04e8d3584e0207ebbbdf6cf12 Mon Sep 17 00:00:00 2001 From: JT Coates Date: Mon, 14 Mar 2022 22:41:56 -0600 Subject: [PATCH 2/2] finished sprint challenge week 1 --- index.js | 62 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/index.js b/index.js index ba442215f..4318d222f 100644 --- a/index.js +++ b/index.js @@ -244,14 +244,12 @@ Use copy to do the following: 🌟 EXAMPLE of return: ["Amedeo Modigliani", "Vasiliy Kandinskiy", "Diego Rivera"....] */ -function listOfNames(array, name) { - for(let i = 0; i < array.length; i++) - if(array[i].name > 100){ - return array[i] = name[i](); - } - return artist[i].name -} - +function listOfNames(array, name){ + let nameArray = []; + for(let i = 0; i < array.length; i++){ +nameArray.push(array[i].name) + } return nameArray +} /* πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€ Task 5: πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€ @@ -263,12 +261,15 @@ 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(array) { -array[0].slice +function removeArtist(array, number){ +array.splice(number, 1); +return array } + + /* πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€ Task 6: πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€ 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. @@ -284,10 +285,15 @@ Use addArtist to do the following: 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(array, id, name, years, genre, nationality, bio,) { - return (array.unshift(id = 20, name = 'jt', years = 2001 - 2022, genre = WebDesign, nationality = american, bio = 'i love playing video games. I enjoy watching and playing lacrosse')); - -} +function addArtist(array, name, years, genre, nationality, bio,) { + array.push({ + name, + years, + genre, + nationality, + bio, + }); return array +} @@ -300,13 +306,15 @@ Use lotsOfArt to do the following: */ function lotsOfArt(array, paintings) { + let moreArt = []; for(let i = 0; i < array.length; i++){ - const lotsOfArt = array[i].paintings - } +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 @@ -317,11 +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(name){ - return "Kazimir Severinovich Malevich (February 23 [O.S. 11] 1879 – May 15, 1935) was a Russian avant-garde artist and art theorist, whose pioneering work and writing had a profound influence on the development of non-objective, or abstract art, in the 20th century. Born in Kiev to an ethnic Polish family, his concept of Suprematism sought to develop a form of expression that moved as far as possible from the world of natural forms (objectivity) and subject matter in order to access \"the supremacy of pure feeling\" and spirituality.Early on, Malevich worked in a variety of styles, quickly assimilating the movements of Impressionism, Symbolism and Fauvism, and after visiting Paris in 1912, Cubism. Gradually simplifying his style, he developed an approach with key works consisting of pure geometric forms and their relationships to one another, set against minimal grounds. His Black Square (1915), a black square on white, represented the most radically abstract painting known to have been created so far and drew \"an uncrossable line (…) between old art and new art\"; Suprematist Composition: White on White (1918), a barely differentiated off-white square superimposed on an off-white ground, would take his ideal of pure abstraction to its logical conclusion. In addition to his paintings, Malevich laid down his theories in writing, such as \"From Cubism and Futurism to Suprematism\" (1915) and The Non-Objective World: The Manifesto of Suprematism (1926).Malevich's trajectory in many ways mirrored the tumult of the decades surrounding the October Revolution (O.S.) in 1917. In its immediate aftermath, vanguard movements such as Suprematism and Vladimir Tatlin's Constructivism were encouraged by Trotskyite factions in the government. Malevich held several prominent teaching positions and received a solo show at the Sixteenth State Exhibition in Moscow in 1919. His recognition spread to the West with solo exhibitions in Warsaw and Berlin in 1927. Upon his return, modern art was falling out of favor with the new government of Joseph Stalin. Malevich soon lost his teaching position, artworks and manuscripts were confiscated, and he was banned from making art. In 1930, he was imprisoned for two months due to suspicions raised by his trip to Poland and Germany. Forced to abandon abstraction, he painted in a representational style in the years before his death from cancer in 1935, at the age of 56." - +function artistInfo(array, name){ + for(let i = 0; i < array.length; i++){ + if(array[i].name === name){ + return array[i].bio + } +} } - /* πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€ Task 9: πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€ @@ -333,9 +343,13 @@ Use artistByCountry to do the following: 🌟 EXAMPLE: Invoking artistByCountry(artists, 'Spanish') will return: [ 'Salvador Dali', 'Pablo Picasso', 'Francisco Goya'] */ -function artistByCountry (){ - const nationality = artist.find(artist.nationality === 'Spanish') - const resultValue = nationality['Spanish'] +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 }