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

javascript character count

const string = "Hello world"

const charCount = string.length //11
const charCountWithoutWhitespace = string.replace(/s/g, '').length //10
const wordCount = string.split(/s+/).length //2
const paragraphCount = string.replace(/
$/gm, '').split(/
/).length //1
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery delay to call function 
Javascript :: auto comoplete off in vu js 
Javascript :: how to encode a string in javascript 
Javascript :: useHistory goback 
Javascript :: get all keys of object in javascript 
Javascript :: javascript log Time from Date 
Javascript :: chart js y axis integer 
Javascript :: nuxt scroll to top 
Javascript :: jquery scroll when object appear on screen make animation 
Javascript :: how to change react icon color 
Javascript :: even number function in javascript 
Javascript :: React Native Expo Scrollview Scroll to bottom 
Javascript :: nodejs check if variable is undefined 
Javascript :: node express send error response 
Javascript :: react-native curved view 
Javascript :: change background image through props 
Javascript :: moment + 1 day 
Javascript :: remove character at index from string javascript 
Javascript :: node js request download file 
Javascript :: How to create $(document).ready() for vanilla JavaScript 
Javascript :: javascript replace string at position 
Javascript :: javascript redirect function 
Javascript :: vehicle number formik validation 
Javascript :: javascript open in new window not tab 
Javascript :: js is number 
Javascript :: do not trigger useeffect on start 
Javascript :: arry suffle javascript 
Javascript :: javascript remove first character from string 
Javascript :: How to iterate over the DOM 
Javascript :: get only day from date in javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =