https://bigfrontend.dev/zh/problem/implement-Object.is

    1. function is(a, b) {
    2. if (a === b) {
    3. return a !== 0 || 1 / a === 1 / b;
    4. }
    5. return a !== a && b !== b;
    6. }

    https://leetcode-cn.com/problems/decode-string/

    function decodeString(s: string): string {
      let result = '';
      let prevNum = 0;
      const numStack: number[] = [];
      const strStack: string[] = [];
      for (const char of s) {
        const c = Number.parseInt(char);
        if (Number.isInteger(c)) {
          prevNum = prevNum * 10 + c;
        } else if (char === '[') {
          numStack.push(prevNum);
          strStack.push(result);
          result = '';
          prevNum = 0;
        } else if (char === ']') {
          const repeatTimes = numStack.pop();
          result = strStack.pop() + result.repeat(repeatTimes);
        } else {
          result += char;
        }
      }
      return result;
    };