Giter Club home page Giter Club logo

coffee_lab's Introduction

CoffeeScript Exercises

For this lab we would like you to complete the following exercises in CoffeeScript. You can do this in a Rails app or in a seperate coffee file.

reverse()

Define a function reverse() that reverses a string. For example, reverse("building") should return the string "gnidliub".

filterLongWords()

Write a function filterLongWords() that takes an array of words and an integer i and returns an array of words that are longer than i.

range()

Write a function range that takes one argument, a positive number, and returns an array containing all numbers from 0 up to and including the given number.

startsWith

Write a function called startsWith that takes two arguments, both strings. It returns true when the first argument starts with the characters in the second argument, and false otherwise.

grade()

Write a function named assignGrade that:

  • takes 1 argument, a number score.
  • returns a grade for the score, either "A", "B", "C", "D", or "F".

Call that function for a few different scores and log the result to make sure it works.

pluralizer()

Write a function named pluralize that:

  • takes 2 arguments, a noun and a number.
  • returns the number and pluralized form, like "5 cats" or "1 dog".

Call that function for a few different scores and log the result to make sure it works.

tempConvert()

Store a celsius temperature into a variable. Convert it to fahrenheit and output "NN°C is NN°F".

coffee_lab's People

Contributors

elie avatar ohligerj avatar tlicata avatar

Watchers

 avatar  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.