Giter Club home page Giter Club logo

string-theory's Introduction

String Theory

Let's do some string building!

Start off by forking and cloning this assignment, then create a file main.js in which you'll write a series of functions.

Guidelines

  • Other than .toUpperCase and .toLowerCase, don't use any string methods. Sure, .slice would be nice here, but you'll learn just a ton more if you use actual loops!

Task

Your task is to write a series of functions that execute the following tasks:

  • xify - returns the same string, but with every character replaced by an 'x'
    • Examples:
      • xify('hello') -> 'xxxxx'
      • xify('hi there') -> 'xxxxxxxx'
  • yellingChars - returns the given string with an exclamation point after each character
    • Examples:
      • yellingChars('goodness') -> 'g!o!o!d!n!e!s!s!'
      • yellingChars('oh hello') -> 'o!h! !h!e!l!l!o!'
    • Hints:
      • We can add more than one thing to the string each time through the loop. In this case, it's the current character AND an exlamation point.
  • indexedChars - adds the index of each character before that character in the given string
    • Examples:
      • indexedChars('hello') -> '0h1e2l3l4o'
      • indexedChars('bye') -> '0b1y2e'
    • Hints:
      • We can add something BEFORE the current character as well!
  • exclaim - returns the given sentence with every question mark or period changed to an exclamation point
    • Examples:
      • exclaim('What are you doing? Are you a fool?') -> 'What are you doing! Are you a fool!'
      • exclaim('This is fine.') -> 'This is fine!'
  • truncate - shortens a long string to 15 characters plus an ellipsis (...)
    • Examples:
      • truncate('The fault, dear Brutus, is not in our stars, but in ourselves.') -> 'The fault, dear...'
      • truncate("Well, that's just, like, your opinion man.") -> "Well, that's ju..."
  • ciEmailify - creates an email from a two-part name
  • reverse - reverses the given string
    • Examples:
      • reverse('colin') -> 'niloc'
      • reverse('mesuara') -> 'arausem'
  • onlyVowels - returns only the vowels from a word
    • Examples:
      • onlyVowels('Colin Jaffe') -> 'oiae'
      • onlyVowels('quickly') -> 'ui'
      • onlyVowels('Anthony DeRosa') -> 'Aoeoa'

Extra stretch goals

  • crazyCase - returns the given string with alternating lower and upper cases
    • Examples:
      • crazyCase('hello') -> 'hElLo'
      • crazyCase('multiple words here') -> 'mUlTiPlE WoRdS HeRe'
      • crazyCase('YELLING') -> 'yElLiNg'
  • titleCase - returns a transformed version of the given string where every word starts with a capital letter and every non-word-starting letter is lowercased
    • Examples:
      • titleCase('return of the king') -> 'Return Of The King'
      • titleCase('cOde iMMerSives') -> 'Code Immersives'
  • camelCase - returns the given string in camel case
    • Examples:
      • camelCase('oh Hello') -> 'ohHello'
      • camelCase('well yeah of course') -> 'wellYeahOfCourse'
      • camelCase('Boy howdy') -> 'boyHowdy'
  • crazyCase2ReturnOfCrazyCase - same as crazyCase, but does NOT count spaces as letters to upper or lower case (see examples below!)
    • Examples:
      • crazyCase2ReturnOfCrazyCase('multiple words here') -> 'mUlTiPlE wOrDs HeRe'
      • crazyCase2ReturnOfCrazyCase('crazy stuff') -> 'cRaZy StUfF'

string-theory's People

Contributors

alexcrist avatar abbreviatedman avatar briancarela avatar glf30 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.