-
-
Save 3rdp/3b8d115ea40b18f9aa8cc43d2d710f66 to your computer and use it in GitHub Desktop.
Test quest javascript / Save The Day
This file contains hidden or 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
/* | |
* Finished: 30 min | |
*/ | |
function countOfSymbol(arr) { | |
let filter2 = (v) => v == '2' | |
return arr.map((v) => v.toString().split('')) | |
.reduce((prev, curr) => prev.filter(filter2).length >= curr.filter(filter2).length ? prev : curr, []) | |
.join('') || null | |
} | |
let simpleArr = [11, 22, 23] | |
let dumb = [1] | |
console.log(countOfSymbol(dumb)) |
This file contains hidden or 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
/* | |
* Finished: 20 min | |
*/ | |
// You will be given a string of space separated words. | |
// The task is to remove the first | |
// and the last letter from each word. | |
// For example: | |
// 'Fortune favors the bold' to 'ortun avor h ol'. | |
function countOfSymbol(arr) { | |
let filter2 = (v) => v == '2' | |
return arr.map((v) => v.toString().split('')) | |
.reduce((prev, curr) => prev.filter(filter2).length >= curr.filter(filter2).length ? prev : curr, []) | |
.join('') || null | |
} | |
let simpleArr = [11, 22, 23] | |
let dumb = [1] | |
console.log(countOfSymbol(dumb)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment