Giter Site home page Giter Site logo

ten-simple-javascript-exercises's Introduction

Ten Simple Javascript Exercises

Assignment #7, part 2 from The Iron Yard's 12-week Front End Engineering bootcamp Q1 2015.

Fun little exercises:

  • Define a function max() that takes two numbers as arguments and returns the largest of them. Use the if-then-else construct available in Javascript.

  • Define a function maxOfThree() that takes three numbers as arguments and returns the largest of them.

  • Write a function that takes a character (i.e. a string of length 1) and returns true if it is a vowel, false otherwise.

  • Write a function translate() that will translate a text into "rövarspråket". That is, double every consonant and place an occurrence of "o" in between. For example, translate("this is fun") should return the string "tothohisos isos fofunon".

  • Define a function sum() and a function multiply() that sums and multiplies (respectively) all the numbers in an array of numbers. For example, sum([1,2,3,4]) should return 10, and multiply([1,2,3,4]) should return 24.

  • Define a function reverse() that computes the reversal of a string. For example, reverse("jag testar") should return the string "ratset gaj".

  • Represent a small bilingual lexicon as a Javascript object in the following fashion {"merry":"god", "christmas":"jul", "and":"och", "happy":gott", "new":"nytt", "year":"år"} and use it to translate your Christmas cards from English into Swedish.

  • Write a function findLongestWord() that takes an array of words and returns the length of the longest one.

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

  • Write a function charFreq() that takes a string and builds a frequency listing of the characters contained in it. Represent the frequency listing as a Javascript object. Try it with something like charFreq("abbabcbdbabdbdbabababcbcbab").

Technologies

  • JavaScript

How to use it

From command line:

ten-simple-javascript-exercises's People

Contributors

bholben avatar

Watchers

 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.