Palindrome=ॱ=>(ॱ=>ॱ==[...ॱ].reverse().join``)(ॱ.toUpperCase())
function Palindrome(str){// Case insensitive palindromefor (let i = 0, j = str.length - 1; i < j; i++, j--) {if (str[i].toLowerCase() !== str[j].toLowerCase()) return false;}return true;}- Palindrome=ॱ=>(ॱ=>ॱ==[...ॱ].reverse().join``)(ॱ.toUpperCase())
Mathematics
Algorithms
Logic
Numbers
Data Types
countVowelAtWord=s=>s.replace(!/[aeiou]/ig,``).length
function countVowelAtWord(str) {}- countVowelAtWord=s=>s.replace(!/[aeiou]/ig,``).length
// Since Node 10, we're using Mocha. // You can use `chai` for assertions. const chai = require("chai"); const assert = chai.assert; // Uncomment the following line to disable truncating failure messages for deep equals, do: // chai.config.truncateThreshold = 0; // Since Node 12, we no longer include assertions from our deprecated custom test framework by default. // Uncomment the following to use the old assertions: // const Test = require("@codewars/test-compat"); describe("Solution", function() { it("should test for something", function() { // Test.assertEquals(1 + 1, 2); // assert.strictEqual(1 + 1, 2); }); });
- // Since Node 10, we're using Mocha.
- // You can use `chai` for assertions.
- const chai = require("chai");
- const assert = chai.assert;
- // Uncomment the following line to disable truncating failure messages for deep equals, do:
- // chai.config.truncateThreshold = 0;
- // Since Node 12, we no longer include assertions from our deprecated custom test framework by default.
- // Uncomment the following to use the old assertions:
- // const Test = require("@codewars/test-compat");
- describe("Solution", function() {
- it("should test for something", function() {
- // Test.assertEquals(1 + 1, 2);
- // assert.strictEqual(1 + 1, 2);
- });
- });
// Since Node 10, we're using Mocha. // You can use `chai` for assertions. const chai = require("chai"); const assert = chai.assert; // Uncomment the following line to disable truncating failure messages for deep equals, do: // chai.config.truncateThreshold = 0; // Since Node 12, we no longer include assertions from our deprecated custom test framework by default. // Uncomment the following to use the old assertions: // const Test = require("@codewars/test-compat"); describe("Solution", function() { it("should test for something", function() { // Test.assertEquals(1 + 1, 2); // assert.strictEqual(1 + 1, 2); }); });
- // Since Node 10, we're using Mocha.
- // You can use `chai` for assertions.
- const chai = require("chai");
- const assert = chai.assert;
- // Uncomment the following line to disable truncating failure messages for deep equals, do:
- // chai.config.truncateThreshold = 0;
- // Since Node 12, we no longer include assertions from our deprecated custom test framework by default.
- // Uncomment the following to use the old assertions:
- // const Test = require("@codewars/test-compat");
- describe("Solution", function() {
- it("should test for something", function() {
- // Test.assertEquals(1 + 1, 2);
- // assert.strictEqual(1 + 1, 2);
- });
- });
Logic
Arrays
Data Types
Objects
mapOrder=(a,o,k)=>!Array.isArray(a)?[]:(l=>o.map(k=>l.get(k)))(a.reduceRight((t,o)=>t.set(o[k],o),new Map))
function mapOrder(array, order, key) {if (!Array.isArray(array)) return [];const lookupTablea = array.reduceRight((table, o) => table.set(o[key], o), new Map());return order.map(k => lookupTablea.get(k));}- mapOrder=(a,o,k)=>!Array.isArray(a)?[]:(l=>o.map(k=>l.get(k)))(a.reduceRight((t,o)=>t.set(o[k],o),new Map))
ॱ