Coder Social home page Coder Social logo

quiz-web's Introduction

JS Assignment

Instructions

  1. Fork this repository to your own account by clicking the "Fork" button in the top right.
  2. Clone the repository to your local machine. Using the command line, navigate to the directory you want to clone the repository into and run the following command:
git clone URL
  1. Create a new branch for your work. Using the command line, navigate to the repository directory and run the following command:
git checkout -b BRANCH_NAME
  1. Complete the assignment and commit your work. Using the command line, navigate to the repository directory and run the following commands:
git add .
git commit -m "COMMIT MESSAGE"
  1. Push your changes to your forked repository. Using the command line, navigate to the repository directory and run the following command:
git push origin BRANCH_NAME
  1. Create a pull request to submit your work. Navigate to your forked repository in the browser and click the "New pull request" button. Fill out the pull request form and click "Create pull request".

Setup

  1. Run npm install to install dependencies.
  2. Run npm test to run the tests. The tests will run automatically every time you save a file.

Assignment

  1. Write a function that takes two parameters, an array of numbers and a target number. The function should return a pair of numbers from the array that adds up to the target number. If no such pair is found, the function should return null.

    Example input: findPair([1, 2, 3, 4], 5) Example output: [1, 4]

  2. Write a function that takes a string as input and returns the reverse of the string.

    Example input: reverseString("hello") Example output: "olleh"

  3. Write a function that takes an array of numbers as input and returns the sum of the two largest numbers in the array.

    Example input: sumLargest([1, 2, 3, 4]) Example output: 7

  4. Write a function that takes an array of strings as input and returns a new array that contains only the strings that have more than three characters.

    Example input: filterStrings(["hi", "hello", "hey", "howdy"]) Example output: ["hello", "howdy"]

  5. Write a function that takes an array of numbers as input and returns a new array that contains only the even numbers.

    Example input: filterEven([1, 2, 3, 4, 5, 6]) Example output: [2, 4, 6]

  6. Write a function that takes an array of objects and a key name as input and returns a new array that contains only the values of the specified key from each object in the array.

    Example input: pluck([{name: "John", age: 30}, {name: "Jane", age: 25}], "name") Example output: ["John", "Jane"]

  7. Write a function that takes a string as input and returns true if the string is a palindrome (reads the same backwards as forwards), and false otherwise.

    Example input: isPalindrome("racecar") Example output: true

  8. Write a function that takes a string as input and returns the most frequent character in the string. If there are multiple characters that appear with the same frequency, return the one that appears first.

    Example input: mostFrequent("hello world") Example output: "l"

  9. Write a function that takes an array of strings as input and returns a new array that contains the length of each string in the original array.

    Example input: stringLengths(["hi", "hello", "hey", "howdy"]) Example output: [2, 5, 3, 5]

  10. Write a function that takes an array of numbers as input and returns the index of the first number in the array that is greater than or equal to 10.

    Example input: firstGreater([1, 5, 15, 20]) Example output: 2

quiz-web's People

Contributors

muzammil-bilwani avatar

Stargazers

 avatar Mohib ur Rehman avatar  avatar Mubashir Alam avatar Muhammad Muaz avatar Abdul Haseeb Imran avatar  avatar Adan Lodhi avatar Muhammad Muzammil Ansari avatar AdilAhmedShekhani 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.