↳
var name = "person_First_Name"; var d = name.split("_").join(""); console.log(d); Less
↳
'Person_First_Name'.split("_").join("");
↳
function convertor(name){ let result="" splittedNames=name.split("_") splittedNames.map(a=>{ result+=a }) console.log(result); } convertor("Person_First_Name") Less
↳
function removeDuplicateUsingSet(arr){ let unique_array = Array.from(new Set(arr)) return unique_array } Less
↳
var chars1 = ['A', 'B', 'A', 'C', 'B']; var uniqueChars2 = []; chars1.forEach((c) => { if(!uniqueChars2.includes(c)) { uniqueChars2.push(c); } }) Less
↳
for(let i=0; i
↳
{display:block; margin:0 auto;}
↳
Margin : auto
↳
a=128,b=857
↳
a = 128 b= 857
↳
a=128 b=124
↳
Convert the strings to objects with each word being added as a property to speed up the lookup. I had heard of this technique but never done it myself. Less
↳
sort the words will be done in n Log n . for each word in 1st string do binary search on other string which will run in n log n so overall complexity will be n log n. Less
↳
Can use the loop in structure
↳
Str.split('').reverse().join('')
↳
let arr = ["acr", "bat", "car", "atb", "rca", "rac", "xyz"]; let flag = 0; let result = []; let pos = 0; for (let i = 0; i < arr.length; i++) { if (!result.flat().includes(arr[i])) { result.push([arr[i]]); pos += 1; for (let j = i + 1; j < arr.length; j++) { if (arr[i].length === arr[j].length) { for (let k = 0; k < arr[i].length; k++) { if (arr[j].includes(arr[i][k])) { flag += 1; } } if (flag == arr[i].length) { result[pos - 1].push(arr[j]); } flag = 0; } } } } console.log(result); Less