Answers for "get first common characters between 2 string javascript"

5

javascript get first 2 char

String.substring(0, 2);
//Return the first two characters of the string
//First parameter is the starting index, 0 corresponding to the first character
//Second parameter is the number of character to return
Posted by: Guest on January-02-2021
0

find common characters in two strings javascript

var s1 = "abcd";
var s2 = "aad";
var count=0;
function match(s1,s2)
{
for(let i in s1)
s2.includes(s1[i])?count++:false;
console.log(count)
}
match(s1,s2)
Posted by: Guest on April-17-2021

Code answers related to "get first common characters between 2 string javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language