mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-07 02:05:08 +08:00
fixed some spellings
This commit is contained in:
@ -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]
|
||||
}
|
||||
|
Reference in New Issue
Block a user