Find associated code in the corresponding repositories at https://github.com/1dv021
Before you start:
Make a function that returns the text 'Hello, World!'
Make the function testable with npm:
describe('hello module', () => {
describe('#sayHello()', () => {
it('should return \'Hello, World!\'', () => {
expect(hello.sayHello()).to.eql('Hello, World!')
})
})
})
Print a triangle with #'s.
Print the type of the argument.
let newArray = ma.immutablePushNumber(arr, 4);
Sort array of objects
Search names from initials using generator objects.
Filter an array of objects. Consider Array.reduce, Array.filter and Array.map.
Get sum with Array.reduce.
Adder that accepts variable number of arguments directly as numbers or parsed from strings. Optionally add support for nested arrays.
Useful concepts: arguments object , spread syntax , Array.concat, Array.some, String.indexOf, String.replace
Find numbers evenly divisible by the sum of their digits: 24 since 24/(2+4)=4
Useful functions: Number.toString, String.split, parseInt.
Get sum with Array.reduce.
Count frequencies of names in a list.
Useful functions: Array.every, Array.filter
Explore the factory, constructor (also with prototype) and class patterns.
Make a constructor/prototype pattern for ellipses and one for circles through inheritance.
As above except with class syntax.
https://github.com/1dv021/examination-1
JSDOC comment:
Document your own functions too.
/**
* Returns the descriptive information (maximum, mean, median, minimum, mode, range and standard deviation) from a set of numbers.
*
* @param {number[]} source The set of data to be analyzed.
* @throws {TypeError} The passed argument is not an array.
* @throws {Error} The passed array contains no elements.
* @throws {TypeError} The passed array contains not just numbers.
* @returns {{maximum: number, mean: number, median: number, minimum: number, mode: number[], range: number, standardDeviation: number}}
*/
https://github.com/1dv021/examination-2
Note: This is not black jack, however if you aren't doing the formal examination feel free to implement the classical black jack game.
Updated on 2020-08-07.