GithubHelp home page GithubHelp logo

arraymethods's Introduction

Practice: Solar System Setup These commands are a helpful quick start. You may choose to ignore them completely and create your own directory structure. If you choose to use this recommendation, just copy the commands below and paste. It doesn't matter what directory you are currently in.

mkdir -p ~/workspace/javascript/exercises/array-methods && cd $_ touch index.html touch array-methods.js Requirements Copy the code below into the JavaScript file, and follow the instructions in the comments. const planets = ["mercury", "venus", "earth", "mars", "jupiter", "saturn", "uranus", "neptune"]

/* Use the forEach method to add the name of each planet to a section element in your HTML with an id of "planets". Use string templates to construct the DOM elements. */ const planetEl = document.getElementById("planets")

/* Use the map method to create a new array where the first letter of each planet is capitalized. Use the toUpperCase() method on strings.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase

*/

/* Use the filter method to create a new array that contains planets with the letter 'e'. Use the includes() method on strings.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes

*/

// Use the reduce method to create a sentence from the words in the following array const words = ["The", "early", "bird", "might", "get", "the", "worm", "but", "the", "second", "mouse", "gets", "the", "cheese"] More Practice: Spam, Spam, Spam, Spam You have been tasked with building a list of email addresses for all of our customers, so we can spam them with email about Miffles the Vampire Weiner Dog.

Create a new project in workspace. In your JavaScript file, define a variable named customers. Copy the contents of the customers.json and make that object the value of customers. From that object extract just the customers' email addresses and store them in a new array. You will need to use methods such as map(), forEach() and/or concat() to accomplish this.

Challenge: Chaining Methods Setup These commands are a helpful quick start. You may choose to ignore them completely and create your own directory structure. If you choose to use this recommendation, just copy the commands below and paste. It doesn't matter what directory you are currently in.

mkdir -p ~/workspace/exercises/javascript/chaining-methods && cd $_ touch index.html touch chaining.js Requirements Using one single line of JavaScript code, complete the following tasks on the array of integers below.

Sort the numbers in descending order (10, 9, 8, 7, etc). Remove any integers greater than 19. Multiply each remaining number by 1.5 and then subtract 1. Then output (either in the DOM or the console) the sum of all the resulting numbers. const integers = [13, 25, 6, 3, 11, 2, 18, 7, 21, 1, 29, 20, 12, 8]; Advanced Challenge: Car Dealership Copy the JSON from cars.json and assign it to a variable in a new application. This data holds sales information for a car dealership. Your job is to produce the following reports for the dealership based on their total 2017 sales.

Total profit for 2017 In which month did they sell the most cars? Which salesperson sold the most cars? Which salesperson made the most profit? Which model was the most popular? Which bank provided the most loans to our customers?# arraymethods

arraymethods's People

Contributors

gretchenmarie avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.