Given a string remove all + present together in the string. Javascript Program

Input string ='a+++b++c+'; Output String=a+b+c+ Source Code let str='a+++b++c+'; let outStr=''; let len=str.length; for(let i=0;i<len;i++) { if(str[i]=='+'&&str[i+1]=='+') { outStr=outStr+''; } else { outStr=outStr+str[i]; } } console.log(outStr);

Continue ReadingGiven a string remove all + present together in the string. Javascript Program

Given a string str, create a string consisting of all the non-alphabets and non-digits.

JavaScript code let str='q#w2@B**g'; let len=str.length; let alpha=''; let alpha1=''; let rest=''; let digits=''; for(let i=0;i<len;i++) { if(str[i]>='a'&&str[i]<='z') { alpha=alpha+str[i]; } else if(str[i]>='A'&&str[i]<='Z') { alpha1=alpha1+str[i]; } else if(str[i]>='0'&&str[i]<='9') { digits=digits+str[i];…

Continue ReadingGiven a string str, create a string consisting of all the non-alphabets and non-digits.