Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

shrinkStringByRepeatFactor

const howMany = (str) => str

    .toLowerCase()
    .split("")
    .sort()
    .join("")
    .match(/(.)1+/g)


const repet = (str, num) => {
    const filter = howMany(str)
    let result = ''
    for (let i = 0; i < filter.length; i++) {
        if (filter[i].length === num) {
            result += filter[i].charAt(0)
        }
    }

    return result
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: Backbone Template Simple Example 
Javascript :: React Futures - Server Components 
Javascript :: Backbone View Notes 
Javascript :: add even javascript 
Javascript :: selling partner api node install 
Javascript :: react native long form keyboard awaire 
Javascript :: java scrypt 
Javascript :: javascript odd or even 
Javascript :: data.json 
Javascript :: how to check the validation of time in react datetime 
Javascript :: javascript declare multiple variables on one line 
Javascript :: character length jquery 
Javascript :: why null is object in javascript 
Javascript :: react component did mount function 
Javascript :: jwt_access_secret generator 
Javascript :: looping object 
Javascript :: javascript return multiple values 
Javascript :: online convert python to javascript 
Javascript :: mdn objects javascript 
Javascript :: The DOM Parent-Child Relationship 
Javascript :: eager loading 
Javascript :: javascript Arguments Binding 
Javascript :: javascript Undeclared variable is not allowed 
Javascript :: mui on node 
Javascript :: ex: javascript Executor 
Javascript :: How to get prime numbers using for loop in Js 
Javascript :: find minimum 
Javascript :: phaser play animation after delay 
Javascript :: remove text and keep div inside a div jquery 
Javascript :: Count the number of child records on the each parent object 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =