This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ASSIGNMENT | |
_____________________________ | |
In this kata you will create a function that takes a list of non-negative integers and strings | |
and returns a new list with the strings filtered out. | |
Example: | |
filter_list([1,2,'a','b']) == [1,2] | |
filter_list([1,'a','b',0,15]) == [1,0,15] | |
filter_list([1,2,'aasf','1','123',123]) == [1,2,123] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ASSIGNMENT | |
_________________________________________ | |
write a helper function to capitalize a string (that contains a single word). | |
Don't worry about numbers, special characters, or non-string types being passed to the function. | |
The string lengths will be from 1 character up to 10 characters, but will never be empty. | |
_________________________________________ | |
SOLUTION | |
_________________________________________ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ASSIGNMENT | |
_________________________________________ | |
Our football team finished the championship. The result of each match look like "x:y". Results of all matches are recorded in the array. | |
For example: ["3:1", "2:2", "0:1", ...] | |
Write a function that takes such list and counts the points of our team in the championship. Rules for counting points for each match: | |
if x>y - 3 points | |
if x<y - 0 point |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ASSIGNMENT | |
_______________________________________________________________________________________________________________________________ | |
Design a cash register drawer function checkCashRegister() that accepts purchase price as the first argument (price), | |
payment as the second argument (cash), and cash-in-drawer (cid) as the third argument. | |
cid is a 2D array listing available currency. | |
The checkCashRegister() function should always return an object with a status key and a change key. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ASSIGNMENT | |
________________________________________________________________________________ | |
Return a new array that transforms the elements' average altitude into their orbital periods (in seconds). | |
The array will contain objects in the format {name: 'name', avgAlt: avgAlt}. | |
You can read about orbital periods on Wikipedia. | |
The values should be rounded to the nearest whole number. The body being orbited is Earth. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ASSIGNMENT | |
__________________________________________________________________________________________________________________________ | |
Return true if the passed string looks like a valid US phone number. | |
The user may fill out the form field any way they choose as long as it has | |
the format of a valid US number. The following are examples of valid formats for US numbers | |
(refer to the tests below for other variants): | |
555-555-5555 | |
(555)555-5555 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ASSIGNMENT: | |
The variable watchList holds an array of objects with information on several movies. | |
Use a combination of filter and map to return a new array of objects with only title and rating keys, | |
but where imdbRating is greater than or equal to 8.0. | |
Note that the rating values are saved as strings in the object | |
and you may want to convert them into numbers to perform mathematical operations on them. | |
__________________________________________ | |
//NOTE In fact, I didn't have to convert strings into numbers, I used '>=' (greater than or equal) symbol and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ASSIGNMENT: | |
Use arrow function syntax to compute the square of only the positive integers (fractions are not integers) | |
in the array realNumberArray and store the new array in the variable squaredIntegers. | |
_____________________________________________________________________________________________ | |
SOLUTION: | |
_____________________________________________________________________________________________ | |
const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ASSIGNMENT | |
_____________________________________ | |
Find the missing letter in the passed letter range and return it. | |
If all letters are present in the range, return undefined. | |
_____________________________________ | |
SOLUTION | |
_____________________________________ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ASSIGNMRENT | |
_______________________________________________ | |
The DNA strand is missing the pairing element. Take each character, get its pair, and return the results as a 2d array. | |
Base pairs are a pair of AT and CG. Match the missing element to the provided character. | |
Return the provided character as the first element in each array. | |
For example, for the input GCG, return [["G", "C"], ["C","G"],["G", "C"]] | |
The character and its pair are paired up in an array, and all the arrays are grouped into one encapsulating array. | |
_______________________________________________ |