Open knpwrs opened 9 years ago
For example, the following:
/* Get stock data somehow */ var source = getStockData(); source .filter(function (quote) { return quote.price > 30; }) .map(function (quote) { return quote.price; }) .forEach(function (price) { console.log('Prices higher than $30: $' + price); });
Could be expressed as such:
// Get stock data somehow var source = getStockData(); source .filter(quote => quote.price > 30) .map(quote => quote.price) .forEach(price => console.log(`Prices higher than $30: $${price}`));
Or even:
// Get stock data somehow var source = getStockData(); source .filter(({price}) => price > 30) .forEach(({price}) => console.log(`Prices higher than $30: $${price}`));
Compatibility (Arrow Functions):
@knpwrs fixed the front page at the very least.
For example, the following:
Could be expressed as such:
Or even:
Compatibility (Arrow Functions):