Giter VIP home page Giter VIP logo

hs-js-cartoon-collections-js-cartoon-collections-000's Introduction

Objectives

You're going to get familiar with iterating through arrays in Javascript.

Instructions

There are four functions to complete in this lab:

  1. Dwarf Roll Call
  2. Summon Captain Planet
  3. Long Planeteer Calls
  4. Find the Cheese

Function 1 - Dwarf Roll Call

dwarves

This function should accept an array of dwarf names, for instance:

["Doc", "Dopey", "Bashful", "Grumpy"]

It should then return a string with the numbered dwarves. The string should look like this:

"1. Doc 2. Dopey 3. Bashful 4. Grumpy "

Function 2 - Summon Captain Planet

captain-planet

This function should accept an array of planeteer calls, like this:

planeteerCalls = ["earth", "wind", "fire", "water", "heart"]

It should then convert each element to uppercase and add an exclamation point at the end. The return value of this method should be an array, in this example:

summonCaptainPlanet(planeteerCalls)
#=> ["EARTH!", "WIND!", "FIRE!", "WATER!", "HEART!"]

Once the test for this method is passing, move on to the next method, long planeteer calls.

Function 3 - Long Planeteer Calls

The longPlaneteerCalls method should accept an array of calls. The function should tell us if any of the calls are longer than four characters. For example:

shortWords = ["wind", "fire"]
longPlaneteerCalls(short_words)
#=> false

assortedWords = ["earth", "wind", "heart", "fire"]
longPlaneteerCalls(assorted_words)
#=> true

Notice the return value of this method is either false or true, depending on the array it was given as an argument.

Once the test for this method is passing, move on to the last function.

Method 4 - Find the Cheese

dancing-mice

The "findTheCheese" function should accept an array of strings. It should then look through these strings and return the first string that is a type of cheese. The types of cheese that appear are cheddar, gouda, and camembert.

For example:

snacks = ["crackers", "gouda", "thyme"]
findTheCheese(snacks)
#=> "gouda"

soup = ["tomato soup", "cheddar", "oyster crackers", "gouda"]
findTheCheese(soup)
#=> "cheddar"

If, sadly, a list of ingredients does not include cheese, return "no cheese!":

ingredients = ["garlic", "rosemary", "bread"]
findTheCheese(ingredients)
#=> null

You can assume that all strings will be lower-case.

View Objectives on Learn.co and start learning to code for free.

hs-js-cartoon-collections-js-cartoon-collections-000's People

Contributors

dfenjves avatar ipc103 avatar aviflombaum avatar jmburges avatar aru120 avatar timothylevi avatar victhevenot 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.