Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

common character count javascript

function solution(s1, s2) {
    let count = 0;
    s1 = s1.split('');
    s2 = s2.split('');
    s1.forEach((e) => {
        if (s2.includes(e)) {
            count++;
            s2.splice(s2.indexOf(e), 1);
        }
    });
    return count;
}
Comment

js character certain count

var str = "Hello Lewes";
var ch = 'e';
 
var count = str.split("e").length - 1;
console.log(count);
 
/*
    Output: 3
*/
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript body element 
Javascript :: referencing an array value in object key js 
Javascript :: document.getElementById visual basic 
Javascript :: refresh page js 
Javascript :: javascript get label value 
Javascript :: jquery when any key is pressed 
Javascript :: scroll to bottom react 
Javascript :: javascript lerp 
Javascript :: object loop in javascript 
Javascript :: form serialize to json 
Javascript :: can i learn backend before frontend 
Javascript :: create hash password in js 
Javascript :: How find a specific character in js 
Javascript :: how to change styles when element comes into view 
Javascript :: javascript ascii to hex 
Javascript :: how to send an embed message discord.js 
Javascript :: javascript regex test number only 
Javascript :: find difference in array of objects javascript 
Javascript :: javascript get element by class name change style 
Javascript :: how to read a firebase txt file 
Javascript :: create new angular component command 
Javascript :: javascript disable context menu 
Javascript :: how to add elements in javascript html 
Javascript :: usehistory example 
Javascript :: or in js 
Javascript :: javascript remove last child element 
Javascript :: styled of styled component not working in nextjs 
Javascript :: event listener for element lost focus 
Javascript :: jquery select element based on for attribute 
Javascript :: js remove spaces 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =