fixed some spellings

This commit is contained in:
Keshav Bohra
2021-10-05 12:49:23 +05:30
parent 199d2637cc
commit 1589263947
41 changed files with 80 additions and 80 deletions

View File

@ -14,24 +14,24 @@ const AlternativeStringArrange = (str1, str2) => {
return 'Not string(s)'
}
// output string vlaue.
// output string value.
let outStr = ''
// get first string length.
const firstStringLength = str1.length
// get second string length.
const secondStringLength = str2.length
// absolute length for oparetion.
const absLenght = firstStringLength > secondStringLength ? firstStringLength : secondStringLength
// absolute length for operation.
const absLength = firstStringLength > secondStringLength ? firstStringLength : secondStringLength
// Iterate the character count until the absolute count is reached.
for (let charCount = 0; charCount < absLenght; charCount++) {
// If firstStringLength is lesser than the charCount it means they are able to re-arange.
for (let charCount = 0; charCount < absLength; charCount++) {
// If firstStringLength is lesser than the charCount it means they are able to re-arrange.
if (charCount < firstStringLength) {
outStr += str1[charCount]
}
// If secondStringLength is lesser than the charCount it means they are able to re-arange.
// If secondStringLength is lesser than the charCount it means they are able to re-arrange.
if (charCount < secondStringLength) {
outStr += str2[charCount]
}