Giter Club home page Giter Club logo

midterm's Introduction

Midterm

  • Please include the correct number of parameters in each function!
  • Make sure every function returns something
  • You can console.log() the functions with test input to test your functions in the space provided
  • Read each question carefully
  • You are NOT forking this project. Just a git clone will suffice! Please submit your main.js file to populi
  • Good luck!

Methods you might need

  • .toLowerCase()
  • .toUpperCase()
  • .concat()
  • .indexOf()
  • .includes()
  • .push()
  • .unshift()
  • That's really all! I think the only one that you'll NEED to use is .push(), the rest are optional/may possibly make your life easier.
  • You can use anything else we've formally covered.
  • If we have not covered it, please ask to be sure that it's okay.

Setup

  • Clone

Tasks

  • sumOfOdds

    • Write a function called sumOfOdds that takes in 2 numbers as parameters and sums the odd numbers between them.
    • This function is inclusive so please include your two parameters in your calculation.
    • After summing the numbers, return the sum.
    • You can assume that the 2nd number passed in will always be greater than the first and that the two numbers will not be the same
  • arraySubtract

    • Write a function arraySubtract that takes in 2 arrays of numbers and subtracts the item in each index at array 1 with its respective item in each index at array 2.
    • The result of each calculation should be placed in a new array and that array should be returned when the calculations are complete.
    • For exmaple arraySubtract([7,9],[2,6]) should return [5,3] You can assume the arrays that are being input are of the same length
  • surroundArray

    • Write a function that takes in 3 parameters in this order: 1 array, 1 string, and then another string.
    • Add the first string to the beginning of the array
    • Add the second string to the end of the array
    • Return the modified array
  • longestString

    • Write a function longestString that takes in an array of strings as a parameter and returns the longest string in the array.
    • If there is nothing in the array, return an empty string ('')
    • You can assume that no two strings will have the same length in the array
  • sToR

    • Write a function sToR that replaces every 's' character in the string with an 'r' AND every 'r' character in the string with an 's'
    • If the letter in the original string is uppercase the letter in the output string should be as well
    • Do NOT use replaceAll or similar string methods. If you are unsure what that means, ask before you use a string method! (toUpperCase() and toLowerCase() should be all you need if anything)
  • divisibleBy4And7

    • Write a function divisibleBy4And7 that takes in a number and returns true if it is divisble by both 4 and 7.
    • If it is not, return false.
  • exclamationAndQuestion

    • Write a function exclamationAndQuestion that takes in a string
    • Return true if the string contains both an exclamation point (!) AND a question mark (?)
    • Return false if otherwise
  • countAB

    • Write a function called countAB that takes in a single string and returns an array of length two. The first item in the array should be the count of every A character in the string. The 2nd item should be the count of every B character in the string.
    • No need to add the count of A and B together. Again, we want an array with the separate counts of each
    • For this problem, you can count both upper and lower case A's and B's
  • createCharacter

    • Write a function called createCharacter() that creates a character object and returns it.
    • A character object should consist of a name (string), an attack stat (number), and a defense stat (number)
  • pairUp

    • Write a function called pairUp() that takes in 2 character objects (an object with the following properties: name, atk, def).
    • For each character, add the following properties: pairedUp (boolean) and set it equal to true as well as pairPartner (string) whose value is the name of the other opposite character.
    • Finally, increase the atk of the first character passed in by half the atk of the second character passed in.

midterm's People

Contributors

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.