const main = () => { let = ['https://www.uol','https://www.bol.com.br','https://www.uol','https://noticias.uol.com.br','https://www.bol.com.br']; return [...new Set(links)].length; }; // Functions should be passed arguments, not have the data already inside them. // Test case: // Test.assertEquals(['https://www.uol','https://www.bol.com.br','https://www.uol','https://noticias.uol.com.br','https://www.bol.com.br'], 3);
const main = () => {let links = ['https://www.uol','https://www.bol.com.br','https://www.uol','https://noticias.uol.com.br','https://www.bol.com.br',];// converter para ES6var uniqueLinks = links.reduce(function (carry, item) {if (carry.indexOf(item) === -1) {carry.push(item);}return carry;}, []);return uniqueLinks.length;};- const main = () => {
- let = ['https://www.uol','https://www.bol.com.br','https://www.uol','https://noticias.uol.com.br','https://www.bol.com.br'];
- return [...new Set(links)].length;
- };
- // Functions should be passed arguments, not have the data already inside them.
- // Test case:
- // Test.assertEquals(['https://www.uol','https://www.bol.com.br','https://www.uol','https://noticias.uol.com.br','https://www.bol.com.br'], 3);
// TODO: Add your tests here // Starting from Node 10.x, [Mocha](https://mochajs.org) is used instead of our custom test framework. // [Codewars' assertion methods](https://github.com/Codewars/codewars.com/wiki/Codewars-JavaScript-Test-Framework) // are still available for now. // // For new tests, using [Chai](https://chaijs.com/) is recommended. // You can use it by requiring: // const assert = require("chai").assert; // If the failure output for deep equality is truncated, `chai.config.truncateThreshold` can be adjusted. describe("Solution", function() { it("should test for something", function() { // Test.assertEquals(1 + 1, 2); // assert.strictEqual(1 + 1, 2); }); });
- // TODO: Add your tests here
- // Starting from Node 10.x, [Mocha](https://mochajs.org) is used instead of our custom test framework.
- // [Codewars' assertion methods](https://github.com/Codewars/codewars.com/wiki/Codewars-JavaScript-Test-Framework)
- // are still available for now.
- //
- // For new tests, using [Chai](https://chaijs.com/) is recommended.
- // You can use it by requiring:
- // const assert = require("chai").assert;
- // If the failure output for deep equality is truncated, `chai.config.truncateThreshold` can be adjusted.
- describe("Solution", function() {
- it("should test for something", function() {
- // Test.assertEquals(1 + 1, 2);
- // assert.strictEqual(1 + 1, 2);
- });
- });