Giter Club home page Giter Club logo

functions's Introduction

8/17 required tasks are completed (12,13,15,16,17 tasks aren't included daily tasks).

TASK 1 Given an array of numbers. Write a function to separate odd and even numbers in different arrays. Input - [45, 12, 3, 6, 17, 0]; output is [45, 3, 17], [12, 6, 0]; Input - [1, 3, 5, 9] output is [1, 3, 5, 9], []; https://github.com/Gayane25/lesson005_functions/blob/master/ex1_oddOrEven.js

TASK 2 Write a function that calculates sum, difference, multiplication and division between given array elements depending on passed operation symbol. Write appropriate function for each operation. https://github.com/Gayane25/lesson005_functions/blob/master/ex2_calcNumber.js

TASK 3 Given a phone number. Write a function to clean it up, so it is valid. The rules are as follows: If the phone number is less than 10 digits assume that it is a bad number. If the phone number is longer than 10, then it is a bad number. If the phone number is 10 digits assume that it is good. If the phone number consists of 11 symbols and the first one is + and others are numbers, then trim + and return remaining 10 digits. If the phone number contains + symbol more than one, consider it as a bad number. If the phone number contains + symbol not as the first character, consider it as a bad number. https://github.com/Gayane25/lesson005_functions/blob/master/ex3_getPhoneNumber.js

TASK 4 Given a word and a list of possible anagrams, select the correct sub list. Input : “listen”, ["enlists", "google", "inlets", "banana"], output is [“inlets”], Input: “pencil”, [“licnep”, “circular”, “pupil”, “nilcpe”, “leppnec”] , output is [“licnep”, nilcpe] https://github.com/Gayane25/lesson005_functions/blob/master/ex4_anagram.js

TASK 6 Write a function which receives two strings and removes appearances of the second string from the first one. Input : “This is some text.”, “is”
Output is : “Th some text.” Input : “Yes, London. You know: fish, chips, cup ‘o tea, bad food, worse weather”, “o”
Output is : “Yes, Lndn. Yu knw: fish, chips, cup ‘ tea, bad fd, wrse weather” https://github.com/Gayane25/lesson005_functions/blob/master/ex6_removeStr.js

TASK 7 Write a function to compute a new string from the given one by moving the first char to come after the next two chars, so "abc" yields "bca". Repeat this process for each subsequent group of 3 chars. Ignore any group of fewer than 3 chars at the end. Input: “dfgjkloyp” / “aweyoolp” Output : “fgdkljypo” / “weaooylp” https://github.com/Gayane25/lesson005_functions/blob/master/ex7_replaceChars.js

TASK 8 Write a function that accepts a string(a sentence) as a parameter and finds the longest word within the string. If there are several words which are the longest ones, print the last word(words can be separated by space, comma or hyphen). Input : “A revolution without dancing is a revolution not worth having.” Output : “revolution” Input ; ”Which would be worse - to live as a monster, or to die as a good man?” Output: “monster” https://github.com/Gayane25/lesson005_functions/blob/master/ex_8largestWord.js

TASK 9 Write a function which receives an array and a number as arguments and returns a new array from the elements of the given array which are larger than the given number. Input ; [10, 25, 16, -5, 30, 15, 24] , 16 Output: [25, 30, 24] Input : [1, 1, 2, -3, 0, 8, 4, 0], 9 Output: “Such values do not exist.” https://github.com/Gayane25/lesson005_functions/blob/master/ex9_largerThen.js

functions's People

Contributors

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