Merge Strings Alternately LeetCode solution in JavaScript

1
/**
2
* @param {string} word1
3
* @param {string} word2
4
* @return {string}
5
*/
6
var mergeAlternately = function (word1, word2) {
7
let length = Math.max(word1.length, word2.length),
8
s = "";
9
for (let i = 0; i < length; i++) {
10
s += word1[i] || "";
11
s += word2[i] || "";
12
}
13
return s;
14
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0