WITH EXPLANATION!! Quick and Simple Javascript Solution!! Beats 100%!!  🔥 🔥!!
ApproachA simple way to solve this problem would be to iterate through the string s using a variable called i. We will NOT add 1 to i with each iteration. Inste
# Approach
<!-- Describe your approach to solving the problem. -->
A simple way to solve this problem would be to iterate through the string `s` using a variable called `i`. We will NOT add `1` to `i` with each iteration. Instead, we will add `k` to `i` because we want a substring of the `ith` character in `s`. So, basically, we will use `s.substring(i - k, i)` to get the substring of the `ith` character in `s`. We will use the `.slice()` and `.reverse()` functions to slice the first part of `s`, add the reversed substring to it, and then add the last part of `s` to the string and set `s` equal to it to make a new string `s`.

This is looking good, for now. But the question here states that we should skip every $$other$$ `k` substrings. So, how can we make sure that we're reversing the right substring? We can set up a `count` variable, and set it equal to `0`. We will add `1` to `count` with each iteration, and when `count` is equivalent to `2` (meaning that we have reached the `k` substring that we $$shouldn't$$ reverse), then we set `count` to `0` and add a `continue` line after it, so that we can skip the rest of the code and not reverse the substring.
# Complexity
- Time complexity: $$O(n)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: $$O(1)$$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

Below is the full implementation: 
# Code
```javascript []
/**
 * @param {string} s
 * @param {number} k
 * @return {string}
 */
var reverseStr = function(s, k) {
    
    let count = 0;
    let i = 0; 
    while (i < s.length) {
        i += k
        count += 1
        if (count == 2) {
            count = 0;
            continue;
        }
        let l_s = s.substring(i - k, i)
        s = s.slice(0, i - k) + l_s.split("").reverse().join("") + s.slice(i, s.length)
        console.log(s, count)
    }
    return s

};
```

If this helped you, then please consider upvoting. Thank you.
['JavaScript']