Chartjs is a free and open source library widely used by the comunity, it supports several types of charts like the doughnut.
#Shapes Using the new ES6 features related to prototyping, implement a small library to define geometric shapes (not visually) and allow basic calculations. ###Requirements
- The shapes to define are Circle, Square and Rectangle.
- All shapes must define a function to calculate the area and perimeter .
- Use a only positive coordinate system (implement validations while building the shapes or changing its properties).
- Implement a predicate function
collidesWith
to check if the shape collides with another shape of the same type. - Given a list of shapes, print its properties and the area and perimeter properties.
- All functionalities should be properly tested.
The call
and apply
functions are similar, they expect a the contex (this) and the parameter to call the function, the only difference is that apply
accepts the function parameters in an array.
const calculate = function(x, y) {
return this.operation(x, y);
}
const multiply = {
Async and await let us handle asynchronous code easily, it's somehow similar to generators, pausing the execution whenever the await
is prefixed:
// To be able to wait for a call we need to mark a function as async
async function getTemperature () {
// We wait until the getWeather function returns the value
const weather = await getWeather(....);
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
export {} | |
// A monoid is a binary associative operation with an identity | |
// Laws | |
// 1 - Associativity: (x <> y) <> z = x <> (y <> z) | |
// 2 - Left identity: mempty <> x = x | |
// 3 - Right identity: x <> mempty = x | |
type Monoid<A = any> = { | |
mempty: A, |
OlderNewer